Re: Managing focus through a GtkSocket - anyone??
- From: Owen Taylor <otaylor redhat com>
- To: GTK Mailing List <gtk-list gnome org>
- Subject: Re: Managing focus through a GtkSocket - anyone??
- Date: 30 Jul 2001 15:59:06 -0400
Neil Bird <neil fnxweb com> writes:
> No-one responded to my last request, but I've not managed to
> get any further :-(
>
>
> Essentially - I don't seem to be able to get a widget to have
> focus if it's in a GtkPlug within another sub-process's
> GtkSocket.
>
> I *think*, looking at the code I have, the sub-process is
> waiting for a focus event into it's GtkPlug (nee GtkWindow), and
> for some reason this isn't being properly attached.
>
> AFAICS, both the GtkPlug on one side (as before) and the new
> GtkSocket both regioster an interest in the relevant events.
>
> What else can I do?
You dont' say what version of GTK+ you are using. There were
various changes here in 1.2.9 and 1.2.10. You might want to
try 1.2.10 with the following patch applied that fixes
a remaining issue.
Regards,
Owen
--- gtk+-1.2.10/gtk/gtkwindow.c.focus Fri Mar 9 18:39:16 2001
+++ gtk+-1.2.10/gtk/gtkwindow.c Thu Jul 5 10:34:00 2001
@@ -985,7 +985,13 @@
break;
case EnterNotify:
case LeaveNotify:
- if (xev->xcrossing.detail != NotifyInferior &&
+ /* We only track the actual destination of keyboard events for real
+ * toplevels, not for embedded toplevels such as GtkPlug. The reason for
+ * this is that GtkPlug redirects events so the widget may effectively not
+ * have the focus even if it actually has the focus.
+ */
+ if (gdk_window_get_parent (GTK_WIDGET (window)->window) == GDK_ROOT_PARENT () &&
+ xev->xcrossing.detail != NotifyInferior &&
xev->xcrossing.focus && !window->window_has_focus)
{
window->window_has_pointer_focus = (xev->xany.type == EnterNotify) ? TRUE : FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]