Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm assuming you control both windows, and this is on an X11 system like Linux. If not, it's much more challenging. I've done things like this within a single app, and here are some recollections.</p> <p>You've probably figured out you can't just use <a href="http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-grab-focus" rel="nofollow">gtk_widget_grab_focus()</a> to do it. That only works for determining which widget within a window has focus when the window itself has focus.</p> <p>It's X11 that determines which window gets a keyboard event, based on the window hierarchy, info from the window manager, etc. However, you can monkey around with that via GDK to get the result you want.</p> <p>You'll have to learn about <a href="http://library.gnome.org/devel/gdk/stable/gdk-Events.html" rel="nofollow">GDK event propagation</a>, and probably read some of the GDK sources. But I believe that, generally, what you'll need to do is this:</p> <ol> <li>Use gdk_event_handler_set() to install your own event handler. You'll need to do this after GTK+ is initialized, and chain to gtk_main_do_event().</li> <li>When you get a keyboard event (GdkEventKey), look at the X event structure. If it has the XID for window A, replace that with the XID for window B, and pass it on to GTK+. You might need to duplicate the event, and not modify the original one.</li> </ol> <p>If the windows belong to different apps, you can look at gdk_event_send_client_message(), but I've never used it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload