Subject: patch - new build-in command EdgeCommand

From: Uwe Pross <[email-masked]>
Date: Mon, 8 Apr 2002 15:33:11 +0200

Hi there,

I wrote a small patch which provides a  new  build-in  command  called
EdgeCommand.  Here  is  the  new  paragraph from the patched fvwm2 man
page. 

EdgeCommand [all|top|bottom|left|right [Function]]
              Binds  a  specified fvwm built-in function Function
              to an edge of the screen.  If Function  is  omitted
              the  binding  for this edge is removed. If EdgeCom
              mand is called without any argument all edge  bind
              ings are removed.

              The  binding gets active means Function is executed
              when the mouse pointer hits the specified edge. The
              binding  works  only  if  EdgeThickness is set to a
              value greater than 0. If a function is bound to  an
              edge  scrolling specified by EdgeScroll is disabled
              for this edge. It is possible to  bind  a  function
              only  to  some  edges  and  use the other edges for
              scrolling. The command  is  intended  to  raise  or
              lower  certain  windows if the mouse pointer hits a
              certain edge.  FvwmAuto can be  used  get  a  delay
              when  raising  or  lowering  windows.

Entries in ChangeLog are provided.

Uwe 
-- 
+----------------------------------------------
| Uwe Pross
| mail : mailto:[email-masked]
| www  : http://www.tu-chemnitz.de/~uwp
+----------------------------------------------

Have a nice day ;-).

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

---

From: Dan Espen <[email-masked]>
Date: Mon, 08 Apr 2002 09:47:42 -0400

>               when  raising  or  lowering  windows.

If someone were to read this, I think they'd be left with the
impression that these edges are on all 4 edges of the display.

These edges are only on the screen edges that are next to virtual
pages.

If this was used for raising and lowering windows, I think the
missing edges might cause a problem.

-- 
Dan Espen                           E-mail: [email-masked]
444 Hoes Lane  Room RRC 1C-214      Phone: (732) 699-5570
Piscataway, NJ 08854
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Uwe Pross <[email-masked]>
Date: Mon, 8 Apr 2002 17:58:23 +0200

> missing edges might cause a problem.

I adapted the checkPanFrames() function that if a command is bound  to
a  pan frame window it is always on the screen. If there is no command
bound to an edge, the virtual desk behaviour is done for this edge. So
if  one  uses  the  EdgeCommand  to bind a function to an edge the pan
frame window of this edge is always on the screen  an  will  never  be
hidden. 
 
If there is an event in one of the pan  frame  windows,  first  it  is
checked  if  a  command  is bound to this window. If so the command is
executed - if  not  the  HandlePaging()  function  which  handles  the
edge-scrolling is called. 

I did it in that way since the  patch  sould  not  touch  the  current
behaviour of the edges if EdgeCommand is not used. 
 
Uwe

Have a nice day ;-).

---

From: Dan Espen <[email-masked]>
Date: Mon, 08 Apr 2002 13:41:33 -0400

> > impression that these edges are on all 4 edges of the display.
...
> a  pan frame window it is always on the screen.

OK, good.

I think safestrdup does what the new duplicateString does.

The east/west stuff and the 1 letter abbreviations aren't
documented.  You could removed the east/west stuff, I don't
think its needed.

I think there should be some mention of the additional frames
when the commands are used.

The FvwmAuto man page refers to an example in the fvwm2 man
page, but I couldn't find an example.

The function StrEquals can be used for doing compares without
worring about case.

I haven't applied the patch, I just reviewed it.

---

From: Uwe Pross <[email-masked]>
Date: Mon, 8 Apr 2002 21:56:35 +0200

> I think safestrdup does what the new duplicateString does.

Done. I have duplicateString removed and use safestrdup instead. 

> documented.  You could removed the east/west stuff, I don't

This has been taken from the new function  
direction_type ParseDirectionArgument(..) 
from libs/gravity.c. Where the directions are "N", "North", "Top",
"Up", ... 

> when the commands are used.

What additional frames? The existing  pan  frame  windows  were  used.
Normally  without the EdgeCommand the pan frames which are on the egde
of the virtual desk were hidden. If  an  EgdeCommand  is  active  this
hidding is just avoided. 

> page, but I couldn't find an example.

I haven't included it in my first posting but it should be in the man
page.  

> The function StrEquals can be used for doing compares without

I have rewritten the function void CMD_EdgeCommand(F_CMD_ARGS) so that
the  new  function ParseDirectionArgument(..) is used. So I don't need
to worry about cases or left, west, w, .... The  "all"  direction  has
been  removed.  First I thought it might be a good idea but I think it
is not neccessary. Man page and ChangeLog has been adapted. 

Uwe

Have a nice day ;-).

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 9 Apr 2002 11:23:37 +0200

> documented.  You could removed the east/west stuff, I don't

I still have to document the possible values of the direction
options.  It's just code from the ParseDirectionArgument()
function.

> I haven't applied the patch, I just reviewed it.

If you think the patch is good, please apply it.  I've a backlog
of 150 mails, so it could take some time before I get to do it.

Bye

Dominik ^_^  ^_^

-- 
Dominik Vogt, email: [email-masked]
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Uwe Pross <[email-masked]>
Date: Tue, 9 Apr 2002 12:54:56 +0200

> of 150 mails, so it could take some time before I get to do it.

After the reply from Dan I did some changes on the patch.  I  use  now
the  safestrdup()  function  and  ParseDirectionArgument(). So the new
patch will be smaller and clearer (maybe faster as well).  

After this has done I had some problems while updating my  cvs  copie.
The  command  "cvs  update"  simply stopped or hung up. So I could not
create a new patch. 

Today I am going to try it again. If successful I will  send  the  new
patch to this mailing list. 

Uwe
-- 
+--------------------------------------------------
| Uwe Pross 
| mail : mailto:[email-masked]
| www  : http://www.tu-chemnitz.de/~uwp
+--------------------------------------------------
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Uwe Pross <[email-masked]>
Date: Tue, 9 Apr 2002 21:29:46 +0200

Hi,

here is the modified patch of EdgeCommand. As written before I changed
the  implementation  of  the function CMD_EdgeCommand and the man page
entry. The function duplicateString  has  been  removed  the  existing
function  safestrdup  is used instead. In the CMD_EdgeCommand function
there   is   no   parsing   done.   The   new   introduced    function
ParseDirectionArgument(..)  is used. This function can distinguish the
following directions strings:

...
char *optlist[] = {
                "N",  "North",     "Top",         "Up",
                "E",  "East",      "Right",       "Right",
                "S",  "South",     "Bottom",      "Down",
                "W",  "West",      "Left",        "Left",
                "NE", "NorthEast", "TopRight",    "UpRight",
                "SE", "SouthEast", "BottomRight", "DownRight",
                "SW", "SouthWest", "BottomLeft",  "DownLeft",
                "NW", "NorthWest", "TopLeft",     "UpLeft",
                NULL
        };
...

In the man page I have only documented the directions "North",  "Top",
"West",  "Left",  "South",  "Bottom",  "Right" and "East" but not "N",
"E", "S", "W", "Up", and "Down". The  later  are  not  documented  but
could  be  used. I did not want to produce to much overhead that's why
it is not documented. Maybe later there will be a section in  the  man
page  about  directions  in  general. Any other command which used the
ParseDirectionArgument(..) function could just refer to this section.

I have tested the reimplemented function again -  no  crashes  or  seg
faults.

Uwe

Have a nice day ;-).

---

From: Dan Espen <[email-masked]>
Date: Tue, 09 Apr 2002 15:37:22 -0400

Uwe Pross <[email-masked]> writes:
> Hi,
> 
> here is the modified patch of EdgeCommand.

It may take a little while, but I'll check it out.

---

From: Dan Espen <[email-masked]>
Date: Fri, 12 Apr 2002 18:20:50 -0400

> here is the modified patch of EdgeCommand.

With some minor adjustments I've applied your patch.

I noticed a coding style I never saw before:

+			if ( Scr.PanFrameTop.command != NULL ) 
+				free( Scr.PanFrameTop.command ) ;
+			Scr.PanFrameTop.command = command ; 

(the space before the semi-colon)

I removed the spaces.

A lot of the lines in the patch had trailing spaces
including the lines above.   I removed the trailing spaces.