summaryrefslogtreecommitdiff
path: root/desktop/gmrun/patches/gmrun-0.9.2-mousewheel.patch
blob: ac1f843223f7c609ea294aa5662af9d8c0c857c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
diff -ur gmrun-0.9.2/src/gtkcompletionline.cc gmrun-0.9.2.new/src/gtkcompletionline.cc
--- gmrun-0.9.2/src/gtkcompletionline.cc	2010-01-11 12:20:16.076644635 +0200
+++ gmrun-0.9.2.new/src/gtkcompletionline.cc	2010-01-11 12:21:11.815581518 +0200
@@ -75,6 +75,8 @@
 
 static gboolean
 on_key_press(GtkCompletionLine *cl, GdkEventKey *event, gpointer data);
+static gboolean
+on_scroll(GtkCompletionLine *cl, GdkEventScroll *event, gpointer data);
 
 /* get_type */
 guint gtk_completion_line_get_type(void)
@@ -204,6 +206,8 @@
                        GTK_SIGNAL_FUNC(on_key_press), NULL);
   gtk_signal_connect(GTK_OBJECT(object), "key_release_event",
                      GTK_SIGNAL_FUNC(on_key_press), NULL);
+  gtk_signal_connect(GTK_OBJECT(object), "scroll-event",
+                     GTK_SIGNAL_FUNC(on_scroll), NULL);
 
   object->hist = new HistoryFile();
 
@@ -954,6 +958,45 @@
 }
 
 static gboolean
+on_scroll(GtkCompletionLine *cl, GdkEventScroll *event, gpointer data)
+{
+	if (event->direction == GDK_SCROLL_UP) {
+      if (cl->win_compl != NULL) {
+        int &item = cl->list_compl_items_where;
+        item--;
+        if (item < 0) {
+          item = 0;
+        } else {
+          complete_from_list(cl);
+        }
+      } else {
+        up_history(cl);
+      }
+      if (MODE_SRC) {
+        search_off(cl);
+      }
+	  return TRUE;
+	} else if (event->direction == GDK_SCROLL_DOWN) {
+      if (cl->win_compl != NULL) {
+        int &item = cl->list_compl_items_where;
+        item++;
+        if (item >= cl->list_compl_nr_rows) {
+          item = cl->list_compl_nr_rows - 1;
+        } else {
+          complete_from_list(cl);
+        }
+      } else {
+        down_history(cl);
+      }
+      if (MODE_SRC) {
+        search_off(cl);
+      }
+	  return TRUE;
+	}
+	return FALSE;
+}
+
+static gboolean
 on_key_press(GtkCompletionLine *cl, GdkEventKey *event, gpointer data)
 {
   static gint tt_id = -1;
Only in gmrun-0.9.2.new/src: gtkcompletionline.cc.orig