[Xfce4-commits] <xfce4-panel:master> Tasklist: Add option to disable mouse scrolling (bug #6996).

Nick Schermer noreply at xfce.org
Fri Aug 12 21:52:01 CEST 2011


Updating branch refs/heads/master
         to 93f436db38d243df30a42272fc6a03326801add2 (commit)
       from 9a7ca5adc8f6a1f1ab65bfd6cba2bd78235a1854 (commit)

commit 93f436db38d243df30a42272fc6a03326801add2
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Aug 12 21:50:06 2011 +0200

    Tasklist: Add option to disable mouse scrolling (bug #6996).

 plugins/tasklist/tasklist-dialog.glade |   13 +++++++++++++
 plugins/tasklist/tasklist-widget.c     |   25 ++++++++++++++++++++++++-
 plugins/tasklist/tasklist.c            |    2 ++
 3 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/plugins/tasklist/tasklist-dialog.glade b/plugins/tasklist/tasklist-dialog.glade
index 835449e..21e24cc 100644
--- a/plugins/tasklist/tasklist-dialog.glade
+++ b/plugins/tasklist/tasklist-dialog.glade
@@ -220,6 +220,19 @@
                             <property name="position">2</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkCheckButton" id="window-scrolling">
+                            <property name="label" translatable="yes">_Switch windows using the mouse wheel</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="position">3</property>
+                          </packing>
+                        </child>
                       </object>
                     </child>
                   </object>
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 320cf48..d5ad920 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -92,7 +92,8 @@ enum
   PROP_SHOW_WIREFRAMES,
   PROP_SHOW_HANDLE,
   PROP_SORT_ORDER,
-  PROP_ROTATE_VERTICALLY
+  PROP_ROTATE_VERTICALLY,
+  PROP_WINDOW_SCROLLING
 };
 
 struct _XfceTasklistClass
@@ -150,6 +151,9 @@ struct _XfceTasklist
   /* if we rotate buttons in a vertical panel */
   guint                 rotate_vertically : 1;
 
+  /* switch window with the mouse wheel */
+  guint                 window_scrolling : 1;
+
   /* whether we only show windows that are in the geometry of
    * the monitor the tasklist is on */
   guint                 all_monitors : 1;
@@ -458,6 +462,13 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
                                                          TRUE,
                                                          EXO_PARAM_READWRITE));
 
+  g_object_class_install_property (gobject_class,
+                                   PROP_WINDOW_SCROLLING,
+                                   g_param_spec_boolean ("window-scrolling",
+                                                         NULL, NULL,
+                                                         TRUE,
+                                                         EXO_PARAM_READWRITE));
+
   gtk_widget_class_install_style_property (gtkwidget_class,
                                            g_param_spec_int ("max-button-length",
                                                              NULL,
@@ -533,6 +544,7 @@ xfce_tasklist_init (XfceTasklist *tasklist)
   tasklist->show_handle = TRUE;
   tasklist->rotate_vertically = TRUE;
   tasklist->all_monitors = TRUE;
+  tasklist->window_scrolling = TRUE;
   xfce_tasklist_geometry_set_invalid (tasklist);
 #ifdef GDK_WINDOWING_X11
   tasklist->wireframe_window = 0;
@@ -619,6 +631,10 @@ xfce_tasklist_get_property (GObject    *object,
       g_value_set_boolean (value, tasklist->rotate_vertically);
       break;
 
+    case PROP_WINDOW_SCROLLING:
+      g_value_set_boolean (value, tasklist->window_scrolling);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -689,6 +705,10 @@ xfce_tasklist_set_property (GObject      *object,
       xfce_tasklist_set_rotate_vertically (tasklist, g_value_get_boolean (value));
       break;
 
+    case PROP_WINDOW_SCROLLING:
+      tasklist->window_scrolling = g_value_get_boolean (value);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1169,6 +1189,9 @@ xfce_tasklist_scroll_event (GtkWidget      *widget,
   XfceTasklistChild *child = NULL;
   GList             *li, *lnew = NULL;
 
+  if (!tasklist->window_scrolling)
+    return TRUE;
+
   for (li = tasklist->windows; li != NULL; li = li->next)
     {
       child = li->data;
diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c
index 383c235..1c1a332 100644
--- a/plugins/tasklist/tasklist.c
+++ b/plugins/tasklist/tasklist.c
@@ -137,6 +137,7 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
     { "show-handle", G_TYPE_BOOLEAN },
     { "sort-order", G_TYPE_UINT },
     { "rotate-vertically", G_TYPE_BOOLEAN },
+    { "window-scrolling", G_TYPE_BOOLEAN },
     { NULL }
   };
 
@@ -237,6 +238,7 @@ tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
   TASKLIST_DIALOG_BIND ("show-wireframes", "active")
   TASKLIST_DIALOG_BIND ("show-handle", "active")
   TASKLIST_DIALOG_BIND ("sort-order", "active")
+  TASKLIST_DIALOG_BIND ("window-scrolling", "active")
 
 #ifndef GDK_WINDOWING_X11
   /* not functional in x11, so avoid confusion */


More information about the Xfce4-commits mailing list