[PATCH 4/4] mark windows with certain hints as dockapp



Signed-off-by: Alexey I. Froloff <raorn altlinux org>
---
 src/windows.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/windows.c b/src/windows.c
index 208ff0d..dcdc1d0 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -78,6 +78,9 @@ DEFSYM(south_west, "south-west");
 DEFSYM(south, "south");
 DEFSYM(south_east, "south-east");
 
+/* for dockapp support */
+DEFSYM(mark_window_as_dockapp, "mark-window-as-dockapp");
+
 static repv gravity_map[StaticGravity+1];
 
 /* In sawfish-1.3.3, the only callback used is keymap_prop_change. */
@@ -468,17 +471,28 @@ add_window (Window id)
 	insert_in_stacking_list_above_all (w);
 	restack_window (w);
 
+	w->wmhints = XGetWMHints (dpy, w->id);
+	if (w->wmhints && w->wmhints->flags & StateHint
+	    && w->wmhints->initial_state == WithdrawnState
+	    && w->wmhints->flags & IconWindowHint
+	    && w->wmhints->icon_window != 0) {
+	    /* window in withdrawn state with IconWindow? */
+	    /* This definitely looks like dockapp... */
+	    w->id = w->wmhints->icon_window;
+	    w->wmhints = XGetWMHints (dpy, w->id);
+	    rep_call_lisp1 (Fsymbol_value (Qmark_window_as_dockapp, Qt), w);
+	}
+
 	/* ..now do the X11 stuff */
 
-	XSelectInput (dpy, id, CLIENT_EVENTS);
-	XGetWindowAttributes (dpy, id, &w->attr);
+	XSelectInput (dpy, w->id, CLIENT_EVENTS);
+	XGetWindowAttributes (dpy, w->id, &w->attr);
 	DB(("  orig: width=%d height=%d x=%d y=%d\n",
 	    w->attr.width, w->attr.height, w->attr.x, w->attr.y));
 	w->old_border_width = w->attr.border_width;
 
 	get_window_name(w);
 
-	w->wmhints = XGetWMHints (dpy, id);
 	if (!XGetWMNormalHints (dpy, w->id, &w->hints, &supplied))
 	    w->hints.flags = 0;
 	get_window_protocols (w);
@@ -509,7 +523,7 @@ add_window (Window id)
 	xwc.width = w->attr.width;
 	xwc.height = w->attr.height;
 	xwc.border_width = 0;
-	XConfigureWindow (dpy, id, xwcm, &xwc);
+	XConfigureWindow (dpy, w->id, xwcm, &xwc);
 
         w->visible = TRUE;
 	w->mapped = TRUE;		/* only called from map request */
@@ -1752,6 +1766,8 @@ windows_init (void)
     rep_INTERN(south);
     rep_INTERN(south_east);
 
+    rep_INTERN(mark_window_as_dockapp);
+
     gravity_map[ForgetGravity] = Qforget;
     gravity_map[NorthWestGravity] = Qnorth_west;
     gravity_map[NorthGravity] = Qnorth;
-- 
1.7.0.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]