annotate libvo/w32_common.c @ 17366:934380353fd6

massive attack: mp_msg printf format fixes
author rathann
date Thu, 12 Jan 2006 20:04:36 +0000
parents e5f2f50744cd
children f57317460375
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
1 #include <limits.h>
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
2 #include <windows.h>
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
3
13787
e047e70a9767 Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents: 12936
diff changeset
4 #include "osdep/keycodes.h"
e047e70a9767 Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents: 12936
diff changeset
5 #include "input/input.h"
e047e70a9767 Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents: 12936
diff changeset
6 #include "input/mouse.h"
e047e70a9767 Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents: 12936
diff changeset
7 #include "mp_msg.h"
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
8 #include "video_out.h"
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
9 #include "aspect.h"
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
10 #include "w32_common.h"
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
11
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
12 extern void mplayer_put_key(int code);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
13
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
14 static const char* classname = "MPlayer - Media player for Win32";
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
15 int vo_vm = 0;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
16 HDC vo_hdc = 0;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
17
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
18 uint32_t o_dwidth;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
19 uint32_t o_dheight;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
20
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
21 static HINSTANCE hInstance;
14142
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 13787
diff changeset
22 HWND vo_window = 0;
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
23 static int cursor = 1;
17115
dbe315450a32 Fix message handling, process resize events
reimar
parents: 17006
diff changeset
24 static int event_flags;
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
25
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
26 static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
27 switch (message) {
17126
e5f2f50744cd WM_PAINT is the "expose" event, not WM_ACTIVATE
reimar
parents: 17115
diff changeset
28 case WM_PAINT:
17115
dbe315450a32 Fix message handling, process resize events
reimar
parents: 17006
diff changeset
29 event_flags |= VO_EVENT_EXPOSE;
dbe315450a32 Fix message handling, process resize events
reimar
parents: 17006
diff changeset
30 break;
dbe315450a32 Fix message handling, process resize events
reimar
parents: 17006
diff changeset
31 case WM_SIZE:
dbe315450a32 Fix message handling, process resize events
reimar
parents: 17006
diff changeset
32 event_flags |= VO_EVENT_RESIZE;
dbe315450a32 Fix message handling, process resize events
reimar
parents: 17006
diff changeset
33 vo_dwidth = lParam & 0xffff;
dbe315450a32 Fix message handling, process resize events
reimar
parents: 17006
diff changeset
34 vo_dheight = lParam >> 16;
dbe315450a32 Fix message handling, process resize events
reimar
parents: 17006
diff changeset
35 break;
12004
494a93a19242 replace WM_DESTROY with WM_CLOSE to make it possible to play multiple files, patch by Reimar Doeffinger
faust3
parents: 11542
diff changeset
36 case WM_CLOSE:
16892
3470c810527b libvo input cleanup: remove the dependency on libinput,
albeu
parents: 16288
diff changeset
37 mplayer_put_key(KEY_CLOSE_WIN);
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
38 break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
39 case WM_SYSCOMMAND:
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
40 switch (wParam) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
41 case SC_SCREENSAVE:
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
42 case SC_MONITORPOWER:
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
43 mp_msg(MSGT_VO, MSGL_V, "vo: win32: killing screensaver\n");
16213
917079aa9fee Cleanup, move declarations to beginning of block.
reimar
parents: 16109
diff changeset
44 return 0;
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
45 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
46 break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
47 case WM_KEYDOWN:
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
48 switch (wParam) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
49 case VK_LEFT: mplayer_put_key(KEY_LEFT); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
50 case VK_UP: mplayer_put_key(KEY_UP); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
51 case VK_RIGHT: mplayer_put_key(KEY_RIGHT); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
52 case VK_DOWN: mplayer_put_key(KEY_DOWN); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
53 case VK_TAB: mplayer_put_key(KEY_TAB); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
54 case VK_CONTROL: mplayer_put_key(KEY_CTRL); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
55 case VK_DELETE: mplayer_put_key(KEY_DELETE); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
56 case VK_INSERT: mplayer_put_key(KEY_INSERT); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
57 case VK_HOME: mplayer_put_key(KEY_HOME); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
58 case VK_END: mplayer_put_key(KEY_END); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
59 case VK_PRIOR: mplayer_put_key(KEY_PAGE_UP); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
60 case VK_NEXT: mplayer_put_key(KEY_PAGE_DOWN); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
61 case VK_ESCAPE: mplayer_put_key(KEY_ESC); break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
62 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
63 break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
64 case WM_CHAR:
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
65 mplayer_put_key(wParam);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
66 break;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
67 case WM_LBUTTONDOWN:
12927
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
68 if (!vo_nomouse_input && (vo_fs || (wParam & MK_CONTROL))) {
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
69 mplayer_put_key(MOUSE_BTN0);
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
70 break;
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
71 }
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
72 if (!vo_fs) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
73 ReleaseCapture();
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
74 SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
75 return 0;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
76 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
77 break;
12927
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
78 case WM_MBUTTONDOWN:
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
79 if (!vo_nomouse_input)
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
80 mplayer_put_key(MOUSE_BTN1);
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
81 break;
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
82 case WM_RBUTTONDOWN:
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
83 if (!vo_nomouse_input)
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
84 mplayer_put_key(MOUSE_BTN2);
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
85 break;
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
86 case WM_MOUSEWHEEL:
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
87 if (!vo_nomouse_input) {
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
88 int x = GET_WHEEL_DELTA_WPARAM(wParam);
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
89 if (x > 0)
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
90 mplayer_put_key(MOUSE_BTN3);
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
91 else
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
92 mplayer_put_key(MOUSE_BTN4);
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
93 break;
ba7d39185cc1 support for passing mouse events on to MPlayer
reimar
parents: 12004
diff changeset
94 }
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
95 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
96
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
97 return DefWindowProc(hWnd, message, wParam, lParam);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
98 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
99
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
100 int vo_w32_check_events(void) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
101 MSG msg;
17115
dbe315450a32 Fix message handling, process resize events
reimar
parents: 17006
diff changeset
102 event_flags = 0;
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
103 while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
104 TranslateMessage(&msg);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
105 DispatchMessage(&msg);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
106 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
107
17115
dbe315450a32 Fix message handling, process resize events
reimar
parents: 17006
diff changeset
108 return event_flags;
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
109 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
110
14747
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
111 static void updateScreenProperties() {
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
112 DEVMODE dm;
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
113 dm.dmSize = sizeof dm;
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
114 dm.dmDriverExtra = 0;
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
115 dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
116 if (!EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &dm)) {
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
117 mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to enumerate display settings!\n");
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
118 return;
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
119 }
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
120
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
121 vo_screenwidth = dm.dmPelsWidth;
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
122 vo_screenheight = dm.dmPelsHeight;
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
123 vo_depthonscreen = dm.dmBitsPerPel;
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
124 aspect_save_screenres(vo_screenwidth, vo_screenheight);
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
125 }
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
126
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
127 static void changeMode(void) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
128 DEVMODE dm;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
129 dm.dmSize = sizeof dm;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
130 dm.dmDriverExtra = 0;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
131
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
132 dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
133 dm.dmBitsPerPel = vo_depthonscreen;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
134 dm.dmPelsWidth = vo_screenwidth;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
135 dm.dmPelsHeight = vo_screenheight;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
136
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
137 if (vo_vm) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
138 int bestMode = -1;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
139 int bestScore = INT_MAX;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
140 int i;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
141 for (i = 0; EnumDisplaySettings(0, i, &dm); ++i) {
16213
917079aa9fee Cleanup, move declarations to beginning of block.
reimar
parents: 16109
diff changeset
142 int score = (dm.dmPelsWidth - o_dwidth) * (dm.dmPelsHeight - o_dheight);
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
143 if (dm.dmBitsPerPel != vo_depthonscreen) continue;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
144 if (dm.dmPelsWidth < o_dwidth) continue;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
145 if (dm.dmPelsHeight < o_dheight) continue;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
146
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
147 if (score < bestScore) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
148 bestScore = score;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
149 bestMode = i;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
150 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
151 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
152
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
153 if (bestMode != -1)
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
154 EnumDisplaySettings(0, bestMode, &dm);
14747
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
155
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
156 ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
157 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
158 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
159
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
160 static void resetMode(void) {
14142
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 13787
diff changeset
161 if (vo_vm)
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
162 ChangeDisplaySettings(0, 0);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
163 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
164
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
165 int createRenderingContext(void) {
11542
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 11479
diff changeset
166 HWND layer = HWND_NOTOPMOST;
16213
917079aa9fee Cleanup, move declarations to beginning of block.
reimar
parents: 16109
diff changeset
167 PIXELFORMATDESCRIPTOR pfd;
17006
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
168 RECT r;
16213
917079aa9fee Cleanup, move declarations to beginning of block.
reimar
parents: 16109
diff changeset
169 int pf;
17006
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
170 int style = (vo_border && !vo_fs) ?
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
171 (WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP;
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
172
11542
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 11479
diff changeset
173 if (vo_fs || vo_ontop) layer = HWND_TOPMOST;
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
174 if (vo_fs) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
175 changeMode();
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
176 if (cursor) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
177 ShowCursor(0);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
178 cursor = 0;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
179 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
180 } else {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
181 resetMode();
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
182 if (!cursor) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
183 ShowCursor(1);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
184 cursor = 1;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
185 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
186 }
14747
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
187 updateScreenProperties();
17006
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
188 ShowWindow(vo_window, SW_HIDE);
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
189 SetWindowLong(vo_window, GWL_STYLE, style);
14747
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
190 vo_dwidth = vo_fs ? vo_screenwidth : o_dwidth;
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
191 vo_dheight = vo_fs ? vo_screenheight : o_dheight;
17006
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
192 r.left = vo_fs ? 0 : vo_dy;
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
193 r.right = r.left + vo_dwidth;
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
194 r.top = vo_fs ? 0 : vo_dx;
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
195 r.bottom = r.top + vo_dheight;
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
196 AdjustWindowRect(&r, style, 0);
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
197 SetWindowPos(vo_window, layer, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_SHOWWINDOW);
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
198
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
199 memset(&pfd, 0, sizeof pfd);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
200 pfd.nSize = sizeof pfd;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
201 pfd.nVersion = 1;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
202 pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
203 pfd.iPixelType = PFD_TYPE_RGBA;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
204 pfd.cColorBits = 24;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
205 pfd.iLayerType = PFD_MAIN_PLANE;
16213
917079aa9fee Cleanup, move declarations to beginning of block.
reimar
parents: 16109
diff changeset
206 pf = ChoosePixelFormat(vo_hdc, &pfd);
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
207 if (!pf) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
208 mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to select a valid pixel format!\n");
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
209 return 0;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
210 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
211
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
212 SetPixelFormat(vo_hdc, pf, &pfd);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
213
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
214 mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, vo_depthonscreen);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
215
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
216 return 1;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
217 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
218
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
219 int vo_init(void) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
220 HICON mplayerIcon = 0;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
221 char exedir[MAX_PATH];
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
222
14142
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 13787
diff changeset
223 if (vo_window)
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
224 return 1;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
225
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
226 hInstance = GetModuleHandle(0);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
227
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
228 if (GetModuleFileName(0, exedir, MAX_PATH))
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
229 mplayerIcon = ExtractIcon(hInstance, exedir, 0);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
230 if (!mplayerIcon)
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
231 mplayerIcon = LoadIcon(0, IDI_APPLICATION);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
232
16226
94bb243636e1 10l, initializers don't work without a declaration :-(
reimar
parents: 16213
diff changeset
233 {
94bb243636e1 10l, initializers don't work without a declaration :-(
reimar
parents: 16213
diff changeset
234 WNDCLASSEX wcex = { sizeof wcex, CS_OWNDC, WndProc, 0, 0, hInstance, mplayerIcon, LoadCursor(0, IDC_ARROW), (HBRUSH)GetStockObject(BLACK_BRUSH), 0, classname, mplayerIcon };
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
235
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
236 if (!RegisterClassEx(&wcex)) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
237 mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to register window class!\n");
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
238 return 0;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
239 }
16226
94bb243636e1 10l, initializers don't work without a declaration :-(
reimar
parents: 16213
diff changeset
240 }
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
241
16282
273d33249c25 -wid support for windows. Not well tested, might still behave a bit weird.
reimar
parents: 16226
diff changeset
242 if (WinID >= 0)
273d33249c25 -wid support for windows. Not well tested, might still behave a bit weird.
reimar
parents: 16226
diff changeset
243 vo_window = WinID;
273d33249c25 -wid support for windows. Not well tested, might still behave a bit weird.
reimar
parents: 16226
diff changeset
244 else {
17006
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
245 vo_window = CreateWindowEx(0, classname, classname,
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
246 vo_border ? (WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP,
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
247 CW_USEDEFAULT, 0, 100, 100, 0, 0, hInstance, 0);
14142
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 13787
diff changeset
248 if (!vo_window) {
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
249 mp_msg(MSGT_VO, MSGL_ERR, "vo: win32: unable to create window!\n");
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
250 return 0;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
251 }
16282
273d33249c25 -wid support for windows. Not well tested, might still behave a bit weird.
reimar
parents: 16226
diff changeset
252 }
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
253
14142
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 13787
diff changeset
254 vo_hdc = GetDC(vo_window);
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
255
14747
d87cc822b343 Remove a lot of duplicate code
reimar
parents: 14142
diff changeset
256 updateScreenProperties();
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
257
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
258 return 1;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
259 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
260
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
261 void vo_w32_fullscreen(void) {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
262 vo_fs = !vo_fs;
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
263
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
264 createRenderingContext();
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
265 }
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
266
17006
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
267 void vo_w32_border() {
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
268 vo_border = !vo_border;
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
269 createRenderingContext();
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
270 }
852499addaa8 Enable border toggling for gl and gl2 under windows.
reimar
parents: 16892
diff changeset
271
11542
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 11479
diff changeset
272 void vo_w32_ontop( void )
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 11479
diff changeset
273 {
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 11479
diff changeset
274 vo_ontop = !vo_ontop;
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 11479
diff changeset
275 if (!vo_fs) {
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 11479
diff changeset
276 HWND layer = HWND_NOTOPMOST;
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 11479
diff changeset
277 if (vo_ontop) layer = HWND_TOPMOST;
14142
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 13787
diff changeset
278 SetWindowPos(vo_window, layer, (vo_screenwidth - vo_dwidth) / 2, (vo_screenheight - vo_dheight) / 2, vo_dwidth, vo_dheight, SWP_SHOWWINDOW);
11542
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 11479
diff changeset
279 }
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 11479
diff changeset
280 }
85e503ddf65f runtime 'stay-on-top' functionality
joey
parents: 11479
diff changeset
281
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
282 void vo_w32_uninit() {
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
283 mp_msg(MSGT_VO, MSGL_V, "vo: win32: uninit\n");
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
284 resetMode();
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
285 ShowCursor(1);
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
286 vo_depthonscreen = 0;
16288
1cb19a114eb8 DestroyWindow must be used when -wid was not given, so for WinID < 0, not >=0
reimar
parents: 16282
diff changeset
287 if (WinID < 0)
14142
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 13787
diff changeset
288 DestroyWindow(vo_window);
f0c1ee83b216 Improving gl2 under windows, moving some functionality to gl_common
reimar
parents: 13787
diff changeset
289 vo_window = 0;
11479
5d76d070b44b change vo_w32_fullscreen to behave like vo_x11_fullscreen patch by Reimar Doeffinger <someone-guy at gmx.de>
faust3
parents: 10880
diff changeset
290 UnregisterClass(classname, 0);
10880
ba9557e864c0 vo_gl2 port to win32 patch by Tristan Seligmann <mithrandi-mplayer-dev-eng at mithrandi.za.net>
faust3
parents:
diff changeset
291 }