Commit 51021f88 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

When the pointer is grabbed on an input window, either explicitely, or

Sat Sep  5 16:01:19 1998  Owen Taylor  <otaylor@gtk.org>

	* gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
	When the pointer is grabbed on an input window,
	either explicitely, or through press-grab, and
	then grabbed on a non-input window, ungrab the
	devices.
parent 78dbc1ef
Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
When the pointer is grabbed on an input window,
either explicitely, or through press-grab, and
then grabbed on a non-input window, ungrab the
devices.
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
......
Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
When the pointer is grabbed on an input window,
either explicitely, or through press-grab, and
then grabbed on a non-input window, ungrab the
devices.
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
......
Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
When the pointer is grabbed on an input window,
either explicitely, or through press-grab, and
then grabbed on a non-input window, ungrab the
devices.
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
......
Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
When the pointer is grabbed on an input window,
either explicitely, or through press-grab, and
then grabbed on a non-input window, ungrab the
devices.
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
......
Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
When the pointer is grabbed on an input window,
either explicitely, or through press-grab, and
then grabbed on a non-input window, ungrab the
devices.
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
......
Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
When the pointer is grabbed on an input window,
either explicitely, or through press-grab, and
then grabbed on a non-input window, ungrab the
devices.
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
......
Sat Sep 5 16:01:19 1998 Owen Taylor <otaylor@gtk.org>
* gdk/gdkinputxfree.h gdk/gdk.c gdk/gdkinputgxi.h:
When the pointer is grabbed on an input window,
either explicitely, or through press-grab, and
then grabbed on a non-input window, ungrab the
devices.
Sat Sep 5 07:13:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.h: don't include any gdk headers.
......
......@@ -1307,8 +1307,7 @@ gdk_pointer_grab (GdkWindow * window,
xevent_mask |= event_mask_table[i];
}
if (((GdkWindowPrivate *)window)->extension_events &&
gdk_input_vtable.grab_pointer)
if (gdk_input_vtable.grab_pointer)
return_val = gdk_input_vtable.grab_pointer (window,
owner_events,
event_mask,
......
......@@ -593,16 +593,31 @@ gdk_input_gxi_grab_pointer (GdkWindow * window,
{
GdkInputWindow *input_window, *new_window;
GList *tmp_list;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
tmp_list = gdk_input_windows;
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
if (input_window->grabbed)
return AlreadyGrabbed;
if (input_window->window == window)
new_window = input_window;
else (input_window->grabbed)
input_window->grabbed = FALSE;
tmp_list = gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
gdkdev->xdevice &&
(gdkdev->button_state != 0))
gdkdev->button_state = 0;
tmp_list = tmp_list->next;
}
tmp_list = tmp_list->next;
}
......
......@@ -257,6 +257,7 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
guint32 time)
{
GdkInputWindow *input_window, *new_window;
gboolean need_ungrab;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
......@@ -265,47 +266,70 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
tmp_list = gdk_input_windows;
new_window = NULL;
need_ungrab = FALSE;
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
if (input_window->grabbed)
return AlreadyGrabbed;
if (input_window->window == window)
new_window = input_window;
else if (input_window->grabbed)
{
input_window->grabbed = FALSE;
need_ungrab = TRUE;
}
tmp_list = tmp_list->next;
}
g_return_val_if_fail (new_window != NULL, Success); /* shouldn't happen */
new_window->grabbed = TRUE;
tmp_list = gdk_input_devices;
while (tmp_list)
if (new_window)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
gdkdev->xdevice)
new_window->grabbed = TRUE;
tmp_list = gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
gdkdev->xdevice)
{
gdk_input_common_find_events (window, gdkdev,
event_mask,
event_classes, &num_classes);
result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
GDK_WINDOW_XWINDOW (window),
owner_events, num_classes, event_classes,
GrabModeAsync, GrabModeAsync, time);
/* FIXME: if failure occurs on something other than the first
device, things will be badly inconsistent */
if (result != Success)
return result;
}
tmp_list = tmp_list->next;
}
}
else
{
tmp_list = gdk_input_devices;
while (tmp_list)
{
gdk_input_common_find_events (window, gdkdev,
event_mask,
event_classes, &num_classes);
result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
GDK_WINDOW_XWINDOW (window),
owner_events, num_classes, event_classes,
GrabModeAsync, GrabModeAsync, time);
/* FIXME: if failure occurs on something other than the first
device, things will be badly inconsistent */
if (result != Success)
return result;
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice &&
((gdkdev->button_state != 0) || need_ungrab))
{
XUngrabDevice( gdk_display, gdkdev->xdevice, time);
gdkdev->button_state = 0;
}
tmp_list = tmp_list->next;
}
tmp_list = tmp_list->next;
}
return Success;
}
static void
......
......@@ -593,16 +593,31 @@ gdk_input_gxi_grab_pointer (GdkWindow * window,
{
GdkInputWindow *input_window, *new_window;
GList *tmp_list;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
tmp_list = gdk_input_windows;
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
if (input_window->grabbed)
return AlreadyGrabbed;
if (input_window->window == window)
new_window = input_window;
else (input_window->grabbed)
input_window->grabbed = FALSE;
tmp_list = gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
gdkdev->xdevice &&
(gdkdev->button_state != 0))
gdkdev->button_state = 0;
tmp_list = tmp_list->next;
}
tmp_list = tmp_list->next;
}
......
......@@ -257,6 +257,7 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
guint32 time)
{
GdkInputWindow *input_window, *new_window;
gboolean need_ungrab;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
......@@ -265,47 +266,70 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
tmp_list = gdk_input_windows;
new_window = NULL;
need_ungrab = FALSE;
while (tmp_list)
{
input_window = (GdkInputWindow *)tmp_list->data;
if (input_window->grabbed)
return AlreadyGrabbed;
if (input_window->window == window)
new_window = input_window;
else if (input_window->grabbed)
{
input_window->grabbed = FALSE;
need_ungrab = TRUE;
}
tmp_list = tmp_list->next;
}
g_return_val_if_fail (new_window != NULL, Success); /* shouldn't happen */
new_window->grabbed = TRUE;
tmp_list = gdk_input_devices;
while (tmp_list)
if (new_window)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
gdkdev->xdevice)
new_window->grabbed = TRUE;
tmp_list = gdk_input_devices;
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
gdkdev->xdevice)
{
gdk_input_common_find_events (window, gdkdev,
event_mask,
event_classes, &num_classes);
result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
GDK_WINDOW_XWINDOW (window),
owner_events, num_classes, event_classes,
GrabModeAsync, GrabModeAsync, time);
/* FIXME: if failure occurs on something other than the first
device, things will be badly inconsistent */
if (result != Success)
return result;
}
tmp_list = tmp_list->next;
}
}
else
{
tmp_list = gdk_input_devices;
while (tmp_list)
{
gdk_input_common_find_events (window, gdkdev,
event_mask,
event_classes, &num_classes);
result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
GDK_WINDOW_XWINDOW (window),
owner_events, num_classes, event_classes,
GrabModeAsync, GrabModeAsync, time);
/* FIXME: if failure occurs on something other than the first
device, things will be badly inconsistent */
if (result != Success)
return result;
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice &&
((gdkdev->button_state != 0) || need_ungrab))
{
XUngrabDevice( gdk_display, gdkdev->xdevice, time);
gdkdev->button_state = 0;
}
tmp_list = tmp_list->next;
}
tmp_list = tmp_list->next;
}
return Success;
}
static void
......
......@@ -1307,8 +1307,7 @@ gdk_pointer_grab (GdkWindow * window,
xevent_mask |= event_mask_table[i];
}
if (((GdkWindowPrivate *)window)->extension_events &&
gdk_input_vtable.grab_pointer)
if (gdk_input_vtable.grab_pointer)
return_val = gdk_input_vtable.grab_pointer (window,
owner_events,
event_mask,
......
Markdown is supported
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