
Untitled
By: a guest on
Apr 21st, 2012 | syntax:
Diff | size: 1.62 KB | hits: 19 | expires: Never
diff --git a/src/commands.c b/src/commands.c
index 1dd53cd..07e933b 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -1196,15 +1196,6 @@ void cmd_focus_level(I3_CMD, char *level) {
*/
void cmd_focus(I3_CMD) {
DLOG("current_match = %p\n", current_match);
- if (focused &&
- focused->type != CT_WORKSPACE &&
- focused->fullscreen_mode != CF_NONE) {
- LOG("Cannot change focus while in fullscreen mode.\n");
- cmd_output->json_output = sstrdup("{\"sucess\": false}");
- return;
- }
-
- owindow *current;
if (match_is_empty(current_match)) {
ELOG("You have to specify which window/container should be focused.\n");
@@ -1217,6 +1208,7 @@ void cmd_focus(I3_CMD) {
}
int count = 0;
+ owindow *current;
TAILQ_FOREACH(current, &owindows, owindows) {
Con *ws = con_get_workspace(current->con);
/* If no workspace could be found, this was a dock window.
@@ -1224,6 +1216,15 @@ void cmd_focus(I3_CMD) {
if (!ws)
continue;
+ if (focused &&
+ focused->type != CT_WORKSPACE &&
+ focused->fullscreen_mode != CF_NONE &&
+ con_get_workspace(focused) == ws) {
+ LOG("Cannot change focus to the same workspace while in fullscreen mode.\n");
+ cmd_output->json_output = sstrdup("{\"sucess\": false}");
+ return;
+ }
+
/* If the container is not on the current workspace,
* workspace_show() will switch to a different workspace and (if
* enabled) trigger a mouse pointer warp to the currently focused