summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cardell Widerkrantz <mc@hack.org>2010-08-10 21:01:47 +0200
committerMichael Cardell Widerkrantz <mc@hack.org>2010-08-10 21:01:47 +0200
commit3ce1586c5711c0db044e235cfb257b4790c6c618 (patch)
treeeac3642bd6eb88d57415f89a88b8c62f0329ea9a
parentec73cb29300ef738541ef5f38ee6547bac861d33 (diff)
downloadmcwm-3ce1586c5711c0db044e235cfb257b4790c6c618.zip
Don't raise window on keyboard focus unless it's really occluded by
some other window. If we don't find any window to focus on, focus first in list, whatever it is.
-rw-r--r--mcwm.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/mcwm.c b/mcwm.c
index 02ec981..ffc4c33 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -1166,7 +1166,7 @@ void focusnext(void)
}
#endif
- /* If we currently focus the root, focus first in list. */
+ /* If we currently have no focus, focus first in list. */
if (NULL == focuswin)
{
if (NULL == wslist[curws])
@@ -1180,7 +1180,10 @@ void focusnext(void)
}
else
{
- /* Find client in list. */
+ /*
+ * Find our current focused window in list of windows on the
+ * current workspace and focus the next.
+ */
for (item = wslist[curws]; item != NULL; item = item->next)
{
if (focuswin == item->data)
@@ -1203,17 +1206,23 @@ void focusnext(void)
}
}
- if (found)
- {
- raisewindow(client->id);
- xcb_warp_pointer(conn, XCB_NONE, client->id, 0, 0, 0, 0,
- 0, 0);
- setfocus(client);
- }
- else
+ if (!found)
{
- PDEBUG("Couldn't find any new window to focus on.\n");
+ PDEBUG("Couldn't find any new window to focus on. Focusing first in "
+ "list...\n");
+ client = wslist[curws]->data;
}
+
+ /*
+ * Raise window if it's occluded, then warp pointer into it and
+ * set keyboard focus to it.
+ */
+ uint32_t values[] = { XCB_STACK_MODE_TOP_IF };
+
+ xcb_configure_window(conn, client->id, XCB_CONFIG_WINDOW_STACK_MODE,
+ values);
+ xcb_warp_pointer(conn, XCB_NONE, client->id, 0, 0, 0, 0, 0, 0);
+ setfocus(client);
}
/* Mark window win as unfocused. */