summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Antognolli <rafael.antognolli@intel.com>2014-09-25 03:57:09 +0200
committerBoram Park <boram1288.park@samsung.com>2015-11-06 11:47:14 +0900
commitf00273e974436ec7364d8b60fa02972e7bb97875 (patch)
tree70b7be4da3ddbed98cca7a4a8befab877afdfe2b
parent7c24ec272a5c49f8a2d86dd093c57ec1720594b4 (diff)
downloadweston-f00273e974436ec7364d8b60fa02972e7bb97875.tar.gz
weston-f00273e974436ec7364d8b60fa02972e7bb97875.tar.bz2
weston-f00273e974436ec7364d8b60fa02972e7bb97875.zip
downstream: Hack to allow selecting a default output
This code originally by Rafael Antognolli <rafael.antognolli@intel.com> was commited by Stephane Desneux <stephane.desneux@open.eurogiciel.org> as a packaging patch. Change-Id: I9c8a452b0bd9369217578fdf6cf43d86e11f45c6 Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
-rw-r--r--desktop-shell/shell.c3
-rw-r--r--src/compositor-drm.c5
-rw-r--r--src/compositor-x11.c15
-rw-r--r--src/compositor.h3
4 files changed, 23 insertions, 3 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index fe620cb8..50f9092e 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -662,6 +662,9 @@ shell_configuration(struct desktop_shell *shell)
struct weston_output *
get_default_output(struct weston_compositor *compositor)
{
+ if (compositor->default_output)
+ return compositor->default_output;
+
return container_of(compositor->output_list.next,
struct weston_output, link);
}
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index bf921bee..90378e7c 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1991,6 +1991,7 @@ create_output_for_connector(struct drm_compositor *ec,
const char *type_name;
enum output_config config;
uint32_t transform;
+ int default_output;
i = find_crtc_for_connector(ec, resources, connector);
if (i < 0) {
@@ -2042,6 +2043,8 @@ create_output_for_connector(struct drm_compositor *ec,
s, output->base.name);
free(s);
+ weston_config_section_get_int(section, "default_output",
+ &default_output, 0);
if (get_gbm_format_from_section(section,
ec->format,
@@ -2164,6 +2167,8 @@ create_output_for_connector(struct drm_compositor *ec,
}
weston_compositor_add_output(&ec->base, &output->base);
+ if (default_output)
+ ec->base.default_output = &output->base;
find_and_parse_output_edid(ec, output, connector);
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 35656777..f134ac7f 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -757,7 +757,8 @@ static struct x11_output *
x11_compositor_create_output(struct x11_compositor *c, int x, int y,
int width, int height, int fullscreen,
int no_input, char *configured_name,
- uint32_t transform, int32_t scale)
+ uint32_t transform, int32_t scale,
+ int default_output)
{
static const char name[] = "Weston Compositor";
static const char class[] = "weston-1\0Weston Compositor";
@@ -917,6 +918,8 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
wl_event_loop_add_timer(loop, finish_frame_handler, output);
weston_compositor_add_output(&c->base, &output->base);
+ if (default_output)
+ c->base.default_output = &output->base;
weston_log("x11 output %dx%d, window id %d\n",
width, height, output->window);
@@ -1515,6 +1518,7 @@ x11_compositor_create(struct wl_display *display,
const char *section_name;
char *name, *t, *mode;
uint32_t transform;
+ int default_output;
weston_log("initializing x11 backend\n");
@@ -1610,10 +1614,14 @@ x11_compositor_create(struct wl_display *display,
t, name);
free(t);
+ weston_config_section_get_int(section, "default_output",
+ &default_output, 0);
+
output = x11_compositor_create_output(c, x, 0,
width, height,
fullscreen, no_input,
- name, transform, scale);
+ name, transform, scale,
+ default_output);
free(name);
if (output == NULL)
goto err_x11_input;
@@ -1628,7 +1636,8 @@ x11_compositor_create(struct wl_display *display,
for (i = output_count; i < count; i++) {
output = x11_compositor_create_output(c, x, 0, width, height,
fullscreen, no_input, NULL,
- WL_OUTPUT_TRANSFORM_NORMAL, scale);
+ WL_OUTPUT_TRANSFORM_NORMAL, scale,
+ default_output);
if (output == NULL)
goto err_x11_input;
x = pixman_region32_extents(&output->base.region)->x2;
diff --git a/src/compositor.h b/src/compositor.h
index 867f8c46..451ca5d9 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -208,6 +208,7 @@ struct weston_output {
uint32_t frame_time; /* presentation timestamp in milliseconds */
uint64_t msc; /* media stream counter */
int disable_planes;
+ uint32_t default_output;
int destroying;
struct wl_list feedback_list;
@@ -656,6 +657,8 @@ struct weston_compositor {
struct wl_list axis_binding_list;
struct wl_list debug_binding_list;
+ struct weston_output *default_output;
+
uint32_t state;
struct wl_event_source *idle_source;
uint32_t idle_inhibit;