Skip to content

webOS 3.x: hide the Magic Remote pointer on D-pad presses and after 5 s idle (#642) - #655

Merged
GLinnik21 merged 6 commits into
plxnative:mainfrom
chriskoperdraad-tech:fix/webos3-cursor-hide
Oct 14, 2026
Merged

GLinnik21 merged 6 commits into
plxnative:mainfrom
chriskoperdraad-tech:fix/webos3-cursor-hide

Conversation

@chriskoperdraad-tech

Copy link
Copy Markdown

Fixes #642.

Tested on an LG OLED C7V (2017), webOS 3.9.3 (dreadlocks2-dudhwa, M16P), rooted with Homebrew Channel. I used debug builds from this branch's CI, installed beside PlxNative Nightly.

What was wrong

The system SDL on this set is 2.0.4 and exports no SDL_webOS* symbols at all. So since #578 the runtime lookup of SDL_webOSCursorVisibility returns None, and every hide_cursor() was a no-op. The pointer then stayed on screen, over video too, until LG's SDL hid it by itself. That happens after about five minutes of stillness (timed).

That SDL draws the pointer itself. Its strings include /usr/share/im/cursorType*.png, wl_starfish_pointer and an SDL_WEBOS_CURSOR_SLEEP_TIME hint.

What does not work: SDL_ShowCursor

My first suggestion in the issue was SDL_ShowCursor(SDL_DISABLE), then SDL_ENABLE on motion. On this set that hides the pointer, but it also stops pointer motion from reaching the app until the pointer re-enters the window. The only thing that did that was opening and closing the Settings overlay. With the pointer hidden this way, sweeping the remote across several cards (far more than the 120 px D-pad gate) did not move focus. So the motion that was meant to bring the cursor back never arrived.

The change

  1. hide_cursor() without LG's extension swaps SDL's cursor for a transparent one instead of switching it off. That is an 8x1 SDL_CreateCursor with every data and mask bit clear. It keeps the cursor it replaced, and show_cursor_after_motion() (new, called from the SDL_MOUSEMOTION arm while cur_hidden) puts it back with SDL_SetCursor. Because the window still has a cursor, motion keeps arriving. SDL_SetCursor, SDL_GetCursor, SDL_GetDefaultCursor and SDL_CreateCursor are all dlsym'd like SDL_webOSCursorVisibility, so the binary gains no import. The door is resolved once, on the first hide (after SDL_Init), and logs which path it took (cursor: ...).
  2. A still pointer hides after five seconds, as it does in the other apps on this set. Without LG's extension, LG's SDL hides its own pointer after SDL_WEBOS_CURSOR_SLEEP_TIME of stillness, and its default is about five minutes. That is the "hides late" in the issue title, and what a viewer sees on every menu. The app now sets the hint to 5000 before SDL_Init, only where SDL_webOSCursorVisibility is absent. I measured the unit with a build that read the value from a dev trigger: it is milliseconds, and 5000 hid a still pointer after about five seconds. A deliberate movement brings it back; a small one does not, which looks like LG's own wake threshold. It is its own commit, to keep the two mechanisms apart in review.

On webOS 4+ nothing should change at runtime. SDL_webOSCursorVisibility resolves there, so the cursor path is the same LG call as before, and the hint is not set.

Verification

  • Instrumented build with switchable hide modes and per-hide logging, in transparent-cursor mode: every D-pad hide and every playback idle hide (seven cycles) was followed by a motion that restored the cursor. The pointer stayed hidden through five consecutive D-pad presses, and I saw no case of it coming back while the remote lay still. Visually, the pointer was invisible after a D-pad press and back immediately on movement.
  • This branch's final build:
    • On Home, a still pointer disappears after about 5 s (LG's PointerHidden, 484, arrives in the event log) and returns on movement.
    • A D-pad press hides it at once, and movement restores it. The log shows cursor: SDL_WEBOS_CURSOR_SLEEP_TIME=5000 (no SDL_webOS* in this SDL) and cursor: transparent SDL cursor (no SDL_webOS* in this SDL).
    • The playback idle hide goes through the same hide_cursor() path the instrumented build exercised, but I did not separately re-run it on this exact build.
    • No crashes.
  • CI on the fork is green (host gates, cross-build and artifact assertions).

Not changed

The doc comment above note_global_press in app/input.rs, and the is_bound paragraph in docs/remote-keys.md, still say hide_cursor names a webOS-only SDL symbol, so a host test that reaches it fails at ld. That has not been true since #578 resolved it at runtime, and it still isn't. I left both alone to keep this change to the cursor itself.

🤖 Generated with Claude Code

chriskoperdraad-tech and others added 6 commits October 13, 2026 15:05
…L_webOS* extension

webOS 3.9.3 ships SDL 2.0.4 with no SDL_webOS* export at all, so the
runtime lookup of SDL_webOSCursorVisibility from plxnative#578 returned None and
every hide_cursor() was a no-op. The Magic Remote pointer then stayed on
screen until LG's own ~5-minute idle timeout, including over video.

That SDL draws the pointer itself (cursorType*.png, wl_starfish_pointer),
so hide_cursor() now falls back to SDL_ShowCursor(SDL_DISABLE) when the
LG extension is absent, and pointer motion re-enables it with
SDL_ShowCursor(SDL_ENABLE), since nothing in the compositor brings a
cursor hidden that way back. SDL_ShowCursor is dlsym'd as well, so the
binary gains no import. Sets with the LG extension (webOS 4+) take the
unchanged path. The resolved door is logged once as "cursor: ...".

Fixes plxnative#642.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: chriskoperdraad-tech <[email protected]>
…rsor

Measured on a webOS 3.9.3 set: SDL_ShowCursor(SDL_DISABLE) hides LG's
SDL-drawn pointer, but pointer motion then stops reaching the app until
the pointer re-enters the window (only opening and closing the Settings
overlay did it), so the motion that was meant to re-enable the cursor
never arrived and the pointer stayed hidden.

hide_cursor() on that path now swaps SDL's cursor for a transparent 8x1
one (SDL_CreateCursor with every data and mask bit clear) and keeps the
cursor it replaced; the next motion puts it back with SDL_SetCursor.
Motion keeps flowing because the window still has a cursor. Verified on
the same set with an instrumented build: every D-pad hide and every
playback idle hide was followed by a motion that restored the pointer,
and the pointer was invisible in between. All four SDL calls are
dlsym'd, so the binary still gains no import. Sets with LG's extension
(webOS 4+) are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: chriskoperdraad-tech <[email protected]>
…ault

Without LG's SDL_webOS* extension, LG's SDL hides its own pointer after
SDL_WEBOS_CURSOR_SLEEP_TIME of stillness, and its default is about five
minutes (timed on a webOS 3.9.3 set, plxnative#642), so on menus the pointer
stayed up far longer than in any other app on that television.

Set the hint to 5000 before SDL_Init where SDL_webOSCursorVisibility is
absent. Measured on the same set with an instrumented build: the unit is
milliseconds, 5000 hides a still pointer after about five seconds, and a
deliberate movement brings it back. webOS 4+ does not get the hint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: chriskoperdraad-tech <[email protected]>
…store, test the hide/show bookkeeping, fix stale docs

hide_cursor now takes its function table through hide_through/show_through, so the host can
grade the bookkeeping with fake extern "C" functions: the transparent cursor is installed, the
previous (or default) cursor is the one motion restores, a second hide keeps it, and LG's
extension door is called with 0. When SDL_GetCursor and SDL_GetDefaultCursor both answer NULL
nothing is saved to restore, so the swap is skipped instead of leaving the pointer invisible for
good. The idle-hide hint decision is a pure function, and a seam-order test pins that it is set
before SDL_Init.

note_global_press, docs/remote-keys.md and Pointer::cur_hidden said hide_cursor names a webOS-only
symbol that fails a host test at ld; since plxnative#578 it resolves through dlsym, and the hider may be a
transparent SDL cursor rather than LG's.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@GLinnik21
GLinnik21 enabled auto-merge (squash) October 14, 2026 14:07
@GLinnik21
GLinnik21 merged commit 63fb1fe into plxnative:main Oct 14, 2026
11 checks passed
@GLinnik21

Copy link
Copy Markdown
Collaborator

Merged, thank you @chriskoperdraad-tech! Great work.

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.

Magic Remote pointer hides late on webOS 3.9.3 (SDL 2.0.4 has no SDL_webOSCursorVisibility)

2 participants