JWM icon indicating copy to clipboard operation
JWM copied to clipboard

Wayland support

Open TheDrawingCoder-Gamer opened this issue 2 years ago • 99 comments

Untested (couldn't get javac to work) Highly expect something here to be extremely broken. Would not be surprised if there was an instant segfault. bc it's literally a new platform this touches a LOT of files. Will work on merging

TheDrawingCoder-Gamer avatar Dec 03 '23 01:12 TheDrawingCoder-Gamer

Changes I needed to make to have it build/run on my (X11) system (i.e. not running any of the actual wayland stuff):

diff --git a/linux/cc/ILayer.hh b/linux/cc/ILayer.hh
index f21346a..5b8ee03 100644
--- a/linux/cc/ILayer.hh
+++ b/linux/cc/ILayer.hh
@@ -15,7 +15,7 @@ public:
     virtual void makeCurrentForced();
     virtual void setVsyncMode(VSync v) = 0;
     virtual void close() = 0;
-    virtual void resize(int width, int height);
+    virtual void resize(int width, int height) = 0;


     static ILayer* _ourCurrentLayer;
diff --git a/wayland/cc/WindowWayland.cc b/wayland/cc/WindowWayland.cc
index ecbd2a9..ecb7c42 100644
--- a/wayland/cc/WindowWayland.cc
+++ b/wayland/cc/WindowWayland.cc
@@ -100,8 +100,10 @@ bool WindowWayland::init()
     wl_surface_listener surfaceListener = {
         .enter = WindowWayland::surfaceEnter,
         .leave = WindowWayland::surfaceLeave,
+#ifdef HAVE_WAYLAND_1_22
         .preferred_buffer_scale = WindowWayland::surfacePreferredBufferScale,
         .preferred_buffer_transform = WindowWayland::surfacePreferredBufferTransform
+#endif
     };
     wl_surface_add_listener(_waylandWindow, &surfaceListener, this);

dzaima avatar Dec 03 '23 13:12 dzaima

and here's a bunch of changes, ranging from fixes to hacks to debug utils (i.e. don't blindly copy everything here), to get ./script/run.py to not crash in Weston (doesn't render anything though):

that
diff --git a/examples/dashboard/java/Example.java b/examples/dashboard/java/Example.java
index f8a2ee2..fd3e29a 100644
--- a/examples/dashboard/java/Example.java
+++ b/examples/dashboard/java/Example.java
@@ -55,8 +55,9 @@ public class Example implements Consumer<Event> {

         var scale = window.getScreen().getScale();
         int count = App._windows.size() - 1;
-        Screen screen = App.getScreens()[(count / 5) % App.getScreens().length];
-        IRect bounds = screen.getWorkArea();
+        // Screen screen = App.getScreens()[(count / 5) % App.getScreens().length];
+        // IRect bounds = screen.getWorkArea();
+        IRect bounds = new IRect(0, 0, 100, 100);

         window.setTitle("JWM Window #" + count);
         if (window instanceof WindowMac windowMac) {
@@ -202,6 +203,7 @@ public class Example implements Consumer<Event> {
                 }
             }
         } else if (e instanceof EventFrame) {
+            System.out.println("frame");
             if (!paused)
                 window.requestFrame();
         } else if (e instanceof EventFrameSkija ee) {
diff --git a/examples/dashboard/java/PanelRendering.java b/examples/dashboard/java/PanelRendering.java
index 5ab882b..fde41f2 100644
--- a/examples/dashboard/java/PanelRendering.java
+++ b/examples/dashboard/java/PanelRendering.java
@@ -34,6 +34,8 @@ public class PanelRendering extends Panel {
             layers = new String[] { "LayerD3D12Skija", "LayerGLSkija", "SkijaLayerRaster" };
         else if (Platform.CURRENT == Platform.X11)
             layers = new String[] { "LayerGLSkija", "LayerRasterSkija" };
+        else if (Platform.CURRENT == Platform.WAYLAND)
+            layers = new String[] { "LayerRasterSkija", "LayerGLSkija" };

         for (var layerName: layers)
             layersStatus.put(layerName, UNKNOWN);
diff --git a/script/build.py b/script/build.py
index 9954d82..589461f 100755
--- a/script/build.py
+++ b/script/build.py
@@ -4,7 +4,7 @@ import argparse, build_utils, common, glob, os, platform, subprocess, sys
 def build_native_system(system):
   os.chdir(common.basedir + "/" + system)
   subprocess.check_call(["cmake",
-    "-DCMAKE_BUILD_TYPE=Release",
+    "-DCMAKE_BUILD_TYPE=Debug",
     "-B", "build",
     "-G", "Ninja",
     "-DJWM_ARCH=" + build_utils.arch,
diff --git a/script/run.py b/script/run.py
index 98f3c0e..e90cbe7 100755
--- a/script/run.py
+++ b/script/run.py
@@ -10,9 +10,10 @@ def main():
   parser.add_argument('--skija-shared-jar', default=None)
   parser.add_argument('--skija-platform-jar', default=None)
   parser.add_argument('--types-dir', default=None)
+  parser.add_argument('--just-run', action='store_true')
   args = parser.parse_args()

-  if not args.jwm_version:
+  if not args.jwm_version and not args.just_run:
     build.main()

   if args.skija_dir:
diff --git a/shared/java/App.java b/shared/java/App.java
index 268ddc6..7a1c5a7 100644
--- a/shared/java/App.java
+++ b/shared/java/App.java
@@ -52,6 +52,8 @@ public class App {
             window = new WindowMac();
         else if (Platform.CURRENT == Platform.X11)
             window = new WindowX11();
+        else if (Platform.CURRENT == Platform.WAYLAND)
+            window = new WindowWayland();
         else
             throw new RuntimeException("Unsupported platform: " + Platform.CURRENT);
         _windows.add(window);
diff --git a/shared/java/impl/Library.java b/shared/java/impl/Library.java
index 43fd5cb..29a5da5 100644
--- a/shared/java/impl/Library.java
+++ b/shared/java/impl/Library.java
@@ -46,10 +46,10 @@ public class Library {
         } else if (Platform.CURRENT == Platform.X11) {
             File library = _extract("/", "libjwm_x64.so", tempDir);
             System.load(library.getAbsolutePath());
-        } /*else if (Platform.CURRENT == Platform.WAYLAND) {
+        } else if (Platform.CURRENT == Platform.WAYLAND) {
             File library = _extract("/", "libjwm_x64_wayland.so", tempDir);
             System.load(library.getAbsolutePath());
-        }*/
+        }

         if (tempDir.exists() && version == null) {
             Runtime.getRuntime().addShutdownHook(new Thread(() -> {
diff --git a/wayland/CMakeLists.txt b/wayland/CMakeLists.txt
index 95ca0ad..f13c700 100644
--- a/wayland/CMakeLists.txt
+++ b/wayland/CMakeLists.txt
@@ -15,6 +15,8 @@ if(NOT JWM_ARCH)
     endif()
 endif()

+find_package(OpenGL REQUIRED)
+
 file(GLOB SOURCES_CXX ${CMAKE_CURRENT_LIST_DIR}/../shared/cc/*.cc
     ${CMAKE_CURRENT_LIST_DIR}/../linux/cc/*.cc
     ${CMAKE_CURRENT_LIST_DIR}/cc/*.cc )
@@ -44,3 +46,4 @@ set_target_properties(jwm PROPERTIES OUTPUT_NAME "jwm_${JWM_ARCH}_wayland")
 target_link_libraries(jwm PRIVATE ${WAYLAND_CLIENT_LIB} ${DECOR_LIB}
     ${WAYLAND_CURSOR} ${XKBCOMMON})
 target_link_libraries(jwm PRIVATE ${EGL} ${WAYLAND_EGL})
+target_link_libraries(jwm PRIVATE OpenGL::GL)
diff --git a/wayland/cc/LayerRasterWayland.cc b/wayland/cc/LayerRasterWayland.cc
index 0462940..2177fdf 100644
--- a/wayland/cc/LayerRasterWayland.cc
+++ b/wayland/cc/LayerRasterWayland.cc
@@ -36,7 +36,6 @@ namespace jwm {
             _pool->grow(bufSize);
             // LSBFirst means Little endian : )
             auto buf = _pool->createBuffer(0, width, height, width * sizeof(uint32_t), WL_SHM_FORMAT_ABGR8888);
-
             _buffer = buf.first;
             _imageData = buf.second;
         }
diff --git a/wayland/cc/WindowManagerWayland.cc b/wayland/cc/WindowManagerWayland.cc
index 2c62963..ee92779 100644
--- a/wayland/cc/WindowManagerWayland.cc
+++ b/wayland/cc/WindowManagerWayland.cc
@@ -75,7 +75,7 @@ WindowManagerWayland::WindowManagerWayland():
               .leave = WindowManagerWayland::pointerHandleLeave,
               .motion = WindowManagerWayland::pointerHandleMotion,
               .button = WindowManagerWayland::pointerHandleButton,
-              .axis = WindowManagerWayland::pointerHandleAxis
+              // .axis = WindowManagerWayland::pointerHandleAxis
             };
             wl_pointer_add_listener(pointer, &pointerListener, this);
         }
@@ -112,7 +112,7 @@ void WindowManagerWayland::runLoop() {
         }

         if (myPoll.revents & POLLIN) {
-            while (read(pipes[0], buf, sizeof(buf) == sizeof(buf))) {}
+            while (read(pipes[0], buf, sizeof(buf)) == sizeof(buf)) {}
         }
         notifyBool.store(false);
     }
@@ -166,7 +166,7 @@ void WindowManagerWayland::registryHandleGlobal(void* data, wl_registry *registr
                 &wl_shm_interface, 1);
     } else if (strcmp(interface, "xdg_wm_base") == 0) {
         self->xdgShell = (xdg_wm_base*)wl_registry_bind(registry, name,
-                &xdg_wm_base_interface, 2);
+                &xdg_wm_base_interface, 1);
     } else if (strcmp(interface, "wl_data_device_manager") == 0) {
         self->deviceManager = (wl_data_device_manager*)wl_registry_bind(registry, name,
                 &wl_data_device_manager_interface, 1);
diff --git a/wayland/cc/xdg-shell.cc b/wayland/cc/xdg-shell.cc
index 03826cd..4001974 100644
--- a/wayland/cc/xdg-shell.cc
+++ b/wayland/cc/xdg-shell.cc
@@ -28,16 +28,19 @@
  * DEALINGS IN THE SOFTWARE.
  */

+
 #include <stdlib.h>
 #include <stdint.h>
 #include "wayland-util.h"

+extern "C" {
+
 #ifndef __has_attribute
 # define __has_attribute(x) 0  /* Compatibility with non-clang compilers. */
 #endif

 #if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
-#define WL_PRIVATE __attribute__ ((visibility("hidden")))
+#define WL_PRIVATE __attribute__ ((visibility("hidden"))) extern "C"
 #else
 #define WL_PRIVATE
 #endif
@@ -181,3 +184,5 @@ WL_PRIVATE const struct wl_interface xdg_popup_interface = {
 	3, xdg_popup_events,
 };

+
+}
diff --git a/wayland/java/WindowWayland.java b/wayland/java/WindowWayland.java
index 056f7f4..5c09dd5 100644
--- a/wayland/java/WindowWayland.java
+++ b/wayland/java/WindowWayland.java
@@ -32,14 +32,14 @@ public class WindowWayland extends Window {
     public IRect getWindowRect() {
         assert _onUIThread() : "Should be run on UI thread";
         // very very bad!
-        return IRect.makeXYWH(0, 0, 0, 0);
+        return IRect.makeXYWH(0, 0, 100, 100);
     }

     @Override
     public IRect getContentRect() {
         assert _onUIThread() : "Should be run on UI thread";
         // stop!
-        return IRect.makeXYWH(0, 0, 0, 0);
+        return IRect.makeXYWH(0, 0, 100, 100);
     }

     @Override

dzaima avatar Dec 03 '23 15:12 dzaima

sorry for the bad commit names. this is what I do when stuff DOESN'T WORK

TheDrawingCoder-Gamer avatar Dec 03 '23 22:12 TheDrawingCoder-Gamer

I have a question about what format the buffer is supposed to be in. I assumed ABGR8888 because of LSBFirst, but is it RGBA8888?

TheDrawingCoder-Gamer avatar Dec 03 '23 23:12 TheDrawingCoder-Gamer

updates ( i guess):

window does now open, but no rendering skija won't actually bind to LayerGL for some reason??? it can't find the egl context : /. idk what to do there LayerRaster currently memory leaks every resize because skija is holding on to a pointer. I get crashes when uncommenting out munmap in ShmPool::close.

I've made a surprising amount of progress which is nice. I want to get rendering working before I start hooking up the keyboard. Any help would be appreciated bc I don't fully understand C++ (multiple days were taken up because I didn't realize things were freed at the end of scope).

TheDrawingCoder-Gamer avatar Dec 06 '23 03:12 TheDrawingCoder-Gamer

skija won't actually bind to LayerGL for some reason??? it can't find the egl context

Sorry, I wish I could help, but I have no experience with Wayland

tonsky avatar Dec 06 '23 14:12 tonsky

ok here's some digging I've done on the GL issue - within Java_io_github_humbleui_jwm_LayerGL__1nAttachLayerGL::attachLayerGL::makeCurrentForcedeglMakeCurrent, some address is set to 1, which then Java_io_github_humbleui_skija_DirectContext__1nMakeGL → ... → GrGLMakeGLXInterfaceglXGetCurrentContext later doesn't like. My attempts at searching haven't ended up conclusive, but I think the "X" in "GLX" stands for X11, and thus shouldn't be used on Wayland (and/or be mixed with egl)? (I don't have much clue what I'm looking at, I'm primarily just having fun with debugging under https://rr-project.org/)

dzaima avatar Dec 06 '23 16:12 dzaima

I am not using glx though. I'm using egl, which SHOULD work on wayland.

TheDrawingCoder-Gamer avatar Dec 06 '23 16:12 TheDrawingCoder-Gamer

OH, you mean in skija. Yeah that is likely an upstream issue.

TheDrawingCoder-Gamer avatar Dec 06 '23 16:12 TheDrawingCoder-Gamer

#0  0x00007f22c3e5c9fe in glXGetCurrentContext () from /lib/x86_64-linux-gnu/libGLX.so.0
#1  0x00007f228af92132 in GrGLMakeGLXInterface() () from /tmp/skija_0.116.1_x64/libskija.so
#2  0x00007f228ae93d72 in GrGLMakeNativeInterface() () from /tmp/skija_0.116.1_x64/libskija.so
#3  0x00007f228aafe498 in GrGLGpu::Make(sk_sp<GrGLInterface const>, GrContextOptions const&, GrDirectContext*) () from /tmp/skija_0.116.1_x64/libskija.so
#4  0x00007f228a9e9a45 in GrDirectContext::MakeGL(sk_sp<GrGLInterface const>, GrContextOptions const&) () from /tmp/skija_0.116.1_x64/libskija.so
#5  0x00007f228a9e9ed7 in GrDirectContext::MakeGL() () from /tmp/skija_0.116.1_x64/libskija.so
#6  0x00007f228a4c2920 in Java_io_github_humbleui_skija_DirectContext__1nMakeGL () from /tmp/skija_0.116.1_x64/libskija.so
#7  0x00007f22b4356b11 in ?? ()
#8  0x00007f22cad16e10 in ?? ()
#9  0x0000000000000000 in ?? ()

the full gdb stacktrace of the fail fwiw

dzaima avatar Dec 06 '23 17:12 dzaima

oh, is skia in skija built with X11/GLX hard-coded? skia does have a thing that'd supposedly use EGL for GrGLMakeNativeInterface, but that's not present in the skija build afaict

dzaima avatar Dec 06 '23 17:12 dzaima

perhaps a skia_use_egl=true in like here or something?

gonna try building that, probably gonna take a while though

dzaima avatar Dec 06 '23 17:12 dzaima

X11 could also be possibly rewritten to use EGL too - it would ensure that all linux targets would work with EGL.

(or we could just add an if statement to the constructor of LayerGLSkija : ) )

TheDrawingCoder-Gamer avatar Dec 06 '23 17:12 TheDrawingCoder-Gamer

Got a skia build with that to load (ended up ln -sing SkiaBuild's output unzipped to Skija's platform/Skia-m116-f44dbc40d8-linux-Release-x64/ and doing a clean rebuild); gives this now:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/skija_369211854708109/libskija.so: /tmp/skija_369211854708109/libskija.so: undefined symbol: eglQueryString
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2404)
	at java.base/java.lang.Runtime.load0(Runtime.java:785)
	at java.base/java.lang.System.load(System.java:2011)
	at io.github.humbleui.skija.impl.Library._loadFromFile(Library.java:147)
	at io.github.humbleui.skija.impl.Library.load(Library.java:122)
	at io.github.humbleui.skija.impl.Library.staticLoad(Library.java:20)
	at io.github.humbleui.skija.Font.<clinit>(Font.java:9)
	at io.github.humbleui.jwm.examples.Example.<clinit>(Example.java:18)

should be easy enough to fix once I find where

dzaima avatar Dec 06 '23 19:12 dzaima

and with a

diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt
index 6b352fe..23afd7e 100644
--- a/platform/CMakeLists.txt
+++ b/platform/CMakeLists.txt
@@ -84,4 +84,4 @@ endif()

 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
 include(FindSkia)
-target_link_libraries(skija skottie sksg svg skparagraph skshaper skunicode skresources skia ${FREETYPE_LIBRARIES} ${HARFBUZZ_LIBRARIES})
+target_link_libraries(skija skottie sksg svg skparagraph skshaper skunicode skresources skia EGL ${FREETYPE_LIBRARIES} ${HARFBUZZ_LIBRARIES})

in Skija, JWM now doesn't crash with LayerGLSkija! Doesn't show any window though; presumably just unfinished?

dzaima avatar Dec 06 '23 19:12 dzaima

(here's a Skija linux x64 jar file of that; usable for JWM's example thing with ./script/run.py --skija-platform-jar /path/to/that/target/skija-linux-x64-0.0.0-SNAPSHOT.jar)

dzaima avatar Dec 06 '23 19:12 dzaima

Seems with this EGL build JWM & Skija still work on X11 with no extra changes? So that's nice (assuming that's correct and not me having forgotten to do something)

dzaima avatar Dec 06 '23 19:12 dzaima

Yeah just unfinished - needs more work. Will make a PR to skia build and skija to include EGL.

TheDrawingCoder-Gamer avatar Dec 06 '23 19:12 TheDrawingCoder-Gamer

You did test X11, correct? this doesn't break X11 if I change skija?

TheDrawingCoder-Gamer avatar Dec 06 '23 19:12 TheDrawingCoder-Gamer

yeah, said that in my last comment; running the exact same command works both in my native X11, and within Weston, both using LayerGLSkija (with X11 properly rendering things as usual, and Weston quietly doing nothing). There could be some implications I'm not aware of, but ¯\_(ツ)_/¯

dzaima avatar Dec 06 '23 19:12 dzaima

I think I will have to add an if statement in JWM and add an "MakeEGL" thing for it, as MakeGL is currently platform specific (thus can't really differ on different installs of linux).

TheDrawingCoder-Gamer avatar Dec 06 '23 20:12 TheDrawingCoder-Gamer

While the window is infact showing, it's incapable of actually rendering anything. It can't actually make the DirectContext (it errors out, because GrDirectContext::MakeGL().release() returns nullptr only on wayland : /)

TheDrawingCoder-Gamer avatar Dec 07 '23 01:12 TheDrawingCoder-Gamer

Huh? For me, GrDirectContext::MakeGL().release() gave nullptr before the SkiaBuild change, but the entire purpose of the Skia change was to make GrDirectContext::MakeGL() work, and it does appear to for me; i.e. adjusting Skija's DirectContext::makeGL to

    public static DirectContext makeGL() {
        Stats.onNativeCall();
        System.out.println("pre-_nMakeGL in Java");
        long ptr = _nMakeGL();
        System.out.println("post-_nMakeGL in Java: got "+ptr);
        new Exception().printStackTrace();
        return new DirectContext(ptr);
    }

results in logging of

pre-_nMakeGL in Java
post-_nMakeGL in Java: got 140025466978336
java.lang.Exception
  at io.github.humbleui.skija.DirectContext.makeGL(DirectContext.java:15)
  at io.github.humbleui.jwm.skija.LayerGLSkija.frame(LayerGLSkija.java:27)
  at io.github.humbleui.jwm.Window.accept(Window.java:412)
  at io.github.humbleui.jwm.Window.accept(Window.java:427)
  at io.github.humbleui.jwm.Window.accept(Window.java:425)
  at io.github.humbleui.jwm.Window.setLayer(Window.java:66)
  at io.github.humbleui.jwm.examples.PanelRendering.changeLayer(PanelRendering.java:57)
  at io.github.humbleui.jwm.examples.PanelRendering.<init>(PanelRendering.java:44)
  at io.github.humbleui.jwm.examples.Example.<init>(Example.java:51)
  at io.github.humbleui.jwm.examples.Example.lambda$main$0(Example.java:229)
  at io.github.humbleui.jwm.App.lambda$start$1(App.java:35)
  at io.github.humbleui.jwm.App._nStart(Native Method)
  at io.github.humbleui.jwm.App.start(App.java:28)
  at io.github.humbleui.jwm.examples.Example.main(Example.java:228)
pre-_nMakeGL in Java
post-_nMakeGL in Java: got 140025466978336
java.lang.Exception
  at io.github.humbleui.skija.DirectContext.makeGL(DirectContext.java:15)
  at io.github.humbleui.jwm.skija.LayerGLSkija.frame(LayerGLSkija.java:27)
  at io.github.humbleui.jwm.Window.accept(Window.java:412)
  at io.github.humbleui.jwm.Window.accept(Window.java:427)
  at io.github.humbleui.jwm.Window.accept(Window.java:425)
  at io.github.humbleui.jwm.Window.setVisible(Window.java:280)
  at io.github.humbleui.jwm.WindowWayland.setVisible(WindowWayland.java:92)
  at io.github.humbleui.jwm.examples.Example.<init>(Example.java:88)
  at io.github.humbleui.jwm.examples.Example.lambda$main$0(Example.java:229)
  at io.github.humbleui.jwm.App.lambda$start$1(App.java:35)
  at io.github.humbleui.jwm.App._nStart(Native Method)
  at io.github.humbleui.jwm.App.start(App.java:28)
  at io.github.humbleui.jwm.examples.Example.main(Example.java:228)

dzaima avatar Dec 07 '23 06:12 dzaima

hm, I must have messed up my local build. Did you do anything other than just add skia_use_egl?

TheDrawingCoder-Gamer avatar Dec 07 '23 18:12 TheDrawingCoder-Gamer

Something must be different in our environments : / Adding that same code it still returns null under wayland, but works fine under x11.

What I'm more worried about at the moment is that Raster isn't showing anything.

TheDrawingCoder-Gamer avatar Dec 07 '23 18:12 TheDrawingCoder-Gamer

this is my SkiaBuild diff (the compiler diffs are just because I don't have gcc-9 installed; shouldn't affect anything), and this in Skija (all that matters is the platform/CMakeLists.txt; ignore the syscall(-1), I abuse that as a "checkpoint" for debugging).

After doing SkiaBuild script/checkout.py --version m116-f44dbc40d8, script/build.py, and script/archive.py, I unzipped the Skia-m116-f44dbc40d8-linux-Release-x64.zip to a folder in Skija under platform/Skia-m116-f44dbc40d8-linux-Release-x64, removing what was there before. Then within Skija I ran ./script/clean.py and then ./script/build.py && ./script/package_platform.py and then for JWM's --skija-platform-jar used the output in Skija's target/skija-linux-x64-0.0.0-SNAPSHOT.jar.

In Weston I do have raster rendering the window (although it is somewhat broken, only redrawing whenever the window is unfocused & refocused).

dzaima avatar Dec 07 '23 19:12 dzaima

Wayland also either forces you to draw window frames, or use a library like libdecor to ask the compositor nicely to draw it for you. I opted to use libdecor, but it crashes on mouse hover under weston (swaywm doesn't crash, but I assume that's because it doesn't actually draw anything)

It seems to be an error in JNI from mouse movement, more likely due to dispatching, which is kind of odd considering OTHER dispatches work?

TheDrawingCoder-Gamer avatar Dec 07 '23 19:12 TheDrawingCoder-Gamer

here's a random stacktrace of a random segfault from making PanelRendering switch from raster to GL on a mouse button press (doesn't error always, sometimes it does manage to switch from raster to rendering nothing on GL; this is before the libdecor change):

#0  0x00007f583a3efe43 in jwm::Window::dispatch(_jobject*) () from /mnt/linux2/git/jwm-wayland/target/classes/libjwm_x64_wayland.so
#1  0x00007f583a3f27c6 in jwm::WindowManagerWayland::mouseUpdate(jwm::WindowWayland*, unsigned int, unsigned int, unsigned int) () from /mnt/linux2/git/jwm-wayland/target/classes/libjwm_x64_wayland.so
#2  0x00007f583a327e2e in ?? () from /lib/x86_64-linux-gnu/libffi.so.8
#3  0x00007f583a324493 in ?? () from /lib/x86_64-linux-gnu/libffi.so.8
#4  0x00007f583a632ad0 in ?? () from /lib/x86_64-linux-gnu/libwayland-client.so.0
#5  0x00007f583a633243 in ?? () from /lib/x86_64-linux-gnu/libwayland-client.so.0
#6  0x00007f583a63343c in wl_display_dispatch_queue_pending () from /lib/x86_64-linux-gnu/libwayland-client.so.0
#7  0x00007f583a3f21dd in jwm::WindowManagerWayland::runLoop() () from /mnt/linux2/git/jwm-wayland/target/classes/libjwm_x64_wayland.so

not a worry for now, but noting regardless (error is from myWindow being null, presumably pointerHandleMotion of the old surface running after we've switched to the new one?)

will look at what the libdecor change looks like

edit: oh that's handled in the latest commit!

dzaima avatar Dec 07 '23 19:12 dzaima

ok with that last commit GL crashes with my "OH NO SAD", and raster doesn't render anything

dzaima avatar Dec 07 '23 19:12 dzaima

It breaking may have been caused by me switching from glext api to glplatform. Unsure why that breaks stuff

edit: nvm, doesn't change anything. how peculiar

TheDrawingCoder-Gamer avatar Dec 07 '23 19:12 TheDrawingCoder-Gamer