GtkSocket: focus to embedded child widget or plug widget

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

 



Hi,

I am trying to put the keyboard focus on a widget (or similar) inside a
embedded window of a GtkSocket, but although I am using grab_focus on
the GtkSocket and the plugin seems to be receiving the events (at least
the socket-side window is not anymore) the widget or window does not
have keyboard focus. E.g. in the case of a simple plug with a GtkEntry,
the entry does not have cursor, or if I embed gvim the gvim cursor is
not blinking/active.

I have submitted a bug here:
https://bugzilla.gnome.org/show_bug.cgi?id=729248

I am using Gtk+ git.

It turns out it is possible to give focus to the first widget by
'Tab'-ing into the embedded child, but it does not seem to be a way to
do this programtically. The specific XEMBED signals that are required to
be sent [0] can, as far as I can see, only be sent through the GtkSocket
by the tab-handler.

grab_focus() sends a XEMBED_FOCUS_IN message but with an
XEMBED_FOCUS_CURRENT detail, by replacing ..._CURRENT with ...._FIRST
the embedded child acts as if Tab has been pressed and the first widget
gets focus.

As you can see from the bug report I created a patch for Gtk where I can
send the focus_forward and backward ( _FIRST and _LAST ) signals. When I
use it the focus changes as expected.

A small example based on gtkmm's socket and plug examples can be found
here:
https://github.com/gauteh/plug-socket-grab-focus/tree/focus_forward

After some discussion on #gtk+ we've also discovered that the testsocket
program appears to give focus to the plugin entry field, but the entry
does not get any key events before it is clicked.

If there is no other way of programatically changing the focus of the
embedded plugin I would greatly appreciate either something like the
patch I include in the bug report or some other way to control the focus
from the socket-side.

By the way, thanks for the helpful discussions on #gtk+.

Best regards, Gaute

[0 http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html#idm139742756373280

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list




[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux