diff --git a/widget/src/gtk/nsWidget.cpp b/widget/src/gtk/nsWidget.cpp index 280aafce1b8a..266f0b4f1022 100644 --- a/widget/src/gtk/nsWidget.cpp +++ b/widget/src/gtk/nsWidget.cpp @@ -1834,6 +1834,21 @@ nsWidget::OnButtonPressSignal(GdkEventButton * aGdkButtonEvent) nsMouseScrollEvent scrollEvent; PRUint32 eventType = 0; + // If you double click in GDK, it will actually generate a single + // click event before sending the double click event, and this is + // different than the DOM spec. GDK puts this in the queue + // programatically, so it's safe to assume that if there's a + // double click in the queue, it was generated so we can just drop + // this click. + GdkEvent *peekedEvent = gdk_event_peek(); + if (peekedEvent) { + GdkEventType type = peekedEvent->any.type; + gdk_event_free(peekedEvent); + if (type == GDK_2BUTTON_PRESS || type == GDK_3BUTTON_PRESS) + return; + } + + // Switch on single, double, triple click. switch (aGdkButtonEvent->type) {