aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/server.h1
-rw-r--r--sway/server.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/include/sway/server.h b/include/sway/server.h
index 76a05476..d497e132 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -33,6 +33,7 @@ struct sway_server {
33 33
34 struct wlr_xwayland *xwayland; 34 struct wlr_xwayland *xwayland;
35 struct wl_listener xwayland_surface; 35 struct wl_listener xwayland_surface;
36 struct wl_listener xwayland_ready;
36 37
37 struct wlr_wl_shell *wl_shell; 38 struct wlr_wl_shell *wl_shell;
38 struct wl_listener wl_shell_surface; 39 struct wl_listener wl_shell_surface;
diff --git a/sway/server.c b/sway/server.c
index 365094ef..b5eb510b 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -11,9 +11,27 @@
11// TODO WLR: make Xwayland optional 11// TODO WLR: make Xwayland optional
12#include <wlr/xwayland.h> 12#include <wlr/xwayland.h>
13#include <wlr/util/log.h> 13#include <wlr/util/log.h>
14#include "sway/commands.h"
15#include "sway/config.h"
14#include "sway/server.h" 16#include "sway/server.h"
15#include "sway/input/input-manager.h" 17#include "sway/input/input-manager.h"
16 18
19static void server_ready(struct wl_listener *listener, void *data) {
20 wlr_log(L_DEBUG, "Compositor is ready, executing cmds in queue");
21 // Execute commands until there are none left
22 config->active = true;
23 while (config->cmd_queue->length) {
24 char *line = config->cmd_queue->items[0];
25 struct cmd_results *res = handle_command(line);
26 if (res->status != CMD_SUCCESS) {
27 wlr_log(L_ERROR, "Error on line '%s': %s", line, res->error);
28 }
29 free_cmd_results(res);
30 free(line);
31 list_del(config->cmd_queue, 0);
32 }
33}
34
17bool server_init(struct sway_server *server) { 35bool server_init(struct sway_server *server) {
18 wlr_log(L_DEBUG, "Initializing Wayland server"); 36 wlr_log(L_DEBUG, "Initializing Wayland server");
19 37
@@ -48,6 +66,10 @@ bool server_init(struct sway_server *server) {
48 wl_signal_add(&server->xwayland->events.new_surface, 66 wl_signal_add(&server->xwayland->events.new_surface,
49 &server->xwayland_surface); 67 &server->xwayland_surface);
50 server->xwayland_surface.notify = handle_xwayland_surface; 68 server->xwayland_surface.notify = handle_xwayland_surface;
69 wl_signal_add(&server->xwayland->events.ready,
70 &server->xwayland_ready);
71 // TODO: call server_ready now if xwayland is not enabled
72 server->xwayland_ready.notify = server_ready;
51 73
52 server->wl_shell = wlr_wl_shell_create(server->wl_display); 74 server->wl_shell = wlr_wl_shell_create(server->wl_display);
53 wl_signal_add(&server->wl_shell->events.new_surface, 75 wl_signal_add(&server->wl_shell->events.new_surface,