From be10bcf27a958d9c9b8ae1428e09d66097eac926 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Fri, 2 Sep 2011 12:42:09 +0200 Subject: [PATCH 1/2] Fix CPPlatformWindow's title bug if setTitle: is called on a CPWindow with the primaryPlatformWindow as platformWindow, the main page's title is changed. This patch prevent changing the primaryPlatformWindow's title. This is not optimal, but this is better than changing the title at each window setTitle: call --- AppKit/Platform/CPPlatformWindow.j | 3 ++- AppKit/Platform/DOM/CPPlatformWindow+DOM.j | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/AppKit/Platform/CPPlatformWindow.j b/AppKit/Platform/CPPlatformWindow.j index 2d47ce96e..90ee33215 100644 --- a/AppKit/Platform/CPPlatformWindow.j +++ b/AppKit/Platform/CPPlatformWindow.j @@ -264,7 +264,8 @@ var PrimaryPlatformWindow = NULL; _title = aTitle; #if PLATFORM(DOM) - if (_DOMWindow && _DOMWindow.document) + if (_DOMWindow && _DOMWindow.document + && (self != [CPPlatformWindow primaryPlatformWindow])) _DOMWindow.document.title = _title; #endif } diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index 66b847748..58ab7269e 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -541,7 +541,8 @@ var ModifierKeyCodes = [ // FIXME: cpSetFrame? _DOMWindow.document.write(""); _DOMWindow.document.close(); - _DOMWindow.document.title = _title; + if (self != [CPPlatformWindow primaryPlatformWindow]) + _DOMWindow.document.title = _title; if (![CPPlatform isBrowser]) { From afa691376e2d4a9a41a3538dd422aa3a2b5ab634 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Fri, 2 Sep 2011 14:00:49 +0200 Subject: [PATCH 2/2] fix unable to change mainWindow's title --- AppKit/CPWindow/CPWindow.j | 4 ++-- AppKit/Platform/CPPlatformWindow.j | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 2bed398b6..ba3c39732 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -480,7 +480,7 @@ CPTexturedBackgroundWindowMask [self close]; _platformWindow = aPlatformWindow; - [_platformWindow setTitle:_title]; + [_platformWindow _setTitle:_title window:self]; if (wasVisible) [self orderFront:self]; @@ -1360,7 +1360,7 @@ CPTexturedBackgroundWindowMask _title = aTitle; [_windowView setTitle:aTitle]; - [_platformWindow setTitle:_title]; + [_platformWindow _setTitle:_title window:self]; [self _synchronizeMenuBarTitleWithWindowTitle]; } diff --git a/AppKit/Platform/CPPlatformWindow.j b/AppKit/Platform/CPPlatformWindow.j index 90ee33215..4526cbd19 100644 --- a/AppKit/Platform/CPPlatformWindow.j +++ b/AppKit/Platform/CPPlatformWindow.j @@ -259,13 +259,12 @@ var PrimaryPlatformWindow = NULL; return [CPPlatform isBrowser]; } -- (void)setTitle:(CPString)aTitle +- (void)_setTitle:(CPString)aTitle window:(CPWindow)aWindow { _title = aTitle; #if PLATFORM(DOM) - if (_DOMWindow && _DOMWindow.document - && (self != [CPPlatformWindow primaryPlatformWindow])) + if (_DOMWindow && _DOMWindow.document && (aWindow === [CPApp mainWindow])) _DOMWindow.document.title = _title; #endif }