]> git.sur5r.net Git - i3/i3/commitdiff
Implement the popup_during_fullscreen option, set default to leave_fullscreen
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 6 Mar 2011 14:45:42 +0000 (15:45 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 6 Mar 2011 14:46:06 +0000 (15:46 +0100)
Fixes #333

include/config.h
src/cfgparse.l
src/cfgparse.y
src/manage.c

index 6ab6baee718ec04dabc6dd558fe7eb550e7bf370..986f7aa2548027f6dc408c3ae04ff5995c47a47d 100644 (file)
@@ -127,6 +127,12 @@ struct Config {
                 struct Colortriple unfocused;
                 struct Colortriple urgent;
         } bar;
+
+        /** What should happen when a new popup is opened during fullscreen mode */
+        enum {
+                PDF_LEAVE_FULLSCREEN = 0,
+                PDF_IGNORE = 1
+        } popup_during_fullscreen;
 };
 
 /**
index 66afb14b9e5f60a810dea395918c8453d41b108a..b8b1d73d5e7054ba28ce9c69f7cdc6b7b2ddb7ea 100644 (file)
@@ -99,6 +99,9 @@ none                            { return TOK_NONE; }
 1pixel                          { return TOK_1PIXEL; }
 focus_follows_mouse             { return TOKFOCUSFOLLOWSMOUSE; }
 workspace_bar                   { return TOKWORKSPACEBAR; }
+popup_during_fullscreen         { return TOK_POPUP_DURING_FULLSCREEN; }
+ignore                          { return TOK_IGNORE; }
+leave_fullscreen                { return TOK_LEAVE_FULLSCREEN; }
 default                         { /* yylval.number = MODE_DEFAULT; */return TOKCONTAINERMODE; }
 stacking                        { /* yylval.number = MODE_STACK; */return TOKCONTAINERMODE; }
 tabbed                          { /* yylval.number = MODE_TABBED; */return TOKCONTAINERMODE; }
index d3a5ecda0a55688b2da01cc461665fd4d5a423ad..adb021222ceefee3490745bbf768cd4bfef5a428 100644 (file)
@@ -233,6 +233,9 @@ void parse_file(const char *f) {
 %token TOKWORKSPACEBAR "workspace_bar"
 %token TOKCONTAINERMODE "default/stacking/tabbed"
 %token TOKSTACKLIMIT "stack-limit"
+%token TOK_POPUP_DURING_FULLSCREEN "popup_during_fullscreen"
+%token TOK_IGNORE "ignore"
+%token TOK_LEAVE_FULLSCREEN "leave_fullscreen"
 
 %%
 
@@ -260,6 +263,7 @@ line:
         | terminal
         | font
         | comment
+        | popup_during_fullscreen
         ;
 
 comment:
@@ -641,3 +645,16 @@ binding_modifier:
         | TOKCONTROL    { $<number>$ = BIND_CONTROL; }
         | TOKSHIFT      { $<number>$ = BIND_SHIFT; }
         ;
+
+popup_during_fullscreen:
+        TOK_POPUP_DURING_FULLSCREEN WHITESPACE popup_setting
+        {
+                DLOG("popup_during_fullscreen setting: %d\n", $<number>3);
+                config.popup_during_fullscreen = $<number>3;
+        }
+        ;
+
+popup_setting:
+        TOK_IGNORE              { $<number>$ = PDF_IGNORE; }
+        | TOK_LEAVE_FULLSCREEN  { $<number>$ = PDF_LEAVE_FULLSCREEN; }
+        ;
index cd82d020808c15bf77544fc048f542e4af289100..53526f6a9083433304efbcc5165a9cfaac8fe23c 100644 (file)
@@ -247,9 +247,20 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
     if (cwindow->transient_for != XCB_NONE ||
         (cwindow->leader != XCB_NONE &&
          cwindow->leader != cwindow->id &&
-         con_by_window_id(cwindow->leader) != NULL))
+         con_by_window_id(cwindow->leader) != NULL)) {
+        LOG("This window is transiert for another window, setting floating\n");
         want_floating = true;
 
+        if (config.popup_during_fullscreen == PDF_LEAVE_FULLSCREEN) {
+            Con *ws = con_get_workspace(nc);
+            Con *fs = con_get_fullscreen_con(ws);
+            if (fs != NULL) {
+                LOG("There is a fullscreen window, leaving fullscreen mode\n");
+                con_toggle_fullscreen(fs);
+            }
+        }
+    }
+
     /* dock clients cannot be floating, that makes no sense */
     if (cwindow->dock)
         want_floating = false;