i3lock-color

The world's most popular non-default computer lockscreen.
Index Commits Files Refs README LICENSE
commit d9f2e04bab3c5f2bed674edd085355da255f892b
parent 7fdb32a6be218c1eb5516abdd5bdc18ae0ca39f7
Author: Chris Guillott <chris@techfo.xyz>
Date:   Tue, 30 May 2017 19:12:44 -0400

add a no-composite arg

Diffstat:
MREADME.md | 2++
Mi3lock.1 | 4++++
Mi3lock.c | 7+++++++
Mxcb.c | 41++++++++++++++++++++++-------------------
4 files changed, 35 insertions(+), 19 deletions(-)
diff --git a/README.md b/README.md
@@ -34,6 +34,8 @@ Many little improvements have been made to i3lock over time:
      - `-S, --screen` -- specifies which display to draw the unlock indicator on
      - `-k, --clock` -- enables the clock display.
          - `--indicator` -- forces the indicator to always show, even if there's no activity.
+         - `--no-composite` -- disables checking for compositors and trying to grab the compositor window, since that causes issues with some compositors.
+            - **NOTE**: This can potentially allow sensitive information to display over the screen locker, so take care when you use this option.
      - `-B=sigma, --blur` -- enables Gaussian blur. Sigma is the blur radius.
           - Note: You can still composite images over the blur (but still under the indicator) with -i.
                 - Eventually there might be an `imagepos` arg, similar to `time` and `datepos`. 
diff --git a/i3lock.1 b/i3lock.1
@@ -126,6 +126,10 @@ Images may still be overlaid over the blurred screenshot.
 Forces the indicator to always be visible, instead of only showing on activity.
 
 .TP
+.B \-\-no\-composite
+Some compositors have problems with i3lock trying to render over them. If you're having graphical problems, try this arg.
+
+.TP
 .B \-\-insidevercolor=rrggbbaa
 Sets the interior circle color while the password is being verified.
 
diff --git a/i3lock.c b/i3lock.c
@@ -80,6 +80,9 @@ int internal_line_source = 0;
 bool show_clock = false;
 bool show_indicator = false;
 float refresh_rate = 1.0;
+
+/* there's some issues with compositing currently. Let's supply an arg to disable it. */
+bool composite = true;
 /* time formatter strings for date/time
     I picked 32-length char arrays because some people might want really funky time formatters.
     Who am I to judge?
@@ -916,6 +919,7 @@ int main(int argc, char *argv[]) {
         {"clock", no_argument, NULL, 'k'},
         {"indicator", no_argument, NULL, 0},
         {"refresh-rate", required_argument, NULL, 0},
+        {"no-composite", no_argument, NULL, 0},
         
         {"timestr", required_argument, NULL, 0},
         {"datestr", required_argument, NULL, 0},
@@ -1223,6 +1227,9 @@ int main(int argc, char *argv[]) {
                         refresh_rate = 1.0;
                     }
                 }
+                else if (strcmp(longopts[optind].name, "no-composite") == 0) {
+                    composite = false;
+                }
                 break;
             case 'f':
                 show_failed_attempts = true;
diff --git a/xcb.c b/xcb.c
@@ -25,6 +25,7 @@
 #include "unlock_indicator.h"
 
 extern auth_state_t auth_state;
+extern bool composite;
 
 xcb_connection_t *conn;
 xcb_screen_t *screen;
@@ -109,26 +110,28 @@ xcb_window_t open_fullscreen_window(xcb_connection_t *conn, xcb_screen_t *scr, c
     xcb_window_t win = xcb_generate_id(conn);
     xcb_window_t parent_win = scr->root;
 
-    /* Check whether the composite extension is available */
-    const xcb_query_extension_reply_t *extension_query = NULL;
-    xcb_generic_error_t *error = NULL;
-    xcb_composite_get_overlay_window_cookie_t cookie;
-    xcb_composite_get_overlay_window_reply_t *composite_reply = NULL;
-
-    extension_query = xcb_get_extension_data(conn, &xcb_composite_id);
-    if (extension_query && extension_query->present) {
-        /* When composition is used, we need to use the composite overlay
-         * window instead of the normal root window to be able to cover
-         * composited windows */
-        cookie = xcb_composite_get_overlay_window(conn, scr->root);
-        composite_reply = xcb_composite_get_overlay_window_reply(conn, cookie, &error);
-
-        if (!error && composite_reply) {
-            parent_win = composite_reply->overlay_win;
+    if (composite) {
+        /* Check whether the composite extension is available */
+        const xcb_query_extension_reply_t *extension_query = NULL;
+        xcb_generic_error_t *error = NULL;
+        xcb_composite_get_overlay_window_cookie_t cookie;
+        xcb_composite_get_overlay_window_reply_t *composite_reply = NULL;
+
+        extension_query = xcb_get_extension_data(conn, &xcb_composite_id);
+        if (extension_query && extension_query->present) {
+            /* When composition is used, we need to use the composite overlay
+             * window instead of the normal root window to be able to cover
+             * composited windows */
+            cookie = xcb_composite_get_overlay_window(conn, scr->root);
+            composite_reply = xcb_composite_get_overlay_window_reply(conn, cookie, &error);
+
+            if (!error && composite_reply) {
+                parent_win = composite_reply->overlay_win;
+            }
+
+            free(composite_reply);
+            free(error);
         }
-
-        free(composite_reply);
-        free(error);
     }
 
     if (pixmap == XCB_NONE) {