From: David Herrmann Date: Mon, 1 Oct 2012 12:14:28 +0000 (+0200) Subject: wlt: toolkit: pass flags to resize and redraw callbacks X-Git-Tag: kmscon-7~422 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b1ff113559d1115a552cb1f751afcd918a7c570;p=platform%2Fupstream%2Fkmscon.git wlt: toolkit: pass flags to resize and redraw callbacks If a window is maximized, fullscreen or should be drawn without decorations, then the widgets must be notified about it. Hence, this adds a flags argument to resize and redraw callbacks. Signed-off-by: David Herrmann --- diff --git a/src/wlt_terminal.c b/src/wlt_terminal.c index b55dafa..95929be 100644 --- a/src/wlt_terminal.c +++ b/src/wlt_terminal.c @@ -169,15 +169,16 @@ static int draw_cell(struct tsm_screen *scr, return 0; } -static void widget_redraw(struct wlt_widget *widget, void *data) +static void widget_redraw(struct wlt_widget *widget, unsigned int flags, + void *data) { struct wlt_terminal *term = data; tsm_screen_draw(term->scr, NULL, draw_cell, NULL, term); } -static void widget_resize(struct wlt_widget *widget, struct wlt_rect *alloc, - void *data) +static void widget_resize(struct wlt_widget *widget, unsigned int flags, + struct wlt_rect *alloc, void *data) { struct wlt_terminal *term = data; int ret; @@ -202,6 +203,7 @@ static void widget_resize(struct wlt_widget *widget, struct wlt_rect *alloc, } static void widget_prepare_resize(struct wlt_widget *widget, + unsigned int flags, unsigned int width, unsigned int height, unsigned int *min_width, unsigned int *min_height, diff --git a/src/wlt_theme.c b/src/wlt_theme.c index b32624d..025208d 100644 --- a/src/wlt_theme.c +++ b/src/wlt_theme.c @@ -231,7 +231,8 @@ static void widget_draw_fallback(struct wlt_theme *theme) } } -static void widget_redraw(struct wlt_widget *widget, void *data) +static void widget_redraw(struct wlt_widget *widget, unsigned int flags, + void *data) { struct wlt_theme *theme = data; unsigned int width, height; @@ -252,6 +253,7 @@ static void widget_redraw(struct wlt_widget *widget, void *data) } static void widget_prepare_resize(struct wlt_widget *widget, + unsigned int flags, unsigned int width, unsigned int height, unsigned int *min_width, unsigned int *min_height, @@ -280,8 +282,8 @@ static void widget_prepare_resize(struct wlt_widget *widget, *new_height += minh; } -static void widget_resize(struct wlt_widget *widget, struct wlt_rect *alloc, - void *data) +static void widget_resize(struct wlt_widget *widget, unsigned int flags, + struct wlt_rect *alloc, void *data) { struct wlt_theme *theme = data; unsigned int nwidth, nheight; diff --git a/src/wlt_toolkit.c b/src/wlt_toolkit.c index 0b11cf5..bad5c0b 100644 --- a/src/wlt_toolkit.c +++ b/src/wlt_toolkit.c @@ -963,9 +963,13 @@ static void wlt_window_do_redraw(struct wlt_window *wnd, { struct shl_dlist *iter; struct wlt_widget *widget; - unsigned int x, y; + unsigned int x, y, flags; struct wlt_rect alloc; + flags = 0; + if (wnd->maximized) + flags |= WLT_WINDOW_MAXIMIZED; + alloc.x = 0; alloc.y = 0; alloc.width = wnd->buffer.width; @@ -973,7 +977,7 @@ static void wlt_window_do_redraw(struct wlt_window *wnd, shl_dlist_for_each(iter, &wnd->widget_list) { widget = shl_dlist_entry(iter, struct wlt_widget, list); if (widget->resize_cb) - widget->resize_cb(widget, &alloc, widget->data); + widget->resize_cb(widget, flags, &alloc, widget->data); } memset(wnd->buffer.data, 0, @@ -983,7 +987,7 @@ static void wlt_window_do_redraw(struct wlt_window *wnd, shl_dlist_for_each(iter, &wnd->widget_list) { widget = shl_dlist_entry(iter, struct wlt_widget, list); if (widget->redraw_cb) - widget->redraw_cb(widget, widget->data); + widget->redraw_cb(widget, flags, widget->data); } wnd->skip_damage = false; @@ -1014,11 +1018,15 @@ static int resize_window(struct wlt_window *wnd, unsigned int width, struct wlt_pool *old_pool = NULL; size_t nsize; int ret; - unsigned int oldw, oldh, neww, newh, minw, minh; + unsigned int oldw, oldh, neww, newh, minw, minh, flags; if (!wnd || !width || !height) return -EINVAL; + flags = 0; + if (wnd->maximized) + flags |= WLT_WINDOW_MAXIMIZED; + neww = 0; newh = 0; minw = 0; @@ -1026,7 +1034,9 @@ static int resize_window(struct wlt_window *wnd, unsigned int width, shl_dlist_for_each(iter, &wnd->widget_list) { widget = shl_dlist_entry(iter, struct wlt_widget, list); if (widget->prepare_resize_cb) - widget->prepare_resize_cb(widget, width, height, + widget->prepare_resize_cb(widget, + flags, + width, height, &minw, &minh, &neww, &newh, widget->data); diff --git a/src/wlt_toolkit.h b/src/wlt_toolkit.h index f1ea93d..f4d9b98 100644 --- a/src/wlt_toolkit.h +++ b/src/wlt_toolkit.h @@ -73,15 +73,19 @@ enum cursor_type { WLT_CURSOR_NUM, }; +#define WLT_WINDOW_MAXIMIZED 0x01 + typedef void (*wlt_display_cb) (struct wlt_display *disp, unsigned int event, void *data); typedef void (*wlt_window_close_cb) (struct wlt_window *wnd, void *data); typedef void (*wlt_widget_redraw_cb) (struct wlt_widget *widget, + unsigned int flags, void *data); typedef void (*wlt_widget_destroy_cb) (struct wlt_widget *widget, void *data); typedef void (*wlt_widget_prepare_resize_cb) (struct wlt_widget *widget, + unsigned int flags, unsigned int width, unsigned int height, unsigned int *min_width, @@ -90,6 +94,7 @@ typedef void (*wlt_widget_prepare_resize_cb) (struct wlt_widget *widget, unsigned int *new_height, void *data); typedef void (*wlt_widget_resize_cb) (struct wlt_widget *widget, + unsigned int flags, struct wlt_rect *allocation, void *data); typedef void (*wlt_widget_pointer_enter_cb) (struct wlt_widget *widget,