[PATCH weston 2/8] westoy: Remove unused support for window parents
Kristian Høgsberg
hoegsberg at gmail.com
Wed Nov 13 16:44:55 PST 2013
On Tue, Nov 12, 2013 at 08:19:58PM -0500, Jasper St. Pierre wrote:
> It seems that this was only used by the popup menu infrastructure,
> which can handle this all on its own. Implementing e.g. transients
> in the future can be done with a simple xdg_shell_set_transient_for.
> ---
> clients/image.c | 2 +-
> clients/terminal.c | 2 +-
> clients/view.c | 2 +-
> clients/window.c | 28 ++++++++++++----------------
> clients/window.h | 2 +-
> 5 files changed, 16 insertions(+), 20 deletions(-)
>
> diff --git a/clients/image.c b/clients/image.c
> index c73d0c0..3a52c22 100644
> --- a/clients/image.c
> +++ b/clients/image.c
> @@ -336,7 +336,7 @@ fullscreen_handler(struct window *window, void *data)
> }
>
> static void
> -close_handler(struct window *window, void *data)
> +close_handler(void *data)
> {
> struct image *image = data;
>
> diff --git a/clients/terminal.c b/clients/terminal.c
> index a321a1e..d09f94b 100644
> --- a/clients/terminal.c
> +++ b/clients/terminal.c
> @@ -2212,7 +2212,7 @@ fullscreen_handler(struct window *window, void *data)
> }
>
> static void
> -close_handler(struct window *window, void *data)
> +close_handler(void *data)
> {
> struct terminal *terminal = data;
>
> diff --git a/clients/view.c b/clients/view.c
> index cedef08..4ac9ca5 100644
> --- a/clients/view.c
> +++ b/clients/view.c
> @@ -168,7 +168,7 @@ fullscreen_handler(struct window *window, void *data)
> }
>
> static void
> -close_handler(struct window *window, void *data)
> +close_handler(void *data)
> {
> struct view *view = data;
>
> diff --git a/clients/window.c b/clients/window.c
> index 0afd46b..46372d2 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -221,7 +221,6 @@ struct surface {
>
> struct window {
> struct display *display;
> - struct window *parent;
> struct wl_list window_output_list;
> char *title;
> struct rectangle saved_allocation;
> @@ -358,6 +357,7 @@ struct window_frame {
>
> struct menu {
> struct window *window;
> + struct window *parent;
> struct widget *widget;
> struct input *input;
> struct frame *frame;
> @@ -2274,8 +2274,7 @@ frame_menu_func(struct window *window,
> switch (index) {
> case 0: /* close */
> if (window->close_handler)
> - window->close_handler(window->parent,
> - window->user_data);
> + window->close_handler(window->user_data);
> else
> display_exit(window->display);
> break;
> @@ -2392,8 +2391,7 @@ frame_handle_status(struct window_frame *frame, struct input *input,
>
> if (status & FRAME_STATUS_CLOSE) {
> if (window->close_handler)
> - window->close_handler(window->parent,
> - window->user_data);
> + window->close_handler(window->user_data);
> else
> display_exit(window->display);
> return;
> @@ -2894,8 +2892,7 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard,
> input->modifiers == MOD_ALT_MASK &&
> state == WL_KEYBOARD_KEY_STATE_PRESSED) {
> if (window->close_handler)
> - window->close_handler(window->parent,
> - window->user_data);
> + window->close_handler(window->user_data);
> else
> display_exit(window->display);
> } else if (window->key_handler) {
> @@ -4230,8 +4227,7 @@ surface_create(struct window *window)
> }
>
> static struct window *
> -window_create_internal(struct display *display,
> - struct window *parent, int type)
> +window_create_internal(struct display *display, int type)
You didn't fix up window_create_transient() to work with this change,
the patch doesn't compile. I ammended the obvious fix.
Kristian
> {
> struct window *window;
> struct surface *surface;
> @@ -4239,7 +4235,6 @@ window_create_internal(struct display *display,
> window = xzalloc(sizeof *window);
> wl_list_init(&window->subsurface_list);
> window->display = display;
> - window->parent = parent;
>
> surface = surface_create(window);
> window->main_surface = surface;
> @@ -4283,13 +4278,13 @@ window_create_internal(struct display *display,
> struct window *
> window_create(struct display *display)
> {
> - return window_create_internal(display, NULL, TYPE_NONE);
> + return window_create_internal(display, TYPE_NONE);
> }
>
> struct window *
> window_create_custom(struct display *display)
> {
> - return window_create_internal(display, NULL, TYPE_CUSTOM);
> + return window_create_internal(display, TYPE_CUSTOM);
> }
>
> struct window *
> @@ -4374,8 +4369,8 @@ menu_button_handler(struct widget *widget,
> (menu->release_count > 0 || time - menu->time > 500)) {
> /* Either relase after press-drag-release or
> * click-motion-click. */
> - menu->func(menu->window->parent, input,
> - menu->current, menu->window->parent->user_data);
> + menu->func(menu->parent, input,
> + menu->current, menu->parent->user_data);
> input_ungrab(input);
> menu_destroy(menu);
> } else if (state == WL_POINTER_BUTTON_STATE_RELEASED) {
> @@ -4437,13 +4432,14 @@ window_show_menu(struct display *display,
> if (!menu)
> return;
>
> - window = window_create_internal(parent->display, parent, TYPE_MENU);
> + window = window_create_internal(parent->display, TYPE_MENU);
> if (!window) {
> free(menu);
> return;
> }
>
> menu->window = window;
> + menu->parent = parent;
> menu->widget = window_add_widget(menu->window, menu);
> window_set_buffer_scale (menu->window, window_get_buffer_scale (parent));
> window_set_buffer_transform (menu->window, window_get_buffer_transform (parent));
> @@ -4477,7 +4473,7 @@ window_show_menu(struct display *display,
> frame_interior(menu->frame, &ix, &iy, NULL, NULL);
> wl_shell_surface_set_popup(window->shell_surface, input->seat,
> display_get_serial(window->display),
> - window->parent->main_surface->surface,
> + parent->main_surface->surface,
> window->x - ix, window->y - iy, 0);
> }
>
> diff --git a/clients/window.h b/clients/window.h
> index 59e483e..d5e40ed 100644
> --- a/clients/window.h
> +++ b/clients/window.h
> @@ -214,7 +214,7 @@ typedef void (*window_drop_handler_t)(struct window *window,
> struct input *input,
> int32_t x, int32_t y, void *data);
>
> -typedef void (*window_close_handler_t)(struct window *window, void *data);
> +typedef void (*window_close_handler_t)(void *data);
> typedef void (*window_fullscreen_handler_t)(struct window *window, void *data);
>
> typedef void (*window_output_handler_t)(struct window *window, struct output *output,
> --
> 1.8.4.2
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list