summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2011-09-13 09:17:30 +0000
committerokan <okan>2011-09-13 09:17:30 +0000
commit3c67ec8ccc4262aec845544051e8fb8cbedeed87 (patch)
treeb1842534f8d34cb8cb893a948f22bb5e1c7751b7
parentb1d81b7eb678803244a3f16b59109af387d8269e (diff)
parent22f366830e6fc06931f9e0a905e6c34fab0f7a20 (diff)
downloadcwm-3c67ec8ccc4262aec845544051e8fb8cbedeed87.tar.gz
cwm-3c67ec8ccc4262aec845544051e8fb8cbedeed87.tar.xz
cwm-3c67ec8ccc4262aec845544051e8fb8cbedeed87.zip
cvsimport
-rw-r--r--calmwm.h1
-rw-r--r--client.c17
-rw-r--r--conf.c8
-rw-r--r--group.c10
-rw-r--r--xevents.c3
5 files changed, 30 insertions, 9 deletions
diff --git a/calmwm.h b/calmwm.h
index 80dcfd3..09fd899 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -336,6 +336,7 @@ void			 client_send_delete(struct client_ctx *);
 void			 client_setactive(struct client_ctx *, int);
 void			 client_setname(struct client_ctx *);
 int			 client_snapcalc(int, int, int, int, int);
+void			 client_transient(struct client_ctx *);
 void			 client_unhide(struct client_ctx *);
 void			 client_vertmaximize(struct client_ctx *);
 void			 client_warp(struct client_ctx *);
diff --git a/client.c b/client.c
index e7783a4..711aeba 100644
--- a/client.c
+++ b/client.c
@@ -113,6 +113,8 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
 
 	XAddToSaveSet(X_Dpy, cc->win);
 
+	client_transient(cc);
+
 	/* Notify client of its configuration. */
 	xu_configure(cc);
 
@@ -869,6 +871,21 @@ client_freehints(struct client_ctx *cc)
 		XFree(cc->app_class);
 }
 
+void
+client_transient(struct client_ctx *cc)
+{
+	struct client_ctx	*tc;
+	Window			 trans;
+
+	if (XGetTransientForHint(X_Dpy, cc->win, &trans)) {
+		if ((tc = client_find(trans)) && tc->group) {
+			group_movetogroup(cc, tc->group->shortcut - 1);
+			if (tc->flags & CLIENT_IGNORE)
+				cc->flags |= CLIENT_IGNORE;
+		}
+	}
+}
+
 static int
 client_inbound(struct client_ctx *cc, int x, int y)
 {
diff --git a/conf.c b/conf.c
index e8cd157..963a399 100644
--- a/conf.c
+++ b/conf.c
@@ -67,10 +67,10 @@ conf_font(struct conf *c, struct screen_ctx *sc)
 }
 
 static struct color color_binds[] = {
-	{ "#CCCCCC",	0 }, /* CWM_COLOR_BORDOR_ACTIVE */
-	{ "#666666",	0 }, /* CWM_COLOR_BORDOR_INACTIVE */
-	{ "blue",	0 }, /* CWM_COLOR_BORDOR_GROUP */
-	{ "red",	0 }, /* CWM_COLOR_BORDOR_UNGROUP */
+	{ "#CCCCCC",	0 }, /* CWM_COLOR_BORDER_ACTIVE */
+	{ "#666666",	0 }, /* CWM_COLOR_BORDER_INACTIVE */
+	{ "blue",	0 }, /* CWM_COLOR_BORDER_GROUP */
+	{ "red",	0 }, /* CWM_COLOR_BORDER_UNGROUP */
 	{ "black",	0 }, /* CWM_COLOR_FG_MENU */
 	{ "white",	0 }, /* CWM_COLOR_BG_MENU */
 	{ "black",	0 }, /* CWM_COLOR_FONT */
diff --git a/group.c b/group.c
index e8d23e8..877a824 100644
--- a/group.c
+++ b/group.c
@@ -313,7 +313,7 @@ group_only(struct screen_ctx *sc, int idx)
  * Cycle through active groups.  If none exist, then just stay put.
  */
 void
-group_cycle(struct screen_ctx *sc, int reverse)
+group_cycle(struct screen_ctx *sc, int flags)
 {
 	struct group_ctx	*gc, *showgroup = NULL;
 
@@ -321,11 +321,11 @@ group_cycle(struct screen_ctx *sc, int reverse)
 
 	gc = sc->group_active;
 	for (;;) {
-		gc = reverse ? TAILQ_PREV(gc, group_ctx_q, entry) :
-		    TAILQ_NEXT(gc, entry);
+		gc = (flags & CWM_RCYCLE) ? TAILQ_PREV(gc, group_ctx_q,
+		    entry) : TAILQ_NEXT(gc, entry);
 		if (gc == NULL)
-			gc = reverse ? TAILQ_LAST(&sc->groupq, group_ctx_q) :
-			    TAILQ_FIRST(&sc->groupq);
+			gc = (flags & CWM_RCYCLE) ? TAILQ_LAST(&sc->groupq,
+			    group_ctx_q) : TAILQ_FIRST(&sc->groupq);
 		if (gc == sc->group_active)
 			break;
 
diff --git a/xevents.c b/xevents.c
index 6e87382..2739a7f 100644
--- a/xevents.c
+++ b/xevents.c
@@ -192,6 +192,9 @@ xev_handle_propertynotify(XEvent *ee)
 		case XA_WM_NAME:
 			client_setname(cc);
 			break;
+		case XA_WM_TRANSIENT_FOR:
+			client_transient(cc);
+			break;
 		default:
 			/* do nothing */
 			break;