From 2e1615dfd4d997448523b6585d86a13fc2030ed4 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Wed, 31 May 2017 13:47:08 +0200 Subject: [PATCH] i3lock: add --no-composite option --- .../i3lock/i3lock-2.9-no-composite.patch | 98 +++++++++++++++++++ .../i3lock/i3lock-2.9-revert-composite.patch | 71 -------------- satellites/i3lock.sat | 8 +- 3 files changed, 102 insertions(+), 75 deletions(-) create mode 100644 satellites/extrafiles/i3lock/i3lock-2.9-no-composite.patch delete mode 100644 satellites/extrafiles/i3lock/i3lock-2.9-revert-composite.patch diff --git a/satellites/extrafiles/i3lock/i3lock-2.9-no-composite.patch b/satellites/extrafiles/i3lock/i3lock-2.9-no-composite.patch new file mode 100644 index 0000000..20198c1 --- /dev/null +++ b/satellites/extrafiles/i3lock/i3lock-2.9-no-composite.patch @@ -0,0 +1,98 @@ +# Adapted from: https://github.com/chrjguill/i3lock-color/commit/d9f2e04bab3c5f2bed674edd085355da255f892b + ++++ i3lock.1 +@@ -110,6 +110,10 @@ + Enables debug logging. + Note, that this will log the password used for authentication to stdout. + ++.TP ++.B \-\-no-composite ++Some compositors have problems with i3lock trying to render over them. If you're having graphical problems, try this arg. ++ + .SH DPMS + + The \-d (\-\-dpms) option was removed from i3lock in version 2.8. There were ++++ i3lock.c +@@ -90,6 +90,9 @@ + bool ignore_empty_password = false; + bool skip_repeated_empty_password = false; + ++/* there's some issues with compositing currently. Let's supply an arg to disable it. */ ++bool composite = true; ++ + /* isutf, u8_dec © 2005 Jeff Bezanson, public domain */ + #define isutf(c) (((c)&0xC0) != 0x80) + +@@ -835,6 +838,7 @@ + {"ignore-empty-password", no_argument, NULL, 'e'}, + {"inactivity-timeout", required_argument, NULL, 'I'}, + {"show-failed-attempts", no_argument, NULL, 'f'}, ++ {"no-composite", no_argument, NULL, 0}, + {NULL, no_argument, NULL, 0}}; + + if ((pw = getpwuid(getuid())) == NULL) +@@ -896,6 +900,8 @@ + case 0: + if (strcmp(longopts[optind].name, "debug") == 0) + debug_mode = true; ++ else if (strcmp(longopts[optind].name, "no-composite") == 0) ++ composite = false; + break; + case 'f': + show_failed_attempts = true; ++++ 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 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 (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; ++ } + +- if (!error && composite_reply) { +- parent_win = composite_reply->overlay_win; ++ free(composite_reply); ++ free(error); + } +- +- free(composite_reply); +- free(error); + } + + if (pixmap == XCB_NONE) { diff --git a/satellites/extrafiles/i3lock/i3lock-2.9-revert-composite.patch b/satellites/extrafiles/i3lock/i3lock-2.9-revert-composite.patch deleted file mode 100644 index 58ef56b..0000000 --- a/satellites/extrafiles/i3lock/i3lock-2.9-revert-composite.patch +++ /dev/null @@ -1,71 +0,0 @@ -+++ Makefile -@@ -15,8 +15,8 @@ - CFLAGS += -pipe - CFLAGS += -Wall - CPPFLAGS += -D_GNU_SOURCE --CFLAGS += $(shell $(PKG_CONFIG) --cflags cairo xcb-composite xcb-xinerama xcb-atom xcb-image xcb-xkb xkbcommon xkbcommon-x11) --LIBS += $(shell $(PKG_CONFIG) --libs cairo xcb-composite xcb-xinerama xcb-atom xcb-image xcb-xkb xkbcommon xkbcommon-x11) -+CFLAGS += $(shell $(PKG_CONFIG) --cflags cairo xcb-xinerama xcb-atom xcb-image xcb-xkb xkbcommon xkbcommon-x11) -+LIBS += $(shell $(PKG_CONFIG) --libs cairo xcb-xinerama xcb-atom xcb-image xcb-xkb xkbcommon xkbcommon-x11) - LIBS += -lev - LIBS += -lm - -+++ README.md -@@ -25,7 +25,6 @@ - - libxcb-util - - libpam-dev - - libcairo-dev --- libxcb-composite0 - - libxcb-xinerama - - libev - - libx11-dev -+++ xcb.c -@@ -11,7 +11,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -107,29 +106,6 @@ - uint32_t mask = 0; - uint32_t values[3]; - 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; -- } -- -- free(composite_reply); -- free(error); -- } - - if (pixmap == XCB_NONE) { - mask |= XCB_CW_BACK_PIXEL; -@@ -151,8 +127,8 @@ - - xcb_create_window(conn, - XCB_COPY_FROM_PARENT, -- win, /* the window id */ -- parent_win, -+ win, /* the window id */ -+ scr->root, /* parent == root */ - 0, 0, - scr->width_in_pixels, - scr->height_in_pixels, /* dimensions */ diff --git a/satellites/i3lock.sat b/satellites/i3lock.sat index 7701154..18688e0 100644 --- a/satellites/i3lock.sat +++ b/satellites/i3lock.sat @@ -6,16 +6,16 @@ define_option 'pam: Use PAM for authentication' dlextract "https://i3wm.org/$name/$name-$version.tar.bz2" \ '3d0038021778f3178192f566dc87a931' -extrafile "$name-$version-revert-composite.patch" +extrafile "$name-$version-no-composite.patch" option !pam extrafile "$name-$version-no-pam.patch" header_end cd "$name-$version" -# Remove the code that tries to covert composited notifications, -# since it breaks a lot of stuff. Awaiting fix from upstream. +# Give user the option to skip the code that tries to cover composited notifications, +# since it breaks with some compositors. # See: https://github.com/i3/i3lock/issues/128 -patch -p0 -i "../$name-$version-revert-composite.patch" +patch -p0 -i "../$name-$version-no-composite.patch" option !pam patch -p0 -i "../$name-$version-no-pam.patch"