From 2d8a32a9e45472fedcf2ed52b6a798c55db7510e Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Wed, 13 Feb 2013 16:17:19 +0200 Subject: [PATCH] window: add surface pointer to widget So that given a widget, we can access the surface specific data, like buffers, and input and opaque regions. Signed-off-by: Pekka Paalanen --- clients/window.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/clients/window.c b/clients/window.c index 1bfbc78..f83ea01 100644 --- a/clients/window.c +++ b/clients/window.c @@ -245,6 +245,7 @@ struct window { struct widget { struct window *window; + struct surface *surface; struct tooltip *tooltip; struct wl_list child_list; struct wl_list link; @@ -1369,15 +1370,16 @@ window_find_widget(struct window *window, int32_t x, int32_t y) } static struct widget * -widget_create(struct window *window, void *data) +widget_create(struct window *window, struct surface *surface, void *data) { struct widget *widget; widget = malloc(sizeof *widget); memset(widget, 0, sizeof *widget); widget->window = window; + widget->surface = surface; widget->user_data = data; - widget->allocation = window->main_surface->allocation; + widget->allocation = surface->allocation; wl_list_init(&widget->child_list); widget->opaque = 0; widget->tooltip = NULL; @@ -1392,7 +1394,7 @@ window_add_widget(struct window *window, void *data) { struct widget *widget; - widget = widget_create(window, data); + widget = widget_create(window, window->main_surface, data); wl_list_init(&widget->link); window->main_surface->widget = widget; @@ -1404,7 +1406,7 @@ widget_add_widget(struct widget *parent, void *data) { struct widget *widget; - widget = widget_create(parent->window, data); + widget = widget_create(parent->window, parent->surface, data); wl_list_insert(parent->child_list.prev, &widget->link); return widget; @@ -1734,7 +1736,7 @@ frame_resize_handler(struct widget *widget, struct widget *child = frame->child; struct rectangle allocation; struct display *display = widget->window->display; - struct surface *surface = widget->window->main_surface; + struct surface *surface = widget->surface; struct frame_button * button; struct theme *t = display->theme; int x_l, x_r, y, w, h; -- 2.7.4