JUCE icon indicating copy to clipboard operation
JUCE copied to clipboard

[Bug]: X11 _NET_WM_MOVERESIZE stops mouseup from being sent

Open AlexMitchellMus opened this issue 2 years ago • 0 comments
trafficstars

Detailed steps on how to reproduce the bug

  • Create a JUCE app with a minimal window, I tested with JUCE/CMake/GuiApp
  • Make the window resizable & use non-native title bar:
setUsingNativeTitleBar (false);
setResizable (true, false);
  • Resize window with mouse, due to a8fa44e05c2 JUCE asks the X11 server to do the resize, however once the server is resizing it is no longer going to send JUCE mouse events. X11 also does not have a resize finished event.
  • Stop dragging and release the mouse button.
  • At this point JUCE still thinks the mouse is down (dragging), and starts manually resizing the window:

https://github.com/juce-framework/JUCE/assets/12004932/f2cd2a1b-2d9e-48bc-ae5c-429550b450c7

Issue is not in JUCE 7.0.5 (before a8fa44e05c2 was introduced. Old resize system had issues that 7.0.7 has fixed, so I'm not suggesting a revert)

https://github.com/juce-framework/JUCE/assets/12004932/61a3e68e-914e-4758-b0e9-503d647dfef4

Documentation of this same X11 bug in Qt: https://codereview.qt-project.org/c/qt/qtbase/+/231552 https://bugreports.qt.io/browse/QTBUG-68501

What is the expected behaviour?

When resize finished the mouseup should be registered with JUCE, and the resize event should stop

Potential solution:

Use xInput2 (XI2) for mouse events - listening to the "Slave device" (XI2 terminology). This way we don't rely on the server to send JUCE mouse events, as they will be coming directly from the device.

With this (and possibly only solution) we will also need to opt-out of mouse drag if peer->startHostManagedResize() is successful in resizing the window (eg: the WM supports _NET_WM_MOVERESIZE)

Operating systems

Linux

What versions of the operating systems?

OS: Arch-Linux Host: MS-7B98 1.0 Kernel: 6.5.6-arch2-1 Shell: bash 5.1.16 DE: GNOME WM: Mutter WM Theme: Adwaita CPU: Intel i5-8600K (6) @ 4.400GHz GPU: NVIDIA GeForce RTX 3090

Architectures

x86_64

Stacktrace

No response

Plug-in formats (if applicable)

No response

Plug-in host applications (DAWs) (if applicable)

No response

Testing on the develop branch

The bug is present on the develop branch

Code of Conduct

  • [X] I agree to follow the Code of Conduct

AlexMitchellMus avatar Oct 12 '23 03:10 AlexMitchellMus