window: Move widget focus handler to the widget
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 05c444c..febac78 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -230,10 +230,9 @@
}
static void
-panel_widget_focus_handler(struct window *window,
- struct widget *focus, void *data)
+panel_widget_focus_handler(struct widget *widget, void *data)
{
- window_schedule_redraw(window);
+ widget_schedule_redraw(widget);
}
static void
@@ -285,7 +284,6 @@
window_set_custom(panel->window);
window_set_user_data(panel->window, panel);
window_set_button_handler(panel->window, panel_button_handler);
- window_set_widget_focus_handler(panel->window, panel_widget_focus_handler);
return panel;
}
@@ -300,7 +298,9 @@
widget->icon = cairo_image_surface_create_from_png(icon);
widget->path = strdup(path);
widget->panel = panel;
- window_add_widget(panel->window, widget);
+
+ widget->widget = window_add_widget(panel->window, widget);
+ widget_set_focus_handler(widget->widget, panel_widget_focus_handler);
}
static void
@@ -438,10 +438,9 @@
}
static void
-unlock_dialog_widget_focus_handler(struct window *window,
- struct widget *focus, void *data)
+unlock_dialog_widget_focus_handler(struct widget *widget, void *data)
{
- window_schedule_redraw(window);
+ widget_schedule_redraw(widget);
}
static struct unlock_dialog *
@@ -464,9 +463,9 @@
window_set_keyboard_focus_handler(dialog->window,
unlock_dialog_keyboard_focus_handler);
window_set_button_handler(dialog->window, unlock_dialog_button_handler);
- window_set_widget_focus_handler(dialog->window,
- unlock_dialog_widget_focus_handler);
dialog->button = window_add_widget(dialog->window, NULL);
+ widget_set_focus_handler(dialog->button,
+ unlock_dialog_widget_focus_handler);
desktop_shell_set_lock_surface(desktop->shell,
window_get_wl_shell_surface(dialog->window));