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

Giulio Moro giuliomoro at yahoo.it
Fri Jun 2 18:15:22 CEST 2017


That was me opening this bug. It is the first bug I report for Pd, so I hope it is the right place to do so.
________________________________

From: Ticket 1297 <1297 at bugs.pure-data.p.re.sf.net>
To: pd-dev at lists.iem.at 
Sent: Friday, 2 June 2017, 17:04
Subject: [PD-dev] [pure-data:bugs] #1297 Arrow keys are misinterpreted when GUI runs on Mac and backend runs on non-Mac




________________________________

[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 keynums 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._______________________________________________
Pd-dev mailing list
Pd-dev at lists.iem.at
https://lists.puredata.info/listinfo/pd-dev



More information about the Pd-dev mailing list