Don't assert if the xrootwin is invalid. (#309997, Barbie LeVille)

2005-07-14  Matthias Clasen  <mclasen@redhat.com>

	* gdk/x11/gdkevents-x11.c (set_screen_from_root): Don't assert if
	the xrootwin is invalid.  (#309997, Barbie LeVille)
	(gdk_event_translate): Ignore events with an invalid root field.
This commit is contained in:
Matthias Clasen 2005-07-14 14:37:34 +00:00 committed by Matthias Clasen
parent 2362fc2274
commit f1dd819cfe
4 changed files with 57 additions and 15 deletions

View File

@ -1,5 +1,9 @@
2005-07-14 Matthias Clasen <mclasen@redhat.com> 2005-07-14 Matthias Clasen <mclasen@redhat.com>
* gdk/x11/gdkevents-x11.c (set_screen_from_root): Don't assert if
the xrootwin is invalid. (#309997, Barbie LeVille)
(gdk_event_translate): Ignore events with an invalid root field.
* configure.in: Set interface age to 0. * configure.in: Set interface age to 0.
* gtk/gtkimmodule.h: Move G_BEGIN_DECLS to the right spot, noticed * gtk/gtkimmodule.h: Move G_BEGIN_DECLS to the right spot, noticed

View File

@ -1,5 +1,9 @@
2005-07-14 Matthias Clasen <mclasen@redhat.com> 2005-07-14 Matthias Clasen <mclasen@redhat.com>
* gdk/x11/gdkevents-x11.c (set_screen_from_root): Don't assert if
the xrootwin is invalid. (#309997, Barbie LeVille)
(gdk_event_translate): Ignore events with an invalid root field.
* configure.in: Set interface age to 0. * configure.in: Set interface age to 0.
* gtk/gtkimmodule.h: Move G_BEGIN_DECLS to the right spot, noticed * gtk/gtkimmodule.h: Move G_BEGIN_DECLS to the right spot, noticed

View File

@ -1,5 +1,9 @@
2005-07-14 Matthias Clasen <mclasen@redhat.com> 2005-07-14 Matthias Clasen <mclasen@redhat.com>
* gdk/x11/gdkevents-x11.c (set_screen_from_root): Don't assert if
the xrootwin is invalid. (#309997, Barbie LeVille)
(gdk_event_translate): Ignore events with an invalid root field.
* configure.in: Set interface age to 0. * configure.in: Set interface age to 0.
* gtk/gtkimmodule.h: Move G_BEGIN_DECLS to the right spot, noticed * gtk/gtkimmodule.h: Move G_BEGIN_DECLS to the right spot, noticed

View File

@ -570,7 +570,7 @@ generate_focus_event (GdkWindow *window,
gdk_event_put (&event); gdk_event_put (&event);
} }
static void static gboolean
set_screen_from_root (GdkDisplay *display, set_screen_from_root (GdkDisplay *display,
GdkEvent *event, GdkEvent *event,
Window xrootwin) Window xrootwin)
@ -578,9 +578,15 @@ set_screen_from_root (GdkDisplay *display,
GdkScreen *screen; GdkScreen *screen;
screen = _gdk_x11_display_screen_for_xrootwin (display, xrootwin); screen = _gdk_x11_display_screen_for_xrootwin (display, xrootwin);
g_assert (screen);
gdk_event_set_screen (event, screen); if (screen)
{
gdk_event_set_screen (event, screen);
return TRUE;
}
return FALSE;
} }
static void static void
@ -1107,8 +1113,12 @@ gdk_event_translate (GdkDisplay *display,
event->scroll.y_root = (gfloat)xevent->xbutton.y_root; event->scroll.y_root = (gfloat)xevent->xbutton.y_root;
event->scroll.state = (GdkModifierType) xevent->xbutton.state; event->scroll.state = (GdkModifierType) xevent->xbutton.state;
event->scroll.device = display->core_pointer; event->scroll.device = display->core_pointer;
set_screen_from_root (display, event, xevent->xbutton.root); if (!set_screen_from_root (display, event, xevent->xbutton.root))
{
return_val = FALSE;
break;
}
break; break;
@ -1125,7 +1135,11 @@ gdk_event_translate (GdkDisplay *display,
event->button.button = xevent->xbutton.button; event->button.button = xevent->xbutton.button;
event->button.device = display->core_pointer; event->button.device = display->core_pointer;
set_screen_from_root (display, event, xevent->xbutton.root); if (!set_screen_from_root (display, event, xevent->xbutton.root))
{
return_val = FALSE;
break;
}
_gdk_event_button_generate (display, event); _gdk_event_button_generate (display, event);
break; break;
@ -1171,7 +1185,11 @@ gdk_event_translate (GdkDisplay *display,
event->button.button = xevent->xbutton.button; event->button.button = xevent->xbutton.button;
event->button.device = display->core_pointer; event->button.device = display->core_pointer;
set_screen_from_root (display, event, xevent->xbutton.root); if (!set_screen_from_root (display, event, xevent->xbutton.root))
{
return_val = FALSE;
break;
}
_gdk_xgrab_check_button_event (window, xevent); _gdk_xgrab_check_button_event (window, xevent);
break; break;
@ -1190,7 +1208,7 @@ gdk_event_translate (GdkDisplay *display,
return_val = FALSE; return_val = FALSE;
break; break;
} }
event->motion.type = GDK_MOTION_NOTIFY; event->motion.type = GDK_MOTION_NOTIFY;
event->motion.window = window; event->motion.window = window;
event->motion.time = xevent->xmotion.time; event->motion.time = xevent->xmotion.time;
@ -1203,8 +1221,12 @@ gdk_event_translate (GdkDisplay *display,
event->motion.is_hint = xevent->xmotion.is_hint; event->motion.is_hint = xevent->xmotion.is_hint;
event->motion.device = display->core_pointer; event->motion.device = display->core_pointer;
set_screen_from_root (display, event, xevent->xmotion.root); if (!set_screen_from_root (display, event, xevent->xbutton.root))
{
return_val = FALSE;
break;
}
break; break;
case EnterNotify: case EnterNotify:
@ -1220,6 +1242,12 @@ gdk_event_translate (GdkDisplay *display,
break; break;
} }
if (!set_screen_from_root (display, event, xevent->xbutton.root))
{
return_val = FALSE;
break;
}
/* Handle focusing (in the case where no window manager is running */ /* Handle focusing (in the case where no window manager is running */
if (toplevel && xevent->xcrossing.detail != NotifyInferior) if (toplevel && xevent->xcrossing.detail != NotifyInferior)
{ {
@ -1259,8 +1287,6 @@ gdk_event_translate (GdkDisplay *display,
event->crossing.x_root = xevent->xcrossing.x_root; event->crossing.x_root = xevent->xcrossing.x_root;
event->crossing.y_root = xevent->xcrossing.y_root; event->crossing.y_root = xevent->xcrossing.y_root;
set_screen_from_root (display, event, xevent->xcrossing.root);
/* Translate the crossing mode into Gdk terms. /* Translate the crossing mode into Gdk terms.
*/ */
switch (xevent->xcrossing.mode) switch (xevent->xcrossing.mode)
@ -1316,7 +1342,13 @@ gdk_event_translate (GdkDisplay *display,
return_val = FALSE; return_val = FALSE;
break; break;
} }
if (!set_screen_from_root (display, event, xevent->xbutton.root))
{
return_val = FALSE;
break;
}
/* Handle focusing (in the case where no window manager is running */ /* Handle focusing (in the case where no window manager is running */
if (toplevel && xevent->xcrossing.detail != NotifyInferior) if (toplevel && xevent->xcrossing.detail != NotifyInferior)
{ {
@ -1350,8 +1382,6 @@ gdk_event_translate (GdkDisplay *display,
event->crossing.x_root = xevent->xcrossing.x_root; event->crossing.x_root = xevent->xcrossing.x_root;
event->crossing.y_root = xevent->xcrossing.y_root; event->crossing.y_root = xevent->xcrossing.y_root;
set_screen_from_root (display, event, xevent->xcrossing.root);
/* Translate the crossing mode into Gdk terms. /* Translate the crossing mode into Gdk terms.
*/ */
switch (xevent->xcrossing.mode) switch (xevent->xcrossing.mode)