slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.86k stars 559 forks source link

MouseCursor.grab and MouseCursor.grabbing always shows as MouseCursor.move in Windows #5897

Open novakduc opened 3 weeks ago

novakduc commented 3 weeks ago

Language: Rust Platform: Window Issue: MouseCursor.grab or MouseCursor.grabbing always shows as MouseCursor.move. Other seems work well (I have not checked all)

                touch := TouchArea {
                    //mouse-cursor: grab;
                    property <bool> is_holding_image;
                    function get_mouse_cursor() -> MouseCursor {
                        return is_holding_image ? MouseCursor.grabbing : MouseCursor.grab;
                    }
                    mouse-cursor: get_mouse_cursor();
                  //...
                }
ogoffart commented 3 weeks ago

Winit does indeed render grab, gabbing, and move with the same cursor. There might not be grabbing cursor on Windows. https://github.com/rust-windowing/winit/blob/1e1f0fd7e9a877be1b37a60685bf72dad8bb8d3c/src/platform_impl/windows/util.rs#L162

ogoffart commented 3 weeks ago

Note that Qt does provide images for the cursors that Windows don't have builtin https://github.com/qt/qtbase/blob/33874a9424cd03c21ca9986a39c383b3689f03d2/src/plugins/platforms/windows/qwindowscursor.cpp#L415

ogoffart commented 3 weeks ago

IMHO this is an issue in winit. Should winit provide custom cursors for the values in its enum that are not available on a given platform?

We could workaround the issue in slint by using custom cursor on Windows, but I don't think it's worth it.

Thanks @novakduc for the bug report.

novakduc commented 3 weeks ago

Thanks @ogoffart for your comment.