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

At the end of drag and drop, grab and release seat #517

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions src/fr-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -4160,6 +4160,25 @@ file_list_drag_begin (GtkWidget *widget,
return TRUE;
}

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,
Copy link
Member

Choose a reason for hiding this comment

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

That's probably sufficient

Suggested change
GDK_SEAT_CAPABILITY_ALL, TRUE,
GDK_SEAT_CAPABILITY_ALL_POINTING, TRUE,

NULL, NULL, NULL, NULL);
gdk_seat_ungrab (seat);
}

static void
file_list_drag_end (GtkWidget *widget,
GdkDragContext *context,
Expand All @@ -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;
Comment on lines +4197 to +4210
Copy link
Member

Choose a reason for hiding this comment

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

What is this nested loop about? Removing it seems logically identical (and working the same) save not being quadratic:

Suggested change
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;
if (gtk_widget_get_mapped (parent))
xgrab_shell = parent;
else
break;

parent = gtk_widget_get_parent (parent);
}
if (xgrab_shell)
{
grab_widget (widget);
}

gdk_property_delete (gdk_drag_context_get_source_window (context), XDS_ATOM);

Expand Down