summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/client/cairo.h5
-rw-r--r--swaybar/CMakeLists.txt6
-rw-r--r--swaybar/render.c9
-rw-r--r--swaylock/main.c8
-rw-r--r--wayland/cairo.c9
5 files changed, 20 insertions, 17 deletions
diff --git a/include/client/cairo.h b/include/client/cairo.h
index ad8390c4..46c53566 100644
--- a/include/client/cairo.h
+++ b/include/client/cairo.h
@@ -1,6 +1,11 @@
1#ifndef _SWAY_CAIRO_H 1#ifndef _SWAY_CAIRO_H
2#define _SWAY_CAIRO_H 2#define _SWAY_CAIRO_H
3 3
4#include <stdint.h>
5#include <cairo/cairo.h>
6
7void cairo_set_source_u32(cairo_t *cairo, uint32_t color);
8
4#ifdef WITH_GDK_PIXBUF 9#ifdef WITH_GDK_PIXBUF
5#include <gdk-pixbuf/gdk-pixbuf.h> 10#include <gdk-pixbuf/gdk-pixbuf.h>
6 11
diff --git a/swaybar/CMakeLists.txt b/swaybar/CMakeLists.txt
index 60975f40..5b865083 100644
--- a/swaybar/CMakeLists.txt
+++ b/swaybar/CMakeLists.txt
@@ -25,6 +25,12 @@ target_link_libraries(swaybar
25 ${JSONC_LIBRARIES} 25 ${JSONC_LIBRARIES}
26) 26)
27 27
28if (WITH_GDK_PIXBUF)
29 include_directories(
30 ${GDK_PIXBUF_INCLUDE_DIRS}
31 )
32endif()
33
28install( 34install(
29 TARGETS swaybar 35 TARGETS swaybar
30 RUNTIME 36 RUNTIME
diff --git a/swaybar/render.c b/swaybar/render.c
index ce5d10b4..1573a373 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -2,6 +2,7 @@
2#include <stdint.h> 2#include <stdint.h>
3#include <string.h> 3#include <string.h>
4 4
5#include "client/cairo.h"
5#include "client/pango.h" 6#include "client/pango.h"
6#include "client/window.h" 7#include "client/window.h"
7#include "bar/config.h" 8#include "bar/config.h"
@@ -15,14 +16,6 @@ static int ws_horizontal_padding = 5;
15static double ws_vertical_padding = 1.5; 16static double ws_vertical_padding = 1.5;
16static int ws_spacing = 1; 17static int ws_spacing = 1;
17 18
18static void cairo_set_source_u32(cairo_t *cairo, uint32_t color) {
19 cairo_set_source_rgba(cairo,
20 ((color & 0xFF000000) >> 24) / 255.0,
21 ((color & 0xFF0000) >> 16) / 255.0,
22 ((color & 0xFF00) >> 8) / 255.0,
23 (color & 0xFF) / 255.0);
24}
25
26/** 19/**
27 * Renders a sharp line of any width and height. 20 * Renders a sharp line of any width and height.
28 * 21 *
diff --git a/swaylock/main.c b/swaylock/main.c
index 98e26839..f0fe1d00 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -115,14 +115,6 @@ void notify_key(enum wl_keyboard_key_state state, xkb_keysym_t sym, uint32_t cod
115 } 115 }
116} 116}
117 117
118static void cairo_set_source_u32(cairo_t *cairo, uint32_t color) {
119 cairo_set_source_rgba(cairo,
120 (color >> (3*8) & 0xFF) / 255.0,
121 (color >> (2*8) & 0xFF) / 255.0,
122 (color >> (1*8) & 0xFF) / 255.0,
123 (color >> (0*8) & 0xFF) / 255.0);
124}
125
126void render_color(struct window *window, uint32_t color) { 118void render_color(struct window *window, uint32_t color) {
127 cairo_set_source_u32(window->cairo, color); 119 cairo_set_source_u32(window->cairo, color);
128 cairo_paint(window->cairo); 120 cairo_paint(window->cairo);
diff --git a/wayland/cairo.c b/wayland/cairo.c
index 7462b10a..ba439d9d 100644
--- a/wayland/cairo.c
+++ b/wayland/cairo.c
@@ -1,6 +1,13 @@
1#include <cairo/cairo.h>
2#include "client/cairo.h" 1#include "client/cairo.h"
3 2
3void cairo_set_source_u32(cairo_t *cairo, uint32_t color) {
4 cairo_set_source_rgba(cairo,
5 (color >> (3*8) & 0xFF) / 255.0,
6 (color >> (2*8) & 0xFF) / 255.0,
7 (color >> (1*8) & 0xFF) / 255.0,
8 (color >> (0*8) & 0xFF) / 255.0);
9}
10
4#ifdef WITH_GDK_PIXBUF 11#ifdef WITH_GDK_PIXBUF
5#include <gdk-pixbuf/gdk-pixbuf.h> 12#include <gdk-pixbuf/gdk-pixbuf.h>
6 13