[haiku-commits] r37163 - haiku/trunk/src/apps/deskbar

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 17 Jun 2010 10:10:16 +0200 (CEST)

Author: axeld
Date: 2010-06-17 10:10:16 +0200 (Thu, 17 Jun 2010)
New Revision: 37163
Changeset: http://dev.haiku-os.org/changeset/37163/haiku
Ticket: http://dev.haiku-os.org/ticket/6179

Modified:
   haiku/trunk/src/apps/deskbar/BarWindow.cpp
   haiku/trunk/src/apps/deskbar/BarWindow.h
Log:
* 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?


Modified: haiku/trunk/src/apps/deskbar/BarWindow.cpp
===================================================================
--- haiku/trunk/src/apps/deskbar/BarWindow.cpp  2010-06-17 07:24:19 UTC (rev 
37162)
+++ haiku/trunk/src/apps/deskbar/BarWindow.cpp  2010-06-17 08:10:16 UTC (rev 
37163)
@@ -55,7 +55,9 @@
 #include "StatusView.h"
 #include "tracker_private.h"
 
+#include <MessagePrivate.h>
 
+
 // This is a very ugly hack to be able to call the private 
BMenuBar::StartMenuBar()
 // method from the TBarWindow::ShowBeMenu() method.
 // Don't do this at home -- but why the hell is this method private?
@@ -105,8 +107,9 @@
                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 @@
        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;
+}

Modified: haiku/trunk/src/apps/deskbar/BarWindow.h
===================================================================
--- haiku/trunk/src/apps/deskbar/BarWindow.h    2010-06-17 07:24:19 UTC (rev 
37162)
+++ haiku/trunk/src/apps/deskbar/BarWindow.h    2010-06-17 08:10:16 UTC (rev 
37163)
@@ -86,6 +86,9 @@
                        void                            GetIconFrame(BMessage* 
message);
 
 private:
+                       bool                            
_IsFocusMessage(BMessage* message);
+
+private:
        static  TBeMenu*                        sBeMenu;
                        TBarView*                       fBarView;
 };


Other related posts:

  • » [haiku-commits] r37163 - haiku/trunk/src/apps/deskbar - axeld