Mercurial > mplayer.hg
annotate libvo/osx_common.c @ 36371:bbf289ad03f2
vo_vdpau: Initialize variables before, not after setup code.
Fixes possible crashes when playing multiple videos without
-fixed-vo.
author | reimar |
---|---|
date | Tue, 15 Oct 2013 18:58:55 +0000 |
parents | fca6cfc4d5ca |
children |
rev | line source |
---|---|
29607
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
1 /* |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
2 * This file is part of MPlayer. |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
3 * |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
7 * (at your option) any later version. |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
8 * |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
12 * GNU General Public License for more details. |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
13 * |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
17 */ |
29531
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
18 #include "config.h" |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
19 |
29607
5a46b1a05a32
Add standard license header and move a misplaced comment.
reimar
parents:
29536
diff
changeset
|
20 // only to get keycode definitions from HIToolbox/Events.h |
29531
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
21 #include <Carbon/Carbon.h> |
30922
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
22 #include "config.h" |
29531
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
23 #include "osx_common.h" |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
24 #include "video_out.h" |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
25 #include "osdep/keycodes.h" |
29535
b2f841a1905e
Fix implicit declaration of mp_input_.. functions.
reimar
parents:
29534
diff
changeset
|
26 #include "input/input.h" |
29531
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
27 |
29712
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
28 /* |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
29 * Define keycodes only found in OSX >= 10.5 for older versions |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
30 */ |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
31 #if MAC_OS_X_VERSION_MAX_ALLOWED <= 1040 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
32 #define kVK_ANSI_Keypad0 0x52 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
33 #define kVK_ANSI_Keypad1 0x53 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
34 #define kVK_ANSI_Keypad2 0x54 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
35 #define kVK_ANSI_Keypad3 0x55 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
36 #define kVK_ANSI_Keypad4 0x56 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
37 #define kVK_ANSI_Keypad5 0x57 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
38 #define kVK_ANSI_Keypad6 0x58 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
39 #define kVK_ANSI_Keypad7 0x59 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
40 #define kVK_ANSI_Keypad8 0x5b |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
41 #define kVK_ANSI_Keypad9 0x5c |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
42 #define kVK_ANSI_KeypadDecimal 0x41 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
43 #define kVK_ANSI_KeypadDivide 0x4b |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
44 #define kVK_ANSI_KeypadEnter 0x4c |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
45 #define kVK_ANSI_KeypadMinus 0x4e |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
46 #define kVK_ANSI_KeypadMultiply 0x43 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
47 #define kVK_ANSI_KeypadPlus 0x45 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
48 #define kVK_Control 0x3b |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
49 #define kVK_Delete 0x33 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
50 #define kVK_DownArrow 0x7d |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
51 #define kVK_End 0x77 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
52 #define kVK_Escape 0x35 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
53 #define kVK_F1 0x7a |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
54 #define kVK_F10 0x6d |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
55 #define kVK_F11 0x67 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
56 #define kVK_F12 0x6f |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
57 #define kVK_F2 0x78 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
58 #define kVK_F3 0x63 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
59 #define kVK_F4 0x76 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
60 #define kVK_F5 0x60 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
61 #define kVK_F6 0x61 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
62 #define kVK_F7 0x62 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
63 #define kVK_F8 0x64 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
64 #define kVK_F9 0x65 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
65 #define kVK_ForwardDelete 0x75 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
66 #define kVK_Help 0x72 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
67 #define kVK_Home 0x73 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
68 #define kVK_LeftArrow 0x7b |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
69 #define kVK_Option 0x3a |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
70 #define kVK_PageDown 0x79 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
71 #define kVK_PageUp 0x74 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
72 #define kVK_Return 0x24 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
73 #define kVK_RightArrow 0x7c |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
74 #define kVK_Shift 0x38 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
75 #define kVK_Tab 0x30 |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
76 #define kVK_UpArrow 0x7e |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
77 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED <= 1040 */ |
dd8e0a69dfc4
Add keycode definitions for older versions of OSX. Fixes compilation on 10.4.
adrian
parents:
29707
diff
changeset
|
78 |
31017 | 79 static const struct mp_keymap keymap[] = { |
29531
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
80 // special keys |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
81 {0x34, KEY_ENTER}, // Enter key on some iBooks? |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
82 {kVK_Return, KEY_ENTER}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
83 {kVK_Escape, KEY_ESC}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
84 {kVK_Delete, KEY_BACKSPACE}, {kVK_Option, KEY_BACKSPACE}, {kVK_Control, KEY_BACKSPACE}, {kVK_Shift, KEY_BACKSPACE}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
85 {kVK_Tab, KEY_TAB}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
86 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
87 // cursor keys |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
88 {kVK_UpArrow, KEY_UP}, {kVK_DownArrow, KEY_DOWN}, {kVK_LeftArrow, KEY_LEFT}, {kVK_RightArrow, KEY_RIGHT}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
89 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
90 // navigation block |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
91 {kVK_Help, KEY_INSERT}, {kVK_ForwardDelete, KEY_DELETE}, {kVK_Home, KEY_HOME}, |
29707 | 92 {kVK_End, KEY_END}, {kVK_PageUp, KEY_PAGE_UP}, {kVK_PageDown, KEY_PAGE_DOWN}, |
29531
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
93 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
94 // F-keys |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
95 {kVK_F1, KEY_F + 1}, {kVK_F2, KEY_F + 2}, {kVK_F3, KEY_F + 3}, {kVK_F4, KEY_F + 4}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
96 {kVK_F5, KEY_F + 5}, {kVK_F6, KEY_F + 6}, {kVK_F7, KEY_F + 7}, {kVK_F8, KEY_F + 8}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
97 {kVK_F9, KEY_F + 9}, {kVK_F10, KEY_F + 10}, {kVK_F11, KEY_F + 11}, {kVK_F12, KEY_F + 12}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
98 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
99 // numpad |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
100 {kVK_ANSI_KeypadPlus, '+'}, {kVK_ANSI_KeypadMinus, '-'}, {kVK_ANSI_KeypadMultiply, '*'}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
101 {kVK_ANSI_KeypadDivide, '/'}, {kVK_ANSI_KeypadEnter, KEY_KPENTER}, {kVK_ANSI_KeypadDecimal, KEY_KPDEC}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
102 {kVK_ANSI_Keypad0, KEY_KP0}, {kVK_ANSI_Keypad1, KEY_KP1}, {kVK_ANSI_Keypad2, KEY_KP2}, {kVK_ANSI_Keypad3, KEY_KP3}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
103 {kVK_ANSI_Keypad4, KEY_KP4}, {kVK_ANSI_Keypad5, KEY_KP5}, {kVK_ANSI_Keypad6, KEY_KP6}, {kVK_ANSI_Keypad7, KEY_KP7}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
104 {kVK_ANSI_Keypad8, KEY_KP8}, {kVK_ANSI_Keypad9, KEY_KP9}, |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
105 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
106 {0, 0} |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
107 }; |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
108 |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
109 int convert_key(unsigned key, unsigned charcode) |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
110 { |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
111 int mpkey = lookup_keymap_table(keymap, key); |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
112 if (mpkey) |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
113 return mpkey; |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
114 return charcode; |
6bd4c0c77eab
Add osx_common.c and move the keycode conversion (OSX to MPlayer) there.
reimar
parents:
diff
changeset
|
115 } |
29532
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
116 |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
117 static int our_aspect_change; |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
118 static float old_movie_aspect; |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
119 |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
120 /** |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
121 * Sends MPlayer a command to change aspect to the requested value. |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
122 * @param new_aspect desired new aspect, < 0 means restore original. |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
123 */ |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
124 void change_movie_aspect(float new_aspect) |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
125 { |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
126 char cmd_str[64]; |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
127 if (new_aspect < 0) |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
128 new_aspect = old_movie_aspect; |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
129 our_aspect_change = 1; |
29536
1e432b300e57
Make aspect switching work again (used the wrong variable and always
reimar
parents:
29535
diff
changeset
|
130 snprintf(cmd_str, sizeof(cmd_str), "switch_ratio %f", new_aspect); |
29532
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
131 mp_input_queue_cmd(mp_input_parse_cmd(cmd_str)); |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
132 } |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
133 |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
134 /** |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
135 * Call in config to save the original movie aspect. |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
136 * This will ignore config calls caused by change_movie_aspect. |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
137 */ |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
138 void config_movie_aspect(float config_aspect) |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
139 { |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
140 if (!our_aspect_change) |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
141 old_movie_aspect = config_aspect; |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
142 our_aspect_change = 0; |
99b8d8d5c2d4
Move aspect change handling from vo_quartz to osx_common.
reimar
parents:
29531
diff
changeset
|
143 } |
30922
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
144 |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
145 /** This chunk of code is heavily based off SDL_macosx.m from SDL. |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
146 * The CPSEnableForegroundOperation that was here before is private |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
147 * and should not be used. |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
148 * Replaced by a call to the 10.3+ TransformProcessType. |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
149 */ |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
150 void osx_foreground_hack(void) |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
151 { |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
152 #if !defined (CONFIG_MACOSX_FINDER) || !defined (CONFIG_SDL) |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
153 ProcessSerialNumber myProc, frProc; |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
154 Boolean sameProc; |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
155 |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
156 if (GetFrontProcess(&frProc) == noErr && |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
157 GetCurrentProcess(&myProc) == noErr) { |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
158 if (SameProcess(&frProc, &myProc, &sameProc) == noErr && !sameProc) { |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
159 TransformProcessType(&myProc, |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
160 kProcessTransformToForegroundApplication); |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
161 } |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
162 SetFrontProcess(&myProc); |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
163 } |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
164 #endif |
7e3b047c51e7
Refactor OS X foreground process setting into a separate function.
diego
parents:
29712
diff
changeset
|
165 } |