window: Move widget focus handler to the widget
diff --git a/clients/window.c b/clients/window.c
index 33b7b95..6f1c65b 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -134,7 +134,6 @@
 	window_motion_handler_t motion_handler;
 	window_enter_handler_t enter_handler;
 	window_leave_handler_t leave_handler;
-	window_widget_focus_handler_t widget_focus_handler;
 	window_data_handler_t data_handler;
 	window_drop_handler_t drop_handler;
 	window_close_handler_t close_handler;
@@ -150,8 +149,10 @@
 };
 
 struct widget {
+	struct window *window;
 	struct wl_list link;
 	struct rectangle allocation;
+	widget_focus_handler_t focus_handler;
 	void *user_data;
 };
 
@@ -1056,6 +1057,7 @@
 
 	widget = malloc(sizeof *widget);
 	memset(widget, 0, sizeof *widget);
+	widget->window = window;
 	widget->user_data = data;
 	wl_list_insert(window->widget_list.prev, &widget->link);
 
@@ -1100,6 +1102,18 @@
 }
 
 void
+widget_set_focus_handler(struct widget *widget, widget_focus_handler_t handler)
+{
+	widget->focus_handler = handler;
+}
+
+void
+widget_schedule_redraw(struct widget *widget)
+{
+	window_schedule_redraw(widget->window);
+}
+
+void
 window_draw(struct window *window)
 {
 	if (!window->decoration)
@@ -1232,8 +1246,8 @@
 
 	window->focus_widget = focus;
 	data = focus ? focus->user_data : NULL;
-	if (window->widget_focus_handler)
-		window->widget_focus_handler(window, focus, data);
+	if (focus && focus->focus_handler)
+		focus->focus_handler(focus, data);
 }
 
 static void
@@ -2039,13 +2053,6 @@
 }
 
 void
-window_set_widget_focus_handler(struct window *window,
-				window_widget_focus_handler_t handler)
-{
-	window->widget_focus_handler = handler;
-}
-
-void
 window_set_data_handler(struct window *window, window_data_handler_t handler)
 {
 	window->data_handler = handler;