mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-01-06 10:50:18 +01:00
compositor-x11: Fix Weston running on a secondary X screen
When DISPLAY is anything other than #.0 weston would still use .0 Fixes https://bugs.freedesktop.org/show_bug.cgi?id=90532 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
parent
6ce78992a0
commit
61b4d3ea44
1 changed files with 23 additions and 11 deletions
|
|
@ -130,6 +130,20 @@ struct window_delete_data {
|
|||
|
||||
struct gl_renderer_interface *gl_renderer;
|
||||
|
||||
static xcb_screen_t *
|
||||
x11_compositor_get_default_screen(struct x11_backend *b)
|
||||
{
|
||||
xcb_screen_iterator_t iter;
|
||||
int i, screen_nbr = XDefaultScreen(b->dpy);
|
||||
|
||||
iter = xcb_setup_roots_iterator(xcb_get_setup(b->conn));
|
||||
for (i = 0; iter.rem; xcb_screen_next(&iter), i++)
|
||||
if (i == screen_nbr)
|
||||
return iter.data;
|
||||
|
||||
return xcb_setup_roots_iterator(xcb_get_setup(b->conn)).data;
|
||||
}
|
||||
|
||||
static struct xkb_keymap *
|
||||
x11_backend_get_keymap(struct x11_backend *b)
|
||||
{
|
||||
|
|
@ -668,8 +682,8 @@ static int
|
|||
x11_output_init_shm(struct x11_backend *b, struct x11_output *output,
|
||||
int width, int height)
|
||||
{
|
||||
xcb_screen_iterator_t iter;
|
||||
xcb_visualtype_t *visual_type;
|
||||
xcb_screen_t *screen;
|
||||
xcb_format_iterator_t fmt;
|
||||
xcb_void_cookie_t cookie;
|
||||
xcb_generic_error_t *err;
|
||||
|
|
@ -686,8 +700,8 @@ x11_output_init_shm(struct x11_backend *b, struct x11_output *output,
|
|||
return -1;
|
||||
}
|
||||
|
||||
iter = xcb_setup_roots_iterator(xcb_get_setup(b->conn));
|
||||
visual_type = find_visual_by_id(iter.data, iter.data->root_visual);
|
||||
screen = x11_compositor_get_default_screen(b);
|
||||
visual_type = find_visual_by_id(screen, screen->root_visual);
|
||||
if (!visual_type) {
|
||||
weston_log("Failed to lookup visual for root window\n");
|
||||
errno = ENOENT;
|
||||
|
|
@ -698,7 +712,7 @@ x11_output_init_shm(struct x11_backend *b, struct x11_output *output,
|
|||
visual_type->red_mask,
|
||||
visual_type->green_mask,
|
||||
visual_type->blue_mask);
|
||||
output->depth = get_depth_of_visual(iter.data, iter.data->root_visual);
|
||||
output->depth = get_depth_of_visual(screen, screen->root_visual);
|
||||
weston_log("Visual depth is %d\n", output->depth);
|
||||
|
||||
for (fmt = xcb_setup_pixmap_formats_iterator(xcb_get_setup(b->conn));
|
||||
|
|
@ -774,7 +788,7 @@ x11_backend_create_output(struct x11_backend *b, int x, int y,
|
|||
static const char class[] = "weston-1\0Weston Compositor";
|
||||
char title[32];
|
||||
struct x11_output *output;
|
||||
xcb_screen_iterator_t iter;
|
||||
xcb_screen_t *screen;
|
||||
struct wm_normal_hints normal_hints;
|
||||
struct wl_event_loop *loop;
|
||||
int output_width, output_height, width_mm, height_mm;
|
||||
|
|
@ -825,16 +839,16 @@ x11_backend_create_output(struct x11_backend *b, int x, int y,
|
|||
|
||||
values[1] = b->null_cursor;
|
||||
output->window = xcb_generate_id(b->conn);
|
||||
iter = xcb_setup_roots_iterator(xcb_get_setup(b->conn));
|
||||
screen = x11_compositor_get_default_screen(b);
|
||||
xcb_create_window(b->conn,
|
||||
XCB_COPY_FROM_PARENT,
|
||||
output->window,
|
||||
iter.data->root,
|
||||
screen->root,
|
||||
0, 0,
|
||||
output_width, output_height,
|
||||
0,
|
||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||
iter.data->root_visual,
|
||||
screen->root_visual,
|
||||
mask, values);
|
||||
|
||||
if (fullscreen) {
|
||||
|
|
@ -1529,7 +1543,6 @@ x11_backend_create(struct weston_compositor *compositor,
|
|||
struct x11_backend *b;
|
||||
struct x11_output *output;
|
||||
struct weston_config_section *section;
|
||||
xcb_screen_iterator_t s;
|
||||
int i, x = 0, output_count = 0;
|
||||
int width, height, scale, count;
|
||||
const char *section_name;
|
||||
|
|
@ -1556,8 +1569,7 @@ x11_backend_create(struct weston_compositor *compositor,
|
|||
if (xcb_connection_has_error(b->conn))
|
||||
goto err_xdisplay;
|
||||
|
||||
s = xcb_setup_roots_iterator(xcb_get_setup(b->conn));
|
||||
b->screen = s.data;
|
||||
b->screen = x11_compositor_get_default_screen(b);
|
||||
wl_array_init(&b->keys);
|
||||
|
||||
x11_backend_get_resources(b);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue