From f9cc6bc28fcaadc3f0eea32de200c98ed65671e4 Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 4 Mar 2019 19:28:17 +0000 Subject: Separate out the menu window from the client resize/move geom window; in each case, create and destroy on-demand. Isolate more menu specific code. --- kbfunc.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'kbfunc.c') diff --git a/kbfunc.c b/kbfunc.c index 699676e..2971f3b 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: kbfunc.c,v 1.162 2019/02/25 16:40:49 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.163 2019/03/04 19:28:18 okan Exp $ */ #include @@ -166,8 +166,8 @@ kbfunc_client_move_mb(void *ctx, struct cargs *cargs) CurrentTime) != GrabSuccess) return; - menu_windraw(sc, cc->win, "%4d, %-4d", cc->geom.x, cc->geom.y); - + screen_prop_win_create(sc, cc->win); + screen_prop_win_draw(sc, "%+5d%+5d", cc->geom.x, cc->geom.y); while (move) { XMaskEvent(X_Dpy, MOUSEMASK, &ev); switch (ev.type) { @@ -190,8 +190,8 @@ kbfunc_client_move_mb(void *ctx, struct cargs *cargs) cc->geom.y + cc->geom.h + (cc->bwidth * 2), area.y, area.y + area.h, sc->snapdist); client_move(cc); - menu_windraw(sc, cc->win, - "%4d, %-4d", cc->geom.x, cc->geom.y); + screen_prop_win_draw(sc, + "%+5d%+5d", cc->geom.x, cc->geom.y); break; case ButtonRelease: move = 0; @@ -200,8 +200,7 @@ kbfunc_client_move_mb(void *ctx, struct cargs *cargs) } if (ltime) client_move(cc); - XUnmapWindow(X_Dpy, sc->menu.win); - XReparentWindow(X_Dpy, sc->menu.win, sc->rootwin, 0, 0); + screen_prop_win_destroy(sc); XUngrabPointer(X_Dpy, CurrentTime); } @@ -255,7 +254,8 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs) CurrentTime) != GrabSuccess) return; - menu_windraw(sc, cc->win, "%4d x %-4d", cc->dim.w, cc->dim.h); + screen_prop_win_create(sc, cc->win); + screen_prop_win_draw(sc, "%4d x %-4d", cc->dim.w, cc->dim.h); while (resize) { XMaskEvent(X_Dpy, MOUSEMASK, &ev); switch (ev.type) { @@ -269,7 +269,7 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs) cc->geom.h = ev.xmotion.y; client_applysizehints(cc); client_resize(cc, 1); - menu_windraw(sc, cc->win, + screen_prop_win_draw(sc, "%4d x %-4d", cc->dim.w, cc->dim.h); break; case ButtonRelease: @@ -279,8 +279,7 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs) } if (ltime) client_resize(cc, 1); - XUnmapWindow(X_Dpy, sc->menu.win); - XReparentWindow(X_Dpy, sc->menu.win, sc->rootwin, 0, 0); + screen_prop_win_destroy(sc); XUngrabPointer(X_Dpy, CurrentTime); /* Make sure the pointer stays within the window. */ -- cgit v1.2.3-2-gb3c3