|
|
@ -11,9 +11,27 @@
|
|
|
|
// TODO WLR: make Xwayland optional
|
|
|
|
// TODO WLR: make Xwayland optional
|
|
|
|
#include <wlr/xwayland.h>
|
|
|
|
#include <wlr/xwayland.h>
|
|
|
|
#include <wlr/util/log.h>
|
|
|
|
#include <wlr/util/log.h>
|
|
|
|
|
|
|
|
#include "sway/commands.h"
|
|
|
|
|
|
|
|
#include "sway/config.h"
|
|
|
|
#include "sway/server.h"
|
|
|
|
#include "sway/server.h"
|
|
|
|
#include "sway/input/input-manager.h"
|
|
|
|
#include "sway/input/input-manager.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void server_ready(struct wl_listener *listener, void *data) {
|
|
|
|
|
|
|
|
wlr_log(L_DEBUG, "Compositor is ready, executing cmds in queue");
|
|
|
|
|
|
|
|
// Execute commands until there are none left
|
|
|
|
|
|
|
|
config->active = true;
|
|
|
|
|
|
|
|
while (config->cmd_queue->length) {
|
|
|
|
|
|
|
|
char *line = config->cmd_queue->items[0];
|
|
|
|
|
|
|
|
struct cmd_results *res = handle_command(line);
|
|
|
|
|
|
|
|
if (res->status != CMD_SUCCESS) {
|
|
|
|
|
|
|
|
wlr_log(L_ERROR, "Error on line '%s': %s", line, res->error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
free_cmd_results(res);
|
|
|
|
|
|
|
|
free(line);
|
|
|
|
|
|
|
|
list_del(config->cmd_queue, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool server_init(struct sway_server *server) {
|
|
|
|
bool server_init(struct sway_server *server) {
|
|
|
|
wlr_log(L_DEBUG, "Initializing Wayland server");
|
|
|
|
wlr_log(L_DEBUG, "Initializing Wayland server");
|
|
|
|
|
|
|
|
|
|
|
@ -48,6 +66,10 @@ bool server_init(struct sway_server *server) {
|
|
|
|
wl_signal_add(&server->xwayland->events.new_surface,
|
|
|
|
wl_signal_add(&server->xwayland->events.new_surface,
|
|
|
|
&server->xwayland_surface);
|
|
|
|
&server->xwayland_surface);
|
|
|
|
server->xwayland_surface.notify = handle_xwayland_surface;
|
|
|
|
server->xwayland_surface.notify = handle_xwayland_surface;
|
|
|
|
|
|
|
|
wl_signal_add(&server->xwayland->events.ready,
|
|
|
|
|
|
|
|
&server->xwayland_ready);
|
|
|
|
|
|
|
|
// TODO: call server_ready now if xwayland is not enabled
|
|
|
|
|
|
|
|
server->xwayland_ready.notify = server_ready;
|
|
|
|
|
|
|
|
|
|
|
|
server->wl_shell = wlr_wl_shell_create(server->wl_display);
|
|
|
|
server->wl_shell = wlr_wl_shell_create(server->wl_display);
|
|
|
|
wl_signal_add(&server->wl_shell->events.new_surface,
|
|
|
|
wl_signal_add(&server->wl_shell->events.new_surface,
|
|
|
|