desktop-shell: Rename panel_widget to panel_launcher
This commit is contained in:
+26
-24
@@ -75,7 +75,7 @@ struct output {
|
|||||||
struct background *background;
|
struct background *background;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct panel_widget {
|
struct panel_launcher {
|
||||||
struct widget *widget;
|
struct widget *widget;
|
||||||
struct panel *panel;
|
struct panel *panel;
|
||||||
cairo_surface_t *icon;
|
cairo_surface_t *icon;
|
||||||
@@ -144,7 +144,7 @@ show_menu(struct panel *panel, struct input *input, uint32_t time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panel_activate_widget(struct panel *panel, struct panel_widget *widget)
|
panel_launcher_activate(struct panel_launcher *widget)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
@@ -164,10 +164,10 @@ panel_activate_widget(struct panel *panel, struct panel_widget *widget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panel_draw_widget(struct widget *widget, void *data)
|
panel_draw_launcher(struct widget *widget, void *data)
|
||||||
{
|
{
|
||||||
cairo_t *cr = data;
|
cairo_t *cr = data;
|
||||||
struct panel_widget *pi;
|
struct panel_launcher *pi;
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
double dx, dy;
|
double dx, dy;
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ panel_redraw_handler(struct window *window, void *data)
|
|||||||
|
|
||||||
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
|
cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
|
||||||
cairo_translate(cr, 10, 32 / 2);
|
cairo_translate(cr, 10, 32 / 2);
|
||||||
window_for_each_widget(window, panel_draw_widget, cr);
|
window_for_each_widget(window, panel_draw_launcher, cr);
|
||||||
|
|
||||||
cairo_destroy(cr);
|
cairo_destroy(cr);
|
||||||
cairo_surface_destroy(surface);
|
cairo_surface_destroy(surface);
|
||||||
@@ -230,31 +230,30 @@ panel_redraw_handler(struct window *window, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panel_widget_enter_handler(struct widget *widget, struct input *input,
|
panel_launcher_enter_handler(struct widget *widget, struct input *input,
|
||||||
uint32_t time, int32_t x, int32_t y, void *data)
|
uint32_t time, int32_t x, int32_t y, void *data)
|
||||||
{
|
{
|
||||||
widget_schedule_redraw(widget);
|
widget_schedule_redraw(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panel_widget_leave_handler(struct widget *widget,
|
panel_launcher_leave_handler(struct widget *widget,
|
||||||
struct input *input, void *data)
|
struct input *input, void *data)
|
||||||
{
|
{
|
||||||
widget_schedule_redraw(widget);
|
widget_schedule_redraw(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panel_widget_button_handler(struct widget *widget,
|
panel_launcher_button_handler(struct widget *widget,
|
||||||
struct input *input, uint32_t time,
|
struct input *input, uint32_t time,
|
||||||
int button, int state, void *data)
|
int button, int state, void *data)
|
||||||
{
|
{
|
||||||
struct panel *panel = data;
|
struct panel_launcher *launcher;
|
||||||
struct panel_widget *pi;
|
|
||||||
|
|
||||||
pi = widget_get_user_data(widget);
|
launcher = widget_get_user_data(widget);
|
||||||
widget_schedule_redraw(widget);
|
widget_schedule_redraw(widget);
|
||||||
if (state == 0)
|
if (state == 0)
|
||||||
panel_activate_widget(panel, pi);
|
panel_launcher_activate(launcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -304,20 +303,23 @@ panel_create(struct display *display)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
panel_add_widget(struct panel *panel, const char *icon, const char *path)
|
panel_add_launcher(struct panel *panel, const char *icon, const char *path)
|
||||||
{
|
{
|
||||||
struct panel_widget *widget;
|
struct panel_launcher *launcher;
|
||||||
|
|
||||||
widget = malloc(sizeof *widget);
|
launcher = malloc(sizeof *launcher);
|
||||||
memset(widget, 0, sizeof *widget);
|
memset(launcher, 0, sizeof *launcher);
|
||||||
widget->icon = cairo_image_surface_create_from_png(icon);
|
launcher->icon = cairo_image_surface_create_from_png(icon);
|
||||||
widget->path = strdup(path);
|
launcher->path = strdup(path);
|
||||||
widget->panel = panel;
|
launcher->panel = panel;
|
||||||
|
|
||||||
widget->widget = window_add_widget(panel->window, widget);
|
launcher->widget = window_add_widget(panel->window, launcher);
|
||||||
widget_set_enter_handler(widget->widget, panel_widget_enter_handler);
|
widget_set_enter_handler(launcher->widget,
|
||||||
widget_set_leave_handler(widget->widget, panel_widget_leave_handler);
|
panel_launcher_enter_handler);
|
||||||
widget_set_button_handler(widget->widget, panel_widget_button_handler);
|
widget_set_leave_handler(launcher->widget,
|
||||||
|
panel_launcher_leave_handler);
|
||||||
|
widget_set_button_handler(launcher->widget,
|
||||||
|
panel_launcher_button_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -614,7 +616,7 @@ launcher_section_done(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each(output, &desktop->outputs, link)
|
wl_list_for_each(output, &desktop->outputs, link)
|
||||||
panel_add_widget(output->panel,
|
panel_add_launcher(output->panel,
|
||||||
key_launcher_icon, key_launcher_path);
|
key_launcher_icon, key_launcher_path);
|
||||||
|
|
||||||
free(key_launcher_icon);
|
free(key_launcher_icon);
|
||||||
|
|||||||
Reference in New Issue
Block a user