[haiku-commits] haiku: hrev46548 - src/kits/interface

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 17 Dec 2013 05:44:17 +0100 (CET)

hrev46548 adds 2 changesets to branch 'master'
old head: 1b744548e0a31d725a147cfeadf3eeb30a4eb84c
new head: cf9414ff69f8823303ad5ac019f8336a73b94a93
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=cf9414f+%5E1b74454

----------------------------------------------------------------------------

19360a8: BWindow: Style fix, 80 char limit.

cf9414f: Convert coords of B_MOUSE_IDLE in _SanitizeMessage()
  
  When BWindow receives a message in screen coordinates and the
  message has a target view, as it does when the message comes from
  App Server, convert the coordinates to view coordinates before
  passing the message along.
  
  Revert the portion of hrev46532 where BView converts screen
  coordinates and converts them since that happens in
  BWindow::_SanatizeMessage() now.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 21 insertions(+), 7 deletions(-)
src/kits/interface/View.cpp   |  8 ++------
src/kits/interface/Window.cpp | 20 +++++++++++++++++++-

############################################################################

Commit:      19360a8c07772e1fc10835a0c012b4b833e035ba
URL:         http://cgit.haiku-os.org/haiku/commit/?id=19360a8
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Dec 17 03:52:31 2013 UTC

BWindow: Style fix, 80 char limit.

----------------------------------------------------------------------------

diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp
index b80530c..01b7912 100644
--- a/src/kits/interface/Window.cpp
+++ b/src/kits/interface/Window.cpp
@@ -3524,7 +3524,8 @@ BWindow::_SanitizeMessage(BMessage* message, BHandler* 
target, bool usePreferred
                case _MESSAGE_DROPPED_:
                {
                        uint32 originalWhat;
-                       if (message->FindInt32("_original_what", 
(int32*)&originalWhat) == B_OK) {
+                       if (message->FindInt32("_original_what",
+                                       (int32*)&originalWhat) == B_OK) {
                                message->what = originalWhat;
                                message->RemoveName("_original_what");
                        }

############################################################################

Revision:    hrev46548
Commit:      cf9414ff69f8823303ad5ac019f8336a73b94a93
URL:         http://cgit.haiku-os.org/haiku/commit/?id=cf9414f
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Dec 17 04:26:57 2013 UTC

Convert coords of B_MOUSE_IDLE in _SanitizeMessage()

When BWindow receives a message in screen coordinates and the
message has a target view, as it does when the message comes from
App Server, convert the coordinates to view coordinates before
passing the message along.

Revert the portion of hrev46532 where BView converts screen
coordinates and converts them since that happens in
BWindow::_SanatizeMessage() now.

----------------------------------------------------------------------------

diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp
index dd7ea8c..16200bd 100644
--- a/src/kits/interface/View.cpp
+++ b/src/kits/interface/View.cpp
@@ -4324,12 +4324,8 @@ BView::MessageReceived(BMessage* message)
                        case B_MOUSE_IDLE:
                        {
                                BPoint where;
-                               if (message->FindPoint("be:view_where", &where) 
!= B_OK) {
-                                       if (message->FindPoint("screen_where", 
&where) != B_OK)
-                                               break;
-                                       else
-                                               ConvertFromScreen(&where);
-                               }
+                               if (message->FindPoint("be:view_where", &where) 
!= B_OK)
+                                       break;
 
                                BToolTip* tip;
                                if (GetToolTipAt(where, &tip))
diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp
index 01b7912..5e3de79 100644
--- a/src/kits/interface/Window.cpp
+++ b/src/kits/interface/Window.cpp
@@ -3521,6 +3521,23 @@ BWindow::_SanitizeMessage(BMessage* message, BHandler* 
target, bool usePreferred
                        break;
                }
 
+               case B_MOUSE_IDLE:
+               {
+                       // App Server sends screen coordinates, convert the 
point to
+                       // local view coordinates, then add the point in 
be:view_where
+                       BPoint where;
+                       if (message->FindPoint("screen_where", &where) != B_OK)
+                               break;
+
+                       BView* view = dynamic_cast<BView*>(target);
+                       if (view != NULL) {
+                               // add local view coordinates
+                               message->AddPoint("be:view_where",
+                                       view->ConvertFromScreen(where));
+                       }
+                       break;
+               }
+
                case _MESSAGE_DROPPED_:
                {
                        uint32 originalWhat;


Other related posts:

  • » [haiku-commits] haiku: hrev46548 - src/kits/interface - jscipione