Repository navigation
feat(input): add an option to use system cursors - #26
Conversation
input.system_cursor swaps the arrow, hand and text cursors Roblox draws for the desktop's own. Custom game cursors and the shift lock cursor are still drawn by Roblox. The cursor also stays visible at the press point during a right-drag camera turn on Wayland.
CoderDayton
left a comment
There was a problem hiding this comment.
Tested on GNOME Wayland. With input.system_cursor off, right-drag now shows the desktop cursor on top of Roblox's. Roblox keeps drawing its own cursor during the drag here, so the "keep a cursor at the press point" change adds a second one. With the option on it works: one desktop cursor during the drag.
The drag cursor should only show when the desktop cursor was already showing before the drag. With the option off, that's never the case, so it stays like before.
Test first. Flip CameraDragOverRobloxCursorShowsTheArrow in tests/window_pointer_capture_owner_test.cc:
-TEST(WindowPointerCaptureOwnerTest, CameraDragOverRobloxCursorShowsTheArrow) {
+TEST(WindowPointerCaptureOwnerTest, CameraDragOverRobloxCursorKeepsItHidden) {
...
EXPECT_TRUE(owner.OnRightButton(true, false));
EXPECT_TRUE(owner.captured());
- EXPECT_EQ(owner.cursor(), CursorShape::kArrow);
+ EXPECT_EQ(owner.cursor(), CursorShape::kHidden);
}It fails on the PR as is. Then in WindowPointerCaptureOwner::Pump (src/window/window_pointer_capture_owner.cc):
if (!captured_) {
- capture_cursor_ =
- cursor_ != CursorShape::kHidden ? cursor_ : CursorShape::kArrow;
+ capture_cursor_ = cursor_;
}All 26 tests in window_pointer_capture_owner_test pass with it.
Two follow-ups from the same change:
- The comment above that block ("Roblox hides its cursor during an RMB camera drag") isn't true on every desktop. Roblox keeps drawing its cursor on GNOME.
- The CHANGELOG bullet "On Wayland, the cursor now stays on screen at the press point..." now only applies with
input.system_cursoron, so it belongs in that entry instead of standing alone.
If you see Roblox's cursor disappear during the drag with the option off on your setup, can you run this and right-drag a few times:
MOCKTAIL_SYSTEM_CURSOR=on MOCKTAIL_CURSOR_TRACE=1 mocktailIf it prints Roblox draws no cursor while you drag, Roblox is hiding it on your end, and that's worth fixing on its own.
|
Fixed. The drag cursor now only shows if the desktop cursor was already showing. Also covered a right click that refocuses the window, updated the comment and moved the changelog line. |
CoderDayton
left a comment
There was a problem hiding this comment.
Tested on GNOME Wayland with system cursors on and off. Right-drag camera turns no longer leave a cursor on screen, clicking back into the window after alt-tab works, and menu hovers show the desktop shapes. The full test suite passes (1706 tests, 0 failed).
Adds
input.system_cursor(also in the settings window) to show the desktop's arrow, hand and text cursors instead of Roblox's. Custom game cursors and the shift lock cursor are unchanged. On Wayland, the cursor also stays visible during right-drag camera turns.