[cvs.lp.se #6] The DontMoveOff patch

From: Richard Levitte via RT (ctwm-bugs@free.lp.se)
Date: Fri Feb 28 2003 - 17:16:19 CET


I checked the effect before and after, and I agree with the patch. Applied and committed.

This ticket is now resolved.

> More info about this patch: http://www.cis.upenn.edu/~bjornk/ctwm/
>
> To apply this patch:
>
> 1) cd to your CTWM source directory and
> 2) Run 'patch -l -p3 < path_to_this_file'
> 3) Run 'make install'
>
> DontMoveOff patch:
> ------------------
> I did however change the behavior of DontMoveOff/MoveOffResistance.
> Currently the behavior of CTWM if you have set DontMoveOff and set a
> MoveOffResistance is to prevent the window from being moved off until
> you have moved the window #MoveOffResistance pixels outside the
> screen, at which time the window snaps to the position it "should" be
> in had DontMoveOff not been defined. What this means is that if you
> have set a MoveOffResistance to 25, no part of the window can be moved
> off the screen less than 25 pixels.
>
> I find that often when I want to move a window partially off-screen, I
> only want to move it a little bit off the screen, but to accomplish
> this I often end up using force move.
>
> My patch below changes the behavior of DontMoveOff/MoveOffResistance
> so that when you attempt to move a window off screen, it will not move
> at all until it's been moved #MoveOffResistance pixels (as before),
> but at this time it will no longer "snap", but instead it will start
> moving off screen. This means that you still have the old behavior of
> DontMoveOff, but now with the ability to move a window off screen less
> that #MoveOffResistance pixels.
>
> If I find the time over the holidays I'll try to implement similar
> functionality for MovePack.
>
> (I noticed some code in workmgr.c that also seemed to make use of the
> MoveOffResistance, but I didn't change that. I assume that this code
> is for moving windows from within the workspacemanager. I didn't touch
> this code.)
>
> -------------------
> Bjorn Knutsson http://www.cis.upenn.edu/~bjornk/
>
> Patch against CTWM 3.6:
>
> diff -rwc /tmp/ctwm-3.6/util.c /usr/local/src/ctwm-3.6/util.c
> *** /tmp/ctwm-3.6/util.c 2001-12-11 10:38:52.000000000 -0500
> --- /usr/local/src/ctwm-3.6/util.c 2002-12-15 16:33:13.000000000 -0500
> ***************
> *** 64,69 ****
> --- 64,76 ----
> *
> * 22-April-92 Claude Lecommandeur.
> *
> + * Changed behavior of DontMoveOff/MoveOffResistance to allow
> + * moving a window off screen less than #MoveOffResistance pixels.
> + * New code will no longer "snap" windows to #MoveOffResistance
> + * pixels off screen and instead movements will just be stopped and
> + * then resume once movement of #MoveOffResistance have been attempted.
> + *
> + * 15-December-02 Bjorn Knutsson
> *
> ***********************************************************************/
>
> ***************
> *** 3972,3982 ****
> int *value;
> int border;
> {
> ! if (*value < border &&
> ! (Scr->MoveOffResistance < 0 ||
> ! *value > border - Scr->MoveOffResistance))
> {
> *value = border;
> }
> }
>
> --- 3979,3994 ----
> int *value;
> int border;
> {
> ! if (*value < border) {
> ! if (Scr->MoveOffResistance < 0 ||
> ! *value > border - Scr->MoveOffResistance)
> {
> *value = border;
> + } else if (Scr->MoveOffResistance > 0 &&
> + *value <= border - Scr->MoveOffResistance)
> + {
> + *value = *value + Scr->MoveOffResistance;
> + }
> }
> }
>
> ***************
> *** 3986,3996 ****
> int border;
> int size2;
> {
> ! if (*value + size1 > size2 - border &&
> ! (Scr->MoveOffResistance < 0 ||
> ! *value + size1 < size2 - border + Scr->MoveOffResistance))
> {
> *value = size2 - size1 - border;
> }
> }
>
> --- 3998,4012 ----
> int border;
> int size2;
> {
> ! if (*value + size1 > size2 - border) {
> ! if (Scr->MoveOffResistance < 0 ||
> ! *value + size1 < size2 - border + Scr->MoveOffResistance)
> {
> *value = size2 - size1 - border;
> + } else if (Scr->MoveOffResistance > 0 &&
> + *value + size1 >= size2 - border + Scr->MoveOffResistance) {
> + *value = *value - Scr->MoveOffResistance;
> + }
> }
> }
>



This archive was generated by hypermail 2.1.4 : Sat Mar 01 2003 - 06:45:04 CET