Commit fb88ec72 authored by Robert Ögren's avatar Robert Ögren Committed by Tor Lillqvist
Browse files

Don't propagate mouse events to windows that want extended input events.

2004-05-11  Robert Ögren  <gtk@roboros.com>

	* gdk/win32/gdkevents-win32.c (propagate): Don't propagate mouse
	events to windows that want extended input events. (#142943)
	(gdk_event_translate): Move check for extended input devices to
	propagate, new parameter to propagate.
	(gdk_pointer_grab, gdk_display_pointer_ungrab): Enable calls to
	_gdk_input_(un)grab_pointer. (#142943)

	* gdk/win32/gdkinput-win32.c (_gdk_input_other_event): Check for
	input grab. [Fix missing update of impl in "dijkstra" event
	propagation loop] Drop the parallel "impl" pointer, just use a
	cast. Don't propagate beyond windows that want normal input
	events. (#142943)
	(gdk_input_grab_pointer, gdk_input_ungrab_pointer): Limited
	implementation of input grab. (#142943)
parent 0916b965
2004-05-11 Robert Ögren <gtk@roboros.com>
* gdk/win32/gdkevents-win32.c (propagate): Don't propagate mouse
events to windows that want extended input events. (#142943)
(gdk_event_translate): Move check for extended input devices to
propagate, new parameter to propagate.
(gdk_pointer_grab, gdk_display_pointer_ungrab): Enable calls to
_gdk_input_(un)grab_pointer. (#142943)
* gdk/win32/gdkinput-win32.c (_gdk_input_other_event): Check for
input grab. [Fix missing update of impl in "dijkstra" event
propagation loop] Drop the parallel "impl" pointer, just use a
cast. Don't propagate beyond windows that want normal input
events. (#142943)
(gdk_input_grab_pointer, gdk_input_ungrab_pointer): Limited
implementation of input grab. (#142943)
2004-05-22 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.c (print_lc): Remove duplicated
......
2004-05-11 Robert Ögren <gtk@roboros.com>
* gdk/win32/gdkevents-win32.c (propagate): Don't propagate mouse
events to windows that want extended input events. (#142943)
(gdk_event_translate): Move check for extended input devices to
propagate, new parameter to propagate.
(gdk_pointer_grab, gdk_display_pointer_ungrab): Enable calls to
_gdk_input_(un)grab_pointer. (#142943)
* gdk/win32/gdkinput-win32.c (_gdk_input_other_event): Check for
input grab. [Fix missing update of impl in "dijkstra" event
propagation loop] Drop the parallel "impl" pointer, just use a
cast. Don't propagate beyond windows that want normal input
events. (#142943)
(gdk_input_grab_pointer, gdk_input_ungrab_pointer): Limited
implementation of input grab. (#142943)
2004-05-22 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.c (print_lc): Remove duplicated
......
2004-05-11 Robert Ögren <gtk@roboros.com>
* gdk/win32/gdkevents-win32.c (propagate): Don't propagate mouse
events to windows that want extended input events. (#142943)
(gdk_event_translate): Move check for extended input devices to
propagate, new parameter to propagate.
(gdk_pointer_grab, gdk_display_pointer_ungrab): Enable calls to
_gdk_input_(un)grab_pointer. (#142943)
* gdk/win32/gdkinput-win32.c (_gdk_input_other_event): Check for
input grab. [Fix missing update of impl in "dijkstra" event
propagation loop] Drop the parallel "impl" pointer, just use a
cast. Don't propagate beyond windows that want normal input
events. (#142943)
(gdk_input_grab_pointer, gdk_input_ungrab_pointer): Limited
implementation of input grab. (#142943)
2004-05-22 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.c (print_lc): Remove duplicated
......
2004-05-11 Robert Ögren <gtk@roboros.com>
* gdk/win32/gdkevents-win32.c (propagate): Don't propagate mouse
events to windows that want extended input events. (#142943)
(gdk_event_translate): Move check for extended input devices to
propagate, new parameter to propagate.
(gdk_pointer_grab, gdk_display_pointer_ungrab): Enable calls to
_gdk_input_(un)grab_pointer. (#142943)
* gdk/win32/gdkinput-win32.c (_gdk_input_other_event): Check for
input grab. [Fix missing update of impl in "dijkstra" event
propagation loop] Drop the parallel "impl" pointer, just use a
cast. Don't propagate beyond windows that want normal input
events. (#142943)
(gdk_input_grab_pointer, gdk_input_ungrab_pointer): Limited
implementation of input grab. (#142943)
2004-05-22 Tor Lillqvist <tml@iki.fi>
* gdk/win32/gdkinput-win32.c (print_lc): Remove duplicated
......
......@@ -533,13 +533,13 @@ gdk_pointer_grab (GdkWindow *window,
hcursor = NULL;
else if ((hcursor = CopyCursor (cursor_private->hcursor)) == NULL)
WIN32_API_FAILED ("CopyCursor");
#if 0
return_val = _gdk_input_grab_pointer (window,
owner_events,
event_mask,
confine_to,
time);
#endif
if (return_val == GDK_GRAB_SUCCESS)
{
if (!GDK_WINDOW_DESTROYED (window))
......@@ -615,9 +615,8 @@ gdk_display_pointer_ungrab (GdkDisplay *display,
GDK_NOTE (EVENTS, g_print ("%sgdk_display_pointer_ungrab%s",
(debug_indent > 0 ? "\n" : ""),
(debug_indent == 0 ? "\n" : "")));
#if 0
_gdk_input_ungrab_pointer (time);
#endif
if (GetCapture () != NULL)
ReleaseCapture ();
......@@ -1557,6 +1556,9 @@ translate_mouse_coords (GdkWindow *window1,
msg->lParam = MAKELPARAM (pt.x, pt.y);
}
/* The check_extended flag controls whether to check if the windows want
* events from extended input devices and if the message should be skipped
* because an extended input device is active */
static gboolean
propagate (GdkWindow **window,
MSG *msg,
......@@ -1564,13 +1566,24 @@ propagate (GdkWindow **window,
gboolean grab_owner_events,
gint grab_mask,
gboolean (*doesnt_want_it) (gint mask,
MSG *msg))
MSG *msg),
gboolean check_extended)
{
gboolean in_propagation = FALSE;
if (grab_window != NULL && !grab_owner_events)
{
/* Event source is grabbed with owner_events FALSE */
/* See if the event should be ignored because an extended input device
* is used */
if (check_extended &&
((GdkWindowObject *) grab_window)->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored for grabber)"));
return FALSE;
}
if ((*doesnt_want_it) (grab_mask, msg))
{
GDK_NOTE (EVENTS, g_print (" (grabber doesn't want it)"));
......@@ -1585,7 +1598,16 @@ propagate (GdkWindow **window,
}
while (TRUE)
{
if ((*doesnt_want_it) (((GdkWindowObject *) *window)->event_mask, msg))
/* See if the event should be ignored because an extended input device
* is used */
if (check_extended &&
((GdkWindowObject *) *window)->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored)"));
return FALSE;
}
if ((*doesnt_want_it) (((GdkWindowObject *) *window)->event_mask, msg))
{
/* Owner doesn't want it, propagate to parent. */
GdkWindow *parent = gdk_window_get_parent (*window);
......@@ -1595,6 +1617,16 @@ propagate (GdkWindow **window,
if (grab_window != NULL)
{
/* Event source is grabbed with owner_events TRUE */
/* See if the event should be ignored because an extended
* input device is used */
if (check_extended &&
((GdkWindowObject *) grab_window)->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored for grabber)"));
return FALSE;
}
if ((*doesnt_want_it) (grab_mask, msg))
{
/* Grabber doesn't want it either */
......@@ -2168,16 +2200,9 @@ gdk_event_translate (GdkDisplay *display,
assign_object (&window, new_window);
if (((GdkWindowObject *) window)->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored)"));
goto done;
}
if (!propagate (&window, msg,
p_grab_window, p_grab_owner_events, p_grab_mask,
doesnt_want_scroll))
doesnt_want_scroll, TRUE))
goto done;
if (GDK_WINDOW_DESTROYED (window))
......@@ -2319,7 +2344,7 @@ gdk_event_translate (GdkDisplay *display,
if (!propagate (&window, msg,
k_grab_window, k_grab_owner_events, GDK_ALL_EVENTS_MASK,
doesnt_want_key))
doesnt_want_key, FALSE))
break;
if (GDK_WINDOW_DESTROYED (window))
......@@ -2401,7 +2426,7 @@ gdk_event_translate (GdkDisplay *display,
if (!propagate (&window, msg,
k_grab_window, k_grab_owner_events, GDK_ALL_EVENTS_MASK,
doesnt_want_char))
doesnt_want_char, FALSE))
break;
if (GDK_WINDOW_DESTROYED (window))
......@@ -2479,16 +2504,9 @@ gdk_event_translate (GdkDisplay *display,
synthesize_crossing_events (window, GDK_CROSSING_NORMAL, msg);
}
if (((GdkWindowObject *) window)->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored)"));
break;
}
if (!propagate (&window, msg,
p_grab_window, p_grab_owner_events, p_grab_mask,
doesnt_want_button_press))
doesnt_want_button_press, TRUE))
break;
if (GDK_WINDOW_DESTROYED (window))
......@@ -2568,16 +2586,18 @@ gdk_event_translate (GdkDisplay *display,
synthesize_crossing_events (window, GDK_CROSSING_NORMAL, msg);
}
#if 0
if (((GdkWindowObject *) window)->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored)"));
break;
}
#endif
if (!propagate (&window, msg,
p_grab_window, p_grab_owner_events, p_grab_mask,
doesnt_want_button_release))
doesnt_want_button_release, TRUE))
{
}
else if (!GDK_WINDOW_DESTROYED (window))
......@@ -2640,16 +2660,9 @@ gdk_event_translate (GdkDisplay *display,
synthesize_crossing_events (window, GDK_CROSSING_NORMAL, msg);
}
if (((GdkWindowObject *) window)->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored)"));
break;
}
if (!propagate (&window, msg,
p_grab_window, p_grab_owner_events, p_grab_mask,
doesnt_want_button_motion))
doesnt_want_button_motion, TRUE))
break;
if (GDK_WINDOW_DESTROYED (window))
......@@ -2747,16 +2760,9 @@ gdk_event_translate (GdkDisplay *display,
assign_object (&window, new_window);
}
if (((GdkWindowObject *) window)->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored)"));
break;
}
if (!propagate (&window, msg,
p_grab_window, p_grab_owner_events, p_grab_mask,
doesnt_want_scroll))
doesnt_want_scroll, TRUE))
break;
if (GDK_WINDOW_DESTROYED (window))
......
......@@ -77,6 +77,16 @@ static GdkWindow *wintab_window;
#endif /* HAVE_WINTAB */
#ifdef HAVE_SOME_XINPUT
static GdkWindow *x_grab_window = NULL; /* Window that currently holds
* the extended inputs grab
*/
static GdkEventMask x_grab_mask;
static gboolean x_grab_owner_events;
#endif /* HAVE_SOME_XINPUT */
#ifdef HAVE_WINTAB
static GdkDevicePrivate *
......@@ -694,8 +704,7 @@ _gdk_input_other_event (GdkEvent *event,
GdkWindow *current_window;
#endif
GdkDisplay *display;
GdkWindowObject *obj;
GdkWindowImplWin32 *impl;
GdkWindowObject *obj, *grab_obj;
GdkInputWindow *input_window;
GdkDevicePrivate *gdkdev = NULL;
GdkEventMask masktest;
......@@ -741,12 +750,11 @@ _gdk_input_other_event (GdkEvent *event,
}
obj = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
switch (msg->message)
{
case WT_PACKET:
if (window == _gdk_parent_root)
if (window == _gdk_parent_root && x_grab_window == NULL)
{
GDK_NOTE (EVENTS_OR_INPUT, g_print ("...is root\n"));
return FALSE;
......@@ -805,17 +813,46 @@ _gdk_input_other_event (GdkEvent *event,
masktest |= GDK_BUTTON_MOTION_MASK | GDK_BUTTON3_MOTION_MASK;
}
/* See if input is grabbed */
/* FIXME: x_grab_owner_events should probably be handled somehow */
if (x_grab_window != NULL)
{
grab_obj = GDK_WINDOW_OBJECT (x_grab_window);
if (!GDK_WINDOW_IMPL_WIN32 (grab_obj->impl)->extension_events_selected
|| !(grab_obj->extension_events & masktest)
|| !(x_grab_mask && masktest))
{
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("...grabber doesn't want it\n"));
return FALSE;
}
GDK_NOTE (EVENTS_OR_INPUT, g_print ("...to grabber\n"));
g_object_ref(x_grab_window);
g_object_unref(window);
window = x_grab_window;
obj = grab_obj;
}
/* Now we can check if the window wants the event, and
* propagate if necessary.
*/
dijkstra:
if (!impl->extension_events_selected
if (!GDK_WINDOW_IMPL_WIN32 (obj->impl)->extension_events_selected
|| !(obj->extension_events & masktest))
{
GDK_NOTE (EVENTS_OR_INPUT, g_print ("...not selected\n"));
if (obj->parent == GDK_WINDOW_OBJECT (_gdk_parent_root))
return FALSE;
/* It is not good to propagate the extended events up to the parent
* if this window wants normal (not extended) motion/button events */
if (obj->event_mask & masktest)
{
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("...wants ordinary event, ignoring this\n"));
return FALSE;
}
pt.x = x;
pt.y = y;
......@@ -1026,6 +1063,11 @@ _gdk_input_grab_pointer (GdkWindow *window,
if (new_window)
{
new_window->grabbed = TRUE;
x_grab_window = window;
x_grab_mask = event_mask;
x_grab_owner_events = owner_events;
/* FIXME: Do we need to handle confine_to and time? */
tmp_list = _gdk_input_devices;
while (tmp_list)
......@@ -1055,6 +1097,7 @@ _gdk_input_grab_pointer (GdkWindow *window,
}
else
{
x_grab_window = NULL;
tmp_list = _gdk_input_devices;
while (tmp_list)
{
......@@ -1113,6 +1156,7 @@ _gdk_input_ungrab_pointer (guint32 time)
}
}
#endif
x_grab_window = NULL;
}
gboolean
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment