[patch] xfwm4 cycle desktop number

Joseph E. O'Doherty joeyo at phy.ucsf.edu
Tue Apr 29 03:43:38 CEST 2014


Hi,

I use xfce on a multi-monitor system as part of an apparatus for displaying
visual stimuli to experimental subjects (one monitor is for the subject;
the other for the experimenter). Since the window cycling "alt tab" window
occludes the display on all monitors, it can interfere with a running
experiment. I've implemented a simple patch (below) for configuring which
monitor receives the modal window via an Xfconf property:
"cycle_desktop_number". A value of -1 enables the current behavior (all
monitors). Hopefully someone else will find this useful too.

Thanks for making a great desktop environment,
/joeyo

diff --git a/xfwm4-4.10.0_orig/src/settings.c b/xfwm4-4.10.0/src/settings.c
index 607bb7b..729897c 100644
--- a/xfwm4-4.10.0_orig/src/settings.c
+++ b/xfwm4-4.10.0/src/settings.c
@@ -679,6 +679,7 @@ loadSettings (ScreenInfo *screen_info)
         {"cycle_hidden", NULL, G_TYPE_BOOLEAN, TRUE},
         {"cycle_minimum", NULL, G_TYPE_BOOLEAN, TRUE},
         {"cycle_workspaces", NULL, G_TYPE_BOOLEAN, TRUE},
+        {"cycle_desktop_number", NULL, G_TYPE_INT, TRUE},
         {"double_click_time", NULL, G_TYPE_INT, TRUE},
         {"double_click_distance", NULL, G_TYPE_INT, TRUE},
         {"double_click_action", NULL, G_TYPE_STRING, TRUE},
@@ -769,6 +770,8 @@ loadSettings (ScreenInfo *screen_info)
         getBoolValue ("cycle_hidden", rc);
     screen_info->params->cycle_workspaces =
         getBoolValue ("cycle_workspaces", rc);
+    screen_info->params->cycle_desktop_number =
+       getIntValue ("cycle_desktop_number", rc);
     screen_info->params->focus_hint =
         getBoolValue ("focus_hint", rc);
     screen_info->params->focus_new =
@@ -1183,6 +1186,11 @@ cb_xfwm4_channel_property_changed(XfconfChannel
*channel, const gchar *property_
                 {
                     screen_info->params->placement_ratio = CLAMP
(g_value_get_int(value), 0, 100);
                 }
+               else if (!strcmp (name, "cycle_desktop_number"))
+                {
+                    screen_info->params->cycle_desktop_number = CLAMP
(g_value_get_int(value), -1, 10);
+                }
+
                 else if ((!strcmp (name, "button_offset"))
                       || (!strcmp (name, "button_spacing"))
                       || (!strcmp (name, "double_click_time"))
diff --git a/xfwm4-4.10.0_orig/src/settings.h b/xfwm4-4.10.0/src/settings.h
index be01b6b..e51f585 100644
--- a/xfwm4-4.10.0_orig/src/settings.h
+++ b/xfwm4-4.10.0/src/settings.h
@@ -205,6 +205,7 @@ struct _XfwmParams
     gboolean cycle_hidden;
     gboolean cycle_minimum;
     gboolean cycle_workspaces;
+    int cycle_desktop_number;
     gboolean focus_hint;
     gboolean focus_new;
     gboolean full_width_title;
diff --git a/xfwm4-4.10.0_orig/src/tabwin.c b/xfwm4-4.10.0/src/tabwin.c
index c130418..db6f3a3 100644
--- a/xfwm4-4.10.0_orig/src/tabwin.c
+++ b/xfwm4-4.10.0/src/tabwin.c
@@ -479,6 +479,7 @@ tabwinCreate (GList **client_list, GList *selected,
gboolean display_workspace)
     Client *c;
     Tabwin *tabwin;
     int num_monitors, i;
+    int cycle_desktop_number;

     g_return_val_if_fail (selected, NULL);
     g_return_val_if_fail (client_list, NULL);
@@ -493,12 +494,16 @@ tabwinCreate (GList **client_list, GList *selected,
gboolean display_workspace)
     tabwin->selected = selected;
     tabwin->tabwin_list = NULL;
     num_monitors = myScreenGetNumMonitors (screen_info);
+    cycle_desktop_number = screen_info->params->cycle_desktop_number;
     for (i = 0; i < num_monitors; i++)
     {
-        gint monitor_index;
+       if (cycle_desktop_number == -1 || cycle_desktop_number == i)
+       {
+            gint monitor_index;

-        monitor_index = myScreenGetMonitorIndex(screen_info, i);
-        tabwin->tabwin_list  = g_list_append (tabwin->tabwin_list,
tabwinCreateWidget (tabwin, screen_info, monitor_index));
+            monitor_index = myScreenGetMonitorIndex(screen_info, i);
+            tabwin->tabwin_list  = g_list_append (tabwin->tabwin_list,
tabwinCreateWidget (tabwin, screen_info, monitor_index));
+        }
     }

     return tabwin;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.xfce.org/pipermail/xfce4-dev/attachments/20140428/2e2ed1cb/attachment.html>


More information about the Xfce4-dev mailing list