aboutsummaryrefslogtreecommitdiff
path: root/rootston/desktop.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-09-23 00:29:53 -0400
committerDrew DeVault <sir@cmpwn.com>2017-09-23 00:30:39 -0400
commitb6d7c3ed8ec6ae29af5d585db5417394ff49f3c7 (patch)
treec3faaa0fdc17e7f4d72a9843bb64d0aed0a2c396 /rootston/desktop.c
parent550748681db7f75888beab41a1a85eb86876604c (diff)
Initialize display, backend; add frame handling
Diffstat (limited to 'rootston/desktop.c')
-rw-r--r--rootston/desktop.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c
new file mode 100644
index 00000000..551d289a
--- /dev/null
+++ b/rootston/desktop.c
@@ -0,0 +1,59 @@
+#define _POSIX_C_SOURCE 199309L
+#include <time.h>
+#include <stdlib.h>
+#include <wlr/types/wlr_output_layout.h>
+#include <wlr/types/wlr_compositor.h>
+#include <wlr/types/wlr_wl_shell.h>
+#include <wlr/types/wlr_xdg_shell_v6.h>
+#include <wlr/types/wlr_gamma_control.h>
+#include <wlr/util/log.h>
+#include "rootston/desktop.h"
+#include "rootston/server.h"
+
+static void handle_xdg_shell_v6_surface(struct wl_listener *listener,
+ void *data) {
+ struct roots_desktop *desktop =
+ wl_container_of(listener, desktop, xdg_shell_v6_surface);
+ struct wlr_xdg_surface_v6 *surface = data;
+ wlr_log(L_DEBUG, "new xdg surface: title=%s, app_id=%s",
+ surface->title, surface->app_id);
+ wlr_xdg_surface_v6_ping(surface);
+}
+
+struct roots_desktop *desktop_create(struct roots_server *server,
+ struct roots_config *config) {
+ struct roots_desktop *desktop = calloc(1, sizeof(struct roots_desktop));
+ wlr_log(L_DEBUG, "Initializing roots desktop");
+
+ wl_list_init(&desktop->outputs);
+ wl_list_init(&desktop->output_add.link);
+ desktop->output_add.notify = output_add_notify;
+ wl_list_init(&desktop->output_remove.link);
+ desktop->output_remove.notify = output_remove_notify;
+
+ wl_signal_add(&server->backend->events.output_add,
+ &desktop->output_add);
+ wl_signal_add(&server->backend->events.output_remove,
+ &desktop->output_remove);
+
+ desktop->server = server;
+ desktop->config = config;
+ desktop->layout = wlr_output_layout_create();
+ desktop->compositor = wlr_compositor_create(
+ server->wl_display, server->renderer);
+ desktop->wl_shell = wlr_wl_shell_create(server->wl_display);
+
+ desktop->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display);
+ wl_signal_add(&desktop->xdg_shell_v6->events.new_surface,
+ &desktop->xdg_shell_v6_surface);
+ desktop->xdg_shell_v6_surface.notify = handle_xdg_shell_v6_surface;
+
+ desktop->gamma_control_manager = wlr_gamma_control_manager_create(
+ server->wl_display);
+
+ return desktop;
+}
+
+void desktop_destroy(struct roots_desktop *desktop) {
+ // TODO
+}