From accfc88901f245a10178ba5c50a9ff02c3b3c400 Mon Sep 17 00:00:00 2001 From: "pavlov%netscape.com" Date: Wed, 9 Aug 2000 05:16:17 +0000 Subject: [PATCH] avoid pulling the event out of the queue and putting it right back when typing.. working on linux performance bug 26502 r=beard --- widget/src/gtk/nsGtkEventHandler.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/widget/src/gtk/nsGtkEventHandler.cpp b/widget/src/gtk/nsGtkEventHandler.cpp index 39ad3c4f682..d039bfb3199 100644 --- a/widget/src/gtk/nsGtkEventHandler.cpp +++ b/widget/src/gtk/nsGtkEventHandler.cpp @@ -25,7 +25,6 @@ #include "nsWindow.h" #include "nsScrollbar.h" -#include "nsIFileWidget.h" #include "nsGUIEvent.h" #include "nsTextWidget.h" @@ -676,19 +675,19 @@ gint handle_key_release_event(GtkObject *w, GdkEventKey* event, gpointer p) // the next event in the queue is a key press event and it has the // exact same timestamp as the current event. - // get the next event - nextEvent = gdk_event_get(); + // get a copy of the next event + nextEvent = gdk_event_peek(); // see if it's a key press event and if the time matches. - if (nextEvent && (nextEvent->type == GDK_KEY_PRESS) && (nextEvent->key.time == event->time)) + if (nextEvent) { + if ((nextEvent->type == GDK_KEY_PRESS) && (nextEvent->key.time == event->time)) + { shouldDrop = PR_TRUE; // the next key press event shouldn't generate a key down event. // this is a global variable suppressNextKeyDown = PR_TRUE; - } - if (nextEvent) { - // put makes a copy so we're safe doing this. - gdk_event_put(nextEvent); + } + // free the event since we just got a copy. gdk_event_free(nextEvent); }