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

[V3-Linux] Fix linux compile and systray OnClicks #3886

Open
wants to merge 4 commits into
base: v3-alpha
Choose a base branch
from

Conversation

atterpac
Copy link
Member

@atterpac atterpac commented Nov 16, 2024

A recent merge added some broken code to the linux webview implementation, this PR corrects that to properly compile linux

Adds the implementation for OnClick and OnRightClick for Linux systray

OnClick may be a single click or a double click / OnRightClick is typically a middle mouse click it varies OS to OS and depending on DE
See very long thread for more information on that sauce

# System
┌──────────────────────────────────────────────────────────────────────────────────────────┐
| Name         | Ubuntu                                                                    |
| Version      | 24.04                                                                     |
| ID           | ubuntu                                                                    |
| Branding     | 24.04 LTS (Noble Numbat)                                                  |
| Platform     | linux                                                                     |
| Architecture | amd64                                                                     |
| CPU          | 12th Gen Intel(R) Core(TM) i5-1235U                                       |
| GPU 1        | Alder Lake-UP3 GT2 [Iris Xe Graphics] (Intel Corporation) - Driver: i915  |
| Memory       | 7GB                                                                       |
└──────────────────────────────────────────────────────────────────────────────────────────┘

# Build Environment
┌─────────────────────────────────────────────────────────┐
| Wails CLI    | v3.0.0-alpha.7                           |
| Go Version   | go1.22.4                                 |
| Revision     | 99d538ea971eb23efa3f65448ff3c5398d220902 |
| Modified     | true                                     |
| -buildmode   | exe                                      |
| -compiler    | gc                                       |
| CGO_CFLAGS   |                                          |
| CGO_CPPFLAGS |                                          |
| CGO_CXXFLAGS |                                          |
| CGO_ENABLED  | 1                                        |
| CGO_LDFLAGS  |                                          |
| GOAMD64      | v1                                       |
| GOARCH       | amd64                                    |
| GOOS         | linux                                    |
| vcs          | git                                      |
| vcs.modified | true                                     |
| vcs.revision | 99d538ea971eb23efa3f65448ff3c5398d220902 |
| vcs.time     | 2024-11-16T01:30:33Z                     |
└─────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────┐
| webkit2gtk | 2.46.1-0ubuntu0.24.04.1 |
| gcc        | 12.10ubuntu1            |
| gtk3       | 3.24.41-4ubuntu1.2      |
| npm        | 10.5.1                  |
| pkg-config | 1.8.1-2build1           |
└────── * - Optional Dependency ───────┘

Summary by CodeRabbit

  • New Features

    • Added documentation for events on the mkdocs website.
    • Introduced templates for SvelteKit and commands for updating build assets and generating runtime.
    • Added support for file associations and window positioning with the InitialPosition option.
    • Implemented Windows options for autofill and password autosave.
  • Bug Fixes

    • Resolved issues with Linux systray interactions and improved functionality on macOS and Linux platforms.
    • Fixed event handling and enhanced drag-and-drop functionality.
  • Improvements

    • Refactored Taskfile and upgraded the go-webview2 library.
    • Consolidated development configuration into a single file for better management.

Copy link
Contributor

coderabbitai bot commented Nov 16, 2024

Walkthrough

The pull request introduces several significant updates to the project, including new features such as documentation for events, SvelteKit templates, and commands for updating build assets and generating runtime. It also adds options for window positioning and file associations. Modifications include a refactor of the Taskfile, upgrades to dependencies, and various bug fixes across platforms. The changes aim to enhance functionality and user interaction, particularly in the system tray and window management.

Changes

File Path Change Summary
mkdocs-website/docs/en/changelog.md Updated changelog to include new features, options, and bug fixes, including commands for build assets and runtime.
v3/pkg/application/systemtray_linux.go Modified Activate and SecondaryActivate methods to call handler functions instead of logging.
v3/pkg/application/webview_window_linux.go Updated run and setPosition methods for improved window positioning and mouse event handling.

Possibly related PRs

🐇 In the meadow, changes bloom,
New features sprout, dispelling gloom.
With windows centered, and clicks that sing,
Our code now dances, a joyful spring!
Let's hop along, with bugs in flight,
Enhancing our app, oh what a delight! 🌼


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4f4f9a8 and d747240.

📒 Files selected for processing (1)
  • mkdocs-website/docs/en/changelog.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • mkdocs-website/docs/en/changelog.md

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@atterpac atterpac marked this pull request as ready for review November 16, 2024 23:37
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
v3/pkg/application/webview_window_linux.go (1)

Line range hint 442-444: Critical: Fix incorrect mouse event ignore state

The setIgnoreMouseEvents method is using the current state instead of the new state, which prevents the ignore state from being updated correctly.

Apply this fix:

func (w *linuxWebviewWindow) setIgnoreMouseEvents(ignore bool) {
-    w.ignoreMouse(w.ignoreMouseEvents)
+    w.ignoreMouseEvents = ignore
+    w.ignoreMouse(ignore)
}
mkdocs-website/docs/en/changelog.md (1)

41-41: Consider expanding the changelog entry with implementation details.

While the entry correctly documents the fix, it could be more informative by mentioning:

  1. The specific Linux systray click events implemented (single click, double click, and middle click)
  2. The compilation issue that was resolved

Suggested expansion:

- Fixed Linux systray `OnClick` and `OnRightClick` implementation by @atterpac in [#3886](https://github.com/wailsapp/wails/pull/3886)
+ Fixed Linux systray click events and compilation issues by @atterpac in [#3886](https://github.com/wailsapp/wails/pull/3886):
+   - Implemented `OnClick` support for single and double clicks
+   - Implemented `OnRightClick` support for middle mouse clicks
+   - Fixed Linux webview compilation errors from recent merge
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 99d538e and 4f4f9a8.

📒 Files selected for processing (3)
  • mkdocs-website/docs/en/changelog.md (1 hunks)
  • v3/pkg/application/systemtray_linux.go (2 hunks)
  • v3/pkg/application/webview_window_linux.go (1 hunks)
🔇 Additional comments (4)
v3/pkg/application/webview_window_linux.go (2)

299-301: LGTM: Window positioning logic is well-implemented

The window positioning logic correctly handles both centered and custom positions using the parent window options.


Line range hint 1-1: Verify systray implementation files

The PR objectives mention systray OnClick functionality changes, but this file only contains window management code. We should verify the systray implementation.

✅ Verification successful

Let me gather more context about the systray implementation to verify the changes.


Systray click handlers are properly implemented across platforms

The changes in systemtray_linux.go correctly implement the systray click handlers by calling the parent's clickHandler and rightClickHandler functions, which are defined in the base SystemTray struct. The implementation aligns with the PR's objectives:

  • The base SystemTray struct in systemtray.go defines the click handler functions
  • Linux implementation now properly calls these handlers in Activate and SecondaryActivate methods
  • The changes replace debug print statements with actual handler invocations
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for systray-related files in the Linux implementation
echo "Searching for systray-related files..."
rg -l "systray|tray|OnClick|OnRightClick" --type go

# Search for recent changes to systray files
echo "Checking recent changes to systray files..."
git log -p --since="1 week ago" -- "*systray*.go" "*tray*.go"

Length of output: 2716


Script:

#!/bin/bash
# Check the systemtray.go file for click handler definitions
echo "Checking systemtray.go for click handlers..."
rg -A 5 "clickHandler|rightClickHandler" v3/pkg/application/systemtray.go

# Check other platform implementations
echo -e "\nChecking Windows implementation..."
rg -A 5 "OnClick|OnRightClick" v3/pkg/application/systemtray_windows.go

echo -e "\nChecking Darwin implementation..."
rg -A 5 "OnClick|OnRightClick" v3/pkg/application/systemtray_darwin.go

Length of output: 1097

v3/pkg/application/systemtray_linux.go (2)

701-701: LGTM: Proper implementation of systray click handler

The change correctly implements the systray click handler by invoking the parent's clickHandler method instead of just printing coordinates. This aligns with the PR objective to fix systray OnClick functionality.


718-718: LGTM: Proper implementation of systray right-click handler

The change correctly implements the systray right-click handler by invoking the parent's rightClickHandler method. This aligns with the PR objective to implement systray OnRightClick functionality.

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.

2 participants