summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoe Hao Cheng <haochengho12907@gmail.com>2023-03-25 23:03:45 +0800
committerErik Faye-Lund <erik.faye-lund@collabora.com>2023-04-04 19:56:58 +0000
commite8f70dc762e1dff28f3b6813acc4bd1b78b63bb5 (patch)
tree46e71909446007774a9d182955ee0219343f4120
parent4b5cc75a1e6f164e825bcd1472bff0854f5cb2fd (diff)
downloadmesa-demos-e8f70dc762e1dff28f3b6813acc4bd1b78b63bb5.tar.gz
eglut: support the new unified WSI
This is no-op until the build system is hooked up to use it. Note: the ifdefs surrounding _eglutGetWindowSystemInterface() in eglut.c are temporary and will be ripped out with the entire old WSI code in another commit in this series. Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
-rw-r--r--src/egl/eglut/eglut.c4
-rw-r--r--src/egl/eglut/eglutint.h2
-rw-r--r--src/egl/eglut/wsi/wsi.c32
3 files changed, 38 insertions, 0 deletions
diff --git a/src/egl/eglut/eglut.c b/src/egl/eglut/eglut.c
index 9469ef4d..5e352d88 100644
--- a/src/egl/eglut/eglut.c
+++ b/src/egl/eglut/eglut.c
@@ -206,6 +206,10 @@ eglutInit(int argc, char **argv)
}
}
+#if defined(X11_SUPPORT) || defined(WAYLAND_SUPPORT)
+ _eglut->wsi = _eglutGetWindowSystemInterface();
+#endif
+
_eglutNativeInitDisplay();
_eglut->dpy = eglGetDisplay(_eglut->native_dpy);
diff --git a/src/egl/eglut/eglutint.h b/src/egl/eglut/eglutint.h
index a4520b0e..50b33dfb 100644
--- a/src/egl/eglut/eglutint.h
+++ b/src/egl/eglut/eglutint.h
@@ -28,6 +28,7 @@
#include "EGL/egl.h"
#include "eglut.h"
+#include "wsi/wsi.h"
struct eglut_window {
EGLConfig config;
@@ -72,6 +73,7 @@ struct eglut_state {
EGLint major, minor;
struct eglut_window *current;
+ struct eglut_wsi_interface wsi;
int redisplay;
};
diff --git a/src/egl/eglut/wsi/wsi.c b/src/egl/eglut/wsi/wsi.c
index 77ace25f..a8c986c0 100644
--- a/src/egl/eglut/wsi/wsi.c
+++ b/src/egl/eglut/wsi/wsi.c
@@ -20,6 +20,7 @@
* SOFTWARE.
*/
+#include "eglutint.h"
#include "wsi.h"
#include <stdlib.h>
@@ -37,3 +38,34 @@ _eglutGetWindowSystemInterface(void)
return x11_wsi_interface();
#endif
}
+
+void
+_eglutNativeInitDisplay(void)
+{
+ _eglut->wsi.init_display();
+}
+
+void
+_eglutNativeFiniDisplay(void)
+{
+ _eglut->wsi.fini_display();
+}
+
+void
+_eglutNativeInitWindow(struct eglut_window *win, const char *title,
+ int x, int y, int w, int h)
+{
+ _eglut->wsi.init_window(win, title, x, y, w, h);
+}
+
+void
+_eglutNativeFiniWindow(struct eglut_window *win)
+{
+ _eglut->wsi.fini_window(win);
+}
+
+void
+_eglutNativeEventLoop(void)
+{
+ _eglut->wsi.event_loop();
+}