summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 3175f274..5a5a4f84 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -298,10 +298,12 @@ struct Impl_DocumentWidget {
298 298
299iDefineObjectConstruction(DocumentWidget) 299iDefineObjectConstruction(DocumentWidget)
300 300
301static int docEnum_ = 0;
302
301void init_DocumentWidget(iDocumentWidget *d) { 303void init_DocumentWidget(iDocumentWidget *d) {
302 iWidget *w = as_Widget(d); 304 iWidget *w = as_Widget(d);
303 init_Widget(w); 305 init_Widget(w);
304 setId_Widget(w, "document000"); 306 setId_Widget(w, format_CStr("document%03d", ++docEnum_));
305 setFlags_Widget(w, hover_WidgetFlag, iTrue); 307 setFlags_Widget(w, hover_WidgetFlag, iTrue);
306 init_PersistentDocumentState(&d->mod); 308 init_PersistentDocumentState(&d->mod);
307 d->flags = 0; 309 d->flags = 0;
@@ -880,7 +882,7 @@ static void updateWindowTitle_DocumentWidget_(const iDocumentWidget *d) {
880 } 882 }
881 /* Take away parts if it doesn't fit. */ 883 /* Take away parts if it doesn't fit. */
882 const int avail = bounds_Widget(as_Widget(tabButton)).size.x - 3 * gap_UI; 884 const int avail = bounds_Widget(as_Widget(tabButton)).size.x - 3 * gap_UI;
883 iBool setWindow = (document_App() == d); 885 iBool setWindow = (document_App() == d && isUnderKeyRoot_Widget(d));
884 for (;;) { 886 for (;;) {
885 iString *text = collect_String(joinCStr_StringArray(title, " \u2014 ")); 887 iString *text = collect_String(joinCStr_StringArray(title, " \u2014 "));
886 if (setWindow) { 888 if (setWindow) {
@@ -1953,7 +1955,8 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
1953 } 1955 }
1954 return iTrue; 1956 return iTrue;
1955 } 1957 }
1956 else if (equal_Command(cmd, "window.resized") || equal_Command(cmd, "font.changed")) { 1958 else if (equal_Command(cmd, "window.resized") || equal_Command(cmd, "font.changed") ||
1959 equal_Command(cmd, "keyroot.changed")) {
1957 /* Alt/Option key may be involved in window size changes. */ 1960 /* Alt/Option key may be involved in window size changes. */
1958 setLinkNumberMode_DocumentWidget_(d, iFalse); 1961 setLinkNumberMode_DocumentWidget_(d, iFalse);
1959 d->phoneToolbar = findWidget_App("toolbar"); 1962 d->phoneToolbar = findWidget_App("toolbar");