Author: olivier
Date: 2007-03-03 21:36:01 +0000 (Sat, 03 Mar 2007)
New Revision: 25082

Modified:
   xfwm4/trunk/defaults/defaults
   xfwm4/trunk/mcs-plugin/wmtweaks_plugin.c
   xfwm4/trunk/src/client.c
   xfwm4/trunk/src/events.c
   xfwm4/trunk/src/settings.c
   xfwm4/trunk/src/settings.h
Log:
Add new wm tweak option to instruct xfwm4 not to bring window back on current 
workspace when activated (bug #2961)

Modified: xfwm4/trunk/defaults/defaults
===================================================================
--- xfwm4/trunk/defaults/defaults       2007-03-03 21:07:59 UTC (rev 25081)
+++ xfwm4/trunk/defaults/defaults       2007-03-03 21:36:01 UTC (rev 25082)
@@ -1,6 +1,7 @@
 borderless_maximize=true
 box_move=false
 box_resize=false
+bring_on_activate=true
 button_layout=OT|SHMC
 button_offset=0
 button_spacing=0

Modified: xfwm4/trunk/mcs-plugin/wmtweaks_plugin.c
===================================================================
--- xfwm4/trunk/mcs-plugin/wmtweaks_plugin.c    2007-03-03 21:07:59 UTC (rev 
25081)
+++ xfwm4/trunk/mcs-plugin/wmtweaks_plugin.c    2007-03-03 21:36:01 UTC (rev 
25082)
@@ -56,6 +56,7 @@
 static gboolean is_running = FALSE;
 
 static gboolean borderless_maximize = TRUE;
+static gboolean bring_on_activate = TRUE;
 static gboolean cycle_minimum = TRUE;
 static gboolean cycle_hidden = TRUE;
 static gboolean cycle_workspaces = FALSE;
@@ -84,6 +85,7 @@
 static char *easy_click = "Alt";
 /* 
     "Xfwm/BorderlessMaximize"
+    "Xfwm/BringOnActivate"
     "Xfwm/CycleHidden"
     "Xfwm/CycleMinimum"
     "Xfwm/CycleWorkspaces"
@@ -434,6 +436,12 @@
     gtk_widget_show (check_button);
 
     check_button =
+        create_gboolean_button (mcs_plugin, _("Bring window back on current 
workspace when activated"),
+        "Xfwm/BringOnActivate", &bring_on_activate);
+    gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, TRUE, 0);
+    gtk_widget_show (check_button);
+
+    check_button =
         create_gboolean_button (mcs_plugin, _("Honor the standard ICCCM focus 
hint"),
         "Xfwm/FocusHint", &focus_hint);
     gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, TRUE, 0);
@@ -748,6 +756,7 @@
     g_free (rcfile);
 
     init_gboolean_setting (mcs_plugin, "Xfwm/BorderlessMaximize", 
&borderless_maximize);
+    init_gboolean_setting (mcs_plugin, "Xfwm/BringOnActivate", 
&bring_on_activate);
     init_gboolean_setting (mcs_plugin, "Xfwm/CycleMinimum", &cycle_minimum);
     init_gboolean_setting (mcs_plugin, "Xfwm/CycleHidden", &cycle_hidden);
     init_gboolean_setting (mcs_plugin, "Xfwm/CycleWorkspaces", 
&cycle_workspaces);

Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c    2007-03-03 21:07:59 UTC (rev 25081)
+++ xfwm4/trunk/src/client.c    2007-03-03 21:36:01 UTC (rev 25082)
@@ -2582,11 +2582,20 @@
     TRACE ("entering clientActivate \"%s\" (0x%lx)", c->name, c->window);
 
     screen_info = c->screen_info;
-    clientSetWorkspace (c, screen_info->current_ws, TRUE);
-    clientShow (c, TRUE);
-    clientClearAllShowDesktop (screen_info);
-    clientSetFocus (screen_info, c, timestamp, NO_FOCUS_FLAG);
-    clientRaise (c, None);
+    if ((screen_info->current_ws == c->win_workspace) || 
(screen_info->params->bring_on_activate))
+    {
+        clientSetWorkspace (c, screen_info->current_ws, TRUE);
+        clientShow (c, TRUE);
+        clientClearAllShowDesktop (screen_info);
+        clientSetFocus (screen_info, c, timestamp, NO_FOCUS_FLAG);
+        clientRaise (c, None);
+    }
+    else
+    {
+        TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", 
c->name, c->window); 
+        FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
+        clientSetNetState (c);
+    }
 }
 
 void

Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c    2007-03-03 21:07:59 UTC (rev 25081)
+++ xfwm4/trunk/src/events.c    2007-03-03 21:36:01 UTC (rev 25082)
@@ -1444,7 +1444,7 @@
             last_raised = clientGetLastRaise (screen_info);
             if (last_raised && (c != last_raised))
             {
-                if (screen_info->params->prevent_focus_stealing)
+                if ((screen_info->params->prevent_focus_stealing) && 
!(screen_info->params->bring_on_activate))
                 {
                     ev->value_mask &= ~(CWSibling | CWStackMode);
                     TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" 
(0x%lx)", c->name, c->window); 

Modified: xfwm4/trunk/src/settings.c
===================================================================
--- xfwm4/trunk/src/settings.c  2007-03-03 21:07:59 UTC (rev 25081)
+++ xfwm4/trunk/src/settings.c  2007-03-03 21:36:01 UTC (rev 25082)
@@ -364,6 +364,10 @@
                         screen_info->params->borderless_maximize = 
setting->data.v_int;
                         reloadScreenSettings (screen_info, UPDATE_MAXIMIZE);
                     }
+                    else if (!strcmp (name, "Xfwm/BringOnActivate"))
+                    {
+                        screen_info->params->bring_on_activate = 
setting->data.v_int;
+                    }
                     else if (!strcmp (name, "Xfwm/CycleMinimum"))
                     {
                         screen_info->params->cycle_minimum = 
setting->data.v_int;
@@ -731,6 +735,12 @@
             setBooleanValueFromInt ("borderless_maximize", 
setting->data.v_int, rc);
             mcs_setting_free (setting);
         }
+        if (mcs_client_get_setting (screen_info->mcs_client, 
"Xfwm/BringOnActivate", CHANNEL5,
+                &setting) == MCS_SUCCESS)
+        {
+            setBooleanValueFromInt ("bring_on_activate", setting->data.v_int, 
rc);
+            mcs_setting_free (setting);
+        }
         if (mcs_client_get_setting (screen_info->mcs_client, 
"Xfwm/CycleMinimum", CHANNEL5,
                 &setting) == MCS_SUCCESS)
         {
@@ -1304,6 +1314,7 @@
         {"borderless_maximize", NULL, TRUE},
         {"box_move", NULL, TRUE},
         {"box_resize", NULL, TRUE},
+        {"bring_on_activate", NULL, TRUE},
         {"button_layout", NULL, TRUE},
         {"button_offset", NULL, TRUE},
         {"button_spacing", NULL, TRUE},
@@ -1447,6 +1458,8 @@
         !g_ascii_strcasecmp ("true", getValue ("box_resize", rc));
     screen_info->params->box_move =
         !g_ascii_strcasecmp ("true", getValue ("box_move", rc));
+    screen_info->params->bring_on_activate =
+        !g_ascii_strcasecmp ("true", getValue ("bring_on_activate", rc));
     screen_info->params->click_to_focus =
         !g_ascii_strcasecmp ("true", getValue ("click_to_focus", rc));
     screen_info->params->cycle_minimum =

Modified: xfwm4/trunk/src/settings.h
===================================================================
--- xfwm4/trunk/src/settings.h  2007-03-03 21:07:59 UTC (rev 25081)
+++ xfwm4/trunk/src/settings.h  2007-03-03 21:36:01 UTC (rev 25082)
@@ -197,6 +197,7 @@
     gboolean borderless_maximize;
     gboolean box_move;
     gboolean box_resize;
+    gboolean bring_on_activate;
     gboolean click_to_focus;
     gboolean cycle_hidden;
     gboolean cycle_minimum;

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to