From 7885890df8be868a12b561858c3feeba9bd7a321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 1 Jan 2014 23:57:42 -0800 Subject: [PATCH] editor: Add keyboard_focus handler to schedule repaint This let the editor client repaint the frame to indicate it's active when it receives keyboard focus. --- clients/editor.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/clients/editor.c b/clients/editor.c index 6e38426ed..b34aafa9d 100644 --- a/clients/editor.c +++ b/clients/editor.c @@ -1098,6 +1098,16 @@ editor_button_handler(struct widget *widget, } } + +static void +keyboard_focus_handler(struct window *window, + struct input *device, void *data) +{ + struct editor *editor = data; + + window_schedule_redraw(editor->window); +} + static void key_handler(struct window *window, struct input *input, uint32_t time, @@ -1233,6 +1243,8 @@ main(int argc, char *argv[]) window_set_title(editor.window, "Text Editor"); window_set_key_handler(editor.window, key_handler); + window_set_keyboard_focus_handler(editor.window, + keyboard_focus_handler); window_set_user_data(editor.window, &editor); widget_set_redraw_handler(editor.widget, redraw_handler);