From 4c139440d0a017d214046b7db310c8bad6fd1a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 17 Jun 2010 08:10:16 +0000 Subject: [PATCH] * Only move the window when we were targeted. This fixes #6179. * I wondered if I should make BWindow::_IsFocusMessage() public - it determines whether or not the message was retrieved via normal focus, or via the SetEventMask() functionality. Any opinions? git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37163 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/BarWindow.cpp | 22 ++++++++++++++++++++-- src/apps/deskbar/BarWindow.h | 3 +++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/apps/deskbar/BarWindow.cpp b/src/apps/deskbar/BarWindow.cpp index 5784db8282..98dc43a33a 100644 --- a/src/apps/deskbar/BarWindow.cpp +++ b/src/apps/deskbar/BarWindow.cpp @@ -55,6 +55,8 @@ All rights reserved. #include "StatusView.h" #include "tracker_private.h" +#include + // This is a very ugly hack to be able to call the private BMenuBar::StartMenuBar() // method from the TBarWindow::ShowBeMenu() method. @@ -105,8 +107,9 @@ TBarWindow::DispatchMessage(BMessage* message, BHandler* handler) if (!((TBarApp*)be_app)->Settings()->autoRaise) Activate(true); - if ((modifiers() & (B_CONTROL_KEY | B_COMMAND_KEY | B_OPTION_KEY - | B_SHIFT_KEY)) == (B_CONTROL_KEY | B_COMMAND_KEY)) { + if (_IsFocusMessage(message) + && (modifiers() & (B_CONTROL_KEY | B_COMMAND_KEY | B_OPTION_KEY + | B_SHIFT_KEY)) == (B_CONTROL_KEY | B_COMMAND_KEY)) { // The window key was pressed - enter dragging code fBarView->DragRegion()->MouseDown( fBarView->DragRegion()->DragRegion().LeftTop()); @@ -614,3 +617,18 @@ TBarWindow::GetIconFrame(BMessage* message) message->SendReply(&reply); } + +bool +TBarWindow::_IsFocusMessage(BMessage* message) +{ + BMessage::Private messagePrivate(message); + if (!messagePrivate.UsePreferredTarget()) + return false; + + bool feedFocus; + if (message->HasInt32("_token") + && (message->FindBool("_feed_focus", &feedFocus) != B_OK || !feedFocus)) + return false; + + return true; +} diff --git a/src/apps/deskbar/BarWindow.h b/src/apps/deskbar/BarWindow.h index d972f5ef57..ac274100b5 100644 --- a/src/apps/deskbar/BarWindow.h +++ b/src/apps/deskbar/BarWindow.h @@ -85,6 +85,9 @@ public: void GetIconFrame(BMessage* message); +private: + bool _IsFocusMessage(BMessage* message); + private: static TBeMenu* sBeMenu; TBarView* fBarView;