-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(v2/linux): handle native file drops without WebKit navigation #5994
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
Open
valdemardi
wants to merge
1
commit into
wailsapp:master
Choose a base branch
from
valdemardi:fix-v2-linux-drag-n-drop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: wailsapp/wails
Length of output: 725
🏁 Script executed:
Repository: wailsapp/wails
Length of output: 10530
🌐 Web query:
GTK3 GtkWidget drag-drop drag-data-received GTK_DEST_DEFAULT_DROP gtk_drag_finish documentation💡 Result:
In GTK3, drag-and-drop operations rely on specific signals and flags to manage data transfer and completion. Below is a synthesis of how these components interact. GtkWidget::drag-data-received The drag-data-received signal is emitted on the drop site widget when drag data has been successfully retrieved or when the retrieval fails [1][2]. Its behavior depends on why the data was requested: 1. If requested to determine drop acceptance: The handler should call gdk_drag_status and must not call gtk_drag_finish [1][2]. 2. If requested in response to a GtkWidget::drag-drop signal: The handler is expected to process the received data and then call gtk_drag_finish to signal completion to the source [1][2]. GTK_DEST_DEFAULT_DROP This flag, used with gtk_drag_dest_set, provides automatic behavior for the drop site [3][4]. When set: - GTK+ automatically checks if the drag matches the widget's targets and actions [4][5]. - If it matches, GTK+ calls gtk_drag_get_data on behalf of the widget [4][6]. - After the data is retrieved, GTK+ automatically calls gtk_drag_finish [4][6]. Warning: Using GTK_DEST_DEFAULT_DROP can conflict with manual signal handling [7][3]. Specifically, it performs actions automatically that you might otherwise implement yourself, such as invoking gdk_drag_status during the drag-motion signal or gtk_drag_finish during drag-data-received [7][3]. gtk_drag_finish This function informs the drag source that the drop operation is complete [8][9]. - Signature: void gtk_drag_finish(GdkDragContext *context, gboolean success, gboolean del, guint32 time_) [8][9]. - success: TRUE if the data was processed successfully, FALSE otherwise [1][8]. - del: Should be TRUE if the action was a move and the data was processed successfully (triggering the source to delete the original data), otherwise FALSE [4][8]. - time_: The timestamp, usually taken from the GtkWidget::drag-drop signal [8][9]. When you use GTK_DEST_DEFAULT_DROP, you generally do not need to manually call gtk_drag_finish in your drag-data-received handler because GTK handles it for you [6]. If you do not use this flag, you are responsible for calling gtk_drag_finish to finalize the transaction [1][7].
Citations:
🏁 Script executed:
Repository: wailsapp/wails
Length of output: 50371
🏁 Script executed:
Repository: wailsapp/wails
Length of output: 3628
🏁 Script executed:
Repository: wailsapp/wails
Length of output: 493
🏁 Script executed:
Repository: wailsapp/wails
Length of output: 11814
Complete handled drops with
gtk_drag_finish().At Line 554,
return TRUEbypasses GTK’s default drop handler. Neither callback callsgtk_drag_finish(), so the drag source is not notified that the drop completed. Request the target withgtk_drag_get_data()inonDragDrop, then callgtk_drag_finish(context, success, FALSE, time)for every terminal path inonDragDataReceived.🤖 Prompt for AI Agents
Source: MCP tools