From 2de6b5083a8228e93a023d5a62eca3a271727ac6 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Tue, 22 Jan 2019 17:38:34 +0000 Subject: [PATCH 1/3] unicode.c: remove utf8_decode --- unicode.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/unicode.c b/unicode.c index 5070e08..3d81a34 100644 --- a/unicode.c +++ b/unicode.c @@ -13,41 +13,6 @@ size_t utf8_chsize(uint32_t ch) { return 4; } -static const uint8_t masks[] = { - 0x7F, - 0x1F, - 0x0F, - 0x07, - 0x03, - 0x01 -}; - -uint32_t utf8_decode(const char **char_str) { - uint8_t **s = (uint8_t **)char_str; - - uint32_t cp = 0; - if (**s < 128) { - // shortcut - cp = **s; - ++*s; - return cp; - } - int size = utf8_size((char *)*s); - if (size == -1) { - ++*s; - return UTF8_INVALID; - } - uint8_t mask = masks[size - 1]; - cp = **s & mask; - ++*s; - while (--size) { - cp <<= 6; - cp |= **s & 0x3f; - ++*s; - } - return cp; -} - size_t utf8_encode(char *str, uint32_t ch) { size_t len = 0; uint8_t first; From f698711ddc0c45523cdc1a4e746a1319afd72e26 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Wed, 23 Jan 2019 12:18:22 +0000 Subject: [PATCH 2/3] background-image.c: remove stdbool header --- background-image.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/background-image.c b/background-image.c index d2ab03b..c765bdf 100644 --- a/background-image.c +++ b/background-image.c @@ -1,5 +1,4 @@ #include -#include #include "background-image.h" #include "cairo.h" #include "log.h" @@ -30,7 +29,7 @@ cairo_surface_t *load_background_image(const char *path) { if (!pixbuf) { swaylock_log(LOG_ERROR, "Failed to load background image (%s).", err->message); - return false; + return NULL; } image = gdk_cairo_image_surface_create_from_pixbuf(pixbuf); g_object_unref(pixbuf); From b87e2a4916684944c31d452166631b39a01e57c6 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Wed, 23 Jan 2019 12:20:24 +0000 Subject: [PATCH 3/3] Remove references to pango --- .build.yml | 1 - README.md | 1 - include/pool-buffer.h | 2 -- meson.build | 4 ---- pool-buffer.c | 5 ----- 5 files changed, 13 deletions(-) diff --git a/.build.yml b/.build.yml index 1c1bc12..59bc722 100644 --- a/.build.yml +++ b/.build.yml @@ -1,7 +1,6 @@ image: alpine/edge packages: - meson - - pango-dev - cairo-dev - wayland-dev - wayland-protocols diff --git a/README.md b/README.md index bae1753..3f30cd5 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,6 @@ Install dependencies: * wayland * wayland-protocols \* * libxkbcommon -* pango * cairo * gdk-pixbuf2 \*\* * pam (optional) diff --git a/include/pool-buffer.h b/include/pool-buffer.h index 54f5be0..0ebf787 100644 --- a/include/pool-buffer.h +++ b/include/pool-buffer.h @@ -1,7 +1,6 @@ #ifndef _SWAY_BUFFERS_H #define _SWAY_BUFFERS_H #include -#include #include #include #include @@ -10,7 +9,6 @@ struct pool_buffer { struct wl_buffer *buffer; cairo_surface_t *surface; cairo_t *cairo; - PangoContext *pango; uint32_t width, height; void *data; size_t size; diff --git a/meson.build b/meson.build index c937e19..3255d39 100644 --- a/meson.build +++ b/meson.build @@ -38,8 +38,6 @@ wayland_client = dependency('wayland-client') wayland_protos = dependency('wayland-protocols', version: '>=1.14') xkbcommon = dependency('xkbcommon') cairo = dependency('cairo') -pango = dependency('pango') -pangocairo = dependency('pangocairo') gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) libpam = cc.find_library('pam', required: get_option('pam')) crypt = cc.find_library('crypt', required: not libpam.found()) @@ -120,8 +118,6 @@ dependencies = [ client_protos, gdk_pixbuf, math, - pango, - pangocairo, xkbcommon, wayland_client, ] diff --git a/pool-buffer.c b/pool-buffer.c index 2eadb4f..b3f1ef2 100644 --- a/pool-buffer.c +++ b/pool-buffer.c @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include @@ -93,7 +92,6 @@ static struct pool_buffer *create_buffer(struct wl_shm *shm, buf->surface = cairo_image_surface_create_for_data(data, CAIRO_FORMAT_ARGB32, width, height, stride); buf->cairo = cairo_create(buf->surface); - buf->pango = pango_cairo_create_context(buf->cairo); wl_buffer_add_listener(buf->buffer, &buffer_listener, buf); return buf; @@ -109,9 +107,6 @@ void destroy_buffer(struct pool_buffer *buffer) { if (buffer->surface) { cairo_surface_destroy(buffer->surface); } - if (buffer->pango) { - g_object_unref(buffer->pango); - } if (buffer->data) { munmap(buffer->data, buffer->size); }