Owen Taylor <[EMAIL PROTECTED]> writes:
> Unless anybody objects to the above reasoning, I'm going to
> submit a patch that:
>
> * Changes xf86PostKbdEvent() to force convert keycodes
> KEY_SysReqest => KEY_Print and KEY_Break => KEY_Pause
>
> * Changes the supplied xkb maps to remove the mappings
> for the SYRQ and BRK keycodes.
>
> (This should cause no compatibility problems for applications,
> since applications should never be hardcoding keycodes.
> It might cause some small compatibility problems for people's
> custom keymaps if they are hardcoding keycodes, but the current
> situation is broken enough that I think it's worth that
> incompatibility.)
Here's the patch as promised. It works as expected.
Possible concerns:
- There may be some very rare PC keyboards that use the
SysRq/Break scancodes in different ways.
The czsk keyboard description distributed with XFree86
has:
key <BRK> {
type= "PC_BREAK",
symbols[Group1]= [ Pause, Break ]
};
key <PAUS> { [ Multi_key ] };
I have no idea if this is accurate, or a mistake in the
keymap, but since czsk hasn't existed since 1993
(cz and sk are fine), I'm not very concerned.
- On non-PC platforms, it's conceivable that Pause/Break
could be on different keys and have legitimately different
key codes. Any problems here could probably be solved
with the right #ifdef.
From what I've seen, virtually all current keyboards
are based on the PC keyboard for these keys.
Despite these minor potential problems, I think the change
is definitely right:
- It fixes an obvious problem for the vast majority of
XFree86 users.
- It's impossible to develop fixes for potential fringe
cases without going ahead, making the change, and seeing
if anybody complains.
I'll send this to [EMAIL PROTECTED], but wanted to send it
here as well for more chance for comments.
Regards,
Owen
--- xc/programs/Xserver/hw/xfree86/common/xf86Events.c.sysreq Fri Nov 30 07:11:54 2001
+++ xc/programs/Xserver/hw/xfree86/common/xf86Events.c Fri Jul 5 22:03:16 2002
@@ -776,6 +776,17 @@
#endif /* SCO */
/*
+ * PC keyboards generate separate key codes for
+ * Alt+Print and Control+Pause but in the X keyboard model
+ * they need to get the same key code as the base key on the same
+ * physical keyboard key.
+ */
+ if (scanCode == KEY_SysReqest)
+ scanCode = KEY_Print;
+ else if (scanCode == KEY_Break)
+ scanCode = KEY_Pause;
+
+ /*
* Now map the scancodes to real X-keycodes ...
*/
keycode = scanCode + MIN_KEYCODE;
--- xc/programs/xkbcomp/symbols/czsk.sysreq Thu Oct 4 09:12:05 2001
+++ xc/programs/xkbcomp/symbols/czsk Fri Jul 5 22:03:17 2002
@@ -290,11 +290,6 @@
symbols[Group1]= [ Print, Sys_Req ]
};
- key <SYRQ> {
- type= "PC_SYSRQ",
- symbols[Group1]= [ Print, Sys_Req ]
- };
-
key <BRK> {
type= "PC_BREAK",
symbols[Group1]= [ Pause, Break ]
--- xc/programs/xkbcomp/symbols/jp.sysreq Wed Jan 17 18:45:58 2001
+++ xc/programs/xkbcomp/symbols/jp Fri Jul 5 22:03:17 2002
@@ -101,19 +101,11 @@
type= "PC_SYSRQ",
symbols[Group1]= [ Print, Execute ]
};
- key <SYRQ> {
- type= "PC_SYSRQ",
- symbols[Group1]= [ Print, Execute ]
- };
key <SCLK> { [ Scroll_Lock ] };
key <PAUS> {
type= "PC_BREAK",
symbols[Group1]= [ Pause, Break ]
};
- key <BRK> {
- type= "PC_BREAK",
- symbols[Group1]= [ Pause, Break ]
- };
key <INS> { [ Insert ] };
key <HOME> { [ Home ] };
key <PGUP> { [ Prior ] };
--- xc/programs/xkbcomp/symbols/us.sysreq Fri Aug 17 09:27:58 2001
+++ xc/programs/xkbcomp/symbols/us Fri Jul 5 22:03:17 2002
@@ -112,19 +112,11 @@
type= "PC_SYSRQ",
symbols[Group1]= [ Print, Sys_Req ]
};
- key <SYRQ> {
- type= "PC_SYSRQ",
- symbols[Group1]= [ Print, Sys_Req ]
- };
key <SCLK> { [ Scroll_Lock ] };
key <PAUS> {
type= "PC_BREAK",
symbols[Group1]= [ Pause, Break ]
};
- key <BRK> {
- type= "PC_BREAK",
- symbols[Group1]= [ Pause, Break ]
- };
key <INS> { [ Insert ] };
key <HOME> { [ Home ] };
key <PGUP> { [ Prior ] };
--- xc/programs/xkbcomp/symbols/us_group2.sysreq Mon Oct 1 10:04:16 2001
+++ xc/programs/xkbcomp/symbols/us_group2 Fri Jul 5 22:03:17 2002
@@ -116,19 +116,11 @@
type= "PC_SYSRQ",
symbols[Group2]= [], [ Print, Sys_Req ]
};
- key <SYRQ> {
- type= "PC_SYSRQ",
- symbols[Group2]= [], [ Print, Sys_Req ]
- };
key <SCLK> { [], [ Scroll_Lock ] };
key <PAUS> {
type= "PC_BREAK",
symbols[Group2]= [], [ Pause, Break ]
};
- key <BRK> {
- type= "PC_BREAK",
- symbols[Group2]= [], [ Pause, Break ]
- };
key <INS> { [], [ Insert ] };
key <HOME> { [], [ Home ] };
key <PGUP> { [], [ Prior ] };
--- xc/programs/xkbcomp/symbols/us_group3.sysreq Thu Jun 15 16:34:15 2000
+++ xc/programs/xkbcomp/symbols/us_group3 Fri Jul 5 22:03:17 2002
@@ -120,19 +120,11 @@
type= "PC_SYSRQ",
symbols[Group3]= [], [], [ Print, Execute ]
};
- key <SYRQ> {
- type= "PC_SYSRQ",
- symbols[Group3]= [], [], [ Print, Execute ]
- };
key <SCLK> { [], [], [ Scroll_Lock ] };
key <PAUS> {
type= "PC_BREAK",
symbols[Group3]= [], [], [ Pause, Break ]
};
- key <BRK> {
- type= "PC_BREAK",
- symbols[Group3]= [], [], [ Pause, Break ]
- };
key <INS> { [], [], [ Insert ] };
key <HOME> { [], [], [ Home ] };
key <PGUP> { [], [], [ Prior ] };