summaryrefslogtreecommitdiff
path: root/src/ui/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index da1db514..9ac9b918 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29#include "embedded.h" 29#include "embedded.h"
30#include "keys.h" 30#include "keys.h"
31#include "labelwidget.h" 31#include "labelwidget.h"
32#include "documentwidget.h"
32#include "paint.h" 33#include "paint.h"
33#include "root.h" 34#include "root.h"
34#include "touch.h" 35#include "touch.h"
@@ -1170,13 +1171,27 @@ void setSplitMode_Window(iWindow *d, int splitMode) {
1170 } 1171 }
1171 else if ((splitMode & mask_WindowSplit) && oldCount == 1) { 1172 else if ((splitMode & mask_WindowSplit) && oldCount == 1) {
1172 /* Add a second root. */ 1173 /* Add a second root. */
1174 iDocumentWidget *moved = document_Root(d->roots[0]);
1173 iAssert(d->roots[1] == NULL); 1175 iAssert(d->roots[1] == NULL);
1174 d->roots[1] = new_Root(); 1176 d->roots[1] = new_Root();
1175 setCurrent_Root(d->roots[1]); 1177 setCurrent_Root(d->roots[1]);
1176 createUserInterface_Root(d->roots[1]); 1178 createUserInterface_Root(d->roots[1]);
1177 /* If the old root has multiple tabs, move the current one to the new split. */ 1179 /* If the old root has multiple tabs, move the current one to the new split. */ {
1178 1180 iWidget *docTabs0 = findChild_Widget(d->roots[0]->widget, "doctabs");
1179 postCommand_Root(d->roots[1], "navigate.home"); 1181 iWidget *docTabs1 = findChild_Widget(d->roots[1]->widget, "doctabs");
1182 if (tabCount_Widget(docTabs0) >= 2) {
1183 int movedIndex = tabPageIndex_Widget(docTabs0, moved);
1184 removeTabPage_Widget(docTabs0, movedIndex);
1185 showTabPage_Widget(docTabs0, tabPage_Widget(docTabs0, iMax(movedIndex - 1, 0)));
1186 iRelease(removeTabPage_Widget(docTabs1, 0)); /* delete the default tab */
1187 setRoot_Widget(as_Widget(moved), d->roots[1]);
1188 prependTabPage_Widget(docTabs1, iClob(moved), "", 0, 0);
1189 showTabPage_Widget(docTabs1, as_Widget(moved));
1190 }
1191 else {
1192 postCommand_Root(d->roots[1], "navigate.home");
1193 }
1194 }
1180 setCurrent_Root(NULL); 1195 setCurrent_Root(NULL);
1181 } 1196 }
1182 d->splitMode = splitMode; 1197 d->splitMode = splitMode;