Revert "x11: Query pointer devices' scroll valuators on toplevel enter events"
This reverts commit 77b8495bc4
.
The commit broke more scenarios than fixed, better to go back to square one.
This commit is contained in:
@ -40,6 +40,7 @@ struct _ScrollValuator
|
|||||||
{
|
{
|
||||||
guint n_valuator : 4;
|
guint n_valuator : 4;
|
||||||
guint direction : 4;
|
guint direction : 4;
|
||||||
|
guint last_value_valid : 1;
|
||||||
gdouble last_value;
|
gdouble last_value;
|
||||||
gdouble increment;
|
gdouble increment;
|
||||||
};
|
};
|
||||||
@ -818,8 +819,8 @@ _gdk_x11_device_xi2_add_scroll_valuator (GdkX11DeviceXI2 *device,
|
|||||||
|
|
||||||
scroll.n_valuator = n_valuator;
|
scroll.n_valuator = n_valuator;
|
||||||
scroll.direction = direction;
|
scroll.direction = direction;
|
||||||
|
scroll.last_value_valid = FALSE;
|
||||||
scroll.increment = increment;
|
scroll.increment = increment;
|
||||||
scroll.last_value = 0;
|
|
||||||
|
|
||||||
g_array_append_val (device->scroll_valuators, scroll);
|
g_array_append_val (device->scroll_valuators, scroll);
|
||||||
}
|
}
|
||||||
@ -850,10 +851,18 @@ _gdk_x11_device_xi2_get_scroll_delta (GdkX11DeviceXI2 *device,
|
|||||||
if (delta_ret)
|
if (delta_ret)
|
||||||
*delta_ret = 0;
|
*delta_ret = 0;
|
||||||
|
|
||||||
if (delta_ret)
|
if (scroll->last_value_valid)
|
||||||
*delta_ret = (valuator_value - scroll->last_value) / scroll->increment;
|
{
|
||||||
|
if (delta_ret)
|
||||||
|
*delta_ret = (valuator_value - scroll->last_value) / scroll->increment;
|
||||||
|
|
||||||
scroll->last_value = valuator_value;
|
scroll->last_value = valuator_value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scroll->last_value = valuator_value;
|
||||||
|
scroll->last_value_valid = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -863,33 +872,17 @@ _gdk_x11_device_xi2_get_scroll_delta (GdkX11DeviceXI2 *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gdk_device_xi2_revalidate_scroll_valuators (GdkX11DeviceXI2 *device)
|
_gdk_device_xi2_reset_scroll_valuators (GdkX11DeviceXI2 *device)
|
||||||
{
|
{
|
||||||
GdkDisplay *display;
|
guint i;
|
||||||
XIDeviceInfo *info;
|
|
||||||
gint i, ndevices;
|
|
||||||
|
|
||||||
display = gdk_device_get_display (GDK_DEVICE (device));
|
|
||||||
|
|
||||||
gdk_x11_display_error_trap_push (display);
|
|
||||||
info = XIQueryDevice (GDK_DISPLAY_XDISPLAY (display),
|
|
||||||
device->device_id, &ndevices);
|
|
||||||
gdk_x11_display_error_trap_pop_ignored (display);
|
|
||||||
|
|
||||||
if (!info)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < device->scroll_valuators->len; i++)
|
for (i = 0; i < device->scroll_valuators->len; i++)
|
||||||
{
|
{
|
||||||
XIValuatorClassInfo *valuator;
|
|
||||||
ScrollValuator *scroll;
|
ScrollValuator *scroll;
|
||||||
|
|
||||||
scroll = &g_array_index (device->scroll_valuators, ScrollValuator, i);
|
scroll = &g_array_index (device->scroll_valuators, ScrollValuator, i);
|
||||||
valuator = (XIValuatorClassInfo *) info->classes[scroll->n_valuator + 1];
|
scroll->last_value_valid = FALSE;
|
||||||
scroll->last_value = valuator->value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XIFreeDeviceInfo (info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -824,11 +824,13 @@ handle_device_changed (GdkX11DeviceManagerXI2 *device_manager,
|
|||||||
XIDeviceChangedEvent *ev)
|
XIDeviceChangedEvent *ev)
|
||||||
{
|
{
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
GdkDevice *device;
|
GdkDevice *device, *source_device;
|
||||||
|
|
||||||
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (device_manager));
|
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (device_manager));
|
||||||
device = g_hash_table_lookup (device_manager->id_table,
|
device = g_hash_table_lookup (device_manager->id_table,
|
||||||
GUINT_TO_POINTER (ev->deviceid));
|
GUINT_TO_POINTER (ev->deviceid));
|
||||||
|
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||||
|
GUINT_TO_POINTER (ev->sourceid));
|
||||||
|
|
||||||
if (device)
|
if (device)
|
||||||
{
|
{
|
||||||
@ -839,6 +841,9 @@ handle_device_changed (GdkX11DeviceManagerXI2 *device_manager,
|
|||||||
|
|
||||||
g_signal_emit_by_name (G_OBJECT (device), "changed");
|
g_signal_emit_by_name (G_OBJECT (device), "changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (source_device)
|
||||||
|
_gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkCrossingMode
|
static GdkCrossingMode
|
||||||
@ -1678,16 +1683,16 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
|||||||
xev->detail != XINotifyInferior && xev->mode != XINotifyPassiveUngrab &&
|
xev->detail != XINotifyInferior && xev->mode != XINotifyPassiveUngrab &&
|
||||||
gdk_window_get_window_type (window) == GDK_WINDOW_TOPLEVEL)
|
gdk_window_get_window_type (window) == GDK_WINDOW_TOPLEVEL)
|
||||||
{
|
{
|
||||||
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER)
|
if (gdk_device_get_device_type (source_device) != GDK_DEVICE_TYPE_MASTER)
|
||||||
_gdk_device_xi2_revalidate_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
|
_gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GList *slaves, *l;
|
GList *slaves, *l;
|
||||||
|
|
||||||
slaves = gdk_device_list_slave_devices (device);
|
slaves = gdk_device_list_slave_devices (source_device);
|
||||||
|
|
||||||
for (l = slaves; l; l = l->next)
|
for (l = slaves; l; l = l->next)
|
||||||
_gdk_device_xi2_revalidate_scroll_valuators (l->data);
|
_gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (l->data));
|
||||||
|
|
||||||
g_list_free (slaves);
|
g_list_free (slaves);
|
||||||
}
|
}
|
||||||
|
@ -246,8 +246,6 @@ gboolean _gdk_x11_device_xi2_get_scroll_delta (GdkX11DeviceXI2 *device,
|
|||||||
GdkScrollDirection *direction_ret,
|
GdkScrollDirection *direction_ret,
|
||||||
gdouble *delta_ret);
|
gdouble *delta_ret);
|
||||||
void _gdk_device_xi2_reset_scroll_valuators (GdkX11DeviceXI2 *device);
|
void _gdk_device_xi2_reset_scroll_valuators (GdkX11DeviceXI2 *device);
|
||||||
void _gdk_device_xi2_revalidate_scroll_valuators (GdkX11DeviceXI2 *device);
|
|
||||||
|
|
||||||
|
|
||||||
gdouble gdk_x11_device_xi2_get_last_axis_value (GdkX11DeviceXI2 *device,
|
gdouble gdk_x11_device_xi2_get_last_axis_value (GdkX11DeviceXI2 *device,
|
||||||
gint n_axis);
|
gint n_axis);
|
||||||
|
Reference in New Issue
Block a user