summaryrefslogtreecommitdiff
path: root/kde-plasma/kwin/files/kwin-5.22.5-libglvnd-1.3.4.patch
blob: d185d5e41fe69f3e1842064076dfe7662c3ee53f (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
51
52
53
54
55
56
57
58
59
60
61
62
63
From 839710201c389b7f4ed248cb3818e755a37ce977 Mon Sep 17 00:00:00 2001
From: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Date: Fri, 10 Sep 2021 13:36:04 +0300
Subject: [PATCH] x11: Fix build with EGL_NO_PLATFORM_SPECIFIC_TYPES

eglCreateWindowSurface() wants a Window (unsigned long), but with
EGL_NO_PLATFORM_SPECIFIC_TYPES, EGLNativeWindowType is defined as an
opaque pointer, i.e. void*.

BUG: 440372

* asturm 2021-09-21: Merged with upstream commits:
38e24ecd6416a975db0989c21b70d6a4cc242f35 "Fix build with 32-bit"
e26ea6bf2313c021db7e5ca5454cd8b1e2e2037f "Fix build on 32bit platforms"

* asturm 2021-10-04: Merged with upstream commit:
From df11acd46778e1e43183c2660bc9dcb1a8ad3282 Mon Sep 17 00:00:00 2001
From: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Date: Tue, 21 Sep 2021 17:34:59 +0300
Subject: [PATCH] x11: Cast Window to EGLNativeWindowType using a C cast

reinterpret_cast<>() will fail if the types we cast from and to have
mismatching sizes.

Unfortunately, there are platforms that have Window and
EGLNativeWindowType of different size. This results in compilation
errors.

In order to work around those problematic platforms, this change
replaces reinterpret_cast cast with a c style cast.
---
 src/plugins/platforms/x11/common/eglonxbackend.cpp | 16 +++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff -u a/src/plugins/platforms/x11/common/eglonxbackend.cpp b/src/plugins/platforms/x11/common/eglonxbackend.cpp
--- a/src/plugins/platforms/x11/common/eglonxbackend.cpp
+++ b/src/plugins/platforms/x11/common/eglonxbackend.cpp
@@ -213,15 +213,19 @@
         return EGL_NO_SURFACE;
     }
 
+    // Window is 64 bits on a 64-bit architecture whereas xcb_window_t is always 32 bits.
+    Window nativeWindow = window;
+
     EGLSurface surface = EGL_NO_SURFACE;
     if (havePlatformBase()) {
-        // Note: Window is 64 bits on a 64-bit architecture whereas xcb_window_t is
-        //       always 32 bits. eglCreatePlatformWindowSurfaceEXT() expects the
-        //       native_window parameter to be pointer to a Window, so this variable
-        //       cannot be an xcb_window_t.
-        surface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(), (void *) &window, nullptr);
+        // eglCreatePlatformWindowSurfaceEXT() expects a pointer to the Window.
+        surface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(), (void *) &nativeWindow, nullptr);
     } else {
-        surface = eglCreateWindowSurface(eglDisplay(), config(), window, nullptr);
+        // eglCreateWindowSurface() expects a Window, not a pointer to the Window. Use
+        // a c style cast as there are (buggy) platforms where the size of the Window
+        // type is not the same as the size of EGLNativeWindowType, reinterpret_cast<>()
+        // may not compile.
+        surface = eglCreateWindowSurface(eglDisplay(), config(), (EGLNativeWindowType) nativeWindow, nullptr);
     }
 
     return surface;