Sponsored Content
Full Discussion: xlib and keyboard events
Top Forums UNIX for Advanced & Expert Users xlib and keyboard events Post 302720873 by N7DR on Wednesday 24th of October 2012 06:09:49 PM
Old 10-24-2012
It turns out that the change to XGrabKeyboard() is still not quite doing the right thing :-(

Now keyboard events from ALL windows are being sent to my application, even though I specifically use the correct window ID for the xterm in the call to XGrabKeyboard().

So I'm back to asking what I'm doing wrong :-(
 

5 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How can I map Unix keyboard for PC keyboard

A Solaris AXI 440 machine with Solaris 8 version. I have PC users who use an emulation to login to the Solaris server. How can I change the keyboard mapping of the Sun keyboard to fit to the PC keyboard ? Any comment will be appreciated. Thanks (1 Reply)
Discussion started by: simhab
1 Replies

2. Programming

How to get capture input events from keyboard and mouse

Hi, Is there any way to capture/record the input events from keyboard, as well as from mouse using C. Thanks in advance (4 Replies)
Discussion started by: yhacks
4 Replies

3. Programming

Xlib mouse events and ButtonPressMask

I have written a simple program which will report key press and release events for a particular window. In my case, it is mostly the terminal since I invoke the program from the terminal. I am able to get the key press and release events taking place in the terminal window (I have used... (0 Replies)
Discussion started by: abhinav.zoso
0 Replies

4. UNIX for Dummies Questions & Answers

Problem getting vertical bar with British keyboard layout on US (physical) keyboard

Hi, I've got a bit of a ridiculous problem and wasn't sure where to post it. I need to use the vertical bar for piping in Bash but, as per the title, am using a UK layout on a US (physical) keyboard which doesn't have a key for it in the place I'd expect. I've tried using xbindkeys and Unicode... (7 Replies)
Discussion started by: crunchgargoyle
7 Replies

5. Programming

Xlib registering

hey, Im new to the linux world. Lately, I have tried to create a glx window with xlib, making it a popup window(fullscreen) so I set override_redirect to true. Im happy with the removed borders, but apparantly, the application doesnt show up in the left bar in ubuntu, neither when I press alt... (4 Replies)
Discussion started by: thedardanius
4 Replies
XGrabKeyboard() 														   XGrabKeyboard()

Name
  XGrabKeyboard - grab the keyboard.

Synopsis
  int XGrabKeyboard(display, grab_window, owner_events, pointer_mode,
	    keyboard_mode, time)
	Display *display;
	Window grab_window;
	Bool owner_events;
	int pointer_mode, keyboard_mode;
	Time time;

Arguments
  display   Specifies a connection to an X server; returned from XOpenDisplay().

  grab_window
	    Specifies the ID of the window that requires continuous keyboard input.

  owner_events
	    Specifies a boolean value of either True or False.	See the "Description" section below.

  pointer_mode
	    Controls processing of pointer events during the grab.  Pass either GrabModeSync or GrabModeAsync.

  keyboard_mode
	    Controls processing of keyboard events during the grab.  Pass either GrabModeSync or GrabModeAsync.

  time	    Specifies the time when the grab should take place.  Pass either a timestamp, expressed in milliseconds, or the constant Current-
	    Time.

Returns
  GrabSuccess on success.  AlreadyGrabbed, GrabNotViewable, GrabInvalidTime, or GrabFrozen on failure.

Description
  XGrabKeyboard() actively grabs control of the main keyboard.	Further key events are reported only to the grabbing  client.	This  request
  generates FocusIn and FocusOut events.

  XGrabKeyboard() processing is controlled by the value in the owner_events argument:

  o  If owner_events is False, all generated key events are reported to grab_window.

  o  If  owner_events  is  True, then if a generated key event would normally be reported to this client, it is reported normally.  Otherwise
     the event is reported to grab_window.

  Both KeyPress and KeyRelease events are always reported, independent of any event selection made by the client.

  XGrabKeyboard() processing of pointer events and keyboard events are controlled by pointer_mode and keyboard_mode:

  o  If the pointer_mode or keyboard_mode is GrabModeAsync, event processing for the respective device continues normally.

  o  For keyboard_mode GrabModeAsync only: if the keyboard was currently frozen by  this  client,  then  processing  of  keyboard  events  is
     resumed.

  o  If  the  pointer_mode or keyboard_mode is GrabModeSync, events for the respective device are queued by the server until a releasing XAl-
     lowEvents() request occurs or until the keyboard grab is released as described above.

  If the grab is successful, XGrabKeyboard() returns the constant GrabSuccess.	XGrabKeyboard() fails  under  the  following  conditions  and
  returns the following:

  o  If the keyboard is actively grabbed by some other client, it returns AlreadyGrabbed.

  o  If grab_window is not viewable, it returns GrabNotViewable.

  o  If time is earlier than the last keyboard grab time or later than the current server time, it returns GrabInvalidTime.

  o  If the pointer is frozen by an active grab of another client, the request fails with a status GrabFrozen.

  If the grab succeeds, the last keyboard grab time is set to the specified time, with CurrentTime replaced by the current X server time.

  For more information on grabbing, see Volume One, Chapter 9, The Keyboard and Pointer.

Errors
  BadValue
  BadWindow

See Also
  XChangeActivePointerGrab(),  XGrabButton(),  XGrabKey(),  XGrabPointer(),  XGrabServer(), XUngrabButton(), XUngrabKey(), XUngrabKeyboard(),
  XUngrabPointer(), XUngrabServer().

Xlib - Grabbing 														   XGrabKeyboard()
All times are GMT -4. The time now is 06:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy