summaryrefslogtreecommitdiff
path: root/src/entry_backend
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-06-10 19:36:29 +0100
committerPhil Jones <philj56@gmail.com>2022-06-10 19:36:29 +0100
commit7c31982244f179cb2f51bb1d81b21ad4efd649ba (patch)
tree07c612f81b6b5a15aa2c0587fdee7077ceaeba36 /src/entry_backend
parenta6ac47fb763fd4448c0269e274f061226fa0f10a (diff)
Various small changes.
- Split the compgen and history sorting parts of compgen(), for future dmenu-like work. - Add a separate tofi-compgen executable. - Remove harfbuzz-glib usage, as we shouldn't be doing any complicated unicode stuff.
Diffstat (limited to 'src/entry_backend')
-rw-r--r--src/entry_backend/harfbuzz.c2
-rw-r--r--src/entry_backend/pango.c9
2 files changed, 3 insertions, 8 deletions
diff --git a/src/entry_backend/harfbuzz.c b/src/entry_backend/harfbuzz.c
index 78d0757..89ed13b 100644
--- a/src/entry_backend/harfbuzz.c
+++ b/src/entry_backend/harfbuzz.c
@@ -1,6 +1,5 @@
#include <cairo/cairo.h>
#include <harfbuzz/hb-ft.h>
-#include <harfbuzz/hb-glib.h>
#include <math.h>
#include <wchar.h>
#include "harfbuzz.h"
@@ -162,7 +161,6 @@ void entry_backend_init(
log_debug("Creating Harfbuzz buffer.\n");
hb_buffer_t *buffer = hb_buffer_create();
entry->backend.hb_buffer = buffer;
- hb_buffer_set_unicode_funcs(buffer, hb_glib_get_unicode_funcs());
setup_hb_buffer(buffer);
/* Draw the prompt now, as this only needs to be done once */
diff --git a/src/entry_backend/pango.c b/src/entry_backend/pango.c
index 787dfd8..6aafaef 100644
--- a/src/entry_backend/pango.c
+++ b/src/entry_backend/pango.c
@@ -27,10 +27,6 @@ void entry_backend_init(struct entry *entry, uint32_t *width, uint32_t *height,
entry->backend.layout = pango_layout_new(context);
log_debug("Setting Pango text.\n");
pango_layout_set_text(entry->backend.layout, "run: ", -1);
- int prompt_width;
- int prompt_height;
- log_debug("Get Pango pixel size.\n");
- pango_layout_get_pixel_size(entry->backend.layout, &prompt_width, &prompt_height);
log_debug("First Pango draw.\n");
pango_cairo_update_layout(cr, entry->backend.layout);
@@ -40,6 +36,8 @@ void entry_backend_init(struct entry *entry, uint32_t *width, uint32_t *height,
pango_cairo_show_layout(cr, entry->backend.layout);
/* Move and clip so we don't draw over the prompt */
+ int prompt_width;
+ pango_layout_get_pixel_size(entry->backend.layout, &prompt_width, NULL);
cairo_translate(cr, prompt_width, 0);
*width -= prompt_width;
cairo_rectangle(cr, 0, 0, *width, *height);
@@ -63,9 +61,8 @@ void entry_backend_update(struct entry *entry)
pango_cairo_update_layout(cr, layout);
pango_cairo_show_layout(cr, layout);
- int width;
int height;
- pango_layout_get_size(entry->backend.layout, &width, &height);
+ pango_layout_get_size(layout, NULL, &height);
for (size_t i = 0; i < 5; i++) {
cairo_translate(cr, 0, (int)(height / PANGO_SCALE));