Skip to content

fix(linux): prevent firing duplicate mouse events (fixes #939) - #941

Merged
pewsheen merged 3 commits into
tauri-apps:devfrom
Sanae6:dev
Jun 24, 2024
Merged

fix(linux): prevent firing duplicate mouse events (fixes #939)#941
pewsheen merged 3 commits into
tauri-apps:devfrom
Sanae6:dev

Conversation

@Sanae6

@Sanae6 Sanae6 commented Jun 19, 2024

Copy link
Copy Markdown
Contributor

Prevents the press, release, and motion events from firing twice on Linux, fixing #939.

@Sanae6
Sanae6 requested a review from a team as a code owner June 19, 2024 21:15
@wusyong

wusyong commented Jun 20, 2024

Copy link
Copy Markdown
Member

Thanks for help fix this issue! Could you add a change file before it can be merged?

@Sanae6

Sanae6 commented Jun 20, 2024

Copy link
Copy Markdown
Contributor Author

Should be good now 👍

Comment thread .changes/bump.md Outdated
Co-authored-by: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>
@wusyong

wusyong commented Jun 20, 2024

Copy link
Copy Markdown
Member

@jbolda Do you know why covector returned error here? It seems fine for me.

@amrbashir

Copy link
Copy Markdown
Member

This is because, PR is from a fork, it is a known issue, wet can ignore it for now

}
}
glib::Propagation::Proceed
glib::Propagation::Stop

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How does this change affects Widgets added inside the window, do they still receive events? or will be swallowed by these handlers here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is there a way I can easily test that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you can get the gtk window created by tao using https://docs.rs/tao/latest/tao/platform/unix/trait.WindowExtUnix.html#tymethod.gtk_window and then you can create a gtk Button https://docs.rs/gtk/latest/gtk/struct.Button.html and add it to the window using gtk_window.add(), then you will need to add these same handlers on the button you created, and ensure:

  1. the button can be clicked normally
  2. the handlers on the button are triggered

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The button worked fine, I checked all three event handlers and they fire correctly as well. Should be good to go!

@pewsheen
pewsheen merged commit e67cf1b into tauri-apps:dev Jun 24, 2024
@github-actions github-actions Bot mentioned this pull request Jun 24, 2024
dgerhardt added a commit to dgerhardt/tao that referenced this pull request May 7, 2026
This reverts tauri-apps#941, which broke CSD event handling on Wayland. A new fix
for tauri-apps#939 might now be needed.

Fixes tauri-apps/tauri#13440
Might fix (unconfirmed) tauri-apps/tauri#11856
FabianLars added a commit that referenced this pull request Jun 29, 2026
…cessary (#1218)

* fix(wayland): remove broken custom CSD

The default client side decoration handling of GTK is now used once
again. Custom CSD don't make any sense when no custom widgets are added
to the title bar. Futhermore, the custom CSD didn't work correctly and
introduced multiple bugs regarding the titlebar and server-side
rendering on Wayland.

This is mostly a revert of #979.

Fixes #1046, tauri-apps/tauri#13749, tauri-apps/tauri#14251,
tauri-apps/tauri#14748
Supersedes #1055

* fix(wayland): propagate window events for CSD

This reverts #941, which broke CSD event handling on Wayland. A new fix
for #939 might now be needed.

Fixes tauri-apps/tauri#13440
Might fix (unconfirmed) tauri-apps/tauri#11856

* fix(wayland): ensure compositors don't force decorations

This enables CSD for undecorated windows to ensure that compositors with
server-side decoration support (e.g. KDE Plasma) do not apply them when
decorations are disabled for the window. Changing the decoration state
for existing windows is however still not supported.

This is a workaround for a GTK bug:
https://gitlab.gnome.org/GNOME/gtk/-/work_items/5479

Fixes #899, tauri-apps/tauri#6562

* chore: add changelog entry for Wayland CSD fixes

* fix(linux): reapply maximize fix from #979

This ensures that the window is resizable before maximizing it to avoid
unexpected behavior.

* Revert "fix(wayland): propagate window events for CSD"

This reverts commit 25edb8e.

* Reapply "fix(wayland): propagate window events for CSD"

This reverts commit 6b11c08.

* enable min/max buttons

* prevent crash on wsl/weston when maximizing undecorated window

* prevent duplicate mouse events

* keep default decorations

---------

Co-authored-by: Fabian-Lars <30730186+FabianLars@users.noreply.github.com>
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.

4 participants