scrolled window: Protect against nameless devices
It seems that gdk_device_get_name() can return NULL. We should not crash if that happens. https://bugzilla.gnome.org/show_bug.cgi?id=756625
This commit is contained in:
@ -1224,6 +1224,7 @@ captured_event_cb (GtkWidget *widget,
|
|||||||
GdkDevice *source_device;
|
GdkDevice *source_device;
|
||||||
GtkWidget *event_widget;
|
GtkWidget *event_widget;
|
||||||
gboolean on_scrollbar;
|
gboolean on_scrollbar;
|
||||||
|
const gchar *device_name;
|
||||||
|
|
||||||
sw = GTK_SCROLLED_WINDOW (widget);
|
sw = GTK_SCROLLED_WINDOW (widget);
|
||||||
priv = sw->priv;
|
priv = sw->priv;
|
||||||
@ -1243,6 +1244,7 @@ captured_event_cb (GtkWidget *widget,
|
|||||||
return GDK_EVENT_PROPAGATE;
|
return GDK_EVENT_PROPAGATE;
|
||||||
|
|
||||||
input_source = gdk_device_get_source (source_device);
|
input_source = gdk_device_get_source (source_device);
|
||||||
|
device_name = gdk_device_get_name (source_device);
|
||||||
|
|
||||||
if (input_source == GDK_SOURCE_KEYBOARD ||
|
if (input_source == GDK_SOURCE_KEYBOARD ||
|
||||||
input_source == GDK_SOURCE_TOUCHSCREEN)
|
input_source == GDK_SOURCE_TOUCHSCREEN)
|
||||||
@ -1268,8 +1270,8 @@ captured_event_cb (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
else if (input_source == GDK_SOURCE_PEN ||
|
else if (input_source == GDK_SOURCE_PEN ||
|
||||||
input_source == GDK_SOURCE_ERASER ||
|
input_source == GDK_SOURCE_ERASER ||
|
||||||
strstr (gdk_device_get_name (source_device), "TrackPoint") ||
|
(device_name != NULL && strstr (device_name, "TrackPoint")) ||
|
||||||
strstr (gdk_device_get_name (source_device), "DualPoint Stick"))
|
(device_name != NULL && strstr (device_name, "DualPoint Stick")))
|
||||||
{
|
{
|
||||||
indicator_set_over (&priv->hindicator, TRUE);
|
indicator_set_over (&priv->hindicator, TRUE);
|
||||||
indicator_set_over (&priv->vindicator, TRUE);
|
indicator_set_over (&priv->vindicator, TRUE);
|
||||||
|
|||||||
Reference in New Issue
Block a user