sawfish r4468 - trunk/src



Author: chrisb
Date: Sun Apr  5 14:05:17 2009
New Revision: 4468
URL: http://svn.gnome.org/viewvc/sawfish?rev=4468&view=rev

Log:
2009-04-05  Christopher Bratusek <zanghar freenet de>
        * src/events.c
        * src/windows.c: Fix for iconify issue (improved solution) [Teika]

Modified:
   trunk/src/events.c
   trunk/src/windows.c

Modified: trunk/src/events.c
==============================================================================
--- trunk/src/events.c	(original)
+++ trunk/src/events.c	Sun Apr  5 14:05:17 2009
@@ -747,22 +747,6 @@
     Lisp_Window *w = find_window_by_id (id);
     if (w == 0)
     {
-        /* The reason for doing this before the add is to give matchers
-         * a chance to do their thing and reverse the iconification,
-         * if the user desires.  There's a minor downside: rep doesn't
-         * know about this, so any hooks that might be operative for
-         * iconification don't get run, and there's no iconify sound.
-         * But it can be argued that this is the Right Thing anyway,
-         * since the hint was set outside of rep's watch too. */
-
-        XWMHints* wmhints = XGetWMHints(dpy, id);
-
-	if (wmhints && (wmhints->flags & StateHint) && wmhints->initial_state == IconicState)
-            XIconifyWindow(dpy, id, screen_num);
-        
-	if (wmhints)
-            XFree(wmhints);
-        
 	/* Also adds the frame. */
 	w = add_window (id);
 	if (w == 0)

Modified: trunk/src/windows.c
==============================================================================
--- trunk/src/windows.c	(original)
+++ trunk/src/windows.c	Sun Apr  5 14:05:17 2009
@@ -424,7 +424,8 @@
 }
 
 
-/* Add the top-level window ID to the manager's data structures */
+/* Add the top-level window ID to the manager's data structures.
+ * This is called only from events.c -> map_request */
 Lisp_Window *
 add_window (Window id)
 {
@@ -510,6 +511,21 @@
 	if (initialising)
 	    Fwindow_put (rep_VAL (w), Qplaced, Qt);
 
+	/* If the window requires to start as icon, then iconify it.
+	 * It is better to be done before 'before_add_window_hook', where
+	 * matching takes place, because in future, matcher can have an
+	 * option to un-iconify, overrinding the application's request
+	 * to iconify. 
+	 */
+	if (w->wmhints && w->wmhints->flags & StateHint
+	    && w->wmhints->initial_state == IconicState)
+	  {
+	    DEFSTRING (iconify_mod, "sawfish.wm.state.iconify");
+	    rep_call_lisp1 (module_symbol_value
+			    (rep_VAL (&iconify_mod), Qiconify_window),
+			    rep_VAL(w));
+	  }
+	
 	/* ..then call the add-window-hook's.. */
 	rep_PUSHGC(gc_win, win);
 	Fcall_window_hook (Qbefore_add_window_hook, rep_VAL(w), Qnil, Qnil);



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