[gtk+] Inspector: Make picking work without a grab
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Inspector: Make picking work without a grab
- Date: Tue, 28 Oct 2014 11:05:55 +0000 (UTC)
commit 850143b7a09383aa3c47a5ea89d4066ee832a8b3
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Oct 28 07:04:23 2014 -0400
Inspector: Make picking work without a grab
Turns out Weston takes an X grab while delivering button events.
Thus, trying to take a grab in response to a button press is
futile.
gtk/inspector/inspect-button.c | 12 +++++-------
gtk/inspector/window.h | 2 ++
2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c
index 4d94037..dbe98dc 100644
--- a/gtk/inspector/inspect-button.c
+++ b/gtk/inspector/inspect-button.c
@@ -280,7 +280,8 @@ property_query_event (GtkWidget *widget,
{
g_signal_handlers_disconnect_by_func (widget, property_query_event, data);
gtk_grab_remove (widget);
- gdk_device_ungrab (gdk_event_get_device (event), GDK_CURRENT_TIME);
+ if (iw->grabbed)
+ gdk_device_ungrab (gdk_event_get_device (event), GDK_CURRENT_TIME);
on_inspect_widget (widget, event, data);
}
else if (event->type == GDK_MOTION_NOTIFY)
@@ -297,7 +298,8 @@ property_query_event (GtkWidget *widget,
g_signal_handlers_disconnect_by_func (widget, property_query_event, data);
gtk_grab_remove (widget);
device = gdk_device_get_associated_device (gdk_event_get_device (event));
- gdk_device_ungrab (device, GDK_CURRENT_TIME);
+ if (iw->grabbed)
+ gdk_device_ungrab (device, GDK_CURRENT_TIME);
gdk_window_raise (gtk_widget_get_window (GTK_WIDGET (iw)));
clear_flash (iw);
}
@@ -337,11 +339,7 @@ gtk_inspector_on_inspect (GtkWidget *button,
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
cursor, GDK_CURRENT_TIME);
g_object_unref (cursor);
- if (status != GDK_GRAB_SUCCESS)
- {
- g_warning ("grab failed (%d) :-(\n", status);
- return;
- }
+ iw->grabbed = status == GDK_GRAB_SUCCESS;
g_signal_connect (iw->invisible, "event", G_CALLBACK (property_query_event), iw);
diff --git a/gtk/inspector/window.h b/gtk/inspector/window.h
index c06cd16..e2aa87c 100644
--- a/gtk/inspector/window.h
+++ b/gtk/inspector/window.h
@@ -68,6 +68,8 @@ typedef struct
GtkWidget *selected_widget;
GtkWidget *flash_widget;
+ gboolean grabbed;
+
gint flash_count;
gint flash_cnx;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]