mirror of
https://github.com/lbonn/rofi
synced 2024-11-29 23:30:27 +00:00
parent
cb6afae71f
commit
fce721a105
4 changed files with 11 additions and 3 deletions
|
@ -1501,6 +1501,8 @@ This option is only available on the \fB\fCelement-text\fR widget.
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fBplaceholder\fP: Set the displayed text (String) when nothing is entered.
|
\fBplaceholder\fP: Set the displayed text (String) when nothing is entered.
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
|
\fBplaceholder-markup\fP: If true, placeholder text supports pango markup for stylizing.
|
||||||
|
.IP \(bu 2
|
||||||
\fBplaceholder-color\fP: Color of the placeholder text.
|
\fBplaceholder-color\fP: Color of the placeholder text.
|
||||||
.IP \(bu 2
|
.IP \(bu 2
|
||||||
\fBblink\fP: Enable/Disable blinking on an input textbox (Boolean).
|
\fBblink\fP: Enable/Disable blinking on an input textbox (Boolean).
|
||||||
|
|
|
@ -929,6 +929,7 @@ The following properties are currently supported:
|
||||||
* **width**: override the desired width for the textbox.
|
* **width**: override the desired width for the textbox.
|
||||||
* **content**: Set the displayed text (String).
|
* **content**: Set the displayed text (String).
|
||||||
* **placeholder**: Set the displayed text (String) when nothing is entered.
|
* **placeholder**: Set the displayed text (String) when nothing is entered.
|
||||||
|
* **placeholder-markup**: If true, placeholder text supports pango markup for stylizing.
|
||||||
* **placeholder-color**: Color of the placeholder text.
|
* **placeholder-color**: Color of the placeholder text.
|
||||||
* **blink**: Enable/Disable blinking on an input textbox (Boolean).
|
* **blink**: Enable/Disable blinking on an input textbox (Boolean).
|
||||||
* **markup**: Force markup on, beware that only valid pango markup strings are shown.
|
* **markup**: Force markup on, beware that only valid pango markup strings are shown.
|
||||||
|
|
|
@ -63,7 +63,7 @@ typedef struct {
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
short cursor;
|
short cursor;
|
||||||
char *text;
|
char *text;
|
||||||
const char *placeholder;
|
char *placeholder;
|
||||||
int show_placeholder;
|
int show_placeholder;
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
int tbft;
|
int tbft;
|
||||||
|
|
|
@ -227,7 +227,11 @@ textbox *textbox_create(widget *parent, WidgetType type, const char *name,
|
||||||
const char *placeholder =
|
const char *placeholder =
|
||||||
rofi_theme_get_string(WIDGET(tb), "placeholder", NULL);
|
rofi_theme_get_string(WIDGET(tb), "placeholder", NULL);
|
||||||
if (placeholder) {
|
if (placeholder) {
|
||||||
tb->placeholder = placeholder;
|
if (rofi_theme_get_boolean(WIDGET(tb), "placeholder-markup", FALSE)) {
|
||||||
|
tb->placeholder = g_strdup(placeholder);
|
||||||
|
} else {
|
||||||
|
tb->placeholder = g_markup_escape_text(placeholder, -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
textbox_text(tb, txt ? txt : "");
|
textbox_text(tb, txt ? txt : "");
|
||||||
textbox_cursor_end(tb);
|
textbox_cursor_end(tb);
|
||||||
|
@ -310,7 +314,7 @@ static void __textbox_update_pango_text(textbox *tb) {
|
||||||
pango_layout_set_attributes(tb->layout, NULL);
|
pango_layout_set_attributes(tb->layout, NULL);
|
||||||
if (tb->placeholder && (tb->text == NULL || tb->text[0] == 0)) {
|
if (tb->placeholder && (tb->text == NULL || tb->text[0] == 0)) {
|
||||||
tb->show_placeholder = TRUE;
|
tb->show_placeholder = TRUE;
|
||||||
pango_layout_set_text(tb->layout, tb->placeholder, -1);
|
pango_layout_set_markup(tb->layout, tb->placeholder, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tb->show_placeholder = FALSE;
|
tb->show_placeholder = FALSE;
|
||||||
|
@ -442,6 +446,7 @@ static void textbox_free(widget *wid) {
|
||||||
}
|
}
|
||||||
g_free(tb->text);
|
g_free(tb->text);
|
||||||
|
|
||||||
|
g_free(tb->placeholder);
|
||||||
if (tb->layout != NULL) {
|
if (tb->layout != NULL) {
|
||||||
g_object_unref(tb->layout);
|
g_object_unref(tb->layout);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue