Forráskód Böngészése

Expose X11 Window and Display

Bach Le 5 hónapja
szülő
commit
c3e2b1101c
1 módosított fájl, 31 hozzáadás és 0 törlés
  1. 31 0
      sokol_app.h

+ 31 - 0
sokol_app.h

@@ -310,6 +310,16 @@
             HWND has been cast to a void pointer in order to be tunneled
             HWND has been cast to a void pointer in order to be tunneled
             through code which doesn't include Windows.h.
             through code which doesn't include Windows.h.
 
 
+        const void* sapp_x11_get_window(void)
+            On Linux, get the X11 Window, otherwise a null pointer. The
+            Window has been cast to a void pointer in order to be tunneled
+            through code which doesn't include X11/Xlib.h.
+
+        const void* sapp_x11_get_display(void)
+            On Linux, get the X11 Display, otherwise a null pointer. The
+            Display has been cast to a void pointer in order to be tunneled
+            through code which doesn't include X11/Xlib.h.
+
         const void* sapp_wgpu_get_device(void)
         const void* sapp_wgpu_get_device(void)
         const void* sapp_wgpu_get_render_view(void)
         const void* sapp_wgpu_get_render_view(void)
         const void* sapp_wgpu_get_resolve_view(void)
         const void* sapp_wgpu_get_resolve_view(void)
@@ -2005,6 +2015,11 @@ SOKOL_APP_API_DECL int sapp_gl_get_major_version(void);
 /* GL: get minor version (only valid for desktop GL) */
 /* GL: get minor version (only valid for desktop GL) */
 SOKOL_APP_API_DECL int sapp_gl_get_minor_version(void);
 SOKOL_APP_API_DECL int sapp_gl_get_minor_version(void);
 
 
+/* X11: get Window */
+SOKOL_APP_API_DECL const void* sapp_x11_get_window(void);
+/* X11: get Display */
+SOKOL_APP_API_DECL const void* sapp_x11_get_display(void);
+
 /* Android: get native activity handle */
 /* Android: get native activity handle */
 SOKOL_APP_API_DECL const void* sapp_android_get_native_activity(void);
 SOKOL_APP_API_DECL const void* sapp_android_get_native_activity(void);
 
 
@@ -12372,6 +12387,22 @@ SOKOL_API_IMPL int sapp_gl_get_minor_version(void) {
     #endif
     #endif
 }
 }
 
 
+SOKOL_API_IMPL const void* sapp_x11_get_window(void) {
+    #if defined(_SAPP_LINUX)
+        return (void*)_sapp.x11.window;
+    #else
+        return 0;
+    #endif
+}
+
+SOKOL_API_IMPL const void* sapp_x11_get_display(void) {
+    #if defined(_SAPP_LINUX)
+        return (void*)_sapp.x11.display;
+    #else
+        return 0;
+    #endif
+}
+
 SOKOL_API_IMPL const void* sapp_android_get_native_activity(void) {
 SOKOL_API_IMPL const void* sapp_android_get_native_activity(void) {
     // NOTE: _sapp.valid is not asserted here because sapp_android_get_native_activity()
     // NOTE: _sapp.valid is not asserted here because sapp_android_get_native_activity()
     // needs to be callable from within sokol_main() (see: https://github.com/floooh/sokol/issues/708)
     // needs to be callable from within sokol_main() (see: https://github.com/floooh/sokol/issues/708)