From 12a06184e733554bafc76e643b49067fcd758fc0 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Tue, 6 Oct 2020 14:33:05 +0200 Subject: Merge the upstream changes from i3lock --- i3lock.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'i3lock.c') diff --git a/i3lock.c b/i3lock.c index 4ef0f73..f7c5bdc 100644 --- a/i3lock.c +++ b/i3lock.c @@ -46,7 +46,6 @@ #include #endif #include -#include #include #include #include @@ -54,7 +53,7 @@ #include #include #include -#ifdef __OpenBSD__ +#ifdef HAVE_EXPLICIT_BZERO #include /* explicit_bzero(3) */ #endif #include @@ -153,7 +152,7 @@ bool skip_repeated_empty_password = false; * Decrements i to point to the previous unicode glyph * */ -void u8_dec(char *s, int *i) { +static void u8_dec(char *s, int *i) { (void)(isutf(s[--(*i)]) || isutf(s[--(*i)]) || isutf(s[--(*i)]) || --(*i)); } @@ -223,7 +222,7 @@ static bool load_compose_table(const char *locale) { * */ static void clear_password_memory(void) { -#ifdef __OpenBSD__ +#ifdef HAVE_EXPLICIT_BZERO /* Use explicit_bzero(3) which was explicitly designed not to be * optimized out by the compiler. */ explicit_bzero(password, strlen(password)); @@ -664,7 +663,7 @@ static void process_xkb_event(xcb_generic_event_t *gevent) { * and also redraw the image, if any. * */ -void handle_screen_resize(void) { +static void handle_screen_resize(void) { xcb_get_geometry_cookie_t geomc; xcb_get_geometry_reply_t *geom; geomc = xcb_get_geometry(conn, screen->root); @@ -1119,6 +1118,8 @@ int main(int argc, char *argv[]) { err(EXIT_FAILURE, "getpwuid() failed"); if ((username = pw->pw_name) == NULL) errx(EXIT_FAILURE, "pw->pw_name is NULL."); + if (getenv("WAYLAND_DISPLAY") != NULL) + errx(EXIT_FAILURE, "i3lock is a program for X11 and does not work on Wayland. Try https://github.com/swaywm/swaylock instead"); #ifdef EXTRAS char *optstring = "hvnbDdELc:B:G:F:J:O:R:r:S:T:W:X:x:Y:y:Z:p:ui:teI:f"; @@ -1497,7 +1498,8 @@ int main(int argc, char *argv[]) { free(image_raw_format); /* Pixmap on which the image is rendered to (if any) */ - xcb_pixmap_t bg_pixmap = draw_image(last_resolution); + xcb_pixmap_t bg_pixmap = create_bg_pixmap(conn, screen, last_resolution, color); + draw_image(bg_pixmap, last_resolution); xcb_window_t stolen_focus = find_focused_window(conn, screen->root); -- cgit v1.3