summaryrefslogtreecommitdiff
path: root/clients/wscreensaver.c
diff options
context:
space:
mode:
authorPekka Paalanen <ppaalanen@gmail.com>2012-01-17 16:10:41 +0200
committerKristian Høgsberg <krh@bitplanet.net>2012-01-17 10:59:29 -0500
commit57cd0ed9164a325ef87aee55b21ac317dc0e6c9e (patch)
tree6b71534c672557e5696e2e7bca10fd87fdd23887 /clients/wscreensaver.c
parent4d733ee246798a838e4fa625b355fd058eddf3dc (diff)
wscreensaver: get decorations back
In the great toytoolkit widget revolution, wscreensaver demo mode lost its window decorations. Bring them back. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Diffstat (limited to 'clients/wscreensaver.c')
-rw-r--r--clients/wscreensaver.c61
1 files changed, 23 insertions, 38 deletions
diff --git a/clients/wscreensaver.c b/clients/wscreensaver.c
index a66cc8b..27364f0 100644
--- a/clients/wscreensaver.c
+++ b/clients/wscreensaver.c
@@ -69,9 +69,7 @@ frame_callback(void *data, struct wl_callback *callback, uint32_t time)
struct ModeInfo *mi = data;
window_schedule_redraw(mi->window);
-
- if (callback)
- wl_callback_destroy(callback);
+ wl_callback_destroy(callback);
}
static const struct wl_callback_listener listener = {
@@ -172,62 +170,49 @@ errout:
}
static struct ModeInfo *
-create_modeinfo(struct wscreensaver *wscr, struct window *window)
+create_wscreensaver_instance(struct wscreensaver *screensaver,
+ struct wl_output *output, int width, int height)
{
+ static int instance;
struct ModeInfo *mi;
struct rectangle drawarea;
- static int instance;
mi = calloc(1, sizeof *mi);
if (!mi)
return NULL;
- window_get_allocation(window, &drawarea);
-
- mi->priv = wscr;
- mi->eglctx = EGL_NO_CONTEXT;
-
- mi->window = window;
- mi->widget = window_add_widget(window, mi);
- widget_set_redraw_handler(mi->widget, redraw_handler);
-
- mi->instance_number = instance++; /* XXX */
- mi->width = drawarea.width;
- mi->height = drawarea.height;
-
- return mi;
-}
-
-static struct ModeInfo *
-create_wscreensaver_instance(struct wscreensaver *screensaver,
- struct wl_output *output, int width, int height)
-{
- struct ModeInfo *mi;
- struct window *window;
-
- window = window_create(screensaver->display, width, height);
- if (!window) {
+ mi->window = window_create(screensaver->display, width, height);
+ if (!mi->window) {
fprintf(stderr, "%s: creating a window failed.\n", progname);
+ free(mi);
return NULL;
}
- window_set_transparent(window, 0);
- window_set_title(window, progname);
+ window_set_transparent(mi->window, 0);
+ window_set_title(mi->window, progname);
if (screensaver->interface) {
- window_set_custom(window);
+ window_set_custom(mi->window);
+ mi->widget = window_add_widget(mi->window, mi);
screensaver_set_surface(screensaver->interface,
- window_get_wl_shell_surface(window),
+ window_get_wl_shell_surface(mi->window),
output);
+ } else {
+ mi->widget = frame_create(mi->window, mi);
}
+ widget_set_redraw_handler(mi->widget, redraw_handler);
- mi = create_modeinfo(screensaver, window);
- if (!mi)
- return NULL;
+ mi->priv = screensaver;
+ mi->eglctx = EGL_NO_CONTEXT;
+ mi->instance_number = instance++; /* XXX */
+
+ widget_get_allocation(mi->widget, &drawarea);
+ mi->width = drawarea.width;
+ mi->height = drawarea.height;
screensaver->plugin->init(mi);
- frame_callback(mi, NULL, 0);
+ window_schedule_resize(mi->window, width, height);
return mi;
}