public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
* I lose characters because keycode of Fn is same than DEL
@ 2011-06-10  9:33 Paul Maier
  2011-06-23 11:34 ` Jon TURNEY
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Maier @ 2011-06-10  9:33 UTC (permalink / raw)
  To: cygwin-xfree

Hi,

on a a IBM Lenovo Laptop T60 there is a "Fn" key to adjust the screen brightness and such.

That "Fn" key has the same keycode than the DEL key.
Therefore I can't change the Fn key with xmodmap (because I would change the DEL key the same way.)

When I adjust the screen brightness, I lose characters in the editor.
Unfortunately the Fn key REPEATS firing delete while the key is pressed.
And several times I didn't notice the loss before saving and leaving the editor.

Here is the output of xev when I press the Fn key: (Pressing the DEL key would yield the very same output.)


KeyPress event, serial 20, synthetic NO, window 0xa00001,
    root 0x101, subw 0xa00002, time 42594031, (35,42), root:(259,282),
    state 0x0, keycode 107 (keysym 0xffff, Delete), same_screen YES,
    XLookupString gives 1 bytes: (7f) "<7f>"
    XFilterEvent returns: False


What can we do?

Thank you!
  Paul


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: I lose characters because keycode of Fn is same than DEL
  2011-06-10  9:33 I lose characters because keycode of Fn is same than DEL Paul Maier
@ 2011-06-23 11:34 ` Jon TURNEY
  2011-06-30  8:40   ` Phil Betts
  0 siblings, 1 reply; 8+ messages in thread
From: Jon TURNEY @ 2011-06-23 11:34 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: Paul Maier

On 10/06/2011 10:33, Paul Maier wrote:
> on a a IBM Lenovo Laptop T60 there is a "Fn" key to adjust the screen brightness and such.
>
> That "Fn" key has the same keycode than the DEL key.
> Therefore I can't change the Fn key with xmodmap (because I would change the DEL key the same way.)
>
> When I adjust the screen brightness, I lose characters in the editor.
> Unfortunately the Fn key REPEATS firing delete while the key is pressed.
> And several times I didn't notice the loss before saving and leaving the editor.
>
> Here is the output of xev when I press the Fn key: (Pressing the DEL key would yield the very same output.)
>
>
> KeyPress event, serial 20, synthetic NO, window 0xa00001,
>      root 0x101, subw 0xa00002, time 42594031, (35,42), root:(259,282),
>      state 0x0, keycode 107 (keysym 0xffff, Delete), same_screen YES,
>      XLookupString gives 1 bytes: (7f) "<7f>"
>      XFilterEvent returns: False
>
>
> What can we do?

Thanks for the bug report.

I think this is a bug in the way XWin translates Windows keystrokes into X 
keycodes.

Can you run the X server with the extra option '-logverbose 3' and report what 
is written to /var/log/xwin/XWin.0.log when you press the Fn key.

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: I lose characters because keycode of Fn is same than DEL
  2011-06-23 11:34 ` Jon TURNEY
@ 2011-06-30  8:40   ` Phil Betts
  2011-06-30 16:51     ` Jon TURNEY
  0 siblings, 1 reply; 8+ messages in thread
From: Phil Betts @ 2011-06-30  8:40 UTC (permalink / raw)
  To: cygwin-xfree

On 23 June 2011 12:34, Jon TURNEY <jon.turney@dronecode.org.uk> wrote:
> On 10/06/2011 10:33, Paul Maier wrote:
>>
>> on a a IBM Lenovo Laptop T60 there is a "Fn" key to adjust the screen
>> brightness and such.
>>
>> That "Fn" key has the same keycode than the DEL key.
>> Therefore I can't change the Fn key with xmodmap (because I would change
>> the DEL key the same way.)
>>
> ...
> I think this is a bug in the way XWin translates Windows keystrokes into X
> keycodes.
>
> Can you run the X server with the extra option '-logverbose 3' and report
> what is written to /var/log/xwin/XWin.0.log when you press the Fn key.

Since the OP hasn't responded, I have the same problem on a Lenovo R500
laptop.  Running as suggested produces this when the Fn key is pressed:

[   710.350] winTranslateKey: wParam 000000ff lParam 01630001
[   710.350] winSendKeyEvent: dwKey: 99, fDown: 1, nEvents 3
[   710.366] winTranslateKey: wParam 000000ff lParam c1630001
[   710.366] winSendKeyEvent: dwKey: 99, fDown: 0, nEvents 2

and this when the Delete key is pressed:

[   730.240] winTranslateKey: wParam 0000002e lParam 01530001
[   730.240] winSendKeyEvent: dwKey: 99, fDown: 1, nEvents 2
[   730.349] winTranslateKey: wParam 0000002e lParam c1530001
[   730.349] winSendKeyEvent: dwKey: 99, fDown: 0, nEvents 2

Phil

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: I lose characters because keycode of Fn is same than DEL
  2011-06-30  8:40   ` Phil Betts
@ 2011-06-30 16:51     ` Jon TURNEY
  2011-07-01 11:21       ` Phil Betts
  0 siblings, 1 reply; 8+ messages in thread
From: Jon TURNEY @ 2011-06-30 16:51 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: phil.betts, Paul Maier

On 30/06/2011 09:14, Phil Betts wrote:
> On 23 June 2011 12:34, Jon TURNEY <jon.turney@dronecode.org.uk> wrote:
>> On 10/06/2011 10:33, Paul Maier wrote:
>>>
>>> on a a IBM Lenovo Laptop T60 there is a "Fn" key to adjust the screen
>>> brightness and such.
>>>
>>> That "Fn" key has the same keycode than the DEL key.
>>> Therefore I can't change the Fn key with xmodmap (because I would change
>>> the DEL key the same way.)
>>>
>> ...
>> I think this is a bug in the way XWin translates Windows keystrokes into X
>> keycodes.
>>
>> Can you run the X server with the extra option '-logverbose 3' and report
>> what is written to /var/log/xwin/XWin.0.log when you press the Fn key.
> 
> Since the OP hasn't responded, I have the same problem on a Lenovo R500
> laptop.  Running as suggested produces this when the Fn key is pressed:
> 
> [   710.350] winTranslateKey: wParam 000000ff lParam 01630001
> [   710.350] winSendKeyEvent: dwKey: 99, fDown: 1, nEvents 3
> [   710.366] winTranslateKey: wParam 000000ff lParam c1630001
> [   710.366] winSendKeyEvent: dwKey: 99, fDown: 0, nEvents 2
> 
> and this when the Delete key is pressed:
> 
> [   730.240] winTranslateKey: wParam 0000002e lParam 01530001
> [   730.240] winSendKeyEvent: dwKey: 99, fDown: 1, nEvents 2
> [   730.349] winTranslateKey: wParam 0000002e lParam c1530001
> [   730.349] winSendKeyEvent: dwKey: 99, fDown: 0, nEvents 2

Thanks.

I've fixed the mapping for this (undocumented) virtual key code, so hopefully
this works correctly now. I've uploaded a snapshot at [1]

I can't test this as the keyboards I have with an Fn key don't generate a
separate keypress for that, apparently Lenovo laptops are special in this
regard :-), so please let me know if this works.

[1] ftp://cygwin.com/pub/cygwinx/XWin.20110630-git-e89b8ba1b44331d1.exe.bz2

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: I lose characters because keycode of Fn is same than DEL
  2011-06-30 16:51     ` Jon TURNEY
@ 2011-07-01 11:21       ` Phil Betts
  2011-07-01 15:14         ` Jon TURNEY
  0 siblings, 1 reply; 8+ messages in thread
From: Phil Betts @ 2011-07-01 11:21 UTC (permalink / raw)
  To: cygwin-xfree

On 30 June 2011 17:51, Jon TURNEY <jon.turney@dronecode.org.uk> wrote:
> I've fixed the mapping for this (undocumented) virtual key code, so hopefully
> this works correctly now. I've uploaded a snapshot at [1]
>
> I can't test this as the keyboards I have with an Fn key don't generate a
> separate keypress for that, apparently Lenovo laptops are special in this
> regard :-), so please let me know if this works.
>
> [1] ftp://cygwin.com/pub/cygwinx/XWin.20110630-git-e89b8ba1b44331d1.exe.bz2

Thanks Jon, that works a treat.

The new output for the Fn key is:
[ 89311.789] winTranslateKey: wParam 000000ff lParam 01630001
[ 89311.789] winSendKeyEvent: dwKey: 85, fDown: 1, nEvents 2
[ 89311.789] winTranslateKey: wParam 000000ff lParam c1630001
[ 89311.789] winSendKeyEvent: dwKey: 85, fDown: 0, nEvents 2

The corresponding output in xev is now:

KeyPress event, serial 27, synthetic NO, window 0x400001,
    root 0x101, subw 0x0, time 89443079, (86,83), root:(202,215),
    state 0x0, keycode 93 (keysym 0xff7e, Mode_switch), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 27, synthetic NO, window 0x400001,
    root 0x101, subw 0x0, time 89443079, (86,83), root:(202,215),
    state 0x0, keycode 93 (keysym 0xff7e, Mode_switch), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

Phil

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: I lose characters because keycode of Fn is same than DEL
  2011-07-01 11:21       ` Phil Betts
@ 2011-07-01 15:14         ` Jon TURNEY
  2011-07-05 12:50           ` Phil Betts
  0 siblings, 1 reply; 8+ messages in thread
From: Jon TURNEY @ 2011-07-01 15:14 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: phil.betts

On 01/07/2011 12:21, Phil Betts wrote:
> On 30 June 2011 17:51, Jon TURNEY <jon.turney@dronecode.org.uk> wrote:
>> I've fixed the mapping for this (undocumented) virtual key code, so hopefully
>> this works correctly now. I've uploaded a snapshot at [1]
>>
>> I can't test this as the keyboards I have with an Fn key don't generate a
>> separate keypress for that, apparently Lenovo laptops are special in this
>> regard :-), so please let me know if this works.
>>
>> [1] ftp://cygwin.com/pub/cygwinx/XWin.20110630-git-e89b8ba1b44331d1.exe.bz2
> 
> Thanks Jon, that works a treat.
> 
> The new output for the Fn key is:
> [ 89311.789] winTranslateKey: wParam 000000ff lParam 01630001
> [ 89311.789] winSendKeyEvent: dwKey: 85, fDown: 1, nEvents 2
> [ 89311.789] winTranslateKey: wParam 000000ff lParam c1630001
> [ 89311.789] winSendKeyEvent: dwKey: 85, fDown: 0, nEvents 2
> 
> The corresponding output in xev is now:
> 
> KeyPress event, serial 27, synthetic NO, window 0x400001,
>     root 0x101, subw 0x0, time 89443079, (86,83), root:(202,215),
>     state 0x0, keycode 93 (keysym 0xff7e, Mode_switch), same_screen YES,
>     XLookupString gives 0 bytes:
>     XmbLookupString gives 0 bytes:
>     XFilterEvent returns: False
> 
> KeyRelease event, serial 27, synthetic NO, window 0x400001,
>     root 0x101, subw 0x0, time 89443079, (86,83), root:(202,215),
>     state 0x0, keycode 93 (keysym 0xff7e, Mode_switch), same_screen YES,
>     XLookupString gives 0 bytes:
>     XFilterEvent returns: False

Thanks.

I was aiming to generate an unused keycode, though, so I'm not sure I've
picked a good one.

Can I see the output of 'setxkbmap  -print' as well, please?

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: I lose characters because keycode of Fn is same than DEL
  2011-07-01 15:14         ` Jon TURNEY
@ 2011-07-05 12:50           ` Phil Betts
  2011-07-06  8:16             ` Jon TURNEY
  0 siblings, 1 reply; 8+ messages in thread
From: Phil Betts @ 2011-07-05 12:50 UTC (permalink / raw)
  To: cygwin-xfree

On 1 July 2011 16:13, Jon TURNEY <jon.turney@dronecode.org.uk> wrote:
> I was aiming to generate an unused keycode, though, so I'm not sure I've
> picked a good one.

Understood, although just about anything is preferable to Delete :)

Since Fn functions as a modifier, perhaps one of the Mod keys, e.g.
Mod5 might be a better choice.

As long as it can be distinguished from any other key, we can use
xmodmap to map it to whatever we want (e.g. Control_L for me).

> Can I see the output of 'setxkbmap  -print' as well, please?

xkb_keymap {
        xkb_keycodes  { include "xfree86+aliases(qwerty)"       };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+gb+inet(pc105)"     };
        xkb_geometry  { include "pc(pc105)"     };
};

I get the same output regardless of whether X is started with or without
an external keyboard plugged in (is the external keyboard even
considered?).

Thanks,

Phil

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: I lose characters because keycode of Fn is same than DEL
  2011-07-05 12:50           ` Phil Betts
@ 2011-07-06  8:16             ` Jon TURNEY
  0 siblings, 0 replies; 8+ messages in thread
From: Jon TURNEY @ 2011-07-06  8:16 UTC (permalink / raw)
  To: cygwin-xfree

On 04/07/2011 16:19, Phil Betts wrote:
> On 1 July 2011 16:13, Jon TURNEY <jon.turney@dronecode.org.uk> wrote:
>> I was aiming to generate an unused keycode, though, so I'm not sure I've
>> picked a good one.
> 
> Understood, although just about anything is preferable to Delete :)
> 
> Since Fn functions as a modifier, perhaps one of the Mod keys, e.g.
> Mod5 might be a better choice.
> 
> As long as it can be distinguished from any other key, we can use
> xmodmap to map it to whatever we want (e.g. Control_L for me).

Well, I was aiming for it to do nothing by default and then it can be mapped
to a modifier if desired.

>> Can I see the output of 'setxkbmap  -print' as well, please?
> 
> xkb_keymap {
>         xkb_keycodes  { include "xfree86+aliases(qwerty)"       };
>         xkb_types     { include "complete"      };
>         xkb_compat    { include "complete"      };
>         xkb_symbols   { include "pc+gb+inet(pc105)"     };
>         xkb_geometry  { include "pc(pc105)"     };
> };

Hm.. this is strange, I have the same keymap, but when I generate that key
event (I have to hack my X server to do that as I don't have a Fn key), I get:

KeyPress event, serial 27, synthetic NO, window 0x800001,
    root 0x101, subw 0x0, time 7868875, (90,80), root:(2056,142),
    state 0x0, keycode 93 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 27, synthetic NO, window 0x800001,
    root 0x101, subw 0x0, time 7868968, (90,80), root:(2056,142),
    state 0x0, keycode 93 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

.. and this seems right looking at the output of 'xmodmap -pk', so there's
something else going on here I don't understand :-)

> I get the same output regardless of whether X is started with or without
> an external keyboard plugged in (is the external keyboard even
> considered?).

Not really, all the Windows keyboard input (which may come from real keyboards
or programs pretending to be one) is composed into a single virtual X keyboard.

Perhaps this isn't quite right but works well enough for most purposes :-)

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-07-05 12:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-10  9:33 I lose characters because keycode of Fn is same than DEL Paul Maier
2011-06-23 11:34 ` Jon TURNEY
2011-06-30  8:40   ` Phil Betts
2011-06-30 16:51     ` Jon TURNEY
2011-07-01 11:21       ` Phil Betts
2011-07-01 15:14         ` Jon TURNEY
2011-07-05 12:50           ` Phil Betts
2011-07-06  8:16             ` Jon TURNEY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).