[gtk+] place sidebar: Use GdkEvent API
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] place sidebar: Use GdkEvent API
- Date: Tue, 19 Sep 2017 17:17:26 +0000 (UTC)
commit 5d5ae459c4af4a74c2067107c9b900802e1589a0
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Aug 26 10:57:37 2017 -0400
place sidebar: Use GdkEvent API
gtk/gtkplacessidebar.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 0461cc9..8cb1a4f 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -1670,6 +1670,7 @@ on_motion_notify_event (GtkWidget *widget,
{
GtkPlacesSidebar *sidebar = GTK_PLACES_SIDEBAR (user_data);
guint state;
+ double x_root, y_root;
if (sidebar->drag_row == NULL || sidebar->dragging_over)
return FALSE;
@@ -1678,9 +1679,11 @@ on_motion_notify_event (GtkWidget *widget,
!(state & GDK_BUTTON1_MASK))
return FALSE;
+ gdk_event_get_root_coords ((GdkEvent *) event, &x_root, &y_root);
+
if (gtk_drag_check_threshold (widget,
sidebar->drag_root_x, sidebar->drag_root_y,
- event->x_root, event->y_root))
+ x_root, y_root))
{
sidebar->dragging_over = TRUE;
@@ -3679,6 +3682,7 @@ on_button_press_event (GtkWidget *widget,
GtkPlacesSidebar *sidebar;
GtkPlacesSidebarSectionType section_type;
gdouble x, y;
+ double x_root, y_root;
g_object_get (GTK_SIDEBAR_ROW (row),
"sidebar", &sidebar,
@@ -3688,12 +3692,13 @@ on_button_press_event (GtkWidget *widget,
if (section_type == SECTION_BOOKMARKS)
{
gdk_event_get_coords ((GdkEvent *) event, &x, &y);
+ gdk_event_get_root_coords ((GdkEvent *) event, &x_root, &y_root);
sidebar->drag_row = GTK_WIDGET (row);
sidebar->drag_row_x = (gint)x;
sidebar->drag_row_y = (gint)y;
- sidebar->drag_root_x = event->x_root;
- sidebar->drag_root_y = event->y_root;
+ sidebar->drag_root_x = x_root;
+ sidebar->drag_root_y = y_root;
}
g_object_unref (sidebar);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]