Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 21st, 2012  |  syntax: Diff  |  size: 1.62 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/src/commands.c b/src/commands.c
  2. index 1dd53cd..07e933b 100644
  3. --- a/src/commands.c
  4. +++ b/src/commands.c
  5. @@ -1196,15 +1196,6 @@ void cmd_focus_level(I3_CMD, char *level) {
  6.   */
  7.  void cmd_focus(I3_CMD) {
  8.      DLOG("current_match = %p\n", current_match);
  9. -    if (focused &&
  10. -        focused->type != CT_WORKSPACE &&
  11. -        focused->fullscreen_mode != CF_NONE) {
  12. -        LOG("Cannot change focus while in fullscreen mode.\n");
  13. -        cmd_output->json_output = sstrdup("{\"sucess\": false}");
  14. -        return;
  15. -    }
  16. -
  17. -    owindow *current;
  18.  
  19.      if (match_is_empty(current_match)) {
  20.          ELOG("You have to specify which window/container should be focused.\n");
  21. @@ -1217,6 +1208,7 @@ void cmd_focus(I3_CMD) {
  22.      }
  23.  
  24.      int count = 0;
  25. +    owindow *current;
  26.      TAILQ_FOREACH(current, &owindows, owindows) {
  27.          Con *ws = con_get_workspace(current->con);
  28.          /* If no workspace could be found, this was a dock window.
  29. @@ -1224,6 +1216,15 @@ void cmd_focus(I3_CMD) {
  30.          if (!ws)
  31.              continue;
  32.  
  33. +        if (focused &&
  34. +            focused->type != CT_WORKSPACE &&
  35. +            focused->fullscreen_mode != CF_NONE &&
  36. +            con_get_workspace(focused) == ws) {
  37. +            LOG("Cannot change focus to the same workspace while in fullscreen mode.\n");
  38. +            cmd_output->json_output = sstrdup("{\"sucess\": false}");
  39. +            return;
  40. +        }
  41. +
  42.          /* If the container is not on the current workspace,
  43.           * workspace_show() will switch to a different workspace and (if
  44.           * enabled) trigger a mouse pointer warp to the currently focused