summarylogtreecommitdiffstats
path: root/0012-libobs-opengl-Try-to-use-the-platform-display-if-ava.patch
blob: c211e4a1c1c1e53160c98c412984dbc881beb35e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From a9847552f9b6034f78ce6aae2e4ad7a63a274c5a Mon Sep 17 00:00:00 2001
From: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
Date: Sat, 11 Apr 2020 23:32:16 -0300
Subject: [PATCH 12/24] libobs-opengl: Try to use the platform display if
 available

We need to ensure we're running all X11 code on the same display.
---
 libobs-opengl/gl-x11-egl.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libobs-opengl/gl-x11-egl.c b/libobs-opengl/gl-x11-egl.c
index 5b413995..47b8e420 100644
--- a/libobs-opengl/gl-x11-egl.c
+++ b/libobs-opengl/gl-x11-egl.c
@@ -324,14 +324,19 @@ static void gl_x11_egl_windowinfo_destroy(struct gl_windowinfo *info)
 	bfree(info);
 }
 
-static Display *open_windowless_display(void)
+static Display *open_windowless_display(Display *platform_display)
 {
-	Display *display = XOpenDisplay(NULL);
+	Display *display;
 	xcb_connection_t *xcb_conn;
 	xcb_screen_iterator_t screen_iterator;
 	xcb_screen_t *screen;
 	int screen_num;
 
+	if (platform_display)
+		display = platform_display;
+	else
+		display = XOpenDisplay(NULL);
+
 	if (!display) {
 		blog(LOG_ERROR, "Unable to open new X connection!");
 		return NULL;
@@ -392,7 +397,8 @@ static struct gl_platform *gl_x11_egl_platform_create(gs_device_t *device,
 	   For an explanation see here: http://xcb.freedesktop.org/MixingCalls/
 	   Essentially, EGL requires Xlib. Everything else we use xcb. */
 	struct gl_platform *plat = bmalloc(sizeof(struct gl_platform));
-	Display *display = open_windowless_display();
+	Display *platform_display = obs_get_nix_platform_display();
+	Display *display = open_windowless_display(platform_display);
 
 	if (!display) {
 		goto fail_display_open;
-- 
2.28.0