compositor: Use libwayland to find a good default display for us
This commit is contained in:
committed by
Jason Ekstrand
parent
a177df09bf
commit
e2f0f84b08
+34
-25
@@ -4233,7 +4233,7 @@ int main(int argc, char *argv[])
|
|||||||
char *server_socket = NULL, *end;
|
char *server_socket = NULL, *end;
|
||||||
int32_t idle_time = 300;
|
int32_t idle_time = 300;
|
||||||
int32_t help = 0;
|
int32_t help = 0;
|
||||||
char *socket_name = "wayland-0";
|
const char *socket_name = NULL;
|
||||||
int32_t version = 0;
|
int32_t version = 0;
|
||||||
int32_t noconfig = 0;
|
int32_t noconfig = 0;
|
||||||
struct weston_config *config = NULL;
|
struct weston_config *config = NULL;
|
||||||
@@ -4339,30 +4339,6 @@ int main(int argc, char *argv[])
|
|||||||
ec->idle_time = idle_time;
|
ec->idle_time = idle_time;
|
||||||
ec->default_pointer_grab = NULL;
|
ec->default_pointer_grab = NULL;
|
||||||
|
|
||||||
setenv("WAYLAND_DISPLAY", socket_name, 1);
|
|
||||||
|
|
||||||
if (option_shell)
|
|
||||||
shell = strdup(option_shell);
|
|
||||||
else
|
|
||||||
weston_config_section_get_string(section, "shell", &shell,
|
|
||||||
"desktop-shell.so");
|
|
||||||
|
|
||||||
if (load_modules(ec, shell, &argc, argv) < 0) {
|
|
||||||
free(shell);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
free(shell);
|
|
||||||
|
|
||||||
weston_config_section_get_string(section, "modules", &modules, "");
|
|
||||||
if (load_modules(ec, modules, &argc, argv) < 0) {
|
|
||||||
free(modules);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
free(modules);
|
|
||||||
|
|
||||||
if (load_modules(ec, option_modules, &argc, argv) < 0)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
weston_log("fatal: unhandled option: %s\n", argv[i]);
|
weston_log("fatal: unhandled option: %s\n", argv[i]);
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
@@ -4394,12 +4370,45 @@ int main(int argc, char *argv[])
|
|||||||
wl_client_add_destroy_listener(primary_client,
|
wl_client_add_destroy_listener(primary_client,
|
||||||
&primary_client_destroyed);
|
&primary_client_destroyed);
|
||||||
} else {
|
} else {
|
||||||
|
if (socket_name) {
|
||||||
if (wl_display_add_socket(display, socket_name)) {
|
if (wl_display_add_socket(display, socket_name)) {
|
||||||
weston_log("fatal: failed to add socket: %m\n");
|
weston_log("fatal: failed to add socket: %m\n");
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
socket_name = wl_display_add_socket_auto(display);
|
||||||
|
if (!socket_name) {
|
||||||
|
weston_log("fatal: failed to add socket: %m\n");
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setenv("WAYLAND_DISPLAY", socket_name, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (option_shell)
|
||||||
|
shell = strdup(option_shell);
|
||||||
|
else
|
||||||
|
weston_config_section_get_string(section, "shell", &shell,
|
||||||
|
"desktop-shell.so");
|
||||||
|
|
||||||
|
if (load_modules(ec, shell, &argc, argv) < 0) {
|
||||||
|
free(shell);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
free(shell);
|
||||||
|
|
||||||
|
weston_config_section_get_string(section, "modules", &modules, "");
|
||||||
|
if (load_modules(ec, modules, &argc, argv) < 0) {
|
||||||
|
free(modules);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
free(modules);
|
||||||
|
|
||||||
|
if (load_modules(ec, option_modules, &argc, argv) < 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
weston_compositor_wake(ec);
|
weston_compositor_wake(ec);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user