The following shows the diffstat and patchsets between
055b042..4701eec^
----------------------------------------------------------------
commit 4701eec50d810341f41d1cead6fc30b0188e7c7b
Author: Thomas Adam <tho...@fvwm.org>
Date:   Sun Dec 21 14:32:31 2014 +0000

    parsing:  Update ABNF to reflect BaseStruts/NumOfDesktops change
    
    Update the grammar of the EWMHBaseStrut/EWMHNumberOfDesktops command to 
reflect
    the change in grammar.
---
 rewrite-notes/parsing | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rewrite-notes/parsing b/rewrite-notes/parsing
index 8555c62..db6a4a7 100644
--- a/rewrite-notes/parsing
+++ b/rewrite-notes/parsing
@@ -900,9 +900,9 @@ EMULATEVAL =/ "Win"
 
 CMD_ESCAPEFUNC = "EscapeFunc"
 
-CMD_EWMHBASESTRUTS = "EwmhBaseStruts" INT INT INT INT
+CMD_EWMHBASESTRUTS = "EwmhBaseStruts" ["screen" XRANDRMONITORNAME] INT INT INT 
INT
 
-CMD_EWMHNUMBEROFDESKTOPS = "EwmhNumberOfDesktops" INT INT
+CMD_EWMHNUMBEROFDESKTOPS = "EwmhNumberOfDesktops" ["screen" XRANDRMONITORNAME] 
INT INT
 
 CMD_EXEC = "Exec" RESTOFLINE_COMMAND
 

commit bd88a7846b31b37205ad0f1b4b142d7b714c0887
Author: Thomas Adam <tho...@fvwm.org>
Date:   Sun Dec 21 14:29:25 2014 +0000

    EWMHBaseStruts/EWMHNumberOfDesktops: per-monitor
    
    Introduce helper functions, set_ewmhc_strut_values(), and
    ewmhc_desktop_values() which can set the per-monitor base struts.  Switch
    CMD_EwmhBaseStruts() and CMD_EwmhNumberOfDesktops() over to using them,
    respectively.
---
 mvwm/ewmh_conf.c | 131 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 100 insertions(+), 31 deletions(-)

diff --git a/mvwm/ewmh_conf.c b/mvwm/ewmh_conf.c
index e2359e7..dc7d8d1 100644
--- a/mvwm/ewmh_conf.c
+++ b/mvwm/ewmh_conf.c
@@ -39,6 +39,10 @@
 #include "ewmh_intern.h"
 #include "move_resize.h"
 
+/* Forward declarations */
+static void set_ewmhc_strut_values(struct monitor *, int *);
+static void set_ewmhc_desktop_values(struct monitor *, int, int *);
+
 /*
  * CMDS
  */
@@ -97,10 +101,24 @@ Bool EWMH_BugOpts(char *opt, Bool toggle)
 
 void CMD_EwmhNumberOfDesktops(F_CMD_ARGS)
 {
-       struct monitor  *m;
+       struct monitor  *m = NULL;
+       char *option;
        int val[2];
        int num;
 
+       option = PeekToken(action, NULL);
+       if (StrEquals(option, "screen")) {
+               /* Skip literal 'screen' */
+               option = PeekToken(action, &action);
+               /* Actually get the screen value. */
+               option = PeekToken(action, &action);
+
+               if ((m = monitor_by_name(option)) == NULL) {
+                       mvwm_msg(ERR, "CMD_EwmhNumberOfDesktops",
+                               "Invalid screen: %s", option);
+               }
+       }
+
        num = GetIntegerArguments(action, NULL, val, 2);
        if ((num != 1 && num != 2) || val[0] < 1 ||
            (num == 2 && val[1] < val[0] && val[1] != 0))
@@ -110,38 +128,42 @@ void CMD_EwmhNumberOfDesktops(F_CMD_ARGS)
                return;
        }
 
+       /* If m is still NULL, then no monitor was specified, therefore assume
+        * all monitors will be used.
+        */
+       if (m != NULL) {
+               set_ewmhc_desktop_values(m, num, val);
+               return;
+       }
+
        TAILQ_FOREACH(m, &monitor_q, entry) {
                if (monitor_should_ignore_global(m))
                        continue;
-               if (num == 2 && m->ewmhc.MaxDesktops != val[1])
-               {
-                       m->ewmhc.MaxDesktops = val[1];
-                       num = 3;
-               }
-               else if (num == 1 && m->ewmhc.MaxDesktops != 0)
-               {
-                       m->ewmhc.MaxDesktops = 0;
-                       num = 3;
-               }
 
-               if (m->ewmhc.NumberOfDesktops != val[0])
-               {
-                       m->ewmhc.NumberOfDesktops = val[0];
-                       num = 3;
-               }
-
-               if (num == 3)
-               {
-                       m->ewmhc.NeedsToCheckDesk = True;
-                       EWMH_SetNumberOfDesktops(m);
-               }
+               set_ewmhc_desktop_values(m, num, val);
        }
+
 }
 
 void CMD_EwmhBaseStruts(F_CMD_ARGS)
 {
+       struct monitor *m = NULL;
+       char *option;
        int val[4];
 
+       option = PeekToken(action, NULL);
+       if (StrEquals(option, "screen")) {
+               /* Skip literal 'screen' */
+               option = PeekToken(action, &action);
+               /* Actually get the screen value. */
+               option = PeekToken(action, &action);
+
+               if ((m = monitor_by_name(option)) == NULL) {
+                       mvwm_msg(ERR, "CMD_EwmhBaseStruts",
+                               "Invalid screen: %s", option);
+               }
+       }
+
        if (GetIntegerArguments(action, NULL, val, 4) != 4 ||
            val[0] < 0 || val[1] < 0 || val[2] < 0 || val[3] < 0)
        {
@@ -150,19 +172,66 @@ void CMD_EwmhBaseStruts(F_CMD_ARGS)
                return;
        }
 
-       if (ewmhc.BaseStrut.left != val[0] ||
-           ewmhc.BaseStrut.right != val[1] ||
-           ewmhc.BaseStrut.top != val[2] ||
-           ewmhc.BaseStrut.bottom != val[3])
+       /* If m is still NULL, then no monitor was specified, therefore assume
+        * all monitors will be used.
+        */
+       if (m != NULL) {
+               set_ewmhc_strut_values(m, val);
+               return;
+       }
+
+       TAILQ_FOREACH(m, &monitor_q, entry) {
+               if (monitor_should_ignore_global(m))
+                       continue;
+
+               set_ewmhc_strut_values(m, val);
+       }
+}
+
+static void
+set_ewmhc_desktop_values(struct monitor *m, int num, int *val)
+{
+       if (num == 2 && m->ewmhc.MaxDesktops != val[1])
        {
-               ewmhc.BaseStrut.left   = val[0];
-               ewmhc.BaseStrut.right  = val[1];
-               ewmhc.BaseStrut.top    = val[2];
-               ewmhc.BaseStrut.bottom = val[3];
+               m->ewmhc.MaxDesktops = val[1];
+               num = 3;
+       }
+       else if (num == 1 && m->ewmhc.MaxDesktops != 0)
+       {
+               m->ewmhc.MaxDesktops = 0;
+               num = 3;
+       }
 
-               EWMH_UpdateWorkArea();
+       if (m->ewmhc.NumberOfDesktops != val[0])
+       {
+               m->ewmhc.NumberOfDesktops = val[0];
+               num = 3;
+       }
+
+       if (num == 3)
+       {
+               m->ewmhc.NeedsToCheckDesk = True;
+               EWMH_SetNumberOfDesktops(m);
        }
 }
+
+static void
+set_ewmhc_strut_values(struct monitor *m, int *val)
+{
+       if (m->ewmhc.BaseStrut.left != val[0] ||
+           m->ewmhc.BaseStrut.right != val[1] ||
+           m->ewmhc.BaseStrut.top != val[2] ||
+           m->ewmhc.BaseStrut.bottom != val[3])
+       {
+               m->ewmhc.BaseStrut.left   = val[0];
+               m->ewmhc.BaseStrut.right  = val[1];
+               m->ewmhc.BaseStrut.top    = val[2];
+               m->ewmhc.BaseStrut.bottom = val[3];
+
+               EWMH_UpdateWorkArea(m);
+       }
+}
+
 /*
  * Styles
  */

----------------------------------------------------------------

Diffstat:

----------------------------------------------------------------
 mvwm/ewmh_conf.c      | 83 +++++++++++++++++++++++++++++++++++----------------
 rewrite-notes/parsing |  2 +-
 2 files changed, 58 insertions(+), 27 deletions(-)

----------------------------------------------------------------

Reply via email to