[Xfce4-commits] [xfce/xfce4-panel] 02/02: Set window wrapping behavior

noreply at xfce.org noreply at xfce.org
Thu Feb 5 03:03:16 CET 2015


This is an automated email from the git hooks/post-receive script.

andrzejr pushed a commit to branch master
in repository xfce/xfce4-panel.

commit 7933a467559cbf208c51f6d5ba88b51d59a0e86f
Author: Andrzej <ndrwrdck at gmail.com>
Date:   Thu Feb 5 02:03:06 2015 +0000

    Set window wrapping behavior
    
    Disabled window wrapping when scrolling over the tasklist plugin.
    Window wrapping can be enabled by setting a hidden boolean property:
    /plugins/plugin-#/wrap-windows            true
---
 plugins/tasklist/tasklist-widget.c |   24 +++++++++++++++++++++---
 plugins/tasklist/tasklist.c        |    1 +
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 41f000e..2a9afbf 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -90,6 +90,7 @@ enum
   PROP_SHOW_HANDLE,
   PROP_SORT_ORDER,
   PROP_WINDOW_SCROLLING,
+  PROP_WRAP_WINDOWS,
   PROP_INCLUDE_ALL_BLINKING,
   PROP_MIDDLE_CLICK
 };
@@ -151,6 +152,7 @@ struct _XfceTasklist
 
   /* switch window with the mouse wheel */
   guint                 window_scrolling : 1;
+  guint                 wrap_windows : 1;
 
   /* whether we show blinking windows from all workspaces
    * or only the active workspace */
@@ -467,6 +469,13 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
                                                          EXO_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class,
+                                   PROP_WRAP_WINDOWS,
+                                   g_param_spec_boolean ("wrap-windows",
+                                                         NULL, NULL,
+                                                         FALSE,
+                                                         EXO_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class,
                                    PROP_INCLUDE_ALL_BLINKING,
                                    g_param_spec_boolean ("include-all-blinking",
                                                          NULL, NULL,
@@ -560,6 +569,7 @@ xfce_tasklist_init (XfceTasklist *tasklist)
   tasklist->n_monitors = 0;
   tasklist->all_monitors_geometry = NULL;
   tasklist->window_scrolling = TRUE;
+  tasklist->wrap_windows = FALSE;
   tasklist->all_blinking = TRUE;
   tasklist->middle_click = XFCE_TASKLIST_MIDDLE_CLICK_DEFAULT;
   xfce_tasklist_geometry_set_invalid (tasklist);
@@ -648,6 +658,10 @@ xfce_tasklist_get_property (GObject    *object,
       g_value_set_boolean (value, tasklist->window_scrolling);
       break;
 
+    case PROP_WRAP_WINDOWS:
+      g_value_set_boolean (value, tasklist->wrap_windows);
+      break;
+
     case PROP_INCLUDE_ALL_BLINKING:
       g_value_set_boolean (value, tasklist->all_blinking);
       break;
@@ -726,6 +740,10 @@ xfce_tasklist_set_property (GObject      *object,
       tasklist->window_scrolling = g_value_get_boolean (value);
       break;
 
+    case PROP_WRAP_WINDOWS:
+      tasklist->wrap_windows = g_value_get_boolean (value);
+      break;
+
     case PROP_INCLUDE_ALL_BLINKING:
       tasklist->all_blinking = g_value_get_boolean (value);
       break;
@@ -1261,7 +1279,7 @@ xfce_tasklist_scroll_event (GtkWidget      *widget,
         }
 
       /* wrap if the first button is reached */
-      lnew = lnew ? lnew : g_list_last (li);
+      lnew = (lnew == NULL && tasklist->wrap_windows) ? g_list_last (li) : lnew;
       break;
 
     case GDK_SCROLL_DOWN:
@@ -1275,7 +1293,7 @@ xfce_tasklist_scroll_event (GtkWidget      *widget,
         }
 
       /* wrap if the last button is reached */
-      lnew = lnew ? lnew : g_list_first (li);
+      lnew = (lnew == NULL && tasklist->wrap_windows) ? g_list_first (li) : lnew;
       break;
 
     case GDK_SCROLL_LEFT:
@@ -1287,7 +1305,7 @@ xfce_tasklist_scroll_event (GtkWidget      *widget,
       break;
     }
 
-  if (G_LIKELY(lnew != NULL))
+  if (lnew != NULL)
     xfce_tasklist_button_activate (lnew->data, event->time);
 
   return TRUE;
diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c
index 49ab894..fdea304 100644
--- a/plugins/tasklist/tasklist.c
+++ b/plugins/tasklist/tasklist.c
@@ -140,6 +140,7 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
     { "show-handle", G_TYPE_BOOLEAN },
     { "sort-order", G_TYPE_UINT },
     { "window-scrolling", G_TYPE_BOOLEAN },
+    { "wrap-windows", G_TYPE_BOOLEAN },
     { "include-all-blinking", G_TYPE_BOOLEAN },
     { "middle-click", G_TYPE_UINT },
     { NULL }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list