catch hotkeys while not active keyboard focus

This is a discussion on catch hotkeys while not active keyboard focus within the Linux Programming forums, part of the Platform Specific Boards category; how do programs catch hotkeys like that? all window managers have this - fluxbox, kde, gnome I'm sure, and they ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    2

    catch hotkeys while not active keyboard focus

    how do programs catch hotkeys like that? all window managers have this - fluxbox, kde, gnome I'm sure, and they catch your keypress no matter what program has active keyboard focus.

    devices in /dev/input are all (or should be, anyhow) unreadable by any but root, so that idea is out the window.

  2. #2
    Registered User
    Join Date
    Apr 2008
    Posts
    395
    there is a specific feature for that called grabbing, you just 'grab' the key sequence you're interested in and the X server will always send it to you (i.e. your window) (google xgrabkey)

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    They use Xlib:

    http://tronche.com/gui/x/xlib/

    Qv. chapters 11 & 12 about "event handling". Keyboard activity is an event.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Keyboard focus without activation?
    By kgen in forum Windows Programming
    Replies: 3
    Last Post: 01-07-2008, 01:25 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 09:00 AM
  3. Keyboard Focus
    By Aidman in forum Windows Programming
    Replies: 8
    Last Post: 01-07-2003, 04:41 PM
  4. I need help disabling Keyboard and Mouse input on Edit controls
    By Templario in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2003, 11:59 PM
  5. Focus & Always-On-Top :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 06-13-2002, 05:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21