weston: use wet.compositor consistently in main()

Rename user_data to wet, because it is called wet everywhere else.

Drop the local variable ec, because that is available as wet.compositor.

This models a little better that wet_compositor owns weston_compositor,
and not the other way around.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
dev
Pekka Paalanen 7 years ago
parent 3ffc6876ca
commit 03dc95a131
  1. 50
      compositor/main.c

@ -1809,7 +1809,6 @@ int main(int argc, char *argv[])
int ret = EXIT_FAILURE;
char *cmdline;
struct wl_display *display;
struct weston_compositor *ec;
struct wl_event_source *signals[4];
struct wl_event_loop *loop;
int i, fd;
@ -1832,7 +1831,7 @@ int main(int argc, char *argv[])
struct wl_client *primary_client;
struct wl_listener primary_client_destroyed;
struct weston_seat *seat;
struct wet_compositor user_data = { 0 };
struct wet_compositor wet = { 0 };
int require_input;
int32_t wait_for_debugger = 0;
@ -1905,8 +1904,8 @@ int main(int argc, char *argv[])
if (load_configuration(&config, noconfig, config_file) < 0)
goto out_signals;
user_data.config = config;
user_data.parsed_options = NULL;
wet.config = config;
wet.parsed_options = NULL;
section = weston_config_get_section(config, "core", NULL, NULL);
@ -1927,28 +1926,27 @@ int main(int argc, char *argv[])
backend = weston_choose_default_backend();
}
ec = weston_compositor_create(display, &user_data);
user_data.compositor = ec;
if (ec == NULL) {
wet.compositor = weston_compositor_create(display, &wet);
if (wet.compositor == NULL) {
weston_log("fatal: failed to create compositor\n");
goto out;
}
segv_compositor = ec;
segv_compositor = wet.compositor;
if (weston_compositor_init_config(ec, config) < 0)
if (weston_compositor_init_config(wet.compositor, config) < 0)
goto out;
weston_config_section_get_bool(section, "require-input",
&require_input, true);
ec->require_input = require_input;
wet.compositor->require_input = require_input;
if (load_backend(ec, backend, &argc, argv, config) < 0) {
if (load_backend(wet.compositor, backend, &argc, argv, config) < 0) {
weston_log("fatal: failed to create compositor backend\n");
goto out;
}
weston_compositor_flush_heads_changed(ec);
if (user_data.init_failed)
weston_compositor_flush_heads_changed(wet.compositor);
if (wet.init_failed)
goto out;
if (idle_time < 0)
@ -1956,11 +1954,11 @@ int main(int argc, char *argv[])
if (idle_time < 0)
idle_time = 300; /* default idle timeout, in seconds */
ec->idle_time = idle_time;
ec->default_pointer_grab = NULL;
ec->exit = handle_exit;
wet.compositor->idle_time = idle_time;
wet.compositor->default_pointer_grab = NULL;
wet.compositor->exit = handle_exit;
weston_compositor_log_capabilities(ec);
weston_compositor_log_capabilities(wet.compositor);
server_socket = getenv("WAYLAND_SERVER_SOCKET");
if (server_socket) {
@ -1989,28 +1987,28 @@ int main(int argc, char *argv[])
weston_config_section_get_string(section, "shell", &shell,
"desktop-shell.so");
if (wet_load_shell(ec, shell, &argc, argv) < 0)
if (wet_load_shell(wet.compositor, shell, &argc, argv) < 0)
goto out;
weston_config_section_get_string(section, "modules", &modules, "");
if (load_modules(ec, modules, &argc, argv, &xwayland) < 0)
if (load_modules(wet.compositor, modules, &argc, argv, &xwayland) < 0)
goto out;
if (load_modules(ec, option_modules, &argc, argv, &xwayland) < 0)
if (load_modules(wet.compositor, option_modules, &argc, argv, &xwayland) < 0)
goto out;
if (!xwayland)
weston_config_section_get_bool(section, "xwayland", &xwayland,
false);
if (xwayland) {
if (wet_load_xwayland(ec) < 0)
if (wet_load_xwayland(wet.compositor) < 0)
goto out;
}
section = weston_config_get_section(config, "keyboard", NULL, NULL);
weston_config_section_get_bool(section, "numlock-on", &numlock_on, 0);
if (numlock_on) {
wl_list_for_each(seat, &ec->seat_list, link) {
wl_list_for_each(seat, &wet.compositor->seat_list, link) {
struct weston_keyboard *keyboard =
weston_seat_get_keyboard(seat);
@ -2026,7 +2024,7 @@ int main(int argc, char *argv[])
if (argc > 1)
goto out;
weston_compositor_wake(ec);
weston_compositor_wake(wet.compositor);
wl_display_run(display);
@ -2036,13 +2034,13 @@ int main(int argc, char *argv[])
* that want to indicate failure status to
* testing infrastructure above
*/
ret = ec->exit_code;
ret = wet.compositor->exit_code;
out:
/* free(NULL) is valid, and it won't be NULL if it's used */
free(user_data.parsed_options);
free(wet.parsed_options);
weston_compositor_destroy(ec);
weston_compositor_destroy(wet.compositor);
out_signals:
for (i = ARRAY_LENGTH(signals) - 1; i >= 0; i--)

Loading…
Cancel
Save