summaryrefslogtreecommitdiff
path: root/src/entry_backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/entry_backend')
-rw-r--r--src/entry_backend/harfbuzz.c9
-rw-r--r--src/entry_backend/pango.c9
2 files changed, 16 insertions, 2 deletions
diff --git a/src/entry_backend/harfbuzz.c b/src/entry_backend/harfbuzz.c
index 5d9ba99..fd3c3d7 100644
--- a/src/entry_backend/harfbuzz.c
+++ b/src/entry_backend/harfbuzz.c
@@ -231,7 +231,11 @@ void entry_backend_harfbuzz_update(struct entry *entry)
/* Render the entry text */
hb_buffer_clear_contents(buffer);
setup_hb_buffer(buffer);
- if (entry->hide_input) {
+ if (entry->input_utf8_length == 0) {
+ color = entry->placeholder_color;
+ cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
+ hb_buffer_add_utf8(buffer, entry->placeholder_text, -1, 0, -1);
+ } else if (entry->hide_input) {
size_t char_len = N_ELEM(entry->hidden_character_utf8);
for (size_t i = 0; i < entry->input_utf32_length; i++) {
hb_buffer_add_utf8(buffer, entry->hidden_character_utf8, char_len, 0, char_len);
@@ -246,6 +250,9 @@ void entry_backend_harfbuzz_update(struct entry *entry)
cairo_font_extents_t font_extents;
cairo_font_extents(cr, &font_extents);
+ color = entry->foreground_color;
+ cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
+
uint32_t num_results;
if (entry->num_results == 0) {
num_results = entry->results.count;
diff --git a/src/entry_backend/pango.c b/src/entry_backend/pango.c
index d533742..c3dadef 100644
--- a/src/entry_backend/pango.c
+++ b/src/entry_backend/pango.c
@@ -86,7 +86,11 @@ void entry_backend_pango_update(struct entry *entry)
cairo_translate(cr, entry->prompt_padding, 0);
/* Render the entry text */
- if (entry->hide_input) {
+ if (entry->input_utf8_length == 0) {
+ color = entry->placeholder_color;
+ cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
+ pango_layout_set_text(layout, entry->placeholder_text, -1);
+ } else if (entry->hide_input) {
/*
* Pango needs to be passed the whole text at once, so we need
* to manually replicate the replacement character in a buffer.
@@ -107,6 +111,9 @@ void entry_backend_pango_update(struct entry *entry)
pango_layout_get_pixel_extents(entry->pango.layout, &ink_rect, &logical_rect);
logical_rect.width = MAX(logical_rect.width, (int)entry->input_width);
+ color = entry->foreground_color;
+ cairo_set_source_rgba(cr, color.r, color.g, color.b, color.a);
+
uint32_t num_results;
if (entry->num_results == 0) {
num_results = entry->results.count;