[PD-dev] [pure-data:bugs] #1297 Arrow keys are misinterpreted when GUI runs on Mac and backend runs on non-Mac

Ticket 1297 1297 at bugs.pure-data.p.re.sf.net
Fri Jun 2 18:04:37 CEST 2017




---

** [bugs:#1297] Arrow keys are misinterpreted when GUI runs on Mac and backend runs on non-Mac**

**Status:** open
**Group:** v0.47
**Created:** Fri Jun 02, 2017 04:04 PM UTC by Anonymous
**Last Updated:** Fri Jun 02, 2017 04:04 PM UTC
**Owner:** nobody


If Pd runs, on a non-Apple platform, but the GUI runs remotely on Apple, then arrow keys are not received correctly.
The arrow key presses on MacOS are received with `keynum`s 63232, 63233, 63234, 63235. This works just fine if your Pd has been compiled for MacOS, thanks to the  `#ifdef __APPLE__` bit in `g_editor.c` ( see below). Unfortunately, if Pd is built for non-Mac and the GUI runs remotely for Mac, then there is an incompatibilty there.

In principle, this (and possibly other?) mismatches between GUI and backend can be fixed by improving the communication between the two (e.g.: the GUI should tell Pd on what OS it is running on).

On the other hand, I am wondering if this particular one could be simply fixed by removing the `#ifdef`?
I tested this on Linux and it seems that there is no harm in removing it: by the time it gets to the #ifdef, for an arrow-key press we have  `keynum == 0` and therefore none of the `if()` conditionals in the `#ifdef` is ever true. Have not tested on Windows though.

So, proposed patch:

```
diff --git a/src/g_editor.c b/src/g_editor.c
index 07818b4..a255b1c 100644
--- a/src/g_editor.c
+++ b/src/g_editor.c
@@ -1772,7 +1772,6 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
     if (av[1].a_type == A_SYMBOL &&
         !strcmp(av[1].a_w.w_symbol->s_name, "Return"))
             keynum = '\n';
-#ifdef __APPLE__
         if (keynum == 30 || keynum == 63232)
             keynum = 0, gotkeysym = gensym("Up");
         else if (keynum == 31 || keynum == 63233)
@@ -1789,7 +1788,6 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
             keynum = 0, gotkeysym = gensym("Prior");
         else if (keynum == 63277)
             keynum = 0, gotkeysym = gensym("Next");
-#endif
     if (gensym("#key")->s_thing && down)
         pd_float(gensym("#key")->s_thing, (t_float)keynum);
     if (gensym("#keyup")->s_thing && !down)
```
     



---

Sent from sourceforge.net because pd-dev at lists.iem.at is subscribed to https://sourceforge.net/p/pure-data/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/pure-data/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20170602/cda4dab6/attachment.html>


More information about the Pd-dev mailing list