]> git.sur5r.net Git - i3/i3/commitdiff
backport client_leave_fullscreen from next branch (Thanks ccount)
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 20 Mar 2010 13:47:33 +0000 (14:47 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 20 Mar 2010 13:47:33 +0000 (14:47 +0100)
include/client.h
src/client.c

index 9da3a5ecbd2b4f9ec24d38d1dbb25190c4cb0961..41bd5db36c86eddd712c9aebdb72fc02a89f78a7 100644 (file)
@@ -53,6 +53,12 @@ bool client_matches_class_name(Client *client, char *to_class, char *to_title,
  */
 void client_enter_fullscreen(xcb_connection_t *conn, Client *client);
 
+/**
+ * Leaves fullscreen mode for the current client. This is called by toggle_fullscreen.
+ *
+ */
+void client_leave_fullscreen(xcb_connection_t *conn, Client *client);
+
 /**
  * Toggles fullscreen mode for the given client. It updates the data
  * structures and reconfigures (= resizes/moves) the client and its frame to
index dd88acc1f6f73aff072d7a540b52cfb66358eed8..f8303ea4ec680319a2fb50141325c75cb194e992 100644 (file)
@@ -192,6 +192,38 @@ void client_enter_fullscreen(xcb_connection_t *conn, Client *client) {
         xcb_flush(conn);
 }
 
+/*
+ * Leaves fullscreen mode for the current client. This is called by toggle_fullscreen.
+ *
+ */
+void client_leave_fullscreen(xcb_connection_t *conn, Client *client) {
+        LOG("leaving fullscreen mode\n");
+        client->fullscreen = false;
+        Workspace *ws;
+        TAILQ_FOREACH(ws, workspaces, workspaces)
+                if (ws->fullscreen_client == client)
+                        ws->fullscreen_client = NULL;
+
+        if (client_is_floating(client)) {
+                /* For floating clients it’s enough if we just reconfigure that window (in fact,
+                 * re-rendering the layout will not update the client.) */
+                reposition_client(conn, client);
+                resize_client(conn, client);
+                /* redecorate_window flushes */
+                redecorate_window(conn, client);
+        } else {
+                client_set_below_floating(conn, client);
+
+                /* Because the coordinates of the window haven’t changed, it would not be
+                   re-configured if we don’t set the following flag */
+                client->force_reconfigure = true;
+                /* We left fullscreen mode, redraw the whole layout to ensure enternotify events are disabled */
+                render_layout(conn);
+        }
+
+        xcb_flush(conn);
+}
+
 /*
  * Toggles fullscreen mode for the given client. It updates the data structures and
  * reconfigures (= resizes/moves) the client and its frame to the full size of the