Search
lxdream.org :: lxdream :: r1028:f99eeaf084c2
lxdream 0.9.1
released Jun 29
Download Now
changeset1028:f99eeaf084c2
parent1027:4e527bc96109
child1029:7138bbb9537c
authornkeynes
dateSun Jun 14 11:44:19 2009 +0000 (10 years ago)
Add fullscreen support
src/cocoaui/cocoa_win.m
src/cocoaui/cocoaui.h
src/cocoaui/cocoaui.m
1.1 --- a/src/cocoaui/cocoa_win.m Sat Jun 13 07:12:51 2009 +0000
1.2 +++ b/src/cocoaui/cocoa_win.m Sun Jun 14 11:44:19 2009 +0000
1.3 @@ -21,6 +21,7 @@
1.4 #include "dreamcast.h"
1.5 #include "gdrom/gdrom.h"
1.6 #include <ApplicationServices/ApplicationServices.h>
1.7 +#include <Carbon/Carbon.h>
1.8
1.9 @interface NSWindow (OSX10_5_and_later)
1.10 #ifndef CGFLOAT_DEFINED
1.11 @@ -207,6 +208,29 @@
1.12 [self setStatusText: _("Stopped")];
1.13 }
1.14 }
1.15 +- (BOOL)isFullscreen
1.16 +{
1.17 + return isFullscreen;
1.18 +}
1.19 +- (void)setFullscreen:(BOOL)full
1.20 +{
1.21 + if( full != isFullscreen ) {
1.22 + isFullscreen = full;
1.23 +
1.24 + if( full ) {
1.25 + savedFrame = [self frame];
1.26 + SetSystemUIMode( kUIModeAllHidden, 0 );
1.27 + NSRect screenRect = [[NSScreen mainScreen] frame];
1.28 + screenRect.size.height += STATUSBAR_HEIGHT;
1.29 + screenRect.origin.y -= STATUSBAR_HEIGHT;
1.30 + NSRect targetRect = [self frameRectForContentRect: screenRect];
1.31 + [self setFrame: targetRect display: YES];
1.32 + } else {
1.33 + SetSystemUIMode( kUIModeNormal, 0 );
1.34 + [self setFrame: savedFrame display: YES];
1.35 + }
1.36 + }
1.37 +}
1.38 - (BOOL)isGrabbed
1.39 {
1.40 return isGrabbed;
1.41 @@ -249,6 +273,10 @@
1.42 [self setIsGrabbed: NO];
1.43 return useGrab ? self : nil;
1.44 }
1.45 +- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)aScreen
1.46 +{
1.47 + return frameRect;
1.48 +}
1.49 @end
1.50
1.51 LxdreamMainWindow *cocoa_gui_create_main_window()
2.1 --- a/src/cocoaui/cocoaui.h Sat Jun 13 07:12:51 2009 +0000
2.2 +++ b/src/cocoaui/cocoaui.h Sun Jun 14 11:44:19 2009 +0000
2.3 @@ -55,6 +55,8 @@
2.4 NSTextField *status;
2.5 BOOL isGrabbed;
2.6 BOOL useGrab;
2.7 + BOOL isFullscreen;
2.8 + NSRect savedFrame;
2.9 }
2.10 - (id)initWithContentRect:(NSRect)contentRect;
2.11 - (void)setStatusText:(const gchar *)text;
2.12 @@ -63,6 +65,8 @@
2.13 - (BOOL)isGrabbed;
2.14 - (void)setIsGrabbed:(BOOL)grab;
2.15 - (void)setUseGrab: (BOOL)grab;
2.16 +- (BOOL)isFullscreen;
2.17 +- (void)setFullscreen: (BOOL)fs;
2.18 @end
2.19
2.20 @interface LxdreamPrefsPane : NSView
3.1 --- a/src/cocoaui/cocoaui.m Sat Jun 13 07:12:51 2009 +0000
3.2 +++ b/src/cocoaui/cocoaui.m Sun Jun 14 11:44:19 2009 +0000
3.3 @@ -149,6 +149,8 @@
3.4 [fileMenu addItem: [NSMenuItem separatorItem]];
3.5 [fileMenu addItemWithTitle: NSMENU_("_Load State...") action: @selector(load_action:) keyEquivalent: @"o"];
3.6 [fileMenu addItemWithTitle: NSMENU_("_Save State...") action: @selector(save_action:) keyEquivalent: @"s"];
3.7 + [fileMenu addItem: [NSMenuItem separatorItem]];
3.8 + [fileMenu addItemWithTitle: NSMENU_("_Full Screen...") action: @selector(fullscreen_action:) keyEquivalent: @"\r"];
3.9
3.10 menuItem = [[NSMenuItem alloc] initWithTitle:NSMENU_("_File") action: nil keyEquivalent: @""];
3.11 [menuItem setSubmenu: fileMenu];
3.12 @@ -280,6 +282,10 @@
3.13 {
3.14 gdrom_list_set_selection( [sender tag] );
3.15 }
3.16 +- (void) fullscreen_action: (id)sender
3.17 +{
3.18 + [mainWindow setFullscreen: ![mainWindow isFullscreen]];
3.19 +}
3.20 @end
3.21
3.22
3.23 @@ -314,7 +320,9 @@
3.24 [NSApp activateIgnoringOtherApps: YES];
3.25
3.26 register_gdrom_disc_change_hook( cocoa_gui_disc_changed, mainWindow );
3.27 -
3.28 + if( withFullscreen ) {
3.29 + [mainWindow setFullscreen: YES];
3.30 + }
3.31 [pool release];
3.32 return TRUE;
3.33 }
.