aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dominique Martinet <asmadeus@codewreck.org>2018-05-16 12:29:30 +0900
committerLibravatar Dominique Martinet <asmadeus@codewreck.org>2018-05-16 16:50:56 +0900
commit89ae1792b58a1a29afce7e00da06593187297459 (patch)
tree770f7f47574311c5ee91f8217defb4e6ba0a41a4
parentswayidle: terminate if wl_display_dispatch failed (diff)
downloadsway-89ae1792b58a1a29afce7e00da06593187297459.tar.gz
sway-89ae1792b58a1a29afce7e00da06593187297459.tar.zst
sway-89ae1792b58a1a29afce7e00da06593187297459.zip
sway: run commands without waiting for Xwayland
Xwayland is lazy now, there is no need to wait at all
-rw-r--r--include/sway/server.h1
-rw-r--r--sway/main.c14
-rw-r--r--sway/server.c20
3 files changed, 12 insertions, 23 deletions
diff --git a/include/sway/server.h b/include/sway/server.h
index c95ee0f3..65d96e7a 100644
--- a/include/sway/server.h
+++ b/include/sway/server.h
@@ -40,7 +40,6 @@ struct sway_server {
40 struct wlr_xwayland *xwayland; 40 struct wlr_xwayland *xwayland;
41 struct wlr_xcursor_manager *xcursor_manager; 41 struct wlr_xcursor_manager *xcursor_manager;
42 struct wl_listener xwayland_surface; 42 struct wl_listener xwayland_surface;
43 struct wl_listener xwayland_ready;
44 43
45 struct wlr_wl_shell *wl_shell; 44 struct wlr_wl_shell *wl_shell;
46 struct wl_listener wl_shell_surface; 45 struct wl_listener wl_shell_surface;
diff --git a/sway/main.c b/sway/main.c
index efb674b6..e03b8e3a 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -16,6 +16,7 @@
16#include <sys/prctl.h> 16#include <sys/prctl.h>
17#endif 17#endif
18#include <wlr/util/log.h> 18#include <wlr/util/log.h>
19#include "sway/commands.h"
19#include "sway/config.h" 20#include "sway/config.h"
20#include "sway/debug.h" 21#include "sway/debug.h"
21#include "sway/server.h" 22#include "sway/server.h"
@@ -410,9 +411,18 @@ int main(int argc, char **argv) {
410 411
411 security_sanity_check(); 412 security_sanity_check();
412 413
413 // TODO: wait for server to be ready
414 // TODO: consume config->cmd_queue
415 config->active = true; 414 config->active = true;
415 // Execute commands until there are none left
416 while (config->cmd_queue->length) {
417 char *line = config->cmd_queue->items[0];
418 struct cmd_results *res = execute_command(line, NULL);
419 if (res->status != CMD_SUCCESS) {
420 wlr_log(L_ERROR, "Error on line '%s': %s", line, res->error);
421 }
422 free_cmd_results(res);
423 free(line);
424 list_del(config->cmd_queue, 0);
425 }
416 426
417 if (!terminate_request) { 427 if (!terminate_request) {
418 server_run(&server); 428 server_run(&server);
diff --git a/sway/server.c b/sway/server.c
index 050ddf56..e47cc5b6 100644
--- a/sway/server.c
+++ b/sway/server.c
@@ -19,27 +19,11 @@
19#include <wlr/util/log.h> 19#include <wlr/util/log.h>
20// TODO WLR: make Xwayland optional 20// TODO WLR: make Xwayland optional
21#include <wlr/xwayland.h> 21#include <wlr/xwayland.h>
22#include "sway/commands.h"
23#include "sway/config.h" 22#include "sway/config.h"
24#include "sway/input/input-manager.h" 23#include "sway/input/input-manager.h"
25#include "sway/server.h" 24#include "sway/server.h"
26#include "sway/tree/layout.h" 25#include "sway/tree/layout.h"
27 26
28static void server_ready(struct wl_listener *listener, void *data) {
29 wlr_log(L_DEBUG, "Compositor is ready, executing cmds in queue");
30 // Execute commands until there are none left
31 config->active = true;
32 while (config->cmd_queue->length) {
33 char *line = config->cmd_queue->items[0];
34 struct cmd_results *res = execute_command(line, NULL);
35 if (res->status != CMD_SUCCESS) {
36 wlr_log(L_ERROR, "Error on line '%s': %s", line, res->error);
37 }
38 free_cmd_results(res);
39 free(line);
40 list_del(config->cmd_queue, 0);
41 }
42}
43 27
44bool server_init(struct sway_server *server) { 28bool server_init(struct sway_server *server) {
45 wlr_log(L_DEBUG, "Initializing Wayland server"); 29 wlr_log(L_DEBUG, "Initializing Wayland server");
@@ -93,10 +77,6 @@ bool server_init(struct sway_server *server) {
93 wl_signal_add(&server->xwayland->events.new_surface, 77 wl_signal_add(&server->xwayland->events.new_surface,
94 &server->xwayland_surface); 78 &server->xwayland_surface);
95 server->xwayland_surface.notify = handle_xwayland_surface; 79 server->xwayland_surface.notify = handle_xwayland_surface;
96 wl_signal_add(&server->xwayland->events.ready,
97 &server->xwayland_ready);
98 // TODO: call server_ready now if xwayland is not enabled
99 server->xwayland_ready.notify = server_ready;
100 80
101 // TODO: configurable cursor theme and size 81 // TODO: configurable cursor theme and size
102 server->xcursor_manager = wlr_xcursor_manager_create(NULL, 24); 82 server->xcursor_manager = wlr_xcursor_manager_create(NULL, 24);