about summary refs log tree commit diff
path: root/kbfunc.c
diff options
context:
space:
mode:
authorokan <okan>2019-03-11 15:25:46 +0000
committerokan <okan>2019-03-11 15:25:46 +0000
commit85d88f33042f7c397b75513e1561b361815caad7 (patch)
tree5ce311934b167cd4b8514edf062923fd2910eb84 /kbfunc.c
parent412b0c9ef4429d48c200910ffcc8a18b60f815ea (diff)
parent9a7528f5b99bd234f724aa229cbf75fb6a813282 (diff)
downloadcwm-85d88f33042f7c397b75513e1561b361815caad7.tar.gz
cwm-85d88f33042f7c397b75513e1561b361815caad7.tar.xz
cwm-85d88f33042f7c397b75513e1561b361815caad7.zip
cvsimport
* refs/heads/master: (23 commits)
  Check the atom type on propertynotify before iterating.
  use screen_find() for xrandr crtc changes
  Find the managed screen from the parent window for client_current().
  Print window id in hex; while here, remove unnecessary newline.
  Similar to keypress event, fetch the screen from the event root window in the buttonpress handler; bail if we don't manage the screen. Allows us to find the current client based on the screen/event root.
  extend verbose logging for key/button events
  [keypress event] turns out we've been checking the wrong window for a matching client thus always falling back to client_current(); while the current client is problaby right in most cases, use event's subwindow (not window) to find the client. Bail early if this event came to us from a screen we don't manage. This is result of us grabing all keybindings off the root window instead of selectively.
  add parans for readibility
  Teach client_current() to use a screen to find the current client instead of iterating over all (fallback if no screen provided for now). Initially convert trivial uses of client_current().
  check cc->gc directly
  zip extra lines
  gc clientq inside groups, instead use the better maintained one per-screen
  shuffle deck chairs: rename group actions to match intent for clarity
  same thing as screen_find()
  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.
  fix a few misplaced (and misnamed) ewmh root window functions
  _NET_WORKAREA needs ngroups, so screen_update_geometry() needs to come after conf_group().
  simplify xftcolor config
  Tie group number and name together during config.
  Move the group index (desktop number) check to the only 2 callers that require checking due to ewmh.
  ...
Diffstat (limited to 'kbfunc.c')
-rw-r--r--kbfunc.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/kbfunc.c b/kbfunc.c
index 3da28c3..bb5ac37 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -169,8 +169,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) {
@@ -193,8 +193,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;
@@ -203,8 +203,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);
 }
 
@@ -258,7 +257,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) {
@@ -272,7 +272,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:
@@ -282,8 +282,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. */
@@ -432,15 +431,21 @@ kbfunc_client_movetogroup(void *ctx, struct cargs *cargs)
 }
 
 void
+kbfunc_group_only(void *ctx, struct cargs *cargs)
+{
+	group_only(ctx, cargs->flag);
+}
+
+void
 kbfunc_group_toggle(void *ctx, struct cargs *cargs)
 {
-	group_hidetoggle(ctx, cargs->flag);
+	group_toggle(ctx, cargs->flag);
 }
 
 void
-kbfunc_group_only(void *ctx, struct cargs *cargs)
+kbfunc_group_toggle_all(void *ctx, struct cargs *cargs)
 {
-	group_only(ctx, cargs->flag);
+	group_toggle_all(ctx);
 }
 
 void
@@ -456,12 +461,6 @@ kbfunc_group_cycle(void *ctx, struct cargs *cargs)
 }
 
 void
-kbfunc_group_alltoggle(void *ctx, struct cargs *cargs)
-{
-	group_alltoggle(ctx);
-}
-
-void
 kbfunc_menu_client(void *ctx, struct cargs *cargs)
 {
 	struct screen_ctx	*sc = ctx;
@@ -474,7 +473,7 @@ kbfunc_menu_client(void *ctx, struct cargs *cargs)
 	if (cargs->xev == CWM_XEV_BTN)
 		mflags |= CWM_MENU_LIST;
 
-	old_cc = client_current();
+	old_cc = client_current(sc);
 
 	TAILQ_INIT(&menuq);
 	TAILQ_FOREACH(cc, &sc->clientq, entry) {