I needed a way to tell waether the pointer is on an edge or not, and since non of the current conditionals were able to do that I wrote my own. I also included an EdgeIsActive since I thought that could be useful too, and they were to have similar syntax.

Both are conditions to the Test command, and both take one direction argument. The direction argument can be any major direction or "Any" if no argument is given Any is assumed.

EdgeHasPoiner is true if the pointer is over the pan frame specified by direction, and EdgeIsActive is true if the panframe in the given direction is mapped.

/Viktor
Index: AUTHORS
===================================================================
RCS file: /home/cvs/fvwm/fvwm/AUTHORS,v
retrieving revision 1.103
diff -u -r1.103 AUTHORS
--- AUTHORS     29 Jun 2005 17:15:18 -0000      1.103
+++ AUTHORS     12 Aug 2005 22:33:30 -0000
@@ -4,6 +4,7 @@
 
 Viktor Griph:
 Patch for Perl modules on 64 bit machines.
+EdgeHasPointer and EdgeIsActive test conditions.
 
 Bjoern Steinbrink:
 Patch for FvwmScript tasks running too often.
Index: ChangeLog
===================================================================
RCS file: /home/cvs/fvwm/fvwm/ChangeLog,v
retrieving revision 1.2612
diff -u -r1.2612 ChangeLog
--- ChangeLog   12 Aug 2005 15:50:38 -0000      1.2612
+++ ChangeLog   12 Aug 2005 22:33:32 -0000
@@ -1,3 +1,9 @@
+2005-08-13  Viktor Griph  <[EMAIL PROTECTED]>
+
+       * fvwm/conditional.c (CMD_Test):
+       * fvwm/fvwm.1.in: 
+       added test conditions EdgeHasPointer and EdgeIsActive
+
 2005-08-12  Dominik Vogt  <[EMAIL PROTECTED]>
 
        * fvwm/virtual.c (raisePanFrames):
Index: NEWS
===================================================================
RCS file: /home/cvs/fvwm/fvwm/NEWS,v
retrieving revision 1.565
diff -u -r1.565 NEWS
--- NEWS        12 Aug 2005 16:12:54 -0000      1.565
+++ NEWS        12 Aug 2005 22:33:32 -0000
@@ -8,7 +8,8 @@
 * New features:
 
    - Fvwm now officially supports 64-bit architertures.
-   - New Test conditions IsEnvSet and MatchEnv.
+   - New Test conditions IsEnvSet, MatchEnv, EdgeHasPointer
+     and EdgeIsActive..
 
 * New module features:
 
Index: fvwm/conditional.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/conditional.c,v
retrieving revision 1.105
diff -u -r1.105 conditional.c
--- fvwm/conditional.c  12 Aug 2005 11:39:58 -0000      1.105
+++ fvwm/conditional.c  12 Aug 2005 22:33:32 -0000
@@ -47,6 +47,7 @@
 #include "stack.h"
 #include "commands.h"
 #include "decorations.h"
+#include "virtual.h"
 
 /* ---------------------------- local definitions -------------------------- */
 
@@ -1913,6 +1914,113 @@
                                error = 1;
                        }
                }
+               else if (StrEquals(cond, "EdgeIsActive"))
+               {                 
+                       direction_t dir= DIR_NONE;
+                       char *dirname;
+                       char *next;
+                       next = GetNextSimpleOption(flags_ptr, &dirname);
+                       if (dirname)
+                       {
+                               dir = gravity_parse_dir_argument(dirname, 
+                                       NULL, DIR_NONE);
+                               if (dir == DIR_NONE)
+                               {
+                                               if (!StrEquals(dirname, "Any"))
+                                       {
+                                               next = flags_ptr;
+                                       }
+                               }                               
+                               else if (dir > DIR_MAJOR_MASK)
+                               {
+                                       error = 1;
+                               }
+                               free(dirname);
+                       }
+
+                       if (!error)
+                       {
+                               if (((dir == DIR_W || dir == DIR_NONE) &&
+                                       Scr.PanFrameLeft.isMapped) || 
+                                   ((dir == DIR_N || dir == DIR_NONE) &&
+                                       Scr.PanFrameTop.isMapped) ||
+                                   ((dir == DIR_S || dir == DIR_NONE) &&
+                                       Scr.PanFrameBottom.isMapped) ||
+                                   ((dir == DIR_E || dir == DIR_NONE) &&
+                                       Scr.PanFrameRight.isMapped))
+                               {
+                                       match = 1;
+                               }                       
+                               else
+                               {
+                                       match = 0;
+                               }
+                       }
+                       flags_ptr = next;
+               }
+               else if (StrEquals(cond, "EdgeHasPointer"))
+               {
+                       int x,y;
+                       Window win;
+                       direction_t dir = DIR_NONE;
+                       char *dirname;
+                       char *next;
+                       next = GetNextSimpleOption(flags_ptr, &dirname);
+                       if (dirname)
+                       {
+                               dir = gravity_parse_dir_argument(dirname, 
+                                       NULL, DIR_NONE);
+                               if (dir == DIR_NONE)
+                               {
+                                               if (!StrEquals(dirname, "Any"))
+                                       {
+                                               next = flags_ptr;
+                                       }
+                               }                               
+                               else if (dir > DIR_MAJOR_MASK)
+                               {
+                                       error = 1;
+                               }
+                               free(dirname);
+                       }
+
+                       if (!error)
+                       {
+                               if (FQueryPointer(
+                                       dpy, Scr.Root, &JunkRoot, &win, 
+                                       &JunkX, &JunkY, &x, &y, &JunkMask)
+                                       == False)
+                               {
+                                       /* pointer is on a different screen */
+                                       match = 0;
+                               }
+                               else if (is_pan_frame(win))
+                               {
+                                       if (dir == DIR_NONE || 
+                                           (dir == DIR_N && 
+                                            win == Scr.PanFrameTop.win) ||
+                                           (dir == DIR_S && 
+                                            win == Scr.PanFrameBottom.win) ||
+                                           (dir == DIR_E && 
+                                            win == Scr.PanFrameRight.win) ||
+                                           (dir == DIR_W && 
+                                            win == Scr.PanFrameLeft.win))
+                                           
+                                       {
+                                               match = 1;
+                                       }                               
+                                       else 
+                                       {
+                                               match = 0;
+                                       }
+                               }
+                               else
+                               {
+                                       match = 0;
+                               }
+                       }
+                       flags_ptr = next;
+               }
                else
                {
                        /* unrecognized condition */
Index: fvwm/fvwm.1.in
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/fvwm.1.in,v
retrieving revision 1.168
diff -u -r1.168 fvwm.1.in
--- fvwm/fvwm.1.in      12 Aug 2005 11:39:59 -0000      1.168
+++ fvwm/fvwm.1.in      12 Aug 2005 22:33:33 -0000
@@ -10348,6 +10374,8 @@
 .IR "Version operator x.y.z" ,
 .IR "IsEnvSet varname" ,
 .IR "MatchEnv varname pattern" ,
+.IR "EdgeHasPointer direction" ,
+.IR "EdgeIsActive direction" ,
 .IR Start ,
 .IR Init ,
 .IR Restart ,
@@ -10390,7 +10418,23 @@
 test-condition is true if the environment variable value matches
 the pattern that may include special "*" and "?" chars.
 
+The 
+.IB "EdgeHasPointer " [ direction ]
+test-condition is true if the edge in the given direction currently
+contains the pointer. 
+The 
+.IB "EdgeIsActive " [ direction ]
+test-condition is true if the edge in the given direction currently is
+active. An edge is active, and can contain a pointer if either a
+command is bound to it or edge scroll is available in that
+direction. The direction may be one of
+.IR " Any", " North", " Top", " Up", " West", " Left", " South", " Bottom", 
+.IR " Down", " Right" and " East" .
+If no direction is specified
+.I Any
+is assumed.
+
 The
 .I Start
 test-condition is the same as either

Reply via email to