mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2024-12-28 22:23:42 +01:00
sway: run commands without waiting for Xwayland
Xwayland is lazy now, there is no need to wait at all
This commit is contained in:
parent
3b7cae0e31
commit
89ae1792b5
3 changed files with 12 additions and 23 deletions
|
@ -40,7 +40,6 @@ struct sway_server {
|
|||
struct wlr_xwayland *xwayland;
|
||||
struct wlr_xcursor_manager *xcursor_manager;
|
||||
struct wl_listener xwayland_surface;
|
||||
struct wl_listener xwayland_ready;
|
||||
|
||||
struct wlr_wl_shell *wl_shell;
|
||||
struct wl_listener wl_shell_surface;
|
||||
|
|
14
sway/main.c
14
sway/main.c
|
@ -16,6 +16,7 @@
|
|||
#include <sys/prctl.h>
|
||||
#endif
|
||||
#include <wlr/util/log.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/debug.h"
|
||||
#include "sway/server.h"
|
||||
|
@ -410,9 +411,18 @@ int main(int argc, char **argv) {
|
|||
|
||||
security_sanity_check();
|
||||
|
||||
// TODO: wait for server to be ready
|
||||
// TODO: consume config->cmd_queue
|
||||
config->active = true;
|
||||
// Execute commands until there are none left
|
||||
while (config->cmd_queue->length) {
|
||||
char *line = config->cmd_queue->items[0];
|
||||
struct cmd_results *res = execute_command(line, NULL);
|
||||
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);
|
||||
}
|
||||
|
||||
if (!terminate_request) {
|
||||
server_run(&server);
|
||||
|
|
|
@ -19,27 +19,11 @@
|
|||
#include <wlr/util/log.h>
|
||||
// TODO WLR: make Xwayland optional
|
||||
#include <wlr/xwayland.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/input/input-manager.h"
|
||||
#include "sway/server.h"
|
||||
#include "sway/tree/layout.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 = execute_command(line, NULL);
|
||||
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) {
|
||||
wlr_log(L_DEBUG, "Initializing Wayland server");
|
||||
|
@ -93,10 +77,6 @@ bool server_init(struct sway_server *server) {
|
|||
wl_signal_add(&server->xwayland->events.new_surface,
|
||||
&server->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;
|
||||
|
||||
// TODO: configurable cursor theme and size
|
||||
server->xcursor_manager = wlr_xcursor_manager_create(NULL, 24);
|
||||
|
|
Loading…
Reference in a new issue