On Wed, 28 Sep 2016, Okan Demirmen wrote:

> Hi,
> 
> Curious what the reaction might be if I removed the little geometry
> window in the top-left corner for mouse/pointer based window resizes.

I don't know about anyone else, but I use this for one thing only:
making sure my terminal windows are still exactly 80 columns wide after
resizing them to be longer (or going back to 80 after making one wider
temporarily). Any other window I don't care about the exact size.

I suppose I could use stty and the keyboard resizing options if this
went away, but it seems more natural to move and resize windows with the
mouse.

> 
> We currently print the x/y dimensions only for mouse based actions; we
> don't for kbd, nor do we do anything with mouse/kbd window moves (such
> as printing the x/y coordinates, etc). So why have mouse-resize be
> different?  Thus, the below crudely removes it.
> 
> One reason to remove it is for simplicity; this is the only place we
> need to hold and carry around menuwin and a drawable. If we abused
> menuwin/drawable in other locations but the actual menu'ing subsystem,
> then ok. Alternatively, can create/destroy each time for a mouse-resize,
> but likely not worth it, maybe it should stay...

So make it display on movement too? I'm not sure how useful it is, but
it adds symmetry.

Martin

Index: mousefunc.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/mousefunc.c,v
retrieving revision 1.107
diff -u -p -r1.107 mousefunc.c
--- mousefunc.c 28 Sep 2016 17:06:33 -0000      1.107
+++ mousefunc.c 28 Sep 2016 18:33:12 -0000
@@ -32,16 +32,17 @@
 
 #include "calmwm.h"
 
-static void    mousefunc_sweep_draw(struct client_ctx *);
+static void    mousefunc_sweep_draw(struct client_ctx *, int move);
 
 static void
-mousefunc_sweep_draw(struct client_ctx *cc)
+mousefunc_sweep_draw(struct client_ctx *cc, int move)
 {
        struct screen_ctx       *sc = cc->sc;
        char                     s[14]; /* fits " nnnn x nnnn \0" */
        XGlyphInfo               extents;
 
-       (void)snprintf(s, sizeof(s), " %4d x %-4d ", cc->dim.w, cc->dim.h);
+       (void)snprintf(s, sizeof(s), " %4d x %-4d ",
+           move ? cc->geom.x : cc->dim.w, move ? cc->geom.y : cc->dim.h);
 
        XftTextExtentsUtf8(X_Dpy, sc->xftfont, (const FcChar8*)s,
            strlen(s), &extents);
@@ -89,7 +90,7 @@ mousefunc_client_resize(struct client_ct
                        cc->geom.h = ev.xmotion.y;
                        client_applysizehints(cc);
                        client_resize(cc, 1);
-                       mousefunc_sweep_draw(cc);
+                       mousefunc_sweep_draw(cc, 0);
                        break;
                case ButtonRelease:
                        client_resize(cc, 1);
@@ -151,9 +152,12 @@ mousefunc_client_move(struct client_ctx 
                            cc->geom.y + cc->geom.h + (cc->bwidth * 2),
                            area.y, area.y + area.h, sc->snapdist);
                        client_move(cc);
+                       mousefunc_sweep_draw(cc, 1);
                        break;
                case ButtonRelease:
                        client_move(cc);
+                       XUnmapWindow(X_Dpy, sc->menuwin);
+                       XReparentWindow(X_Dpy, sc->menuwin, sc->rootwin, 0, 0);
                        xu_ptr_ungrab();
                        return;
                }

Reply via email to