[PATCH V4 3/7] weston: Add enable-wrandr option and export common functions
Quanxian Wang
quanxian.wang at intel.com
Thu Apr 24 00:50:07 PDT 2014
When starting weston with parameter --enable-wrandr,
it will automatically load wrandr.so module. This is
for QA testing and Admin configuration.
weston_output_transform_scale_init will be used by
weston randr module.
Signed-off-by: Quanxian Wang <quanxian.wang at intel.com>
---
src/compositor.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index c031edc..5708e4e 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -88,7 +88,7 @@ sigchld_handler(int signal_number, void *data)
return 1;
}
-static void
+WL_EXPORT void
weston_output_transform_scale_init(struct weston_output *output,
uint32_t transform, uint32_t scale);
@@ -3297,7 +3297,7 @@ weston_output_update_matrix(struct weston_output *output)
output->dirty = 0;
}
-static void
+WL_EXPORT void
weston_output_transform_scale_init(struct weston_output *output, uint32_t transform, uint32_t scale)
{
output->transform = transform;
@@ -4140,10 +4140,12 @@ int main(int argc, char *argv[])
char *log = NULL;
int32_t idle_time = 300;
int32_t help = 0;
+ int32_t enable_wrandr = 0;
char *socket_name = "wayland-0";
int32_t version = 0;
struct weston_config *config;
struct weston_config_section *section;
+ struct weston_output *last, *output;
const struct weston_option core_options[] = {
{ WESTON_OPTION_STRING, "backend", 'B', &option_backend },
@@ -4151,6 +4153,7 @@ int main(int argc, char *argv[])
{ WESTON_OPTION_STRING, "socket", 'S', &socket_name },
{ WESTON_OPTION_INTEGER, "idle-time", 'i', &idle_time },
{ WESTON_OPTION_STRING, "modules", 0, &option_modules },
+ { WESTON_OPTION_STRING, "enable-wrandr", 0, &enable_wrandr},
{ WESTON_OPTION_STRING, "log", 0, &log },
{ WESTON_OPTION_BOOLEAN, "help", 'h', &help },
{ WESTON_OPTION_BOOLEAN, "version", 0, &version },
@@ -4233,6 +4236,34 @@ int main(int argc, char *argv[])
ec->idle_time = idle_time;
ec->default_pointer_grab = NULL;
+ /* Initialize all links of output */
+ last = NULL;
+ wl_list_for_each(output, &ec->output_list, link) {
+ if (last) {
+ last->hlink.next = &output->hlink;
+ output->hlink.prev = &last->hlink;
+ } else {
+ output->hlink.prev = NULL;
+ }
+ last = output;
+ }
+
+ /* Set default most left up output. */
+ wl_list_for_each(output, &ec->output_list, link) {
+ if (output->x == 0 && output->y == 0) {
+ ec->primary = output;
+ break;
+ }
+ }
+
+ /* Add wrandr module */
+ if (enable_wrandr) {
+ if (!option_modules)
+ option_modules = strdup("wrandr.so");
+ else
+ option_modules = strcat(option_modules, ",wrandr.so");
+ }
+
setenv("WAYLAND_DISPLAY", socket_name, 1);
if (option_shell)
--
1.8.1.2
More information about the wayland-devel
mailing list