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

This commit is contained in:
dbaron%dbaron.org 2003-12-21 18:55:35 +00:00
Родитель 1793165da5
Коммит 395903cde9
1 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -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)
{