Separate out tracking of the X server focus window from tracking our idea

Tue Dec 10 14:37:41 2002  Owen Taylor  <otaylor@redhat.com>

        * 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.
This commit is contained in:
Owen Taylor
2002-12-10 20:05:30 +00:00
committed by Owen Taylor
parent 194a619101
commit 488bdbfaa7
8 changed files with 87 additions and 6 deletions

View File

@@ -1,3 +1,11 @@
Tue Dec 10 14:37:41 2002 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gtk/gtkclist.c (adjust_adjustments): Fix typo with

View File

@@ -1,3 +1,11 @@
Tue Dec 10 14:37:41 2002 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gtk/gtkclist.c (adjust_adjustments): Fix typo with

View File

@@ -1,3 +1,11 @@
Tue Dec 10 14:37:41 2002 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gtk/gtkclist.c (adjust_adjustments): Fix typo with

View File

@@ -1,3 +1,11 @@
Tue Dec 10 14:37:41 2002 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gtk/gtkclist.c (adjust_adjustments): Fix typo with

View File

@@ -1,3 +1,11 @@
Tue Dec 10 14:37:41 2002 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gtk/gtkclist.c (adjust_adjustments): Fix typo with

View File

@@ -1,3 +1,11 @@
Tue Dec 10 14:37:41 2002 Owen Taylor <otaylor@redhat.com>
* 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 <otaylor@redhat.com>
* gtk/gtkclist.c (adjust_adjustments): Fix typo with

View File

@@ -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;

View File

@@ -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.
*/