cwm: keep pointer within window on maximize/fullscreen toggle

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

cwm: keep pointer within window on maximize/fullscreen toggle

Klemens Nanni-2
This scratch has been itching me for far too long and concerns the
funcionality behind those cwm(1) default bindings:

           CM-f            Toggle full-screen mode of current window.
           CM-m            Toggle maximization of current window.
           CM-equal        Toggle vertical maximization of current window.
           CMS-equal       Toggle horizontal maximization of current window.

Spawn a window, maximize it in any way, move the cursor to a window
border that is not on the screen's edge and unmaximize again...

While the window goes back the cursor stays at the screen's edge, i.e.
focus is lost to the underlaying window.

Moving, resizing, tiling or snapping windows in any way always moves the
cursor along iff needed, e.g. using

           MS-[hjkl]       Move window by a large amount; see cwmrc(5).

to move a small window from the center to the edge keeps the cursor
within window borders -- no matter what you do with the keyboard, focus
stays on that window.

Diff below does the same when toggling maximize/fullscreen.

Feedback? OK?



Index: client.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.263
diff -u -p -r1.263 client.c
--- client.c 16 Apr 2020 13:32:35 -0000 1.263
+++ client.c 8 Apr 2021 01:18:56 -0000
@@ -336,6 +336,7 @@ client_toggle_fullscreen(struct client_c
 resize:
  client_resize(cc, 0);
  xu_ewmh_set_net_wm_state(cc);
+ client_ptr_inbound(cc, 1);
 }
 
 void
@@ -376,6 +377,7 @@ client_toggle_maximize(struct client_ctx
 resize:
  client_resize(cc, 0);
  xu_ewmh_set_net_wm_state(cc);
+ client_ptr_inbound(cc, 1);
 }
 
 void
@@ -408,6 +410,7 @@ client_toggle_vmaximize(struct client_ct
 resize:
  client_resize(cc, 0);
  xu_ewmh_set_net_wm_state(cc);
+ client_ptr_inbound(cc, 1);
 }
 
 void
@@ -440,6 +443,7 @@ client_toggle_hmaximize(struct client_ct
 resize:
  client_resize(cc, 0);
  xu_ewmh_set_net_wm_state(cc);
+ client_ptr_inbound(cc, 1);
 }
 
 void

Reply | Threaded
Open this post in threaded view
|

Re: cwm: keep pointer within window on maximize/fullscreen toggle

Kurt Mosiejczuk-9
On Thu, Apr 08, 2021 at 03:35:33AM +0200, Klemens Nanni wrote:
> This scratch has been itching me for far too long and concerns the
> funcionality behind those cwm(1) default bindings:

This fixes one of the few problems I have with cwm. Works well for me.

ok kmos

--Kurt

>            CM-f            Toggle full-screen mode of current window.
>            CM-m            Toggle maximization of current window.
>            CM-equal        Toggle vertical maximization of current window.
>            CMS-equal       Toggle horizontal maximization of current window.
>
> Spawn a window, maximize it in any way, move the cursor to a window
> border that is not on the screen's edge and unmaximize again...
>
> While the window goes back the cursor stays at the screen's edge, i.e.
> focus is lost to the underlaying window.
>
> Moving, resizing, tiling or snapping windows in any way always moves the
> cursor along iff needed, e.g. using
>
>            MS-[hjkl]       Move window by a large amount; see cwmrc(5).
>
> to move a small window from the center to the edge keeps the cursor
> within window borders -- no matter what you do with the keyboard, focus
> stays on that window.
>
> Diff below does the same when toggling maximize/fullscreen.
>
> Feedback? OK?
>
>
>
> Index: client.c
> ===================================================================
> RCS file: /cvs/xenocara/app/cwm/client.c,v
> retrieving revision 1.263
> diff -u -p -r1.263 client.c
> --- client.c 16 Apr 2020 13:32:35 -0000 1.263
> +++ client.c 8 Apr 2021 01:18:56 -0000
> @@ -336,6 +336,7 @@ client_toggle_fullscreen(struct client_c
>  resize:
>   client_resize(cc, 0);
>   xu_ewmh_set_net_wm_state(cc);
> + client_ptr_inbound(cc, 1);
>  }
>  
>  void
> @@ -376,6 +377,7 @@ client_toggle_maximize(struct client_ctx
>  resize:
>   client_resize(cc, 0);
>   xu_ewmh_set_net_wm_state(cc);
> + client_ptr_inbound(cc, 1);
>  }
>  
>  void
> @@ -408,6 +410,7 @@ client_toggle_vmaximize(struct client_ct
>  resize:
>   client_resize(cc, 0);
>   xu_ewmh_set_net_wm_state(cc);
> + client_ptr_inbound(cc, 1);
>  }
>  
>  void
> @@ -440,6 +443,7 @@ client_toggle_hmaximize(struct client_ct
>  resize:
>   client_resize(cc, 0);
>   xu_ewmh_set_net_wm_state(cc);
> + client_ptr_inbound(cc, 1);
>  }
>  
>  void
>

Reply | Threaded
Open this post in threaded view
|

Re: cwm: keep pointer within window on maximize/fullscreen toggle

Okan Demirmen
In reply to this post by Klemens Nanni-2
On Thu 2021.04.08 at 03:35 +0200, Klemens Nanni wrote:

> This scratch has been itching me for far too long and concerns the
> funcionality behind those cwm(1) default bindings:
>
>            CM-f            Toggle full-screen mode of current window.
>            CM-m            Toggle maximization of current window.
>            CM-equal        Toggle vertical maximization of current window.
>            CMS-equal       Toggle horizontal maximization of current window.
>
> Spawn a window, maximize it in any way, move the cursor to a window
> border that is not on the screen's edge and unmaximize again...
>
> While the window goes back the cursor stays at the screen's edge, i.e.
> focus is lost to the underlaying window.

Interestingly this has been proposed before but got opposition as most
things do that changes one's expectation of behavior. Personally, I
dislike anything that moves my pointer for me, including the pointer
warps mentioned below (though that's less surprising). I've been against
creating tons of buttons for these behaviors too, so maybe that's on me.

Changing focus mechanics is likely the best way to approach this, though
you will run into behavior changes when cwm is supposed to act like
classic cwm or dwm or some mix in-between - it's got too many "modes"
(and "half modes") (and not enough buttons to be everything at once).

If this is a behavior change everyone agrees to, okay with me; else I'm
tired of the personal emails complaining about every minut change (thus
my general silence as of late, or longer now!).

> Moving, resizing, tiling or snapping windows in any way always moves the
> cursor along iff needed, e.g. using
>
>            MS-[hjkl]       Move window by a large amount; see cwmrc(5).
>
> to move a small window from the center to the edge keeps the cursor
> within window borders -- no matter what you do with the keyboard, focus
> stays on that window.
>
> Diff below does the same when toggling maximize/fullscreen.
>
> Feedback? OK?

diff-wise, ok.

> Index: client.c
> ===================================================================
> RCS file: /cvs/xenocara/app/cwm/client.c,v
> retrieving revision 1.263
> diff -u -p -r1.263 client.c
> --- client.c 16 Apr 2020 13:32:35 -0000 1.263
> +++ client.c 8 Apr 2021 01:18:56 -0000
> @@ -336,6 +336,7 @@ client_toggle_fullscreen(struct client_c
>  resize:
>   client_resize(cc, 0);
>   xu_ewmh_set_net_wm_state(cc);
> + client_ptr_inbound(cc, 1);
>  }
>  
>  void
> @@ -376,6 +377,7 @@ client_toggle_maximize(struct client_ctx
>  resize:
>   client_resize(cc, 0);
>   xu_ewmh_set_net_wm_state(cc);
> + client_ptr_inbound(cc, 1);
>  }
>  
>  void
> @@ -408,6 +410,7 @@ client_toggle_vmaximize(struct client_ct
>  resize:
>   client_resize(cc, 0);
>   xu_ewmh_set_net_wm_state(cc);
> + client_ptr_inbound(cc, 1);
>  }
>  
>  void
> @@ -440,6 +443,7 @@ client_toggle_hmaximize(struct client_ct
>  resize:
>   client_resize(cc, 0);
>   xu_ewmh_set_net_wm_state(cc);
> + client_ptr_inbound(cc, 1);
>  }
>  
>  void
>

Reply | Threaded
Open this post in threaded view
|

Re: cwm: keep pointer within window on maximize/fullscreen toggle

Dave Voutila-2
In reply to this post by Klemens Nanni-2

Klemens Nanni writes:

> This scratch has been itching me for far too long and concerns the
> funcionality behind those cwm(1) default bindings:
>
>            CM-f            Toggle full-screen mode of current window.
>            CM-m            Toggle maximization of current window.
>            CM-equal        Toggle vertical maximization of current window.
>            CMS-equal       Toggle horizontal maximization of current window.
>
> Spawn a window, maximize it in any way, move the cursor to a window
> border that is not on the screen's edge and unmaximize again...
>
> While the window goes back the cursor stays at the screen's edge, i.e.
> focus is lost to the underlaying window.
>
> Moving, resizing, tiling or snapping windows in any way always moves the
> cursor along iff needed, e.g. using
>
>            MS-[hjkl]       Move window by a large amount; see cwmrc(5).
>
> to move a small window from the center to the edge keeps the cursor
> within window borders -- no matter what you do with the keyboard, focus
> stays on that window.
>
> Diff below does the same when toggling maximize/fullscreen.
>
> Feedback? OK?
>

Solves a minor annoyance I have when I launch some apps and maximize or
minimize then. It's minor, but I like this change for my workflow.

OK dv@ on the diff, but I can understand pointer-moving controversy.