summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhu yaliang <[email protected]>2024-04-19 10:43:39 +0800
committerzhu yaliang <[email protected]>2024-04-19 10:43:44 +0800
commit43319ede03336f60026625d3cc93ee6812a4ca98 (patch)
tree3537f87f3d465adb22676b68d1506c95bb1b7472
parent78903120e74d82ba9610cf5e9fabc1bab7476dc1 (diff)
downloadengrampa-drag.tar.bz2
engrampa-drag.tar.xz
At the end of drag and drop, grab and release seatdrag
Fix https://github.com/mate-desktop/engrampa/issues/515
-rw-r--r--src/fr-window.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/fr-window.c b/src/fr-window.c
index 20ca551..f0fbc78 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -4161,6 +4161,25 @@ file_list_drag_begin (GtkWidget *widget,
}
static void
+grab_widget (GtkWidget *widget)
+{
+
+ GdkWindow *window;
+ GdkDisplay *display;
+ GdkSeat *seat;
+
+ g_return_if_fail (widget != NULL);
+ window = gtk_widget_get_window (widget);
+ display = gdk_window_get_display (window);
+
+ seat = gdk_display_get_default_seat (display);
+ gdk_seat_grab (seat, window,
+ GDK_SEAT_CAPABILITY_ALL, TRUE,
+ NULL, NULL, NULL, NULL);
+ gdk_seat_ungrab (seat);
+}
+
+static void
file_list_drag_end (GtkWidget *widget,
GdkDragContext *context,
gpointer data)
@@ -4168,6 +4187,33 @@ file_list_drag_end (GtkWidget *widget,
FrWindow *window = data;
debug (DEBUG_INFO, "::DragEnd -->\n");
+ GtkWidget *xgrab_shell;
+ GtkWidget *parent;
+
+ parent = gtk_widget_get_parent (widget);
+ xgrab_shell = NULL;
+ while (parent)
+ {
+ gboolean viewable = TRUE;
+ GtkWidget *tmp = parent;
+ while (tmp)
+ {
+ if (!gtk_widget_get_mapped (tmp))
+ {
+ viewable = FALSE;
+ break;
+ }
+ tmp = gtk_widget_get_parent (tmp);
+ }
+
+ if (viewable)
+ xgrab_shell = parent;
+ parent = gtk_widget_get_parent (parent);
+ }
+ if (xgrab_shell)
+ {
+ grab_widget (widget);
+ }
gdk_property_delete (gdk_drag_context_get_source_window (context), XDS_ATOM);