You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2015/09/01 01:35:12 UTC

[4/6] mac commit: Fullscreen windows does not properly get focus

Fullscreen windows does not properly get focus

- ensure that title less window can become key window
- use black background while launching


Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/5ec1cc4b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/5ec1cc4b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/5ec1cc4b

Branch: refs/heads/master
Commit: 5ec1cc4bd6709fda485c8b025fcdd9ef06ee0df8
Parents: 1d5d2e7
Author: Tobias Bocanegra <tr...@adobe.com>
Authored: Sun Aug 30 22:36:14 2015 +0100
Committer: Tobias Bocanegra <tr...@adobe.com>
Committed: Sun Aug 30 22:36:14 2015 +0100

----------------------------------------------------------------------
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |  8 ++++++
 CordovaLib/CordovaLib/Classes/CDVMainWindow.h   | 24 +++++++++++++++++
 CordovaLib/CordovaLib/Classes/CDVMainWindow.m   | 28 ++++++++++++++++++++
 .../CordovaLib/Classes/CDVViewController.m      |  4 +++
 .../__PROJECT_NAME__/MainViewController.xib     |  2 +-
 5 files changed, 65 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5ec1cc4b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index a087a66..78f2e1f 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -48,10 +48,12 @@
 		70BD67BC18FFA12D00A1EFCF /* ShellUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 70BD679618FFA12D00A1EFCF /* ShellUtils.m */; };
 		CC6A01B9AD6ECF2D913FF418 /* CDVWindowSizeCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = CC6A03B1971BACCB9183AEFE /* CDVWindowSizeCommand.h */; };
 		CC6A03130738A1F299369195 /* CDVCursorMonitorService.m in Sources */ = {isa = PBXBuildFile; fileRef = CC6A07666A2CE3AE46F85AD6 /* CDVCursorMonitorService.m */; };
+		CC6A051516599A029D1ECA50 /* CDVMainWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = CC6A0F82EDAFA619D95D3392 /* CDVMainWindow.m */; };
 		CC6A060DFE3B49803140B568 /* CDVCursorMonitorService.h in Headers */ = {isa = PBXBuildFile; fileRef = CC6A08BE679E9B2A17CB995E /* CDVCursorMonitorService.h */; };
 		CC6A061F0987401A5AB7FE69 /* NSScreen+Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = CC6A00E23A9BC2910E28D36E /* NSScreen+Utils.h */; };
 		CC6A07EE3FA39E9ED21FC2AD /* CDVWindowSizeCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = CC6A0DB9905DAB3A94C6BCC8 /* CDVWindowSizeCommand.m */; };
 		CC6A0C2EAD9E57810677CE21 /* NSScreen+Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = CC6A01EC9D87C6FC66791911 /* NSScreen+Utils.m */; };
+		CC6A0EC955BC7E3B3BF31EA3 /* CDVMainWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = CC6A04379104F7E27DB88C08 /* CDVMainWindow.h */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
@@ -105,9 +107,11 @@
 		CC6A00E23A9BC2910E28D36E /* NSScreen+Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSScreen+Utils.h"; sourceTree = "<group>"; };
 		CC6A01EC9D87C6FC66791911 /* NSScreen+Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSScreen+Utils.m"; sourceTree = "<group>"; };
 		CC6A03B1971BACCB9183AEFE /* CDVWindowSizeCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVWindowSizeCommand.h; sourceTree = "<group>"; };
+		CC6A04379104F7E27DB88C08 /* CDVMainWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVMainWindow.h; sourceTree = "<group>"; };
 		CC6A07666A2CE3AE46F85AD6 /* CDVCursorMonitorService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVCursorMonitorService.m; sourceTree = "<group>"; };
 		CC6A08BE679E9B2A17CB995E /* CDVCursorMonitorService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCursorMonitorService.h; sourceTree = "<group>"; };
 		CC6A0DB9905DAB3A94C6BCC8 /* CDVWindowSizeCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWindowSizeCommand.m; sourceTree = "<group>"; };
+		CC6A0F82EDAFA619D95D3392 /* CDVMainWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVMainWindow.m; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -189,6 +193,8 @@
 				70BD677418FFA12D00A1EFCF /* CDVWebViewDelegate.m */,
 				70BD677518FFA12D00A1EFCF /* Commands */,
 				70BD679018FFA12D00A1EFCF /* Utils */,
+				CC6A04379104F7E27DB88C08 /* CDVMainWindow.h */,
+				CC6A0F82EDAFA619D95D3392 /* CDVMainWindow.m */,
 			);
 			path = Classes;
 			sourceTree = "<group>";
@@ -276,6 +282,7 @@
 				CC6A01B9AD6ECF2D913FF418 /* CDVWindowSizeCommand.h in Headers */,
 				CC6A061F0987401A5AB7FE69 /* NSScreen+Utils.h in Headers */,
 				CC6A060DFE3B49803140B568 /* CDVCursorMonitorService.h in Headers */,
+				CC6A0EC955BC7E3B3BF31EA3 /* CDVMainWindow.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -351,6 +358,7 @@
 				CC6A07EE3FA39E9ED21FC2AD /* CDVWindowSizeCommand.m in Sources */,
 				CC6A0C2EAD9E57810677CE21 /* NSScreen+Utils.m in Sources */,
 				CC6A03130738A1F299369195 /* CDVCursorMonitorService.m in Sources */,
+				CC6A051516599A029D1ECA50 /* CDVMainWindow.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5ec1cc4b/CordovaLib/CordovaLib/Classes/CDVMainWindow.h
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib/Classes/CDVMainWindow.h b/CordovaLib/CordovaLib/Classes/CDVMainWindow.h
new file mode 100644
index 0000000..229e0d1
--- /dev/null
+++ b/CordovaLib/CordovaLib/Classes/CDVMainWindow.h
@@ -0,0 +1,24 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+@interface CDVMainWindow : NSWindow
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5ec1cc4b/CordovaLib/CordovaLib/Classes/CDVMainWindow.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib/Classes/CDVMainWindow.m b/CordovaLib/CordovaLib/Classes/CDVMainWindow.m
new file mode 100644
index 0000000..e26d863
--- /dev/null
+++ b/CordovaLib/CordovaLib/Classes/CDVMainWindow.m
@@ -0,0 +1,28 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import "CDVMainWindow.h"
+
+@implementation CDVMainWindow
+
+- (BOOL) canBecomeKeyWindow {
+    return YES;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5ec1cc4b/CordovaLib/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib/Classes/CDVViewController.m b/CordovaLib/CordovaLib/Classes/CDVViewController.m
index cacc15f..1d78e6c 100644
--- a/CordovaLib/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/CordovaLib/Classes/CDVViewController.m
@@ -313,6 +313,10 @@
     } else if (_cfgWindowSize.height > 0 && _cfgWindowSize.width > 0) {
         [CDVWindowSizeCommand setSizeOfWindow:self.window size:_cfgWindowSize];
     }
+    // use black background while starting.
+    self.window.backgroundColor = [NSColor blackColor];
+    self.webView.drawsBackground = NO;
+
     [self showWindow:self];
     [self.window makeKeyAndOrderFront:self];
     [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5ec1cc4b/bin/templates/project/__PROJECT_NAME__/MainViewController.xib
----------------------------------------------------------------------
diff --git a/bin/templates/project/__PROJECT_NAME__/MainViewController.xib b/bin/templates/project/__PROJECT_NAME__/MainViewController.xib
index 1d8d96f..1db431a 100644
--- a/bin/templates/project/__PROJECT_NAME__/MainViewController.xib
+++ b/bin/templates/project/__PROJECT_NAME__/MainViewController.xib
@@ -84,7 +84,7 @@
                 </menuItem>
             </items>
         </menu>
-        <window title="__PROJECT_NAME__" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="371">
+        <window title="__PROJECT_NAME__" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="371" customClass="CDVMainWindow">
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
             <windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
             <rect key="contentRect" x="335" y="299" width="640" height="480"/>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org