]> git.lizzy.rs Git - bspwm.git/commitdiff
Move get_color_pixel() from helpers.h to bspwm.h
authorEmanuele Torre <torreemanuele6@gmail.com>
Tue, 26 May 2020 21:17:59 +0000 (23:17 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Sun, 26 Jul 2020 12:36:52 +0000 (14:36 +0200)
src/bspwm.c
src/bspwm.h
src/helpers.c
src/helpers.h

index 88c48e94b99671bd21914739ab0af9a54cd1d1ac..981bbd640d4d2ec40b48c4a2a91695f0c38bd5c1 100644 (file)
@@ -485,3 +485,16 @@ void sig_handler(int sig)
                running = false;
        }
 }
+
+/* Adapted from i3wm */
+uint32_t get_color_pixel(const char *color)
+{
+       unsigned int red, green, blue;
+       if (sscanf(color + 1, "%02x%02x%02x", &red, &green, &blue) == 3) {
+               /* We set the first 8 bits high to have 100% opacity in case of a 32 bit
+                * color depth visual. */
+               return (0xFF << 24) | (red << 16 | green << 8 | blue);
+       } else {
+               return screen->black_pixel;
+       }
+}
index 9ad04756c0b08991f70c94a9bcbc67cad90ba625..35bded5de3ab7fc4ac3f67187b8d03dd4a75bcfe 100644 (file)
@@ -92,5 +92,6 @@ void register_events(void);
 void cleanup(void);
 bool check_connection (xcb_connection_t *dpy);
 void sig_handler(int sig);
+uint32_t get_color_pixel(const char *color);
 
 #endif
index 1fc555f5a1850327bc2774b0eae2049dde6b70ad..57a82bdd8939da1ff9d1a7f760ac6f119cd28b5e 100644 (file)
@@ -181,19 +181,6 @@ int vasprintf(char **buf, const char *fmt, va_list args)
        return size;
 }
 
-/* Adapted from i3wm */
-uint32_t get_color_pixel(const char *color)
-{
-       unsigned int red, green, blue;
-       if (sscanf(color + 1, "%02x%02x%02x", &red, &green, &blue) == 3) {
-               /* We set the first 8 bits high to have 100% opacity in case of a 32 bit
-                * color depth visual. */
-               return (0xFF << 24) | (red << 16 | green << 8 | blue);
-       } else {
-               return screen->black_pixel;
-       }
-}
-
 bool is_hex_color(const char *color)
 {
        if (color[0] != '#' || strlen(color) != 7) {
index e51e5d06e2c36e8b969fc52292a6aa5534485ca7..c65ebbe5cccba3ee60cc767480ddd5ffa57c8abb 100644 (file)
@@ -82,7 +82,6 @@ char *copy_string(char *str, size_t len);
 char *mktempfifo(const char *template);
 int asprintf(char **buf, const char *fmt, ...);
 int vasprintf(char **buf, const char *fmt, va_list args);
-uint32_t get_color_pixel(const char *color);
 bool is_hex_color(const char *color);
 
 #endif