diff options
Diffstat (limited to 'recipes/gnome/zenity/fingerscroll.patch')
-rw-r--r-- | recipes/gnome/zenity/fingerscroll.patch | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/recipes/gnome/zenity/fingerscroll.patch b/recipes/gnome/zenity/fingerscroll.patch deleted file mode 100644 index 785d179f03..0000000000 --- a/recipes/gnome/zenity/fingerscroll.patch +++ /dev/null @@ -1,102 +0,0 @@ -diff --git a/src/tree.c b/src/tree.c -index 6dd3f64..32e4826 100644 ---- a/src/tree.c -+++ b/src/tree.c -@@ -46,6 +46,9 @@ static gboolean zenity_tree_column_is_hidden (gint column_index); - static void zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data); - static void zenity_tree_row_activated (GtkTreeView *tree_view, GtkTreePath *tree_path, - GtkTreeViewColumn *tree_col, gpointer data); -+static void zenity_tree_drag_start (GtkWidget *widget, GdkEventButton *event, gpointer data); -+static void zenity_tree_drag (GtkWidget *widget, GdkEventMotion *event, gpointer data); -+static void zenity_tree_drag_stop (GtkWidget *widget, GdkEventButton *event, gpointer data); - - static gboolean - zenity_tree_dialog_untoggle (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) -@@ -353,7 +356,12 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) - if (!(tree_data->radiobox || tree_data->checkbox)) - g_signal_connect (G_OBJECT (tree_view), "row-activated", - G_CALLBACK (zenity_tree_row_activated), data); -- -+ -+ /* Connect drag-drop signals for finger scrolling */ -+ tree_data->is_scrolling=FALSE; -+ g_signal_connect (G_OBJECT (tree_view), "motion-notify-event", -+ G_CALLBACK (zenity_tree_drag), tree_data); -+ - /* Create an empty list store */ - model = g_object_new (GTK_TYPE_LIST_STORE, NULL); - -@@ -685,3 +693,56 @@ zenity_tree_extract_column_indexes (char *indexes, int n_columns) - - return result; - } -+void -+zenity_tree_drag_start (GtkWidget *widget, GdkEventButton *event, gpointer data) -+{ -+ ZenityTreeData *zen_data=data; -+ zen_data->is_scrolling=TRUE; -+ zen_data->start_scroll_x=event->x; -+ zen_data->start_scroll_y=event->y; -+ -+ GtkTreeView *tree_view=GTK_TREE_VIEW(widget); -+ zen_data->start_scroll_v_adjustment= -+ gtk_adjustment_get_value (gtk_tree_view_get_vadjustment(tree_view)); -+ zen_data->start_scroll_h_adjustment= -+ gtk_adjustment_get_value (gtk_tree_view_get_hadjustment(tree_view)); -+ zen_data->last_scroll_time=event->time; -+} -+ -+void -+zenity_tree_drag (GtkWidget *widget, GdkEventMotion *event, gpointer data) -+{ -+ ZenityTreeData *zen_data=data; -+ -+ if ((event->state & GDK_BUTTON1_MASK) && -+ (event->time-zen_data->last_scroll_time>50)) -+ { -+ if (!zen_data->is_scrolling) -+ zenity_tree_drag_start(widget,event,data) ; -+ -+ -+ gint dy=event->y-zen_data->start_scroll_y; -+ gint dx=event->x-zen_data->start_scroll_x; -+ -+ GtkTreeView *tree_view=GTK_TREE_VIEW(widget); -+ GtkAdjustment *vAdjustment = gtk_tree_view_get_vadjustment(tree_view); -+ GtkAdjustment *hAdjustment = gtk_tree_view_get_hadjustment(tree_view); -+ gtk_adjustment_set_value (vAdjustment, -+ CLAMP (zen_data->start_scroll_v_adjustment-dy, -+ vAdjustment->lower, -+ vAdjustment->upper - vAdjustment->page_size)); -+ gtk_adjustment_set_value (hAdjustment, -+ CLAMP (zen_data->start_scroll_h_adjustment-dx, -+ hAdjustment->lower, -+ hAdjustment->upper - hAdjustment->page_size)); -+ zen_data->last_scroll_time=event->time; -+ } -+ if (zen_data->is_scrolling && !(event->state & GDK_BUTTON1_MASK)) -+ zenity_tree_drag_stop(widget,event,data); -+} -+void -+zenity_tree_drag_stop (GtkWidget *widget, GdkEventButton *event, gpointer data) -+{ -+ ZenityTreeData *zen_data=data; -+ zen_data->is_scrolling=FALSE; -+} -diff --git a/src/zenity.h b/src/zenity.h -index ac6c4f8..d40d8df 100644 ---- a/src/zenity.h -+++ b/src/zenity.h -@@ -113,6 +113,12 @@ typedef struct { - gboolean editable; - gchar *print_column; - gchar *hide_column; -+ gint start_scroll_x; -+ gint start_scroll_y; -+ gdouble start_scroll_v_adjustment; -+ gdouble start_scroll_h_adjustment; -+ gboolean is_scrolling; -+ guint32 last_scroll_time; - const gchar **data; - } ZenityTreeData; - |