Skip to content

Conversation

@huaxinliao
Copy link
Collaborator

@huaxinliao huaxinliao commented Jun 28, 2025

Windows would jump to unexpected positions when moving with the mouse on the Linux framebuffer backend. This patch, tested on Raspberry Pi 3B and virtual machines, ensures smoother and more reliable window dragging behavior.

Summary by Bito

This pull request fixes a bug in the Linux framebuffer backend that caused windows to jump during mouse movement. It improves window dragging behavior on Raspberry Pi 3B by modifying screen update conditions, enhancing user experience.

@jserv jserv requested a review from weihsinyeh June 28, 2025 04:39
twin_screen_t *screen = SCREEN(closure);

if (!tx->vt_active && twin_screen_damaged(screen))
if (!tx->vt_active && (tx->fb_base == MAP_FAILED) &&
Copy link
Contributor

@jserv jserv Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the condition tx->fb_base == MAP_FAILED be considered as an early return?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I experimented based on the following code and found that the issue still persists.

--- a/backend/fbdev.c
+++ b/backend/fbdev.c
@@ -190,6 +190,9 @@ static bool twin_fbdev_update_damage(void *closure)
     twin_fbdev_t *tx = PRIV(closure);
     twin_screen_t *screen = SCREEN(closure);
 
+    if (tx->fb_base == MAP_FAILED)
+       return;
+
     if (!tx->vt_active && twin_screen_damaged(screen))
         twin_screen_update(screen);

@jserv jserv requested a review from shengwen-tw June 28, 2025 12:51
@weihsinyeh
Copy link
Collaborator

I'm curious why adding condition tx->fb_base == MAP_FAILED solves the problem. Can you provide an explanation?

@huaxinliao
Copy link
Collaborator Author

I'm curious why adding condition tx->fb_base == MAP_FAILED solves the problem. Can you provide an explanation?

Based on my current observations and experiments, I consider this PR suppresses the screen update behavior of twin_fbdev_update_damage, which is why the issue appears to go away. I would like to use this PR as a basis for discussion to explore possible solutions to the underlying problem.

@jserv
Copy link
Contributor

jserv commented Jul 2, 2025

Based on my current observations and experiments, I consider this PR suppresses the screen update behavior of twin_fbdev_update_damage, which is why the issue appears to go away. I would like to use this PR as a basis for discussion to explore possible solutions to the underlying problem.

Make git commit messages informative.

Windows would jump to unexpected positions when moved with the
mouse on the Linux framebuffer backend. By suppressing the screen
update behavior of twin_fbdev_update_damage, this patch ensures
more robust window dragging on Raspberry Pi 3B and virtual machines.
@jserv jserv merged commit f4d5b80 into sysprog21:main Jul 6, 2025
3 checks passed
@jserv
Copy link
Contributor

jserv commented Jul 6, 2025

Thank @huaxinliao for contributing!

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.

3 participants