Capturing global hotkeys with XGrabKey
- From: Fernando Rodriguez <frodriguez developer outlook com>
- To: gtk-app-devel-list gnome org
- Subject: Capturing global hotkeys with XGrabKey
- Date: Mon, 8 Sep 2014 01:23:01 -0400
Hi, Basicly I'm trying to do this: http://stackoverflow.com/questions/2349958/global-hotkey-in-mono-and-gtk
but I'm using C.
Here's a simplified version of my code:
GdkFilterReturn root_window_filter(GdkXEvent* xevent, GdkEvent* event, gpointer data)
{
return GDK_FILTER_CONTINUE;
}
int main( int argc, char *argv[] )
{
gtk_init (&argc, &argv);
gdk_window_add_filter(
gdk_get_default_root_window(),
root_window_filter,
NULL);
XGrabKey(
gdk_x11_get_default_xdisplay(),
AnyKey,
AnyModifier,
gdk_x11_get_default_root_xwindow(),
FALSE,
GrabModeAsync,
GrabModeAsync);
gtk_main ();
return 0;
}
This gives me the following X server error:
The error was 'BadAccess (attempt to access private resource denied)'.
(Details: serial 151 error_code 10 request_code 33 (core protocol) minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Any help would be appreciated.
---
Fernando Rodriguez
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]