diff --git a/ChangeLog b/ChangeLog index 45e8c2d940..d7f4317743 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue Dec 10 14:37:41 2002 Owen Taylor + + * gdk/x11/gdkevents-x11.c (gdk_event_translate) + gdk/x11/gdkwindow-x11.h: Separate out tracking of the X server + focus window from tracking our idea of what the focus window is, + because the PointerRoot code needs to know the real pointer + window. + Tue Dec 10 12:57:00 2002 Owen Taylor * gtk/gtkclist.c (adjust_adjustments): Fix typo with diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 45e8c2d940..d7f4317743 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +Tue Dec 10 14:37:41 2002 Owen Taylor + + * gdk/x11/gdkevents-x11.c (gdk_event_translate) + gdk/x11/gdkwindow-x11.h: Separate out tracking of the X server + focus window from tracking our idea of what the focus window is, + because the PointerRoot code needs to know the real pointer + window. + Tue Dec 10 12:57:00 2002 Owen Taylor * gtk/gtkclist.c (adjust_adjustments): Fix typo with diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 45e8c2d940..d7f4317743 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +Tue Dec 10 14:37:41 2002 Owen Taylor + + * gdk/x11/gdkevents-x11.c (gdk_event_translate) + gdk/x11/gdkwindow-x11.h: Separate out tracking of the X server + focus window from tracking our idea of what the focus window is, + because the PointerRoot code needs to know the real pointer + window. + Tue Dec 10 12:57:00 2002 Owen Taylor * gtk/gtkclist.c (adjust_adjustments): Fix typo with diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 45e8c2d940..d7f4317743 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +Tue Dec 10 14:37:41 2002 Owen Taylor + + * gdk/x11/gdkevents-x11.c (gdk_event_translate) + gdk/x11/gdkwindow-x11.h: Separate out tracking of the X server + focus window from tracking our idea of what the focus window is, + because the PointerRoot code needs to know the real pointer + window. + Tue Dec 10 12:57:00 2002 Owen Taylor * gtk/gtkclist.c (adjust_adjustments): Fix typo with diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 45e8c2d940..d7f4317743 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +Tue Dec 10 14:37:41 2002 Owen Taylor + + * gdk/x11/gdkevents-x11.c (gdk_event_translate) + gdk/x11/gdkwindow-x11.h: Separate out tracking of the X server + focus window from tracking our idea of what the focus window is, + because the PointerRoot code needs to know the real pointer + window. + Tue Dec 10 12:57:00 2002 Owen Taylor * gtk/gtkclist.c (adjust_adjustments): Fix typo with diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 45e8c2d940..d7f4317743 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +Tue Dec 10 14:37:41 2002 Owen Taylor + + * gdk/x11/gdkevents-x11.c (gdk_event_translate) + gdk/x11/gdkwindow-x11.h: Separate out tracking of the X server + focus window from tracking our idea of what the focus window is, + because the PointerRoot code needs to know the real pointer + window. + Tue Dec 10 12:57:00 2002 Owen Taylor * gtk/gtkclist.c (adjust_adjustments): Fix typo with diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index 31b4c284aa..007ce71c1c 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -426,6 +426,26 @@ generate_focus_event (GdkWindow *window, gdk_event_put (&event); } +#ifdef G_ENABLE_DEBUG +static const char notify_modes[][18] = { + "NotifyNormal", + "NotifyGrab", + "NotifyUngrab", + "NotifyWhileGrabbed" +}; + +static const char notify_details[][22] = { + "NotifyAncestor", + "NotifyVirtual", + "NotifyInferior", + "NotifyNonlinear", + "NotifyNonlinearVirtual", + "NotifyPointer", + "NotifyPointerRoot", + "NotifyDetailNone" +}; +#endif + static gint gdk_event_translate (GdkEvent *event, XEvent *xevent, @@ -831,7 +851,7 @@ gdk_event_translate (GdkEvent *event, if (window && GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && xevent->xcrossing.detail != NotifyInferior && - xevent->xcrossing.focus && !window_impl->has_focus) + xevent->xcrossing.focus && !window_impl->has_focus_window) { gboolean had_focus = HAS_FOCUS (window_impl); @@ -924,7 +944,7 @@ gdk_event_translate (GdkEvent *event, if (window && GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && xevent->xcrossing.detail != NotifyInferior && - xevent->xcrossing.focus && !window_impl->has_focus) + xevent->xcrossing.focus && !window_impl->has_focus_window) { gboolean had_focus = HAS_FOCUS (window_impl); @@ -1000,7 +1020,10 @@ gdk_event_translate (GdkEvent *event, */ case FocusIn: GDK_NOTE (EVENTS, - g_message ("focus in:\t\twindow: %ld", xevent->xfocus.window)); + g_message ("focus in:\t\twindow: %ld, detail: %s, mode: %s", + xevent->xfocus.window, + notify_details[xevent->xfocus.detail], + notify_modes[xevent->xfocus.mode])); if (window && GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD) { @@ -1012,6 +1035,7 @@ gdk_event_translate (GdkEvent *event, case NotifyNonlinear: case NotifyVirtual: case NotifyNonlinearVirtual: + window_impl->has_focus_window = TRUE; /* We pretend that the focus moves to the grab * window, so we pay attention to NotifyGrab * NotifyUngrab, and ignore NotifyWhileGrabbed @@ -1039,7 +1063,11 @@ gdk_event_translate (GdkEvent *event, break; case FocusOut: GDK_NOTE (EVENTS, - g_message ("focus out:\t\twindow: %ld", xevent->xfocus.window)); + g_message ("focus out:\t\twindow: %ld, detail: %s, mode: %s", + xevent->xfocus.window, + notify_details[xevent->xfocus.detail], + notify_modes[xevent->xfocus.mode])); + if (window && GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD) { @@ -1051,6 +1079,7 @@ gdk_event_translate (GdkEvent *event, case NotifyNonlinear: case NotifyVirtual: case NotifyNonlinearVirtual: + window_impl->has_focus_window = FALSE; if (xevent->xfocus.mode != NotifyWhileGrabbed) window_impl->has_focus = FALSE; break; diff --git a/gdk/x11/gdkwindow-x11.h b/gdk/x11/gdkwindow-x11.h index 0aaf0f93c2..4c7c9e2d1d 100644 --- a/gdk/x11/gdkwindow-x11.h +++ b/gdk/x11/gdkwindow-x11.h @@ -73,11 +73,15 @@ struct _GdkWindowImplX11 GdkXPositionInfo position_info; - /* Set if the window, or any descendent of it, has the focus + /* Set if the window, or any descendent of it, is the server's focus window + */ + guint has_focus_window : 1; + + /* Set if window->has_focus_window and the focus isn't grabbed elsewhere. */ guint has_focus : 1; - /* Set if !window_has_focus, but events are being sent to the + /* Set if !window->has_focus_window, but events are being sent to the * window because the pointer is in it. (Typically, no window * manager is running. */