diff semiconginev2/rendering/platform/linux.nim @ 1254:b0f4c8ccd49a

did: stuff to test gltf importer
author sam <sam@basx.dev>
date Sat, 27 Jul 2024 20:47:54 +0700
parents a3fa15c25026
children bfb75c934f4e
line wrap: on
line diff
--- a/semiconginev2/rendering/platform/linux.nim	Fri Jul 26 23:39:24 2024 +0700
+++ b/semiconginev2/rendering/platform/linux.nim	Sat Jul 27 20:47:54 2024 +0700
@@ -204,6 +204,16 @@
   if onscreen != 0:
     result = some(Vec2f([float32(winX), float32(winY)]))
 
+proc SetMousePosition*(window: NativeWindow, x, y: int) =
+  checkXlibResult XWarpPointer(
+    window.display,
+    default(x11.Window),
+    window.window,
+    0, 0, 0, 0,
+    x.cint,
+    y.cint,
+  )
+  checkXlibResult XSync(window.display, false.XBool)
 
 proc CreateNativeSurface(instance: VkInstance, window: NativeWindow): VkSurfaceKHR =
   var surfaceCreateInfo = VkXlibSurfaceCreateInfoKHR(