[Scummvm-cvs-logs] scummvm master -> a2250d74ed1bcda6b6726bb7e6866be9129700c7

criezy criezy at scummvm.org
Fri Mar 25 21:28:55 CET 2016


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e917971681 OS X: Clean taskbar code
a2250d74ed CONFIGURE: Only check Sparkle and NSDockTilePlugIn availability on OS X


Commit: e917971681edc7f5e8f3f6158646eac9e22fb81d
    https://github.com/scummvm/scummvm/commit/e917971681edc7f5e8f3f6158646eac9e22fb81d
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2016-03-25T20:26:01Z

Commit Message:
OS X: Clean taskbar code

This involves moving the NSDockTilePlugIn code to backend/taskbar
and fixing style to follow our coding conventions. One make target
was also renamed. All in all there is no change in functionality with this
commit.

Changed paths:
  A backends/taskbar/macosx/dockplugin/dockplugin.m
  R dists/macosx/dockplugin/dockplugin.m
    backends/taskbar/macosx/macosx-taskbar.mm
    ports.mk



diff --git a/backends/taskbar/macosx/dockplugin/dockplugin.m b/backends/taskbar/macosx/dockplugin/dockplugin.m
new file mode 100644
index 0000000..9d864ef
--- /dev/null
+++ b/backends/taskbar/macosx/dockplugin/dockplugin.m
@@ -0,0 +1,125 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <Cocoa/Cocoa.h>
+
+ at interface ScummVMDockTilePlugIn : NSObject <NSDockTilePlugIn> {
+	NSMenu *recentGamesMenu;
+}
+ at end
+
+ at interface StartGameMenuItem : NSMenuItem {
+	NSString *game;
+}
+- (IBAction) startGame;
+- (NSMenuItem*)initWithGame:(NSString *)gameId description:(NSString*)desc icon:(NSString*)iconFile;
+ at end
+
+ at implementation ScummVMDockTilePlugIn
+
+- (id)init {
+	self = [super init];
+	if (self) {
+		recentGamesMenu = nil;
+	}
+	return self;
+}
+
+- (void)dealloc {
+	[recentGamesMenu release];
+	[super dealloc];
+}
+
+
+- (void)setDockTile:(NSDockTile *)dockTile {
+}
+
+- (NSMenu*)dockMenu {
+	// Get the list or recent games
+	CFPreferencesAppSynchronize(CFSTR("org.scummvm.scummvm"));
+	NSArray *array = CFPreferencesCopyAppValue(CFSTR("recentGames"), CFSTR("org.scummvm.scummvm"));
+	if (array == nil)
+		return nil;
+
+	// Create the menu
+	if (recentGamesMenu == nil)
+		recentGamesMenu = [[NSMenu alloc] init];
+	else
+		[recentGamesMenu removeAllItems];
+
+	NSEnumerator *enumerator = [array objectEnumerator];
+	NSDictionary *recentGame;
+	while (recentGame = [enumerator nextObject]) {
+		NSString *gameId = [recentGame valueForKey:@"game"];
+		NSString *desc = [recentGame valueForKey:@"description"];
+		NSString *iconFile = [recentGame valueForKey:@"icon"];
+		
+		StartGameMenuItem *menuItem = [[StartGameMenuItem alloc] initWithGame:gameId description:desc icon:iconFile];
+		[recentGamesMenu addItem:menuItem];
+		[menuItem release];
+	}
+
+	return recentGamesMenu;
+}
+
+ at end
+
+ at implementation StartGameMenuItem
+
+- (NSMenuItem*)initWithGame:(NSString *)gameId description:(NSString*)desc icon:(NSString*)iconFile {
+	self = [super initWithTitle:(desc == nil ? gameId : desc) action:@selector(startGame) keyEquivalent:@""];
+	[self setTarget:self];
+	
+	if (iconFile != nil) {
+		NSImage *image = [[NSImage alloc] initWithContentsOfFile:iconFile];
+		[self setImage:image];
+		[image release];
+	}
+
+	game = gameId;
+	[game retain];
+	
+	return self;
+}
+
+- (void)dealloc {
+	[game release];
+	[super dealloc];
+}
+
+- (IBAction) startGame {
+	NSLog(@"Starting Game %@...", game);
+	
+	NSString *scummVMPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"org.scummvm.scummvm"];
+	if (scummVMPath == nil) {
+		NSLog(@"Cannot find ScummVM.app!");
+		return;
+	}
+	// Start ScummVM.app with the game ID as argument
+	NSURL *url = [NSURL fileURLWithPath:scummVMPath];
+	NSMutableDictionary *args = [[NSMutableDictionary alloc] init];
+	[args setObject:[NSArray arrayWithObject:game] forKey:NSWorkspaceLaunchConfigurationArguments];
+	[[NSWorkspace sharedWorkspace] launchApplicationAtURL:url options:NSWorkspaceLaunchDefault configuration:args error:nil];
+	[args release];
+}
+
+ at end
diff --git a/backends/taskbar/macosx/macosx-taskbar.mm b/backends/taskbar/macosx/macosx-taskbar.mm
index 4e3ce70..577320b 100644
--- a/backends/taskbar/macosx/macosx-taskbar.mm
+++ b/backends/taskbar/macosx/macosx-taskbar.mm
@@ -120,7 +120,7 @@ void MacOSXTaskbarManager::setOverlayIcon(const Common::String &name, const Comm
 	initOverlayIconView();
 
 	CFStringRef imageFile = CFStringCreateWithCString(0, path.c_str(), kCFStringEncodingASCII);
-	NSImage* image = [[NSImage alloc] initWithContentsOfFile:(NSString *)imageFile];
+	NSImage *image = [[NSImage alloc] initWithContentsOfFile:(NSString *)imageFile];
 	[_overlayIconView setImage:image];
 	[image release];
 	CFRelease(imageFile);
@@ -261,19 +261,19 @@ void MacOSXTaskbarManager::addRecent(const Common::String &name, const Common::S
 	
 	// Retrieve the current list of recent items and update it.
 	NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-	NSArray* oldArray = [defaults arrayForKey:@"recentGames"];
+	NSArray *oldArray = [defaults arrayForKey:@"recentGames"];
 	if (oldArray == nil) {
 		[defaults setObject:[NSArray arrayWithObject:dict] forKey:@"recentGames"];
 	} else {
-		NSMutableArray* newArray = [[NSMutableArray alloc] initWithArray:oldArray];
+		NSMutableArray *newArray = [[NSMutableArray alloc] initWithArray:oldArray];
 		// Insert the new game at the start
 		[newArray insertObject:dict atIndex:0];
 		// If the game was already present in the array, remove it
 		for (int i = 1 ; i < [newArray count] ; ++i) {
-			NSDictionary* oldDict = [newArray objectAtIndex:i];
+			NSDictionary *oldDict = [newArray objectAtIndex:i];
 			if (oldDict == nil)
 				continue;
-			NSString* oldGame = [oldDict valueForKey:@"game"];
+			NSString *oldGame = [oldDict valueForKey:@"game"];
 			if (oldGame != nil && [oldGame isEqualToString:(NSString*)gameName]) {
 				[newArray removeObjectAtIndex:i];
 				break;
diff --git a/dists/macosx/dockplugin/dockplugin.m b/dists/macosx/dockplugin/dockplugin.m
deleted file mode 100644
index 9bf0b9b..0000000
--- a/dists/macosx/dockplugin/dockplugin.m
+++ /dev/null
@@ -1,125 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include <Cocoa/Cocoa.h>
-
- at interface ScummVMDockTilePlugIn : NSObject <NSDockTilePlugIn> {
-	NSMenu* recentGamesMenu;
-}
- at end
-
- at interface StartGameMenuItem : NSMenuItem {
-	NSString* game;
-}
-- (IBAction) startGame;
-- (NSMenuItem*)initWithGame:(NSString *)gameId description:(NSString*)desc icon:(NSString*)iconFile;
- at end
-
- at implementation ScummVMDockTilePlugIn
-
-- (id)init {
-	self = [super init];
-	if (self) {
-		recentGamesMenu = nil;
-	}
-	return self;
-}
-
-- (void)dealloc {
-	[recentGamesMenu release];
-	[super dealloc];
-}
-
-
-- (void)setDockTile:(NSDockTile *)dockTile {
-}
-
-- (NSMenu*)dockMenu {
-	// Get the list or recent games
-	CFPreferencesAppSynchronize(CFSTR("org.scummvm.scummvm"));
-	NSArray* array = CFPreferencesCopyAppValue(CFSTR("recentGames"), CFSTR("org.scummvm.scummvm"));
-	if (array == nil)
-		return nil;
-
-	// Create the menu
-	if (recentGamesMenu == nil)
-		recentGamesMenu = [[NSMenu alloc] init];
-	else
-		[recentGamesMenu removeAllItems];
-
-	NSEnumerator *enumerator = [array objectEnumerator];
-	NSDictionary* recentGame;
-	while (recentGame = [enumerator nextObject]) {
-		NSString* gameId = [recentGame valueForKey:@"game"];
-		NSString* desc = [recentGame valueForKey:@"description"];
-		NSString* iconFile = [recentGame valueForKey:@"icon"];
-		
-		StartGameMenuItem* menuItem = [[StartGameMenuItem alloc] initWithGame:gameId description:desc icon:iconFile];
-		[recentGamesMenu addItem:menuItem];
-		[menuItem release];
-	}
-
-	return recentGamesMenu;
-}
-
- at end
-
- at implementation StartGameMenuItem
-
-- (NSMenuItem*)initWithGame:(NSString *)gameId description:(NSString*)desc icon:(NSString*)iconFile {
-	self = [super initWithTitle:(desc == nil ? gameId : desc) action:@selector(startGame) keyEquivalent:@""];
-	[self setTarget:self];
-	
-	if (iconFile != nil) {
-		NSImage* image = [[NSImage alloc] initWithContentsOfFile:iconFile];
-		[self setImage:image];
-		[image release];
-	}
-
-	game = gameId;
-	[game retain];
-	
-	return self;
-}
-
-- (void)dealloc {
-	[game release];
-	[super dealloc];
-}
-
-- (IBAction) startGame {
-	NSLog(@"Starting Game %@...", game);
-	
-	NSString *scummVMPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"org.scummvm.scummvm"];
-	if (scummVMPath == nil) {
-		NSLog(@"Cannot find ScummVM.app!");
-		return;
-	}
-	// Start ScummVM.app with the game ID as argument
-	NSURL* url = [NSURL fileURLWithPath:scummVMPath];
-	NSMutableDictionary* args = [[NSMutableDictionary alloc] init];
-	[args setObject:[NSArray arrayWithObject:game] forKey:NSWorkspaceLaunchConfigurationArguments];
-	[[NSWorkspace sharedWorkspace] launchApplicationAtURL:url options:NSWorkspaceLaunchDefault configuration:args error:nil];
-	[args release];
-}
-
- at end
diff --git a/ports.mk b/ports.mk
index 93b05b3..155bc57 100644
--- a/ports.mk
+++ b/ports.mk
@@ -60,13 +60,13 @@ ifdef USE_DOCKTILEPLUGIN
 # Therefore do not use $(CXXFLAGS) and $(LDFLAGS).
 
 ScummVMDockTilePlugin32.o:
-	$(CXX) -mmacosx-version-min=10.6 -arch i386 -O2 -c $(srcdir)/dists/macosx/dockplugin/dockplugin.m -o ScummVMDockTilePlugin32.o
+	$(CXX) -mmacosx-version-min=10.6 -arch i386 -O2 -c $(srcdir)/backends/taskbar/macosx/dockplugin/dockplugin.m -o ScummVMDockTilePlugin32.o
 
 ScummVMDockTilePlugin32: ScummVMDockTilePlugin32.o
 	$(CXX) -mmacosx-version-min=10.6 -arch i386 -bundle -framework Foundation -framework AppKit -fobjc-link-runtime ScummVMDockTilePlugin32.o -o ScummVMDockTilePlugin32
 
 ScummVMDockTilePlugin64.o:
-	$(CXX) -mmacosx-version-min=10.6 -arch x86_64 -O2 -c $(srcdir)/dists/macosx/dockplugin/dockplugin.m -o ScummVMDockTilePlugin64.o
+	$(CXX) -mmacosx-version-min=10.6 -arch x86_64 -O2 -c $(srcdir)/backends/taskbar/macosx/dockplugin/dockplugin.m -o ScummVMDockTilePlugin64.o
 	
 ScummVMDockTilePlugin64: ScummVMDockTilePlugin64.o
 	$(CXX) -mmacosx-version-min=10.6 -arch x86_64 -bundle -framework Foundation -framework AppKit -fobjc-link-runtime ScummVMDockTilePlugin64.o -o ScummVMDockTilePlugin64
@@ -74,7 +74,7 @@ ScummVMDockTilePlugin64: ScummVMDockTilePlugin64.o
 ScummVMDockTilePlugin: ScummVMDockTilePlugin32 ScummVMDockTilePlugin64
 	lipo -create ScummVMDockTilePlugin32 ScummVMDockTilePlugin64 -output ScummVMDockTilePlugin
 
-dockplugin: ScummVMDockTilePlugin
+scummvm.docktileplugin: ScummVMDockTilePlugin
 	mkdir -p scummvm.docktileplugin/Contents
 	cp $(srcdir)/dists/macosx/dockplugin/Info.plist scummvm.docktileplugin/Contents
 	mkdir -p scummvm.docktileplugin/Contents/MacOS
@@ -86,7 +86,7 @@ endif
 bundle_name = ScummVM.app
 
 ifdef USE_DOCKTILEPLUGIN
-bundle: scummvm-static dockplugin
+bundle: scummvm-static scummvm.docktileplugin
 else
 bundle: scummvm-static
 endif


Commit: a2250d74ed1bcda6b6726bb7e6866be9129700c7
    https://github.com/scummvm/scummvm/commit/a2250d74ed1bcda6b6726bb7e6866be9129700c7
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2016-03-25T20:28:41Z

Commit Message:
CONFIGURE: Only check Sparkle and NSDockTilePlugIn availability on OS X

Changed paths:
    configure



diff --git a/configure b/configure
index f919d86..a1afe4e 100755
--- a/configure
+++ b/configure
@@ -3937,44 +3937,61 @@ echo "$_mpeg2"
 #
 # Check for Sparkle if updates support is enabled
 #
-echocheck "Sparkle"
-if test "$_updates" = no; then
-	_sparkle=no
-else
-if test "$_sparkle" = auto ; then
-	_sparkle=no
-	cat > $TMPC << EOF
+#
+# Check is NSDockTilePlugIn protocol is supported
+#
+case $_host_os in
+	darwin*)
+		echocheck "Sparkle"
+		if test "$_updates" = no; then
+			_sparkle=no
+		else
+		if test "$_sparkle" = auto ; then
+			_sparkle=no
+			cat > $TMPC << EOF
 #include <Cocoa/Cocoa.h>
 #include <Sparkle/Sparkle.h>
 int main(void) { SUUpdater *updater = [SUUpdater sharedUpdater]; return 0; }
 EOF
-	cc_check $SPARKLE_CFLAGS $SPARKLE_LIBS -framework Sparkle -ObjC++ -lobjc && _sparkle=yes
-fi
-if test "$_sparkle" = yes ; then
-	append_var LIBS "$SPARKLE_LIBS -framework Sparkle"
-	append_var INCLUDES "$SPARKLE_CFLAGS"
-fi
-define_in_config_if_yes "$_sparkle" 'USE_SPARKLE'
-fi
-echo "$_sparkle"
+			cc_check $SPARKLE_CFLAGS $SPARKLE_LIBS -framework Sparkle -ObjC++ -lobjc && _sparkle=yes
+		fi
+		if test "$_sparkle" = yes ; then
+			append_var LIBS "$SPARKLE_LIBS -framework Sparkle"
+			append_var INCLUDES "$SPARKLE_CFLAGS"
+		fi
+		define_in_config_if_yes "$_sparkle" 'USE_SPARKLE'
+		fi
+		echo "$_sparkle"
+	;;
+	*)
+		_sparkle=no
+	;;
+esac
 
 #
 # Check is NSDockTilePlugIn protocol is supported
 #
-# NSDockTilePlugIn was added in OS X 10.6, so will not be available when compiling on older OS X versions.
-echocheck "DockTilePlugin"
-if test "$_osxdockplugin" = auto ; then
-	_osxdockplugin=no
-	cat > $TMPC << EOF
+case $_host_os in
+	darwin*)
+		# NSDockTilePlugIn was added in OS X 10.6, so will not be available when compiling on older OS X versions.
+		echocheck "DockTilePlugin"
+		if test "$_osxdockplugin" = auto ; then
+			_osxdockplugin=no
+			cat > $TMPC << EOF
 #include <Cocoa/Cocoa.h>
 @interface ScummVMDockTilePlugIn : NSObject <NSDockTilePlugIn> {
 }
 @end
 EOF
-	cc_check -c -ObjC++ && _osxdockplugin=yes
-fi
-define_in_config_if_yes "$_osxdockplugin" 'USE_DOCKTILEPLUGIN'
-echo "$_osxdockplugin"
+			cc_check -c -ObjC++ && _osxdockplugin=yes
+		fi
+		define_in_config_if_yes "$_osxdockplugin" 'USE_DOCKTILEPLUGIN'
+		echo "$_osxdockplugin"
+	;;
+	*)
+		_osxdockplugin=no
+	;;
+esac
 
 #
 # Check for FluidSynth






More information about the Scummvm-git-logs mailing list