[PATCH] Iconify as requested by WM_HINTS before repyfying [Was: xconsole mystery]
- From: Ian Zimmerman <itz buug org>
- To: General discussion about sawfish wm <sawfish-list gnome org>
- Subject: [PATCH] Iconify as requested by WM_HINTS before repyfying [Was: xconsole mystery]
- Date: Sun, 18 Jan 2009 11:34:35 -0800
Ian> Now I know why it behaves this way. In events.c, map_request(),
Ian> add_window() is called first. That will aplly the matchers, but
Ian> _then_ the check is made is initial_state == IconicState and if
Ian> this is true the window is iconified.
Ian> The right fix would seem to be to use the raw X ID and
Ian> XIconifyWindow() instead of rep's Qiconify_window, and do it
Ian> _before_ the add_window() call.
Here's the patch. Sorry, I don't know how to post it in the wiki;
can someone else please take care of that? Thanks.
diff -u --recur sawfish-1.3.5.1.old/src/events.c sawfish-1.3.5.1/src/events.c
--- sawfish-1.3.5.1.old/src/events.c 2008-11-19 12:45:08.000000000 -0800
+++ sawfish-1.3.5.1/src/events.c 2009-01-18 11:28:07.000000000 -0800
@@ -747,6 +747,19 @@
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)
@@ -754,12 +767,6 @@
fprintf (stderr, "warning: failed to allocate a window\n");
return;
}
- if (w->wmhints && w->wmhints->flags & StateHint
- && w->wmhints->initial_state == IconicState)
- {
- rep_call_lisp1 (module_symbol_value (rep_VAL (&iconify_mod),
- Qiconify_window), rep_VAL(w));
- }
}
else
{
--
Ian Zimmerman <itz buug org>
gpg public key: 1024D/C6FF61AD
fingerprint: 66DC D68F 5C1B 4D71 2EE5 BD03 8A00 786C C6FF 61AD
Ham is for reading, not for eating.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]