Bug 863512 - Fixing xul dnd panels for linux. r=enndeakin
authorGabor Krizsanits <gkrizsanits@mozilla.com>
Wed, 05 Aug 2015 13:19:44 +0200
changeset 291474 de18634e66ab3fe77ba99544a48653cfa6788312
parent 291473 7042219cf7f332ce97605958506557a9ae7e9402
child 291475 884385e6f556fc07d33ddd790474d459a7e55aab
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin
bugs863512
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 863512 - Fixing xul dnd panels for linux. r=enndeakin
widget/gtk/mozgtk/mozgtk.c
widget/gtk/nsWindow.cpp
--- a/widget/gtk/mozgtk/mozgtk.c
+++ b/widget/gtk/mozgtk/mozgtk.c
@@ -463,16 +463,17 @@ STUB(gtk_widget_show_all)
 STUB(gtk_widget_size_allocate)
 STUB(gtk_widget_style_get)
 STUB(gtk_widget_unparent)
 STUB(gtk_window_deiconify)
 STUB(gtk_window_fullscreen)
 STUB(gtk_window_get_group)
 STUB(gtk_window_get_transient_for)
 STUB(gtk_window_get_type)
+STUB(gtk_window_get_type_hint)
 STUB(gtk_window_get_window_type)
 STUB(gtk_window_group_add_window)
 STUB(gtk_window_group_get_current_grab)
 STUB(gtk_window_group_new)
 STUB(gtk_window_iconify)
 STUB(gtk_window_is_active)
 STUB(gtk_window_maximize)
 STUB(gtk_window_move)
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1767,23 +1767,29 @@ nsWindow::CaptureRollupEvents(nsIRollupL
         return NS_ERROR_FAILURE;
 
     LOG(("CaptureRollupEvents %p %i\n", this, int(aDoCapture)));
 
     if (aDoCapture) {
         gRollupListener = aListener;
         // real grab is only done when there is no dragging
         if (!nsWindow::DragInProgress()) {
-            // This widget grab ensures that a Gecko GtkWidget receives mouse
-            // events even when embedded in non-Gecko-owned GtkWidgets.
-            // The grab is placed on the toplevel GtkWindow instead of the
-            // MozContainer to avoid double dispatch of keyboard events
-            // (bug 707623).
-            gtk_grab_add(mShell);
-            GrabPointer(GetLastUserInputTime());
+            // Maybe the dnd flag is not yet set at this point, but dnd has already started
+            // so let's be extra careful and skip this operation for dnd popup panels always
+            // (panels with type="drag").
+            GdkWindowTypeHint gdkTypeHint = gtk_window_get_type_hint(GTK_WINDOW(mShell));
+            if (gdkTypeHint != GDK_WINDOW_TYPE_HINT_DND) {
+              // This widget grab ensures that a Gecko GtkWidget receives mouse
+              // events even when embedded in non-Gecko-owned GtkWidgets.
+              // The grab is placed on the toplevel GtkWindow instead of the
+              // MozContainer to avoid double dispatch of keyboard events
+              // (bug 707623).
+              gtk_grab_add(mShell);
+              GrabPointer(GetLastUserInputTime());
+            }
         }
     }
     else {
         if (!nsWindow::DragInProgress()) {
             ReleaseGrabs();
         }
         // There may not have been a drag in process when aDoCapture was set,
         // so make sure to remove any added grab.  This is a no-op if the grab