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>
dev
Pekka Paalanen 13 years ago committed by Kristian Høgsberg
parent 4d733ee246
commit 57cd0ed916
  1. 59
      clients/wscreensaver.c

@ -69,8 +69,6 @@ frame_callback(void *data, struct wl_callback *callback, uint32_t time)
struct ModeInfo *mi = data; struct ModeInfo *mi = data;
window_schedule_redraw(mi->window); window_schedule_redraw(mi->window);
if (callback)
wl_callback_destroy(callback); wl_callback_destroy(callback);
} }
@ -172,62 +170,49 @@ errout:
} }
static struct ModeInfo * 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 ModeInfo *mi;
struct rectangle drawarea; struct rectangle drawarea;
static int instance;
mi = calloc(1, sizeof *mi); mi = calloc(1, sizeof *mi);
if (!mi) if (!mi)
return NULL; return NULL;
window_get_allocation(window, &drawarea); mi->window = window_create(screensaver->display, width, height);
if (!mi->window) {
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) {
fprintf(stderr, "%s: creating a window failed.\n", progname); fprintf(stderr, "%s: creating a window failed.\n", progname);
free(mi);
return NULL; return NULL;
} }
window_set_transparent(window, 0); window_set_transparent(mi->window, 0);
window_set_title(window, progname); window_set_title(mi->window, progname);
if (screensaver->interface) { 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, screensaver_set_surface(screensaver->interface,
window_get_wl_shell_surface(window), window_get_wl_shell_surface(mi->window),
output); output);
} else {
mi->widget = frame_create(mi->window, mi);
} }
widget_set_redraw_handler(mi->widget, redraw_handler);
mi = create_modeinfo(screensaver, window); mi->priv = screensaver;
if (!mi) mi->eglctx = EGL_NO_CONTEXT;
return NULL; mi->instance_number = instance++; /* XXX */
widget_get_allocation(mi->widget, &drawarea);
mi->width = drawarea.width;
mi->height = drawarea.height;
screensaver->plugin->init(mi); screensaver->plugin->init(mi);
frame_callback(mi, NULL, 0); window_schedule_resize(mi->window, width, height);
return mi; return mi;
} }

Loading…
Cancel
Save