Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinuxKMS: Add support for mouse cursor rendering with the software renderer #5379

Open
tronical opened this issue Jun 10, 2024 · 3 comments
Open
Labels
a:backend-linuxkms The Linux KMS backend (mS,bO) enhancement New feature or request

Comments

@tronical
Copy link
Member

As a follow-up to #4334 , this issue exists to remind about the missing support for rendering the mouse cursor when using renderer-software with backend-linuxkms.

The approach discussed in #4334 to implement this cleanly is briefly outlined in #4334 (comment) : Add support for this type of mouse cursor rendering in the core library by synthesizing an Image that's rendered on top of the scene.

@tronical tronical added enhancement New feature or request a:backend-linuxkms The Linux KMS backend (mS,bO) labels Jun 10, 2024
@ogoffart
Copy link
Member

We probably need a public API in the software renderer as this would also be in used for the uefi example.

Just wondering at which level to do.
The API could look like

impl SoftwareRenderer { // Or should it be in slint::Window?
   pub fn set_draw_mouse_cursor(cursor: Option<slint::Image>);

@tronical
Copy link
Member Author

Maybe fn set_cursor_image(&self, image: Option<slint::Image>). I think Wayland also supports specifying an image for use a cursor, so this could indeed be on the Window.

@ogoffart
Copy link
Member

No, no. The API i have in mind would be that Slint draws the cursor with its own renderer.

So an implementation of a backend would look like

impl WindowAdapter for MyBackendWindow {
 // ...
 
 // this is currently in WindowAdapterInternal, but we should make it public at some point)
 fn set_mouse_cursor(&self, cursor: MouseCursor) {
    let cursor_image: Option<slint::Image> = load_png_for_cursor(cursor);
    self.renderer.set_draw_mouse_cursor(cursor_image);
 }
}

I think Wayland also supports specifying an image for use a cursor, so this could indeed be on the Window.

That is something else, and should be somehow in the MouseCursor enum, we could pass an image to TouchArea::mouse-cursor or an extra property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:backend-linuxkms The Linux KMS backend (mS,bO) enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants