understanding gdk_keyboard_grab behaviour



Hi:

I am trying to use the gdk_grab_keyboard function to grab the keyboard and simulate key events for the system. I wrote a skeleton application to test the behavior and scope of the grab. I have written similar applcation in Xlib.

The basic thing the program does is open a top level window and give it the keypressed signal handling capability. then the application, upon, expose grabs the key pressed. All future key pressed events must reach the keypressed signal handler (I thought). Here is what happens.

1. If I use

gdk_keyboard_grab(app->window,TRUE,GDK_CURRENT_TIME);

the keyboard is grabbed and all events are sent to it. Event when the focus is on other windows. BUT when I minimize the window or switch to another virtual desktop the keybaord grab is lost. I have found this not to be the case with Xlib.

2. If I use

		gdk_keyboard_grab(GDK_ROOT_WINDOW(),
                                 TRUE,
                                 GDK_CURRENT_TIME);

I get an error. what excatly does GDK_ROOT_WINDOW() return: an XWindow object or a GDK_WINDOW object?

3. finally when I use the XGrabKeyboard function (from Xlib), the keybaord is grabbed but no application responds to it. This grab is

	XGrabKeyboard(GDK_DISPLAY(), root_window, False,
              GrabModeAsync, GrabModeAsync, CurrentTime);

This same function works in an Xlib app.

what is going on here? ANy insight/knowledge would be greatly appreciated.

Thanks in advance.

-D




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]