[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 824
Date       : Sun Apr 16 20:16:45 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/dragmgr.cpp

Fix use of GetRect() which does not do what one might think it does


Diff:
Index: Trunk/XaraLX/wxOil/dragmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dragmgr.cpp	(revision 823)
+++ Trunk/XaraLX/wxOil/dragmgr.cpp	(revision 824)
@@ -1285,8 +1285,16 @@
 				if (GadgetID != 0)
 					TargetWindow = TargetWindow->FindWindow((INT32)GadgetID);
 
-				wxRect TargetRect = TargetWindow->GetRect();
+				// We want to do the following. But it doesn't work because GetRect() is relative to the
+				// parent window when TargetWindow is not a TLW. What we need is (consistently) screen
+				// coordinates
+				// wxRect TargetRect = TargetWindow->GetRect();
 
+				wxSize ClientSize = TargetWindow->GetClientSize();
+				wxRect TargetRect (TargetWindow->ClientToScreen(wxPoint(0,0)),
+				 				   TargetWindow->ClientToScreen(wxPoint(ClientSize.GetWidth(),
+																ClientSize.GetHeight())));
+
 				if (BroadcastToAll || Ptr->WantsAllEvents() ||
 					TargetRect.Inside(WinoilMousePos))
 				{


Xara