Skip to content

Cursor not resetting when entering window #29

Description

@baodrate

I have an overlay window with a TouchArea with mouse-cursor: MouseCursor.default. The issue is the cursor that was set before the window spawns stays in place even after interacting with the overlay window.

e.g.:

  • I am hovering over text in firefox
  • My app's overlay window spawns near my cursor
  • I hover over the window and click on it
  • The mouse cursor stays as a text-select cursor the entire time

I inexperienced with slint/wayland, but I think the issue is in this conditional:

pub fn update_cursor(&mut self, mouse_cursor: MouseCursor, queue: &QueueHandle<SpellWin>) {
if self.last_cursor_enter_serial.is_some()
&& self.pointer.is_some()
&& mouse_cursor != self.current_wayland_cursor
{

but current_wayland_cursor gets initialized to MouseCursor::Default:

let pointer_state = PointerState {
pointer: None,
pointer_data: None,
cursor_shape: cursor_manager,
current_wayland_cursor: MouseCursor::Default,
last_cursor_enter_serial: None,
};

so update_cursor() always skips if we're going from non-default -> default cursor.

I think the condition should be amended to (or separated out) so that the cursor update occurs once the first time update_cursor() is called per window (app?)

Alternatively, would it be possible to grab the actual cursor type instead of initializing it to default? I assumed this isn't feasible (didn't check very hard), and I'm not sure it's the cleaner fix anyways

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions