← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2512: remove splitter flickering when resizing

 

------------------------------------------------------------
revno: 2512
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2011-04-24 22:52:25 +0200
message:
  remove splitter flickering when resizing
modified:
  dwt/src/widgets/Splitter.cpp
  dwt/src/widgets/SplitterContainer.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/Splitter.cpp'
--- dwt/src/widgets/Splitter.cpp	2011-03-30 20:27:02 +0000
+++ dwt/src/widgets/Splitter.cpp	2011-04-24 20:52:25 +0000
@@ -69,7 +69,14 @@
 			part = horizontal ? PP_BAR : PP_BARVERT;
 			state = 0;
 		}
-		theme.drawBackground(canvas, part, state, canvas.getPaintRect());
+
+		// don't draw edges.
+		Rectangle rect(canvas.getPaintRect());
+		(horizontal ? rect.pos.x : rect.pos.y) -= 2;
+		(horizontal ? rect.size.x : rect.size.y) += 4;
+
+		theme.drawBackground(canvas, part, state, rect);
+
 	} else if(hovering) {
 		// safe to assume that the text color is different enough from the default background.
 		canvas.fill(canvas.getPaintRect(), Brush(Brush::WindowText));

=== modified file 'dwt/src/widgets/SplitterContainer.cpp'
--- dwt/src/widgets/SplitterContainer.cpp	2011-03-30 20:13:51 +0000
+++ dwt/src/widgets/SplitterContainer.cpp	2011-04-24 20:52:25 +0000
@@ -84,7 +84,6 @@
 }
 
 void SplitterContainer::layout() {
-	BaseType::layout();
 	ensureSplitters();
 
 	auto children = getChildren<Widget>();
@@ -119,7 +118,7 @@
 		} else {
 			auto splitter = *splitter_iter;
 			auto ss = horizontal ? splitter->getPreferredSize().y : splitter->getPreferredSize().x;
-			sz = std::max(static_cast<int>(avail * splitter->getRelativePos() - ss / 2. - p), 0);
+			sz = std::max(avail * splitter->getRelativePos() - ss / 2. - p, 0.);
 			hr.resize(w, rc);
 
 			p += sz;