← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2205: stricter tab drag&drop when dropping outside of the tab control

 

------------------------------------------------------------
revno: 2205
committer: poy <poy@xxxxxxxxxx>
branch nick: repo
timestamp: Tue 2010-08-10 20:00:17 +0200
message:
  stricter tab drag&drop when dropping outside of the tab control
modified:
  dwt/src/widgets/TabView.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dwt/src/widgets/TabView.cpp'
--- dwt/src/widgets/TabView.cpp	2010-08-10 16:53:56 +0000
+++ dwt/src/widgets/TabView.cpp	2010-08-10 18:00:17 +0000
@@ -472,9 +472,10 @@
 }
 
 bool TabView::handleLeftMouseUp(const MouseEvent& mouseEvent) {
+	::ReleaseCapture();
+
 	bool closeAuth = closeAuthorized;
 	closeAuthorized = false;
-	::ReleaseCapture();
 
 	if(dragging) {
 		int dragPos = findTab(dragging);
@@ -486,8 +487,12 @@
 		int dropPos = hitTest(mouseEvent.pos);
 
 		if(dropPos == -1) {
-			// not in the tab control; move the tab to the end
-			dropPos = size() - 1;
+			// not on any of the current tabs; see if the tab should be moved to the end.
+			Point pt = ClientCoordinate(mouseEvent.pos, this).getPoint();
+			if(pt.x >= 0 && pt.x <= clientSize.right() && pt.y >= 0 && pt.y <= clientSize.top())
+				dropPos = size() - 1;
+			else
+				return true;
 		}
 
 		if(dropPos == dragPos) {