summaryrefslogtreecommitdiffstats
path: root/generic/tkPanedWindow.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2015-06-01 18:39:35 (GMT)
committerfvogel <fvogelnew1@free.fr>2015-06-01 18:39:35 (GMT)
commit239a7d4722b9040e52824ffaf02af02558b21dee (patch)
tree3eb6a376ef0c1f6443eb1fb5677e6af3f668c692 /generic/tkPanedWindow.c
parentddb9a7aae8cd0e831b0edb4947628c6ea68cbb7d (diff)
parent1b66389d3538c56f54f4298a2dd9e47d5f6a5213 (diff)
downloadtk-239a7d4722b9040e52824ffaf02af02558b21dee.zip
tk-239a7d4722b9040e52824ffaf02af02558b21dee.tar.gz
tk-239a7d4722b9040e52824ffaf02af02558b21dee.tar.bz2
Fixed bug [3592454fff] - Don't draw the sash associated to the last visible pane
Diffstat (limited to 'generic/tkPanedWindow.c')
-rw-r--r--generic/tkPanedWindow.c52
1 files changed, 42 insertions, 10 deletions
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 81bcbb0..0e1bc53 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -203,6 +203,8 @@ static void PanedWindowReqProc(ClientData clientData,
static void ArrangePanes(ClientData clientData);
static void Unlink(Slave *slavePtr);
static Slave * GetPane(PanedWindow *pwPtr, Tk_Window tkwin);
+static void GetFirstLastVisiblePane(PanedWindow *pwPtr,
+ int *firstPtr, int *lastPtr);
static void SlaveStructureProc(ClientData clientData,
XEvent *eventPtr);
static int PanedWindowSashCommand(PanedWindow *pwPtr,
@@ -1415,6 +1417,7 @@ DisplayPanedWindow(
Tk_Window tkwin = pwPtr->tkwin;
int i, sashWidth, sashHeight;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
+ int first, last;
pwPtr->flags &= ~REDRAW_PENDING;
if ((pwPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) {
@@ -1461,9 +1464,10 @@ DisplayPanedWindow(
* Draw the sashes.
*/
+ GetFirstLastVisiblePane(pwPtr, &first, &last);
for (i = 0; i < pwPtr->numSlaves - 1; i++) {
slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide) {
+ if (slavePtr->hide || i == last) {
continue;
}
if (sashWidth > 0 && sashHeight > 0) {
@@ -1708,17 +1712,10 @@ ArrangePanes(
Tcl_Preserve((ClientData) pwPtr);
/*
- * Find index of last visible pane.
+ * Find index of first and last visible panes.
*/
- for (i = 0, last = 0, first = -1; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->hide == 0) {
- if (first < 0) {
- first = i;
- }
- last = i;
- }
- }
+ GetFirstLastVisiblePane(pwPtr, &first, &last);
/*
* First pass; compute sizes
@@ -2056,6 +2053,41 @@ GetPane(
}
/*
+ *----------------------------------------------------------------------
+ *
+ * GetFirstLastVisiblePane --
+ *
+ * Given panedwindow, find the index of the first and last visible panes
+ * of that paned window.
+ *
+ * Results:
+ * Index of the first and last visible panes.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+GetFirstLastVisiblePane(
+ PanedWindow *pwPtr, /* Pointer to the paned window info. */
+ int *firstPtr, /* Returned index for first. */
+ int *lastPtr) /* Returned index for last. */
+{
+ int i;
+
+ for (i = 0, *lastPtr = 0, *firstPtr = -1; i < pwPtr->numSlaves; i++) {
+ if (pwPtr->slaves[i]->hide == 0) {
+ if (*firstPtr < 0) {
+ *firstPtr = i;
+ }
+ *lastPtr = i;
+ }
+ }
+}
+
+/*
*--------------------------------------------------------------
*
* SlaveStructureProc --