diff options
Diffstat (limited to 'i3lock.c')
| -rw-r--r-- | i3lock.c | 14 |
1 files changed, 8 insertions, 6 deletions
| @@ -46,7 +46,6 @@ | |||
| 46 | #include <security/pam_appl.h> | 46 | #include <security/pam_appl.h> |
| 47 | #endif | 47 | #endif |
| 48 | #include <getopt.h> | 48 | #include <getopt.h> |
| 49 | #include <string.h> | ||
| 50 | #include <ev.h> | 49 | #include <ev.h> |
| 51 | #include <sys/mman.h> | 50 | #include <sys/mman.h> |
| 52 | #include <xkbcommon/xkbcommon.h> | 51 | #include <xkbcommon/xkbcommon.h> |
| @@ -54,7 +53,7 @@ | |||
| 54 | #include <xkbcommon/xkbcommon-x11.h> | 53 | #include <xkbcommon/xkbcommon-x11.h> |
| 55 | #include <cairo.h> | 54 | #include <cairo.h> |
| 56 | #include <cairo/cairo-xcb.h> | 55 | #include <cairo/cairo-xcb.h> |
| 57 | #ifdef __OpenBSD__ | 56 | #ifdef HAVE_EXPLICIT_BZERO |
| 58 | #include <strings.h> /* explicit_bzero(3) */ | 57 | #include <strings.h> /* explicit_bzero(3) */ |
| 59 | #endif | 58 | #endif |
| 60 | #include <xcb/xcb_aux.h> | 59 | #include <xcb/xcb_aux.h> |
| @@ -153,7 +152,7 @@ bool skip_repeated_empty_password = false; | |||
| 153 | * Decrements i to point to the previous unicode glyph | 152 | * Decrements i to point to the previous unicode glyph |
| 154 | * | 153 | * |
| 155 | */ | 154 | */ |
| 156 | void u8_dec(char *s, int *i) { | 155 | static void u8_dec(char *s, int *i) { |
| 157 | (void)(isutf(s[--(*i)]) || isutf(s[--(*i)]) || isutf(s[--(*i)]) || --(*i)); | 156 | (void)(isutf(s[--(*i)]) || isutf(s[--(*i)]) || isutf(s[--(*i)]) || --(*i)); |
| 158 | } | 157 | } |
| 159 | 158 | ||
| @@ -223,7 +222,7 @@ static bool load_compose_table(const char *locale) { | |||
| 223 | * | 222 | * |
| 224 | */ | 223 | */ |
| 225 | static void clear_password_memory(void) { | 224 | static void clear_password_memory(void) { |
| 226 | #ifdef __OpenBSD__ | 225 | #ifdef HAVE_EXPLICIT_BZERO |
| 227 | /* Use explicit_bzero(3) which was explicitly designed not to be | 226 | /* Use explicit_bzero(3) which was explicitly designed not to be |
| 228 | * optimized out by the compiler. */ | 227 | * optimized out by the compiler. */ |
| 229 | explicit_bzero(password, strlen(password)); | 228 | explicit_bzero(password, strlen(password)); |
| @@ -664,7 +663,7 @@ static void process_xkb_event(xcb_generic_event_t *gevent) { | |||
| 664 | * and also redraw the image, if any. | 663 | * and also redraw the image, if any. |
| 665 | * | 664 | * |
| 666 | */ | 665 | */ |
| 667 | void handle_screen_resize(void) { | 666 | static void handle_screen_resize(void) { |
| 668 | xcb_get_geometry_cookie_t geomc; | 667 | xcb_get_geometry_cookie_t geomc; |
| 669 | xcb_get_geometry_reply_t *geom; | 668 | xcb_get_geometry_reply_t *geom; |
| 670 | geomc = xcb_get_geometry(conn, screen->root); | 669 | geomc = xcb_get_geometry(conn, screen->root); |
| @@ -1119,6 +1118,8 @@ int main(int argc, char *argv[]) { | |||
| 1119 | err(EXIT_FAILURE, "getpwuid() failed"); | 1118 | err(EXIT_FAILURE, "getpwuid() failed"); |
| 1120 | if ((username = pw->pw_name) == NULL) | 1119 | if ((username = pw->pw_name) == NULL) |
| 1121 | errx(EXIT_FAILURE, "pw->pw_name is NULL."); | 1120 | errx(EXIT_FAILURE, "pw->pw_name is NULL."); |
| 1121 | if (getenv("WAYLAND_DISPLAY") != NULL) | ||
| 1122 | errx(EXIT_FAILURE, "i3lock is a program for X11 and does not work on Wayland. Try https://github.com/swaywm/swaylock instead"); | ||
| 1122 | 1123 | ||
| 1123 | #ifdef EXTRAS | 1124 | #ifdef EXTRAS |
| 1124 | char *optstring = "hvnbDdELc:B:G:F:J:O:R:r:S:T:W:X:x:Y:y:Z:p:ui:teI:f"; | 1125 | 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[]) { | |||
| 1497 | free(image_raw_format); | 1498 | free(image_raw_format); |
| 1498 | 1499 | ||
| 1499 | /* Pixmap on which the image is rendered to (if any) */ | 1500 | /* Pixmap on which the image is rendered to (if any) */ |
| 1500 | xcb_pixmap_t bg_pixmap = draw_image(last_resolution); | 1501 | xcb_pixmap_t bg_pixmap = create_bg_pixmap(conn, screen, last_resolution, color); |
| 1502 | draw_image(bg_pixmap, last_resolution); | ||
| 1501 | 1503 | ||
| 1502 | xcb_window_t stolen_focus = find_focused_window(conn, screen->root); | 1504 | xcb_window_t stolen_focus = find_focused_window(conn, screen->root); |
| 1503 | 1505 | ||
