From b8e3c1eaad02b695b6e5bbebef41de21ae623c04 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Mon, 27 Nov 2006 21:11:47 +0000
Subject: [PATCH] * added an option to the apple script binding to check for
 windowed or fullscreen mode. Patch by Martin Kahr <martin --att-- martinkahr
 com>

---
 extras/MacOSX/Resources/vlc.scriptSuite       | 20 ++++++++++++++
 extras/MacOSX/Resources/vlc.scriptTerminology | 22 +++++++++++++++
 modules/gui/macosx/controls.h                 |  3 +++
 modules/gui/macosx/controls.m                 | 27 +++++++++++++++++++
 4 files changed, 72 insertions(+)

diff --git a/extras/MacOSX/Resources/vlc.scriptSuite b/extras/MacOSX/Resources/vlc.scriptSuite
index fbea7a66a7..25cd6e357d 100644
--- a/extras/MacOSX/Resources/vlc.scriptSuite
+++ b/extras/MacOSX/Resources/vlc.scriptSuite
@@ -6,6 +6,26 @@
     <string>vlc</string>
     <key>AppleEventCode</key>
     <string>VLC#</string>
+    <key>Classes</key>
+    <dict>
+        <key>VLCApplication</key>
+        <dict>
+            <key>AppleEventCode</key>
+            <string>capp</string>
+            <key>Attributes</key>
+            <dict>
+                <key>scriptFullscreenMode</key>
+                <dict>
+                    <key>AppleEventCode</key>
+                    <string>pFsC</string>
+                    <key>Type</key>
+                    <string>NSNumber&lt;Bool&gt;</string>
+                </dict>             
+            </dict>
+            <key>Superclass</key>
+            <string>NSCoreSuite.NSApplication</string>          
+        </dict>
+    </dict> 
     <key>Commands</key>
     <dict>
         <key>OpenURL</key>
diff --git a/extras/MacOSX/Resources/vlc.scriptTerminology b/extras/MacOSX/Resources/vlc.scriptTerminology
index 498fecc43b..f3557d63d2 100644
--- a/extras/MacOSX/Resources/vlc.scriptTerminology
+++ b/extras/MacOSX/Resources/vlc.scriptTerminology
@@ -6,6 +6,28 @@
     <string>VLC suite</string>
     <key>Description</key>
     <string>VLC commands.</string>
+    <key>Classes</key>
+    <dict>
+        <key>VLCApplication</key>
+        <dict>
+            <key>Description</key>
+            <string>VLC's top level scripting object</string>
+            <key>Name</key>
+            <string>application</string>
+            <key>PluralName</key>
+            <string>applications</string>
+            <key>Attributes</key>
+            <dict>
+                <key>scriptFullscreenMode</key>
+                <dict>
+                    <key>Description</key>
+                    <string>indicates wheter fullscreen is enabled or not</string>
+                    <key>Name</key>
+                    <string>fullscreen mode</string>
+                </dict>
+            </dict>         
+        </dict>
+    </dict>
     <key>Commands</key>
     <dict>
         <key>OpenURL</key>
diff --git a/modules/gui/macosx/controls.h b/modules/gui/macosx/controls.h
index cd5ab7d7d5..cc7111597b 100644
--- a/modules/gui/macosx/controls.h
+++ b/modules/gui/macosx/controls.h
@@ -78,6 +78,9 @@
 - (IBAction)mute:(id)sender;
 - (IBAction)volumeSliderUpdated:(id)sender;
 
+- (IBAction)showPosition: (id)sender;
+- (IBAction)toogleFullscreen:(id)sender;
+- (BOOL) isFullscreen;
 - (IBAction)windowAction:(id)sender;
 - (BOOL)keyEvent:(NSEvent *)o_event;
 
diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m
index 0f53bff28c..47ed015d36 100644
--- a/modules/gui/macosx/controls.m
+++ b/modules/gui/macosx/controls.m
@@ -383,6 +383,33 @@
     [o_main manageVolumeSlider];
 }
 
+- (IBAction)showPosition: (id)sender
+{
+    vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT,
+                                             FIND_ANYWHERE );
+    if( p_vout != NULL )
+    {
+        vlc_value_t val;
+        intf_thread_t * p_intf = VLCIntf;
+        val.i_int = config_GetInt( p_intf, "key-position" );
+        var_Set( p_intf, "key-pressed", val );
+    }
+}
+
+- (IBAction)toogleFullscreen:(id)sender {
+    NSMenuItem *o_mi = [[NSMenuItem alloc] initWithTitle: _NS("Fullscreen") action: nil keyEquivalent:@""];             
+    [self windowAction: [o_mi autorelease]]; 
+}
+
+- (BOOL) isFullscreen {
+    id o_vout_view = [self getVoutView];
+    if( o_vout_view )
+    {
+        return [o_vout_view isFullscreen];
+    }
+    return NO;
+}
+
 - (IBAction)windowAction:(id)sender
 {
     NSString *o_title = [sender title];
-- 
2.25.4