Skip to content

Fix cursor visibility API compatibility with newer GNOME Shell versions#54

Open
neoRandom wants to merge 1 commit into
jkitching:masterfrom
neoRandom:fix-cursor-visibility
Open

Fix cursor visibility API compatibility with newer GNOME Shell versions#54
neoRandom wants to merge 1 commit into
jkitching:masterfrom
neoRandom:fix-cursor-visibility

Conversation

@neoRandom
Copy link
Copy Markdown

Fixes #53

Summary

Adds fallback cursor visibility handling for GNOME Shell versions where Meta.CursorTracker.inhibit_cursor_visibility() and uninhibit_cursor_visibility() methods are not available in the JavaScript bindings.

Changes

  • Added runtime check for cursor visibility methods availability
  • Implements fallback using global.stage.set_cursor_type() when tracker methods unavailable
  • Maintains full backward compatibility with versions that have the methods
  • Preserves input focus inhibition via ClutterSeat unchanged

Technical Details

The fix uses a dual-path approach:

  1. Primary path: Uses Meta.CursorTracker methods when available (original behavior)
  2. Fallback path: Uses global.stage.set_cursor_type() when methods not found
    • Hide: Sets cursor to Clutter.CursorType.NONE
    • Show: Sets cursor to Clutter.CursorType.DEFAULT

The implementation gracefully degrades without crashes on any GNOME Shell version.

Testing

Please verify the extension:

  • Works on GNOME Shell versions with the tracker methods
  • Doesn't crash on GNOME Shell versions without the methods
  • Cursor visibility controls function as expected

- Add runtime check for Meta.CursorTracker visibility methods
- Fall back to global.stage.set_cursor_type() when methods unavailable
- Maintain backward compatibility with older Shell versions
- Fixes jkitching#53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conflict between "Mouse cursor brightness control" and GNOME Screenshot Tool

1 participant