summaryrefslogtreecommitdiff
path: root/recipes/gnome/zenity/fingerscroll.patch
diff options
context:
space:
mode:
authorPrevidi Roberto <previdi.roberto@gmail.com>2009-04-28 10:51:39 +0000
committerKoen Kooi <koen@openembedded.org>2009-05-19 09:54:07 +0200
commit04e583d2be81fd42f36bb79eb7b3d64ab8deaf99 (patch)
tree208f61574878674bb4c96e2589b5e4202ce0101e /recipes/gnome/zenity/fingerscroll.patch
parent26b65117eb91d94ec1d4e6546eeefa90f0be7090 (diff)
zenity package
Please ignore my previous zenity patches. I collected all in one single patch this time so it should be more handy to use. The package zenity allows to use powerful graphic dialogs from the shell or scripts without effort. I added some patches to build fine (makefile.patch and no-gnome-doc.patch) and one patch to add a little but handy feature, fingerscroll.patch. it add the capability to the list dialogs of being scrolled dragging them with finger or pen (on touchscreens) or mouse (on desktop). The package has got some gnome dependencies (libgnomecanvas) and the tar.bz2 get downloaded from the gnome ftp, but i used inherit autotools because setting inherit gnome breaks the build for me.. i don't know how but some /usr/include path sneak into the CFLAGS making the cross compiler complain. Please tell me if there is any problem or i forgot something..
Diffstat (limited to 'recipes/gnome/zenity/fingerscroll.patch')
-rw-r--r--recipes/gnome/zenity/fingerscroll.patch102
1 files changed, 102 insertions, 0 deletions
diff --git a/recipes/gnome/zenity/fingerscroll.patch b/recipes/gnome/zenity/fingerscroll.patch
new file mode 100644
index 0000000000..785d179f03
--- /dev/null
+++ b/recipes/gnome/zenity/fingerscroll.patch
@@ -0,0 +1,102 @@
+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;
+