Re: gtk_event_put() and foreign GDK windows



On Wed, 2003-12-17 at 16:12, Owen Taylor wrote:
On Wed, 2003-12-17 at 16:02, Dave Menendez wrote:
I apologize for the typo in the thread title:  the subject should be
"gdk_event_put() and foreign GDK windows".

===========

I have a GdkWindow which I created with gdk_window_foreign_new(),
wrapping a GdkWindow around an nedit X window.  I'm able to select for
and handle GDK events on it just fine.

However, when I want to send a synthetic key press event, for example,
to nedit using gdk_event_put() and specifying its GdkWindow, the nedit
application itself doesn't seem to see the key press (i.e., no new
character appears in the edit window).  Interestingly, though, the event
is successfully placed in the GDK event queue and my application can see
it fine.

So it seems as if gdk_event_put() when used on a foreign GDK window will
place the event in my local application's gdk event queue but will not
send an actual X event to the foreign X window.  I'm able to get Nedit
to see a key press only by sending an XEvent myself at the Xlib level. 
Is this the intended behavior of gdk_event_put()?

Yes, you have it exactly. (Using Xlib directly is generally the right
thing to do when you are doing something specific to X.)

Regards,
                                              Owen


Thanks, Owen.  At least it sounds like I was following the right path,
then, even though it didn't feel right.  Let me ask a follow-up question
to set my mind straight on the overall intent of GDK.  I was trying to
stay within GDK and away from Xlib-specific calls since I thought that
GDK's purpose was to abstract windowing system calls.  So I assumed that
gdk_put_event would have translated and forwarded the "abstract" GDK
event to the underlying windowing system, whether it was running on
Win32 or X windows.

Was my understanding of GDK, then, placing more responsibility on GDK
than was intended by its developers?  I'm fine with sometimes having to
make windowing system-specific calls, but I guess the line where I
should utilize GDK and where I should utilize windowing system-specific
library calls was blurry, at least in this instance.

Thanks,
Dave





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