summary refs log tree commit diff
path: root/calmwm.c
diff options
context:
space:
mode:
authorokan <okan>2016-10-24 20:44:08 +0000
committerokan <okan>2016-10-24 20:44:08 +0000
commitdcb741d2b1378432e226bbeea274c2e5e2508c2d (patch)
treeb9a0fcb7200417e49167e78a687632b23cdbf812 /calmwm.c
parentfa06851b0ee5b49138f782e500e12646455dd171 (diff)
parentdb93599a0fb302271e10a9dcbcbe6cafdc8aa2cb (diff)
downloadcwm-dcb741d2b1378432e226bbeea274c2e5e2508c2d.tar.gz
cwm-dcb741d2b1378432e226bbeea274c2e5e2508c2d.tar.xz
cwm-dcb741d2b1378432e226bbeea274c2e5e2508c2d.zip
cvsimport
* refs/heads/master: (34 commits)
  Make it clear these are flags.
  Remove duplicate check that strsubmatch() already does; while here, fix a comment.
  Sprinkle __func__ in appropriate error messages.
  Get rid of 'matchname'; it's too surprising to have the menu change during client search as different potential str matches are cycled through. If there's interest, the only string that doesn't exist in the listing is the window's class - that can be added of course, but it makes the line too long imho.
  clean up search_match_client(); no behaviour change
  Refactor callbacks to take a void * so as to not try and generalize into client_ctx in keypress and buttonpress event handlers; pass appropriate *ctx's based on context.
  remove another unused proto
  Rename 2 kbfunc to match closer to what they do
  Add an argument to the callbacks to pass the xevent context, button or key press. This allows to remove a few hacks to duplicate functions only for behaviour changes; now differing behaviours are pushed down to the callback. Also will allow for previously unavailable actions to be bind-able down the road.
  Check the ptr bounds in the new client during cycling, since not all actions do ptrsave, such as restoring client geometry; adapted from a diff by Vadim Vygonets.
  More accurate to say 'toggle', rather than 'select', for group[n]/nogroup.
  Add CM-a for 'nogroup' (CM-0 stays for now); update manpage to reflect.
  Stash wmname into conf.
  When removing xrandr regions, ensure clients are within the bounds of the screen; adapted from an ancient diff from Sviatoslav Chagaev. Things in this area will likely change, but put this in so it works now and serves as a reminder.
  Calculate client nameqlen in client_setname(), the only place it's needed/used.
  Turn CALMWM_NGROUPS define into variable, ngroups.
  Start simplifying menu code; and in turn, remove a cursor no longer needed.
  Defaults are split between defines and conf_init(); normalize these, as well as give 'sticky' groups its own variable.
  For both kb and mouse move, it is possible to grab a client and move it completely off the screen/region; instead, if the pointer is outside of the client bounds, warp the pointer to the closest edge before moving.
  client_ptrwarp should not deal with unhiding or raising clients (non ptr requests); most callers do this already - deal with the few that do not. client_ptrwarp becomes a simple wrapper (setpos) but it will be expanded.
  ...
Diffstat (limited to 'calmwm.c')
-rw-r--r--calmwm.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/calmwm.c b/calmwm.c
index 7fc749b..813d606 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -36,18 +36,14 @@
 
 #include "calmwm.h"
 
-Display				*X_Dpy;
-Time				 Last_Event_Time = CurrentTime;
-Atom				 cwmh[CWMH_NITEMS];
-Atom				 ewmh[EWMH_NITEMS];
-
-struct screen_ctx_q		 Screenq = TAILQ_HEAD_INITIALIZER(Screenq);
-
-int				 HasRandr, Randr_ev;
-struct conf			 Conf;
-const char			*homedir;
-char				*wm_argv;
-volatile sig_atomic_t		 cwm_status;
+Display			*X_Dpy;
+Time			 Last_Event_Time = CurrentTime;
+Atom			 cwmh[CWMH_NITEMS];
+Atom			 ewmh[EWMH_NITEMS];
+struct screen_q		 Screenq = TAILQ_HEAD_INITIALIZER(Screenq);
+struct conf		 Conf;
+const char		*homedir;
+volatile sig_atomic_t	 cwm_status;
 
 static void	sighdlr(int);
 static int	x_errorhandler(Display *, XErrorEvent *);
@@ -67,7 +63,7 @@ main(int argc, char **argv)
 		warnx("no locale support");
 	mbtowc(NULL, NULL, MB_CUR_MAX);
 
-	wm_argv = u_argv(argv);
+	Conf.wm_argv = u_argv(argv);
 	while ((ch = getopt(argc, argv, "c:d:")) != -1) {
 		switch (ch) {
 		case 'c':
@@ -107,6 +103,7 @@ main(int argc, char **argv)
 	}
 
 	conf_init(&Conf);
+
 	if (conf_path && (parse_config(conf_path, &Conf) == -1))
 		warnx("config file %s has errors", conf_path);
 	free(conf_path);
@@ -123,7 +120,7 @@ main(int argc, char **argv)
 		xev_process();
 	x_teardown();
 	if (cwm_status == CWM_EXEC_WM)
-		u_exec(wm_argv);
+		u_exec(Conf.wm_argv);
 
 	return(0);
 }
@@ -141,7 +138,7 @@ x_init(const char *dpyname)
 	XSync(X_Dpy, False);
 	XSetErrorHandler(x_errorhandler);
 
-	HasRandr = XRRQueryExtension(X_Dpy, &Randr_ev, &i);
+	Conf.xrandr = XRRQueryExtension(X_Dpy, &Conf.xrandr_event_base, &i);
 
 	conf_atoms();
 	conf_cursor(&Conf);
@@ -163,10 +160,9 @@ x_teardown(void)
 			XftColorFree(X_Dpy, DefaultVisual(X_Dpy, sc->which),
 			    DefaultColormap(X_Dpy, sc->which),
 			    &sc->xftcolor[i]);
-		XftDrawDestroy(sc->xftdraw);
 		XftFontClose(X_Dpy, sc->xftfont);
-		XUnmapWindow(X_Dpy, sc->menuwin);
-		XDestroyWindow(X_Dpy, sc->menuwin);
+		XftDrawDestroy(sc->menu.xftdraw);
+		XDestroyWindow(X_Dpy, sc->menu.win);
 		XUngrabKey(X_Dpy, AnyKey, AnyModifier, sc->rootwin);
 	}
 	XUngrabPointer(X_Dpy, CurrentTime);