Re: xkb/xlib problem key states
I'd like to add a special hotkey feature to the icewm window manager: If the user holds down a (function) key for a configurable amount of seconds a program will be executed. Now my problem is how to query the key states in xlib. My first attempt was using XGrabKey and calculating the time between KeyPress and KeyRelease events but this did not work because of two problems: . Autorepeat must not be set (bad thing) You can disable autorepeat per key. See man XChangeKeyboardControl Can anyone tell me how to query the real state of a specific key (Pressed/Released?) with xlib ? man XQueryKeymap -- Ivan U. Pascal | e-mail: [EMAIL PROTECTED] Administrator of | Tomsk State University University Network | Tomsk, Russia ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: xkb/xlib problem key states
thx for the great help. XAllowEvents together with Ivan's hint (disable autorepeat per key) works absolute perfectly :)) XKB allows you to switch to detectable auto-repeat mode, where you get Press/Press/Press/Release rather than Press/Release Press/Release Press/Release. You can emulate this on servers without XKB by looking at the timestamps for the events. (You can look at the GTK+ sources in gtk+/gdk/x11 / to see both how it uses XKB and how it emulates when XKB is missing) With that, you should be able to come to something pretty close to what you want; reference here is the locate pointer code in the GNOME control center (gnome-control-center/gnome-settings-daemon/gnome-settings-mouse.c) That shows how to use XGrabKey and XAllowEvents to trap a press/release of a key without intervening key presses, while otherwise letting through the key events to applications. Regards, Owen -- NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien... Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService Jetzt kostenlos anmelden unter http://www.gmx.net +++ GMX - die erste Adresse für Mail, Message, More! +++ ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
Re: xkb/xlib problem key states
Sorry. I was a bit too fast on my last reply. No - This gnome mouse pointer locate code does not work for my issue! If this option is set in gnome no application will get the KeyPress event for Control_L or Control_R anymore ! (Which is not a big problem because Control is a modifier and the state is set in the KeyPress event of other keys) Try it with xev :) When I do a XAllowEvents(.. ReplayKeyboard ..) in my KeyPress handler other apps will get the KeyPress events but my application will never get a KeyRelease event afterwards for the grabbed key :( any ideas ?? On Tue, 2003-10-21 at 07:56, Peter Bergmann wrote: Can anyone tell me how to query the real state of a specific key (Pressed/Released?) with xlib ? Does xkb offer functions for this issue? XKB allows you to switch to detectable auto-repeat mode, where you get Press/Press/Press/Release rather than Press/Release Press/Release Press/Release. You can emulate this on servers without XKB by looking at the timestamps for the events. (You can look at the GTK+ sources in gtk+/gdk/x11 / to see both how it uses XKB and how it emulates when XKB is missing) With that, you should be able to come to something pretty close to what you want; reference here is the locate pointer code in the GNOME control center (gnome-control-center/gnome-settings-daemon/gnome-settings-mouse.c) That shows how to use XGrabKey and XAllowEvents to trap a press/release of a key without intervening key presses, while otherwise letting through the key events to applications. Regards, Owen ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel -- NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien... Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService Jetzt kostenlos anmelden unter http://www.gmx.net +++ GMX - die erste Adresse für Mail, Message, More! +++ ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel
xkb/xlib problem key states
I'd like to add a special hotkey feature to the icewm window manager: If the user holds down a (function) key for a configurable amount of seconds a program will be executed. Now my problem is how to query the key states in xlib. My first attempt was using XGrabKey and calculating the time between KeyPress and KeyRelease events but this did not work because of two problems: . Autorepeat must not be set (bad thing) . Other applications do not get the KeyEvents for the grabbed key (even worse) Can anyone tell me how to query the real state of a specific key (Pressed/Released?) with xlib ? Does xkb offer functions for this issue? .. or do I have to hack this directly into the xserver? Thy for any hints!! cheers, pet -- NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien... Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService Jetzt kostenlos anmelden unter http://www.gmx.net +++ GMX - die erste Adresse für Mail, Message, More! +++ ___ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel