blob: 653372a3c73abaf04940f9a1316ea7628be0676a [file] [log] [blame]
Alexander Larsson73469ed2013-05-28 16:23:34 +02001/*
2 * Copyright © 2008 Kristian Høgsberg
3 * Copyright © 2012 Intel Corporation
4 *
Bryce Harrington1f6b0d12015-06-10 22:48:59 -07005 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
Alexander Larsson73469ed2013-05-28 16:23:34 +020011 *
Bryce Harrington1f6b0d12015-06-10 22:48:59 -070012 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
Alexander Larsson73469ed2013-05-28 16:23:34 +020023 */
24
Andrew Wedgbury9cd661e2014-04-07 12:40:35 +010025#include "config.h"
26
Alexander Larsson73469ed2013-05-28 16:23:34 +020027#include <stdint.h>
28#include <stdio.h>
29#include <stdlib.h>
30#include <stdarg.h>
31#include <string.h>
32#include <math.h>
33#include <cairo.h>
34
35#include <linux/input.h>
36#include <wayland-client.h>
37#include "window.h"
Jonas Ådahl496adb32015-11-17 16:00:27 +080038#include "fullscreen-shell-unstable-v1-client-protocol.h"
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -050039
40struct fs_output {
41 struct wl_list link;
42 struct output *output;
43};
Alexander Larsson73469ed2013-05-28 16:23:34 +020044
45struct fullscreen {
46 struct display *display;
47 struct window *window;
48 struct widget *widget;
Jonas Ådahl496adb32015-11-17 16:00:27 +080049 struct zwp_fullscreen_shell_v1 *fshell;
50 enum zwp_fullscreen_shell_v1_present_method present_method;
Alexander Larsson73469ed2013-05-28 16:23:34 +020051 int width, height;
52 int fullscreen;
53 float pointer_x, pointer_y;
Jasper St. Pierreaf314bb2014-05-12 11:23:44 -040054 int draw_cursor;
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -050055
56 struct wl_list output_list;
57 struct fs_output *current_output;
Alexander Larsson73469ed2013-05-28 16:23:34 +020058};
59
60static void
61fullscreen_handler(struct window *window, void *data)
62{
63 struct fullscreen *fullscreen = data;
64
65 fullscreen->fullscreen ^= 1;
66 window_set_fullscreen(window, fullscreen->fullscreen);
67}
68
69static void
Alexander Larsson73469ed2013-05-28 16:23:34 +020070draw_string(cairo_t *cr,
71 const char *fmt, ...)
72{
73 char buffer[4096];
74 char *p, *end;
75 va_list argp;
76 cairo_text_extents_t text_extents;
77 cairo_font_extents_t font_extents;
78
79 cairo_save(cr);
80
81 cairo_select_font_face(cr, "sans",
82 CAIRO_FONT_SLANT_NORMAL,
83 CAIRO_FONT_WEIGHT_NORMAL);
84 cairo_set_font_size(cr, 14);
85
86 cairo_font_extents (cr, &font_extents);
87
88 va_start(argp, fmt);
89
90 vsnprintf(buffer, sizeof(buffer), fmt, argp);
91
92 p = buffer;
93 while (*p) {
94 end = strchr(p, '\n');
95 if (end)
96 *end = 0;
97
98 cairo_show_text(cr, p);
99 cairo_text_extents (cr, p, &text_extents);
100 cairo_rel_move_to (cr, -text_extents.x_advance, font_extents.height);
101
102 if (end)
103 p = end + 1;
104 else
105 break;
106 }
107
108 va_end(argp);
109
110 cairo_restore(cr);
111
112}
113
114static void
115redraw_handler(struct widget *widget, void *data)
116{
117 struct fullscreen *fullscreen = data;
118 struct rectangle allocation;
119 cairo_surface_t *surface;
120 cairo_t *cr;
121 int i;
122 double x, y, border;
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500123 const char *method_name[] = { "default", "center", "zoom", "zoom_crop", "stretch"};
Alexander Larsson73469ed2013-05-28 16:23:34 +0200124
125 surface = window_get_surface(fullscreen->window);
126 if (surface == NULL ||
127 cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
128 fprintf(stderr, "failed to create cairo egl surface\n");
129 return;
130 }
131
132 widget_get_allocation(fullscreen->widget, &allocation);
133
134 cr = widget_cairo_create(widget);
135
136 cairo_set_source_rgb(cr, 0, 0, 0);
137 cairo_paint (cr);
138
139 cairo_set_source_rgb(cr, 0, 0, 1);
140 cairo_set_line_width (cr, 10);
141 cairo_rectangle(cr, 5, 5, allocation.width - 10, allocation.height - 10);
142 cairo_stroke (cr);
143
144 cairo_move_to(cr,
145 allocation.x + 15,
146 allocation.y + 25);
147 cairo_set_source_rgb(cr, 1, 1, 1);
148
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500149 if (fullscreen->fshell) {
150 draw_string(cr,
151 "Surface size: %d, %d\n"
152 "Scale: %d, transform: %d\n"
153 "Pointer: %f,%f\n"
154 "Output: %s, present method: %s\n"
155 "Keys: (s)cale, (t)ransform, si(z)e, (m)ethod,\n"
156 " (o)utput, modes(w)itch, (q)uit\n",
157 fullscreen->width, fullscreen->height,
158 window_get_buffer_scale (fullscreen->window),
159 window_get_buffer_transform (fullscreen->window),
160 fullscreen->pointer_x, fullscreen->pointer_y,
161 method_name[fullscreen->present_method],
162 fullscreen->current_output ? output_get_model(fullscreen->current_output->output): "null");
163 } else {
164 draw_string(cr,
165 "Surface size: %d, %d\n"
166 "Scale: %d, transform: %d\n"
167 "Pointer: %f,%f\n"
168 "Fullscreen: %d\n"
169 "Keys: (s)cale, (t)ransform, si(z)e, (f)ullscreen, (q)uit\n",
170 fullscreen->width, fullscreen->height,
171 window_get_buffer_scale (fullscreen->window),
172 window_get_buffer_transform (fullscreen->window),
173 fullscreen->pointer_x, fullscreen->pointer_y,
174 fullscreen->fullscreen);
175 }
Alexander Larsson73469ed2013-05-28 16:23:34 +0200176
177 y = 100;
178 i = 0;
179 while (y + 60 < fullscreen->height) {
180 border = (i++ % 2 == 0) ? 1 : 0.5;
181
182 x = 50;
183 cairo_set_line_width (cr, border);
184 while (x + 70 < fullscreen->width) {
Jasper St. Pierreaf314bb2014-05-12 11:23:44 -0400185 if (window_has_focus(fullscreen->window) &&
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500186 fullscreen->pointer_x >= x && fullscreen->pointer_x < x + 50 &&
Alexander Larsson73469ed2013-05-28 16:23:34 +0200187 fullscreen->pointer_y >= y && fullscreen->pointer_y < y + 40) {
188 cairo_set_source_rgb(cr, 1, 0, 0);
189 cairo_rectangle(cr,
190 x, y,
191 50, 40);
192 cairo_fill(cr);
193 }
194 cairo_set_source_rgb(cr, 0, 1, 0);
195 cairo_rectangle(cr,
196 x + border/2.0, y + border/2.0,
197 50, 40);
198 cairo_stroke(cr);
199 x += 60;
200 }
201
202 y += 50;
203 }
204
Jasper St. Pierreaf314bb2014-05-12 11:23:44 -0400205 if (window_has_focus(fullscreen->window) && fullscreen->draw_cursor) {
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500206 cairo_set_source_rgb(cr, 1, 1, 1);
207 cairo_set_line_width (cr, 8);
208 cairo_move_to(cr,
209 fullscreen->pointer_x - 12,
210 fullscreen->pointer_y - 12);
211 cairo_line_to(cr,
212 fullscreen->pointer_x + 12,
213 fullscreen->pointer_y + 12);
214 cairo_stroke(cr);
215
216 cairo_move_to(cr,
217 fullscreen->pointer_x + 12,
218 fullscreen->pointer_y - 12);
219 cairo_line_to(cr,
220 fullscreen->pointer_x - 12,
221 fullscreen->pointer_y + 12);
222 cairo_stroke(cr);
223
224 cairo_set_source_rgb(cr, 0, 0, 0);
225 cairo_set_line_width (cr, 4);
226 cairo_move_to(cr,
227 fullscreen->pointer_x - 10,
228 fullscreen->pointer_y - 10);
229 cairo_line_to(cr,
230 fullscreen->pointer_x + 10,
231 fullscreen->pointer_y + 10);
232 cairo_stroke(cr);
233
234 cairo_move_to(cr,
235 fullscreen->pointer_x + 10,
236 fullscreen->pointer_y - 10);
237 cairo_line_to(cr,
238 fullscreen->pointer_x - 10,
239 fullscreen->pointer_y + 10);
240 cairo_stroke(cr);
241 }
242
Alexander Larsson73469ed2013-05-28 16:23:34 +0200243 cairo_destroy(cr);
244}
245
246static void
247key_handler(struct window *window, struct input *input, uint32_t time,
248 uint32_t key, uint32_t sym, enum wl_keyboard_key_state state,
249 void *data)
250{
251 struct fullscreen *fullscreen = data;
252 int transform, scale;
253 static int current_size = 0;
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500254 struct fs_output *fsout;
255 struct wl_output *wl_output;
Alexander Larsson73469ed2013-05-28 16:23:34 +0200256 int widths[] = { 640, 320, 800, 400 };
257 int heights[] = { 480, 240, 600, 300 };
258
259 if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
260 return;
261
262 switch (sym) {
263 case XKB_KEY_t:
264 transform = window_get_buffer_transform (window);
265 transform = (transform + 1) % 8;
266 window_set_buffer_transform(window, transform);
267 window_schedule_redraw(window);
268 break;
269
270 case XKB_KEY_s:
271 scale = window_get_buffer_scale (window);
272 if (scale == 1)
273 scale = 2;
274 else
275 scale = 1;
276 window_set_buffer_scale(window, scale);
277 window_schedule_redraw(window);
278 break;
279
280 case XKB_KEY_z:
281 current_size = (current_size + 1) % 4;
282 fullscreen->width = widths[current_size];
283 fullscreen->height = heights[current_size];
284 window_schedule_resize(fullscreen->window,
285 fullscreen->width, fullscreen->height);
286 break;
287
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500288 case XKB_KEY_m:
289 if (!fullscreen->fshell)
290 break;
291
292 wl_output = NULL;
293 if (fullscreen->current_output)
294 wl_output = output_get_wl_output(fullscreen->current_output->output);
295 fullscreen->present_method = (fullscreen->present_method + 1) % 5;
Jonas Ådahl496adb32015-11-17 16:00:27 +0800296 zwp_fullscreen_shell_v1_present_surface(fullscreen->fshell,
297 window_get_wl_surface(fullscreen->window),
298 fullscreen->present_method,
299 wl_output);
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500300 window_schedule_redraw(window);
301 break;
302
303 case XKB_KEY_o:
304 if (!fullscreen->fshell)
305 break;
306
307 fsout = fullscreen->current_output;
308 wl_output = fsout ? output_get_wl_output(fsout->output) : NULL;
309
310 /* Clear the current presentation */
Jonas Ådahl496adb32015-11-17 16:00:27 +0800311 zwp_fullscreen_shell_v1_present_surface(fullscreen->fshell, NULL,
312 0, wl_output);
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500313
314 if (fullscreen->current_output) {
315 if (fullscreen->current_output->link.next == &fullscreen->output_list)
316 fsout = NULL;
317 else
318 fsout = wl_container_of(fullscreen->current_output->link.next,
319 fsout, link);
320 } else {
321 fsout = wl_container_of(fullscreen->output_list.next,
322 fsout, link);
323 }
324
325 fullscreen->current_output = fsout;
326 wl_output = fsout ? output_get_wl_output(fsout->output) : NULL;
Jonas Ådahl496adb32015-11-17 16:00:27 +0800327 zwp_fullscreen_shell_v1_present_surface(fullscreen->fshell,
328 window_get_wl_surface(fullscreen->window),
329 fullscreen->present_method,
330 wl_output);
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500331 window_schedule_redraw(window);
332 break;
333
334 case XKB_KEY_w:
335 if (!fullscreen->fshell || !fullscreen->current_output)
336 break;
337
338 wl_output = NULL;
339 if (fullscreen->current_output)
340 wl_output = output_get_wl_output(fullscreen->current_output->output);
Jonas Ådahl496adb32015-11-17 16:00:27 +0800341 zwp_fullscreen_shell_mode_feedback_v1_destroy(
342 zwp_fullscreen_shell_v1_present_surface_for_mode(fullscreen->fshell,
343 window_get_wl_surface(fullscreen->window),
344 wl_output, 0));
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500345 window_schedule_redraw(window);
346 break;
347
Alexander Larsson73469ed2013-05-28 16:23:34 +0200348 case XKB_KEY_f:
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500349 if (fullscreen->fshell)
350 break;
Alexander Larsson73469ed2013-05-28 16:23:34 +0200351 fullscreen->fullscreen ^= 1;
352 window_set_fullscreen(window, fullscreen->fullscreen);
353 break;
354
355 case XKB_KEY_q:
356 exit (0);
357 break;
358 }
359}
360
361static int
362motion_handler(struct widget *widget,
363 struct input *input,
364 uint32_t time,
365 float x,
366 float y, void *data)
367{
368 struct fullscreen *fullscreen = data;
369
370 fullscreen->pointer_x = x;
371 fullscreen->pointer_y = y;
372
373 widget_schedule_redraw(widget);
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500374
375 return fullscreen->draw_cursor ? CURSOR_BLANK : CURSOR_LEFT_PTR;
Alexander Larsson73469ed2013-05-28 16:23:34 +0200376}
377
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500378static int
379enter_handler(struct widget *widget,
380 struct input *input,
381 float x, float y, void *data)
382{
383 struct fullscreen *fullscreen = data;
384
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500385 fullscreen->pointer_x = x;
386 fullscreen->pointer_y = y;
387
388 widget_schedule_redraw(widget);
389
390 return fullscreen->draw_cursor ? CURSOR_BLANK : CURSOR_LEFT_PTR;
391}
392
393static void
Alexander Larsson73469ed2013-05-28 16:23:34 +0200394button_handler(struct widget *widget,
395 struct input *input, uint32_t time,
396 uint32_t button, enum wl_pointer_button_state state, void *data)
397{
398 struct fullscreen *fullscreen = data;
399
400 switch (button) {
401 case BTN_LEFT:
402 if (state == WL_POINTER_BUTTON_STATE_PRESSED)
403 window_move(fullscreen->window, input,
404 display_get_serial(fullscreen->display));
405 break;
406 case BTN_RIGHT:
407 if (state == WL_POINTER_BUTTON_STATE_PRESSED)
408 window_show_frame_menu(fullscreen->window, input, time);
409 break;
410 }
411}
412
413static void
Michael Vetter2a18a522015-05-15 17:17:47 +0200414touch_handler(struct widget *widget, struct input *input,
415 uint32_t serial, uint32_t time, int32_t id,
Rusty Lynch1084da52013-08-15 09:10:08 -0700416 float x, float y, void *data)
417{
418 struct fullscreen *fullscreen = data;
Jasper St. Pierre01eaaac2013-11-12 20:19:57 -0500419 window_move(fullscreen->window, input, display_get_serial(fullscreen->display));
Rusty Lynch1084da52013-08-15 09:10:08 -0700420}
421
422static void
Jonas Ådahl496adb32015-11-17 16:00:27 +0800423fshell_capability_handler(void *data, struct zwp_fullscreen_shell_v1 *fshell,
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500424 uint32_t capability)
425{
426 struct fullscreen *fullscreen = data;
427
428 switch (capability) {
Jonas Ådahl496adb32015-11-17 16:00:27 +0800429 case ZWP_FULLSCREEN_SHELL_V1_CAPABILITY_CURSOR_PLANE:
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500430 fullscreen->draw_cursor = 0;
431 break;
432 default:
433 break;
434 }
435}
436
Jonas Ådahl496adb32015-11-17 16:00:27 +0800437struct zwp_fullscreen_shell_v1_listener fullscreen_shell_listener = {
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500438 fshell_capability_handler
439};
440
441static void
Alexander Larsson73469ed2013-05-28 16:23:34 +0200442usage(int error_code)
443{
444 fprintf(stderr, "Usage: fullscreen [OPTIONS]\n\n"
445 " -w <width>\tSet window width to <width>\n"
446 " -h <height>\tSet window height to <height>\n"
447 " --help\tShow this help text\n\n");
448
449 exit(error_code);
450}
451
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500452static void
453output_handler(struct output *output, void *data)
454{
455 struct fullscreen *fullscreen = data;
456 struct fs_output *fsout;
457
458 /* If we've already seen this one, don't add it to the list */
459 wl_list_for_each(fsout, &fullscreen->output_list, link)
460 if (fsout->output == output)
461 return;
462
463 fsout = calloc(1, sizeof *fsout);
464 fsout->output = output;
465 wl_list_insert(&fullscreen->output_list, &fsout->link);
466}
467
468static void
469global_handler(struct display *display, uint32_t id, const char *interface,
470 uint32_t version, void *data)
471{
472 struct fullscreen *fullscreen = data;
473
Jonas Ådahl496adb32015-11-17 16:00:27 +0800474 if (strcmp(interface, "zwp_fullscreen_shell_v1") == 0) {
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500475 fullscreen->fshell = display_bind(display, id,
Jonas Ådahl496adb32015-11-17 16:00:27 +0800476 &zwp_fullscreen_shell_v1_interface,
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500477 1);
Jonas Ådahl496adb32015-11-17 16:00:27 +0800478 zwp_fullscreen_shell_v1_add_listener(fullscreen->fshell,
479 &fullscreen_shell_listener,
480 fullscreen);
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500481 }
482}
483
Alexander Larsson73469ed2013-05-28 16:23:34 +0200484int main(int argc, char *argv[])
485{
486 struct fullscreen fullscreen;
487 struct display *d;
488 int i;
489
490 fullscreen.width = 640;
491 fullscreen.height = 480;
492 fullscreen.fullscreen = 0;
Jonas Ådahl496adb32015-11-17 16:00:27 +0800493 fullscreen.present_method = ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_DEFAULT;
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500494 wl_list_init(&fullscreen.output_list);
495 fullscreen.current_output = NULL;
Alexander Larsson73469ed2013-05-28 16:23:34 +0200496
497 for (i = 1; i < argc; i++) {
498 if (strcmp(argv[i], "-w") == 0) {
499 if (++i >= argc)
500 usage(EXIT_FAILURE);
501
502 fullscreen.width = atol(argv[i]);
503 } else if (strcmp(argv[i], "-h") == 0) {
504 if (++i >= argc)
505 usage(EXIT_FAILURE);
506
507 fullscreen.height = atol(argv[i]);
508 } else if (strcmp(argv[i], "--help") == 0)
509 usage(EXIT_SUCCESS);
510 else
511 usage(EXIT_FAILURE);
512 }
513
514 d = display_create(&argc, argv);
515 if (d == NULL) {
516 fprintf(stderr, "failed to create display: %m\n");
517 return -1;
518 }
519
520 fullscreen.display = d;
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500521 fullscreen.fshell = NULL;
522 display_set_user_data(fullscreen.display, &fullscreen);
523 display_set_global_handler(fullscreen.display, global_handler);
524 display_set_output_configure_handler(fullscreen.display, output_handler);
525
526 if (fullscreen.fshell) {
527 fullscreen.window = window_create_custom(d);
Jonas Ådahl496adb32015-11-17 16:00:27 +0800528 zwp_fullscreen_shell_v1_present_surface(fullscreen.fshell,
529 window_get_wl_surface(fullscreen.window),
530 fullscreen.present_method,
531 NULL);
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500532 /* If we get the CURSOR_PLANE capability, we'll change this */
533 fullscreen.draw_cursor = 1;
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500534 } else {
535 fullscreen.window = window_create(d);
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500536 fullscreen.draw_cursor = 0;
Jason Ekstrand2bb72fe2014-04-02 19:53:52 -0500537 }
538
Alexander Larsson73469ed2013-05-28 16:23:34 +0200539 fullscreen.widget =
540 window_add_widget(fullscreen.window, &fullscreen);
541
542 window_set_title(fullscreen.window, "Fullscreen");
Alexander Larsson73469ed2013-05-28 16:23:34 +0200543
544 widget_set_transparent(fullscreen.widget, 0);
Alexander Larsson73469ed2013-05-28 16:23:34 +0200545
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500546 widget_set_default_cursor(fullscreen.widget, CURSOR_LEFT_PTR);
Alexander Larsson73469ed2013-05-28 16:23:34 +0200547 widget_set_redraw_handler(fullscreen.widget, redraw_handler);
548 widget_set_button_handler(fullscreen.widget, button_handler);
549 widget_set_motion_handler(fullscreen.widget, motion_handler);
Jason Ekstrand7a17d422014-04-02 19:53:53 -0500550 widget_set_enter_handler(fullscreen.widget, enter_handler);
Alexander Larsson73469ed2013-05-28 16:23:34 +0200551
Rusty Lynch1084da52013-08-15 09:10:08 -0700552 widget_set_touch_down_handler(fullscreen.widget, touch_handler);
553
Alexander Larsson73469ed2013-05-28 16:23:34 +0200554 window_set_key_handler(fullscreen.window, key_handler);
555 window_set_fullscreen_handler(fullscreen.window, fullscreen_handler);
556
557 window_set_user_data(fullscreen.window, &fullscreen);
558 /* Hack to set minimum allocation so we can shrink later */
559 window_schedule_resize(fullscreen.window,
560 1, 1);
561 window_schedule_resize(fullscreen.window,
562 fullscreen.width, fullscreen.height);
563
564 display_run(d);
565
vivek31732f72014-05-15 18:58:16 +0530566 widget_destroy(fullscreen.widget);
567 window_destroy(fullscreen.window);
568 display_destroy(d);
569
Alexander Larsson73469ed2013-05-28 16:23:34 +0200570 return 0;
571}