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

Re: GdkEventMask?



Andreas Volz wrote:

>Am Thu, 10 Jul 2003 09:42:08 -0400 schrieb Tristan Van Berkom:
>
>  
>
>>>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).
>>    
>>
>
>I'm not sure if I understand you right, but my app doesn't create a new
>window. My app react only for a GDK_BUTTON_PRESS_MASK in the root
>window. So it's a add-on for WM's without a root menu. And it works
>great.
>
>But when I start my app with a WM running that graps the
>GDK_BUTTON_PRESS_MASK it crashes with this error. I wish to detect if
>the GDK_BUTTON_PRESS_MASK is yet grapped for the root window and exit my
>app.
>
>I think the way it try to do it should work, but it doesn't. Why?
>
>Perhaps now it's better to understand what I try to do.
>  
>

In the code that you posted you create a new GdkWindow object:

 > rootwindow = gdk_window_foreign_new (gdk_x11_get_default_root_xwindow());

this _NEW_ object refers to an already existant X resource (the root 
window).

now your branchstate here:

 > unavailable_events = gdk_window_get_events(rootwindow);

 > if ((unavailable_events & GDK_BUTTON_PRESS_MASK) == 
GDK_BUTTON_PRESS_MASK)

will always yield the same result because the event mask is freshly 
initialized in your
_NEW_ GdkWindow.

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


Cheers,
                        -Tristan






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