summaryrefslogtreecommitdiff
path: root/src/wlt_toolkit.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-10-01 14:14:28 +0200
committerDavid Herrmann <dh.herrmann@googlemail.com>2012-10-01 14:14:28 +0200
commit1b1ff113559d1115a552cb1f751afcd918a7c570 (patch)
tree6f5ba20241584eeb8750bc47db537d20f0bce1fb /src/wlt_toolkit.c
parentc77e3d8c0c069d5ee0cb618f90817a5520b9d4fe (diff)
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 <dh.herrmann@googlemail.com>
Diffstat (limited to 'src/wlt_toolkit.c')
-rw-r--r--src/wlt_toolkit.c20
1 files changed, 15 insertions, 5 deletions
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);