Re: GdkEventMask?



rootwindow = gdk_window_foreign_new (gdk_x11_get_default_root_xwindow());

hmmm, this is in some kind of callback function ?

This is just an educated guess but here goes:

this:

   gdk_x11_get_default_root_xwindow()

will probably return an int (XID) reference to an X resource (which is an "x window" in
this case).

and this:

  gdk_window_foreign_new(XID *)

_will_ create a new GdkWindow.

a  "GdkEventMask" will apply to some flags in the newly created
"GdkWindow"; it will affect what events you have filtered out in
the "gdk" api; not the "xlib" api.

so; you want to create _one_ GdkWindow and only reference it
in your callbacks. (you probably had some memory leak also
from the continous creation of GdkWindow objects).


Hope this helps,
                                       -Tristan



Andreas Volz wrote:

Hi,

I use this in my gdk-app to show if a event is available for root
window:

GdkEventMask unavailable_events;
GdkWindow *rootwindow;

rootwindow = gdk_window_foreign_new (gdk_x11_get_default_root_xwindow());

unavailable_events = gdk_window_get_events(rootwindow);

if ((unavailable_events & GDK_BUTTON_PRESS_MASK) == GDK_BUTTON_PRESS_MASK)
   {
     printf ("GDK_BUTTON_PRESS_MASK not available for root window\n");
     exit (1);
   }
 else
   {
     printf ("GDK_BUTTON_PRESS_MASK available for root window\n");
     gdk_window_set_events (rootwindow, GDK_BUTTON_PRESS_MASK);
   }

I want to check it, because if not my app crashes with:
The program 'grootevent' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAccess (attempt to access private resource denied)'.
 (Details: serial 44 error_code 10 request_code 2 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 --sync command line
  option to change this behavior. You can then get a meaningful
  backtrace from your debugger if you break on the gdk_x_error() function.)

But it doesn't work. I go everytime into the else-part. What did I wrong?

Thanks
Andreas
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list







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