slackbuilds_ponce/desktop/gmrun/patches/gmrun-0.9.2-mousewheel.patch
Binh Nguyen 942cbdeabd desktop/gmrun: Added (provides a simple "run program" window)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
2010-07-10 02:17:58 -05:00

68 lines
2 KiB
Diff

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