From 395903cde9239de957919608b3aa779c5f39f818 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Sun, 21 Dec 2003 18:55:35 +0000 Subject: [PATCH] Disregard GDK's extra click events that are for double-clicks and triple-clicks. Based on Chris Blizzard's GTK2-port patch. r+sr=blizzard b=227328 --- widget/src/gtk/nsWidget.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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) {