Ticket #10168: 0001-Remove-queued-messages-on-escape.patch

File 0001-Remove-queued-messages-on-escape.patch, 1.3 KB (added by jscipione, 11 years ago)

(untested) remove any queued message after processing escape

  • src/apps/webpositive/BrowserWindow.cpp

    From 0f819a71ab2818d55e72968eea638f08fcb673f9 Mon Sep 17 00:00:00 2001
    From: John Scipione <jscipione@gmail.com>
    Date: Mon, 4 Nov 2013 16:14:28 -0500
    Subject: [PATCH] Remove queued messages on escape
    
    ---
     src/apps/webpositive/BrowserWindow.cpp | 12 ++++++++++++
     1 file changed, 12 insertions(+)
    
    diff --git a/src/apps/webpositive/BrowserWindow.cpp b/src/apps/webpositive/BrowserWindow.cpp
    index 109056a..32ed092 100644
    a b  
    5353#include <ObjectList.h>
    5454#include <MenuBar.h>
    5555#include <MenuItem.h>
     56#include <MessageQueue.h>
    5657#include <MessageRunner.h>
    5758#include <NodeInfo.h>
    5859#include <Path.h>
    BrowserWindow::DispatchMessage(BMessage* message, BHandler* target)  
    692693                return;
    693694            } else if (bytes[0] == B_ESCAPE) {
    694695                _InvokeButtonVisibly(fFindCloseButton);
     696                // Remove any queued messages
     697                BMessageQueue queue;
     698                BMessage* msg;
     699                while ((msg = queue.FindMessage(B_KEY_DOWN, 0)) != NULL) {
     700                    queue.RemoveMessage(msg);
     701                    delete msg;
     702                }
     703                while ((msg = queue.FindMessage(B_UNMAPPED_KEY_DOWN, 0)) != NULL) {
     704                    queue.RemoveMessage(msg);
     705                    delete msg;
     706                }
    695707                return;
    696708            }
    697709        } else if (bytes[0] == B_ESCAPE) {