gdk_grab_keyboard vs. XGrabKeyboard behavior



Hi All:

I wrote a simple GNOME program. All it does is that it opens a small window and when the window gets exposed the first time, it grabs the keyboard. I first used the gdk_grab_keyboard function. And when a key is pressed it displays a g_print message saying "key pressed". Both the "exposed" and "key_press" events are tied to the main window.

What I found is that when I refocus using my mouse on another application, the main application gives up the grab and characters can be typed say into gedit or something.

But then again, this does not happen if I convert this into a Gtk application instead of a GNOME app. It should not, but it is.

If I replace gdk_grab_keyboard with XGrabkeyboard, then the keyboard grab works but nothing is printed on the screen when I press a key.

My understanding was that when I compiled with the GNOME libs. Gtk, GDK , Xlib all got included. Should I be inserting the Gtk Libs as well?

Thanks.

-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]