After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 729248 - No way to give focus to window embedded in GtkSocket
No way to give focus to window embedded in GtkSocket
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: Other
3.12.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-04-30 09:30 UTC by Gaute Hope
Modified: 2016-04-22 08:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add functions gtk_socket_focus_forward and backward (2.06 KB, patch)
2014-05-01 18:40 UTC, Gaute Hope
none Details | Review

Description Gaute Hope 2014-04-30 09:30:13 UTC
It seems like there is no way to give focus in a similar way as widget_grab_focus() to a window embedded in GtkSocket. My use case involves gvim embedded and the only way to make the cursor active and input to gvim is to click on the widget.

According to the XEMBED specs (http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html#idm139742761059984) there seems to be a few signals that could be sent either a XEMBED_FOCUS_IN or a XEMBED_WINDOW_ACTIVATE. But it does not seem to be possible to do this with the current GtkSocket interface.
Comment 1 Gaute Hope 2014-04-30 14:50:15 UTC
I made an example of what I am trying to do based on the example code for Gtkmm: https://github.com/gauteh/plug-socket-grab-focus . The expected behavior would be:

1. start ./plug
2. start ./sock
3. press button

focus should now be on rightmost entry, the plug entry, but it is not.
Comment 2 Gaute Hope 2014-05-01 16:45:33 UTC
Note that it is possible to Tab into the window, but this involves GtkSocket sending a slightly different focus signal.
Comment 3 Gaute Hope 2014-05-01 18:40:19 UTC
Created attachment 275569 [details] [review]
add functions gtk_socket_focus_forward and backward

I've attached a patch adding the functions gtk_socket_focus_forward and _backward. These can be used to focus next or previous widget of the childs logical focus chain, and is equivalent of forward and backwards tabbing.

Unless there is another way to do this I suggest either this or a similar mechanism be added so that focus can be given to the first widget in the child.
Comment 4 Gaute Hope 2014-05-01 19:02:09 UTC
The 'focus_forward' branch of https://github.com/gauteh/plug-socket-grab-focus/tree/focus_forward demonstrates the use of patch above.
Comment 5 Gaute Hope 2014-08-26 20:55:06 UTC
Email to gtk-app-devel-list with some more detail:

https://mail.gnome.org/archives/gtk-app-devel-list/2014-May/msg00002.html
Comment 6 Gaute Hope 2016-04-22 08:55:20 UTC
Possible to work around with TAB_FORWARD.