blob: d7aac704ace3373bf5580f4a3709bb575becadab [file] [log] [blame]
Kristian Høgsberg6336e462011-11-26 17:36:23 -05001/*
Tiago Vignatti0a386112012-03-28 13:04:02 +03002 * Copyright © 2011, 2012 Intel Corporation
Kristian Høgsberg6336e462011-11-26 17:36:23 -05003 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22
23#include <stdint.h>
24#include <stdio.h>
25#include <stdlib.h>
26#include <string.h>
Daniel Stone6d4a3c12012-06-18 19:39:56 +010027#include <unistd.h>
Tiago Vignatti0a386112012-03-28 13:04:02 +030028#include <sys/wait.h>
Kristian Høgsberg6336e462011-11-26 17:36:23 -050029
30#include "window.h"
Kristian Høgsberg5a315bc2012-05-15 22:33:43 -040031#include "../shared/cairo-util.h"
Kristian Høgsberg9b935c82011-12-08 12:44:27 -050032#include "../shared/config-parser.h"
Kristian Høgsberg6336e462011-11-26 17:36:23 -050033
34#include "tablet-shell-client-protocol.h"
35
Tiago Vignatti0a386112012-03-28 13:04:02 +030036struct tablet {
Kristian Høgsberg6336e462011-11-26 17:36:23 -050037 struct display *display;
38 struct tablet_shell *tablet_shell;
39 struct rectangle allocation;
Kristian Høgsberg6336e462011-11-26 17:36:23 -050040 struct window *switcher;
Tiago Vignatti0a386112012-03-28 13:04:02 +030041
42 struct homescreen *homescreen;
43 struct lockscreen *lockscreen;
44};
45
46struct homescreen {
47 struct window *window;
48 struct widget *widget;
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -050049 struct wl_list launcher_list;
50};
51
Tiago Vignatti0a386112012-03-28 13:04:02 +030052struct lockscreen {
53 struct window *window;
54 struct widget *widget;
55};
56
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -050057struct launcher {
Alex Wu5b72a4d2012-06-18 16:52:31 +080058 struct widget *widget;
59 struct homescreen *homescreen;
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -050060 cairo_surface_t *icon;
Alex Wu5b72a4d2012-06-18 16:52:31 +080061 int focused, pressed;
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -050062 char *path;
63 struct wl_list link;
64};
65
66static char *key_lockscreen_icon;
67static char *key_lockscreen_background;
68static char *key_homescreen_background;
69static char *key_launcher_icon;
70static char *key_launcher_path;
71static void launcher_section_done(void *data);
72
Tiago Vignatti9a206c42012-03-21 19:49:18 +020073static const struct config_key shell_config_keys[] = {
74 { "lockscreen-icon", CONFIG_KEY_STRING, &key_lockscreen_icon },
75 { "lockscreen", CONFIG_KEY_STRING, &key_lockscreen_background },
76 { "homescreen", CONFIG_KEY_STRING, &key_homescreen_background },
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -050077};
78
79static const struct config_key launcher_config_keys[] = {
80 { "icon", CONFIG_KEY_STRING, &key_launcher_icon },
81 { "path", CONFIG_KEY_STRING, &key_launcher_path },
82};
83
84static const struct config_section config_sections[] = {
Tiago Vignatti9a206c42012-03-21 19:49:18 +020085 { "shell",
86 shell_config_keys, ARRAY_LENGTH(shell_config_keys) },
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -050087 { "launcher",
88 launcher_config_keys, ARRAY_LENGTH(launcher_config_keys),
89 launcher_section_done }
Kristian Høgsberg6336e462011-11-26 17:36:23 -050090};
91
92static void
Tiago Vignatti0a386112012-03-28 13:04:02 +030093sigchild_handler(int s)
94{
95 int status;
96 pid_t pid;
97
98 while (pid = waitpid(-1, &status, WNOHANG), pid > 0)
99 fprintf(stderr, "child %d exited\n", pid);
100}
101
102static void
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500103paint_background(cairo_t *cr, const char *path, struct rectangle *allocation)
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500104{
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500105 cairo_surface_t *image = NULL;
106 cairo_pattern_t *pattern;
107 cairo_matrix_t matrix;
108 double sx, sy;
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500109
110 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500111 if (path)
Kristian Høgsbergf02a6492012-03-12 01:05:25 -0400112 image = load_cairo_surface(path);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500113 if (image) {
114 pattern = cairo_pattern_create_for_surface(image);
115 sx = (double) cairo_image_surface_get_width(image) /
116 allocation->width;
117 sy = (double) cairo_image_surface_get_height(image) /
118 allocation->height;
119 cairo_matrix_init_scale(&matrix, sx, sy);
120 cairo_pattern_set_matrix(pattern, &matrix);
121 cairo_set_source(cr, pattern);
122 cairo_pattern_destroy (pattern);
123 cairo_surface_destroy(image);
124 cairo_paint(cr);
125 } else {
Tiago Vignatti0a386112012-03-28 13:04:02 +0300126 fprintf(stderr, "couldn't load background image: %s\n", path);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500127 cairo_set_source_rgb(cr, 0.2, 0, 0);
128 cairo_paint(cr);
129 }
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500130}
131
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500132static void
Tiago Vignatti0a386112012-03-28 13:04:02 +0300133homescreen_draw(struct widget *widget, void *data)
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500134{
Tiago Vignatti0a386112012-03-28 13:04:02 +0300135 struct homescreen *homescreen = data;
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500136 cairo_surface_t *surface;
137 struct rectangle allocation;
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500138 cairo_t *cr;
139 struct launcher *launcher;
140 const int rows = 4, columns = 5, icon_width = 128, icon_height = 128;
141 int x, y, i, width, height, vmargin, hmargin, vpadding, hpadding;
142
Tiago Vignatti0a386112012-03-28 13:04:02 +0300143 surface = window_get_surface(homescreen->window);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500144 cr = cairo_create(surface);
145
Tiago Vignatti0a386112012-03-28 13:04:02 +0300146 widget_get_allocation(widget, &allocation);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500147 paint_background(cr, key_homescreen_background, &allocation);
148
149 cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
150
151 width = allocation.width - columns * icon_width;
152 hpadding = width / (columns + 1);
153 hmargin = (width - hpadding * (columns - 1)) / 2;
154
155 height = allocation.height - rows * icon_height;
156 vpadding = height / (rows + 1);
157 vmargin = (height - vpadding * (rows - 1)) / 2;
158
159 x = hmargin;
160 y = vmargin;
161 i = 0;
162
Tiago Vignatti0a386112012-03-28 13:04:02 +0300163 wl_list_for_each(launcher, &homescreen->launcher_list, link) {
Alex Wu5b72a4d2012-06-18 16:52:31 +0800164 widget_set_allocation(launcher->widget,
165 x, y, icon_width, icon_height);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500166 x += icon_width + hpadding;
167 i++;
168 if (i == columns) {
169 x = hmargin;
170 y += icon_height + vpadding;
171 i = 0;
172 }
173 }
174
Tiago Vignatti0a386112012-03-28 13:04:02 +0300175 cairo_destroy(cr);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500176 cairo_surface_destroy(surface);
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500177}
178
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500179static void
Tiago Vignatti0a386112012-03-28 13:04:02 +0300180lockscreen_draw(struct widget *widget, void *data)
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500181{
Tiago Vignatti0a386112012-03-28 13:04:02 +0300182 struct lockscreen *lockscreen = data;
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500183 cairo_surface_t *surface;
184 cairo_surface_t *icon;
185 struct rectangle allocation;
186 cairo_t *cr;
187 int width, height;
188
Tiago Vignatti0a386112012-03-28 13:04:02 +0300189 surface = window_get_surface(lockscreen->window);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500190 cr = cairo_create(surface);
191
Tiago Vignatti0a386112012-03-28 13:04:02 +0300192 widget_get_allocation(widget, &allocation);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500193 paint_background(cr, key_lockscreen_background, &allocation);
194
195 cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
Tiago Vignatti0a386112012-03-28 13:04:02 +0300196 icon = load_cairo_surface(key_lockscreen_icon);
Tiago Vignattid0810202012-03-28 20:56:48 +0300197 if (icon) {
198 width = cairo_image_surface_get_width(icon);
199 height = cairo_image_surface_get_height(icon);
200 cairo_set_source_surface(cr, icon,
201 allocation.x + (allocation.width - width) / 2,
202 allocation.y + (allocation.height - height) / 2);
203 } else {
204 fprintf(stderr, "couldn't load lockscreen icon: %s\n",
205 key_lockscreen_icon);
206 cairo_set_source_rgb(cr, 0.2, 0, 0);
207 }
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500208 cairo_paint(cr);
Tiago Vignatti0a386112012-03-28 13:04:02 +0300209 cairo_destroy(cr);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500210 cairo_surface_destroy(icon);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500211 cairo_surface_destroy(surface);
Tiago Vignatti0a386112012-03-28 13:04:02 +0300212}
213
214static void
215lockscreen_button_handler(struct widget *widget,
216 struct input *input, uint32_t time,
Daniel Stone4dbadb12012-05-30 16:31:51 +0100217 uint32_t button,
218 enum wl_pointer_button_state state, void *data)
Tiago Vignatti0a386112012-03-28 13:04:02 +0300219{
220 struct lockscreen *lockscreen = data;
221
Daniel Stone4dbadb12012-05-30 16:31:51 +0100222 if (state == WL_POINTER_BUTTON_STATE_PRESSED && lockscreen->window) {
Tiago Vignatti0a386112012-03-28 13:04:02 +0300223 window_destroy(lockscreen->window);
224 lockscreen->window = NULL;
225 }
226}
227
228static struct homescreen *
229homescreen_create(struct tablet *tablet)
230{
231 struct homescreen *homescreen;
232
233 homescreen = malloc (sizeof *homescreen);
234 memset(homescreen, 0, sizeof *homescreen);
235
Scott Moreaufe89f072012-07-11 20:57:15 -0600236 homescreen->window = window_create_custom(tablet->display);
Tiago Vignatti0a386112012-03-28 13:04:02 +0300237 homescreen->widget =
238 window_add_widget(homescreen->window, homescreen);
Tiago Vignatti0a386112012-03-28 13:04:02 +0300239 window_set_user_data(homescreen->window, homescreen);
240 window_set_title(homescreen->window, "homescreen");
241 widget_set_redraw_handler(homescreen->widget, homescreen_draw);
242
243 return homescreen;
244}
245
246static struct lockscreen *
247lockscreen_create(struct tablet *tablet)
248{
249 struct lockscreen *lockscreen;
250
251 lockscreen = malloc (sizeof *lockscreen);
252 memset(lockscreen, 0, sizeof *lockscreen);
253
Scott Moreaufe89f072012-07-11 20:57:15 -0600254 lockscreen->window = window_create_custom(tablet->display);
Tiago Vignatti0a386112012-03-28 13:04:02 +0300255 lockscreen->widget =
256 window_add_widget(lockscreen->window, lockscreen);
257 window_set_user_data(lockscreen->window, lockscreen);
258 window_set_title(lockscreen->window, "lockscreen");
Tiago Vignatti0a386112012-03-28 13:04:02 +0300259 widget_set_redraw_handler(lockscreen->widget, lockscreen_draw);
260 widget_set_button_handler(lockscreen->widget,
261 lockscreen_button_handler);
262
263 return lockscreen;
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500264}
265
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500266static void
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500267show_lockscreen(void *data, struct tablet_shell *tablet_shell)
268{
Tiago Vignatti0a386112012-03-28 13:04:02 +0300269 struct tablet *tablet = data;
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500270
Tiago Vignatti0a386112012-03-28 13:04:02 +0300271 tablet->lockscreen = lockscreen_create(tablet);
272 tablet_shell_set_lockscreen(tablet->tablet_shell,
273 window_get_wl_surface(tablet->lockscreen->window));
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500274
Tiago Vignatti0a386112012-03-28 13:04:02 +0300275 widget_schedule_resize(tablet->lockscreen->widget,
276 tablet->allocation.width,
277 tablet->allocation.height);
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500278}
279
280static void
281show_switcher(void *data, struct tablet_shell *tablet_shell)
282{
Tiago Vignatti0a386112012-03-28 13:04:02 +0300283 struct tablet *tablet = data;
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500284
Scott Moreaufe89f072012-07-11 20:57:15 -0600285 tablet->switcher = window_create_custom(tablet->display);
Tiago Vignatti0a386112012-03-28 13:04:02 +0300286 window_set_user_data(tablet->switcher, tablet);
Tiago Vignatti0a386112012-03-28 13:04:02 +0300287 tablet_shell_set_switcher(tablet->tablet_shell,
288 window_get_wl_surface(tablet->switcher));
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500289}
290
291static void
292hide_switcher(void *data, struct tablet_shell *tablet_shell)
293{
294}
295
296static const struct tablet_shell_listener tablet_shell_listener = {
297 show_lockscreen,
298 show_switcher,
299 hide_switcher
300};
301
Alex Wu5b72a4d2012-06-18 16:52:31 +0800302static int
303launcher_enter_handler(struct widget *widget, struct input *input,
304 float x, float y, void *data)
305{
306 struct launcher *launcher = data;
307
308 launcher->focused = 1;
309 widget_schedule_redraw(widget);
310
311 return CURSOR_LEFT_PTR;
312}
313
314static void
315launcher_leave_handler(struct widget *widget,
316 struct input *input, void *data)
317{
318 struct launcher *launcher = data;
319
320 launcher->focused = 0;
321 widget_schedule_redraw(widget);
322}
323
324static void
325launcher_activate(struct launcher *widget)
326{
327 pid_t pid;
328
329 pid = fork();
330 if (pid < 0) {
331 fprintf(stderr, "fork failed: %m\n");
332 return;
333 }
334
335 if (pid)
336 return;
337
338 if (execl(widget->path, widget->path, NULL) < 0) {
339 fprintf(stderr, "execl '%s' failed: %m\n", widget->path);
340 exit(1);
341 }
342}
343
344static void
345launcher_button_handler(struct widget *widget,
346 struct input *input, uint32_t time,
347 uint32_t button,
348 enum wl_pointer_button_state state, void *data)
349{
350 struct launcher *launcher;
351
352 launcher = widget_get_user_data(widget);
353 widget_schedule_redraw(widget);
354 if (state == WL_POINTER_BUTTON_STATE_RELEASED) {
355 launcher_activate(launcher);
356 launcher->pressed = 0;
357 } else if (state == WL_POINTER_BUTTON_STATE_PRESSED)
358 launcher->pressed = 1;
359}
360
361static void
362launcher_redraw_handler(struct widget *widget, void *data)
363{
364 struct launcher *launcher = data;
365 cairo_surface_t *surface;
366 struct rectangle allocation;
367 cairo_t *cr;
368
369 surface = window_get_surface(launcher->homescreen->window);
370 cr = cairo_create(surface);
371
372 widget_get_allocation(widget, &allocation);
373 if (launcher->pressed) {
374 allocation.x++;
375 allocation.y++;
376 }
377
378 cairo_set_source_surface(cr, launcher->icon,
379 allocation.x, allocation.y);
380 cairo_paint(cr);
381
382 if (launcher->focused) {
383 cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.4);
384 cairo_mask_surface(cr, launcher->icon,
385 allocation.x, allocation.y);
386 }
387
388 cairo_destroy(cr);
389}
390
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500391static void
Tiago Vignatti0a386112012-03-28 13:04:02 +0300392tablet_shell_add_launcher(struct tablet *tablet,
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500393 const char *icon, const char *path)
394{
395 struct launcher *launcher;
Tiago Vignatti0a386112012-03-28 13:04:02 +0300396 struct homescreen *homescreen = tablet->homescreen;
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500397
398 launcher = malloc(sizeof *launcher);
Tiago Vignatti0a386112012-03-28 13:04:02 +0300399 launcher->icon = load_cairo_surface(icon);
Juan Zhao8634f512012-06-20 19:29:27 -0700400 if ( !launcher->icon ||
401 cairo_surface_status (launcher->icon) != CAIRO_STATUS_SUCCESS) {
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500402 fprintf(stderr, "couldn't load %s\n", icon);
403 free(launcher);
404 return;
405 }
Rob Bradfordc48c34d2013-07-26 16:29:42 +0100406 launcher->path = strdup(path);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500407
Alex Wu5b72a4d2012-06-18 16:52:31 +0800408 launcher->homescreen = homescreen;
409 launcher->widget = widget_add_widget(homescreen->widget, launcher);
410 widget_set_enter_handler(launcher->widget,
411 launcher_enter_handler);
412 widget_set_leave_handler(launcher->widget,
413 launcher_leave_handler);
414 widget_set_button_handler(launcher->widget,
415 launcher_button_handler);
416 widget_set_redraw_handler(launcher->widget,
417 launcher_redraw_handler);
418
Tiago Vignatti0a386112012-03-28 13:04:02 +0300419 wl_list_insert(&homescreen->launcher_list, &launcher->link);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500420}
421
422static void
423launcher_section_done(void *data)
424{
Tiago Vignatti0a386112012-03-28 13:04:02 +0300425 struct tablet *tablet = data;
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500426
427 if (key_launcher_icon == NULL || key_launcher_path == NULL) {
428 fprintf(stderr, "invalid launcher section\n");
429 return;
430 }
431
Tiago Vignatti0a386112012-03-28 13:04:02 +0300432 tablet_shell_add_launcher(tablet, key_launcher_icon, key_launcher_path);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500433
434 free(key_launcher_icon);
435 key_launcher_icon = NULL;
436 free(key_launcher_path);
437 key_launcher_path = NULL;
438}
439
Tiago Vignatti0a386112012-03-28 13:04:02 +0300440static void
Kristian Høgsbergfa80e112012-10-10 21:34:26 -0400441global_handler(struct display *display, uint32_t name,
Tiago Vignatti0a386112012-03-28 13:04:02 +0300442 const char *interface, uint32_t version, void *data)
443{
444 struct tablet *tablet = data;
445
446 if (!strcmp(interface, "tablet_shell")) {
447 tablet->tablet_shell =
Kristian Høgsbergfa80e112012-10-10 21:34:26 -0400448 display_bind(display, name,
449 &tablet_shell_interface, 1);
Tiago Vignatti0a386112012-03-28 13:04:02 +0300450 tablet_shell_add_listener(tablet->tablet_shell,
451 &tablet_shell_listener, tablet);
452 }
453}
454
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500455int main(int argc, char *argv[])
456{
Tiago Vignatti0a386112012-03-28 13:04:02 +0300457 struct tablet tablet = { 0 };
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500458 struct display *display;
Ossama Othmana50e6e42013-05-14 09:48:26 -0700459 int config_fd;
Tiago Vignatti0a386112012-03-28 13:04:02 +0300460 struct output *output;
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500461
Kristian Høgsberg4172f662013-02-20 15:27:49 -0500462 display = display_create(&argc, argv);
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500463 if (display == NULL) {
464 fprintf(stderr, "failed to create display: %m\n");
465 return -1;
466 }
467
Tiago Vignatti0a386112012-03-28 13:04:02 +0300468 tablet.display = display;
469
Kristian Høgsbergfa80e112012-10-10 21:34:26 -0400470 display_set_user_data(tablet.display, &tablet);
471 display_set_global_handler(tablet.display, global_handler);
Tiago Vignatti0a386112012-03-28 13:04:02 +0300472
473 tablet.homescreen = homescreen_create(&tablet);
474 tablet_shell_set_homescreen(tablet.tablet_shell,
475 window_get_wl_surface(tablet.homescreen->window));
Tiago Vignattib67c91d2013-04-09 11:48:06 -0300476
477 wl_display_roundtrip (display_get_display(tablet.display));
478
Tiago Vignatti0a386112012-03-28 13:04:02 +0300479 wl_list_init(&tablet.homescreen->launcher_list);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500480
Ossama Othmana50e6e42013-05-14 09:48:26 -0700481 config_fd = open_config_file("weston.ini");
482 parse_config_file(config_fd,
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500483 config_sections, ARRAY_LENGTH(config_sections),
Tiago Vignatti0a386112012-03-28 13:04:02 +0300484 &tablet);
Ossama Othmana50e6e42013-05-14 09:48:26 -0700485 close(config_fd);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500486
Tiago Vignatti0a386112012-03-28 13:04:02 +0300487 signal(SIGCHLD, sigchild_handler);
Kristian Høgsbergf033a7b2011-11-26 23:38:41 -0500488
Tiago Vignatti0a386112012-03-28 13:04:02 +0300489 output = display_get_output(tablet.display);
490 output_get_allocation(output, &tablet.allocation);
491 widget_schedule_resize(tablet.homescreen->widget,
492 tablet.allocation.width,
493 tablet.allocation.height);
Kristian Høgsberg6336e462011-11-26 17:36:23 -0500494 display_run(display);
495
496 return 0;
497}