From 7a3892f439dc8202562dec1b4e684b21c30cc497 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Thu, 14 Jan 2016 18:55:33 -0500 Subject: [PATCH] BWindow: Fix keyboard handling bug. - In the case of certain messages that are dispatched from the app_server with multiple target tokens (i.e. due to an attached view that has a mouse or keyboard event mask set), we need to strip the focus flag from the message before passing it to the non-focus views. Fixes a bug observed via Clipdinger where the aforementioned circumstance would result in all keyboard shortcuts being invoked multiple times. --- src/kits/interface/Window.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index 3f71c54422..7a6b203199 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2015 Haiku, Inc. All rights reserved + * Copyright 2001-2016 Haiku, Inc. All rights reserved * Distributed under the terms of the MIT License. * * Authors: @@ -3446,6 +3446,10 @@ BWindow::_UnpackMessage(unpack_cookie& cookie, BMessage** _message, continue; *_message = new BMessage(*cookie.message); + // the secondary copies of the message should not be treated as focus + // messages, otherwise there will be unintended side effects, i.e. + // keyboard shortcuts getting processed multiple times. + (*_message)->RemoveName("_feed_focus"); *_target = target; cookie.index++; return true;