From: Armin Krezović Date: Mon, 1 Aug 2016 16:51:46 +0000 (+0200) Subject: compositor: Extend compositor user data X-Git-Tag: upstream/5.0.0~938 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78a36373f6207984d62fa4fb77fa584ee00d1976;p=platform%2Fupstream%2Fweston.git compositor: Extend compositor user data This patch makes the compositor user data a structure which can be expanded with new fields when necessary. v2: Don't export to_wet_compositor Signed-off-by: Armin Krezović Reviewed-by: Pekka Paalanen --- diff --git a/compositor/main.c b/compositor/main.c index 99cb868..6746e3a 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -65,6 +65,10 @@ #define WINDOW_TITLE "Weston Compositor" +struct wet_compositor { + struct weston_config *config; +}; + static FILE *weston_logfile = NULL; static int cached_tm_mday = -1; @@ -414,12 +418,20 @@ log_uname(void) usys.version, usys.machine); } -WL_EXPORT struct weston_config * -wet_get_config(struct weston_compositor *compositor) +static struct wet_compositor * +to_wet_compositor(struct weston_compositor *compositor) { return weston_compositor_get_user_data(compositor); } +WL_EXPORT struct weston_config * +wet_get_config(struct weston_compositor *ec) +{ + struct wet_compositor *compositor = to_wet_compositor(ec); + + return compositor->config; +} + static const char xdg_error_message[] = "fatal: environment variable XDG_RUNTIME_DIR is not set.\n"; @@ -1581,6 +1593,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; const struct weston_option core_options[] = { { WESTON_OPTION_STRING, "backend", 'B', &backend }, @@ -1644,6 +1657,7 @@ int main(int argc, char *argv[]) if (load_configuration(&config, noconfig, config_file) < 0) goto out_signals; + user_data.config = config; section = weston_config_get_section(config, "core", NULL, NULL); @@ -1654,7 +1668,7 @@ int main(int argc, char *argv[]) backend = weston_choose_default_backend(); } - ec = weston_compositor_create(display, config); + ec = weston_compositor_create(display, &user_data); if (ec == NULL) { weston_log("fatal: failed to create compositor\n"); goto out;