summaryrefslogtreecommitdiffstats
path: root/Gui
diff options
context:
space:
mode:
authorvayne <vayne@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-29 19:30:38 +0000
committervayne <vayne@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-07-29 19:30:38 +0000
commit75f80a327725a5fe34216ca6008626de587ed584 (patch)
tree358464c27ad4bd621747352202eed28255401f42 /Gui
parent714109da019b8ae58c9de11cee5324928325aec1 (diff)
downloadmpv-75f80a327725a5fe34216ca6008626de587ed584.tar.bz2
mpv-75f80a327725a5fe34216ca6008626de587ed584.tar.xz
improved fullscreen switching
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19250 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui')
-rw-r--r--Gui/win32/gui.c25
-rw-r--r--Gui/win32/interface.c58
2 files changed, 56 insertions, 27 deletions
diff --git a/Gui/win32/gui.c b/Gui/win32/gui.c
index 3673309330..57e7c9a625 100644
--- a/Gui/win32/gui.c
+++ b/Gui/win32/gui.c
@@ -64,10 +64,6 @@ DWORD oldtime;
NOTIFYICONDATA nid;
int console_state = 0;
-/* Sub window stuff */
-static HBRUSH colorbrush = NULL; //Handle to colorkey brush
-static COLORREF windowcolor = RGB(0,0,16); //Windowcolor == colorkey
-
void console_toggle(void)
{
if (console_state)
@@ -560,6 +556,7 @@ static LRESULT CALLBACK SubProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
int tmpheight=0;
static uint32_t rect_width;
static uint32_t rect_height;
+ DWORD style, flags;
RECT rd;
POINT pt;
while(ShowCursor(TRUE) <= 0){}
@@ -584,9 +581,18 @@ static LRESULT CALLBACK SubProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
rd.right = rd.left + rect_width;
rd.bottom = rd.top + rect_height;
- AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
- SetWindowPos(hWnd, HWND_NOTOPMOST, pt.x+rd.left, pt.y+rd.top,
- rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER);
+ if(fullscreen)
+ {
+ style = WS_VISIBLE | WS_POPUP;
+ flags = SWP_NOZORDER | SWP_FRAMECHANGED;
+ } else {
+ style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
+ flags = SWP_NOOWNERZORDER;
+ }
+
+ AdjustWindowRect(&rd, style, 0);
+ SetWindowPos(hWnd, 0, fullscreen?0:pt.x+rd.left, fullscreen?0:pt.y+rd.top,
+ fullscreen?vo_screenwidth:rd.right-rd.left, fullscreen?vo_screenheight:rd.bottom-rd.top, flags);
return 0;
}
case WM_PAINT:
@@ -1325,6 +1331,7 @@ extern int create_subwindow(gui_t *gui, char *skindir)
window_priv_t *priv = NULL;
window *desc = NULL;
int i, x = -1, y = -1;
+ vo_colorkey = 0xff000000;
for (i=0; i<gui->skin->windowcount; i++)
if(gui->skin->windows[i]->type == wiSub)
@@ -1336,8 +1343,6 @@ extern int create_subwindow(gui_t *gui, char *skindir)
return 1;
}
- windowcolor = vo_colorkey;
- colorbrush = CreateSolidBrush(windowcolor);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
wc.lpfnWndProc = SubProc;
wc.cbClsExtra = 0;
@@ -1345,7 +1350,7 @@ extern int create_subwindow(gui_t *gui, char *skindir)
wc.hInstance = instance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hIcon = gui->icon;
- wc.hbrBackground = colorbrush;
+ wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszClassName = "MPlayer Sub for Windows";
wc.lpszMenuName = NULL;
RegisterClass(&wc);
diff --git a/Gui/win32/interface.c b/Gui/win32/interface.c
index 7c766e4bf9..44eee7d5ab 100644
--- a/Gui/win32/interface.c
+++ b/Gui/win32/interface.c
@@ -67,6 +67,7 @@ char *codecname = NULL;
int mplGotoTheNext = 1;
static gui_t *mygui = NULL;
static int update_subwindow(void);
+static RECT old_rect;
/* test for playlist files, no need to specify -playlist on the commandline.
* add any conceivable playlist extensions here.
@@ -402,6 +403,7 @@ void mplEnd( void )
if (mygui->playlist->current == (mygui->playlist->trackcount - 1))
mygui->playlist->current = 0;
+ fullscreen = vo_fs = 0;
guiGetEvent(guiCEvent, (void *) guiSetStop);
}
@@ -432,6 +434,9 @@ static DWORD WINAPI GuiThread(void)
gtkAutoSync = autosync;
}
+ old_rect.left = gui_sub_pos_x;
+ old_rect.top = gui_sub_pos_y;
+
while(mygui)
{
GetMessage(&msg, NULL, 0, 0);
@@ -665,6 +670,9 @@ int guiGetEvent(int type, char *arg)
case guiSetPlay:
{
guiIntfStruct.Playing = 1;
+ if(guiIntfStruct.sh_video && !IsIconic(mygui->subwindow)
+ && IsWindowVisible(mygui->subwindow) && !fullscreen)
+ GetWindowRect(mygui->subwindow, &old_rect);
break;
}
case guiSetStop:
@@ -690,22 +698,33 @@ int guiGetEvent(int type, char *arg)
case MP_CMD_GUI_FULLSCREEN:
{
if(!guiIntfStruct.sh_video) break;
- video_out->control(VOCTRL_FULLSCREEN, 0);
- /* no WinID, keep the sub window hidden */
- if(!sub_window)
+ /* FIXME: vo_directx is behaving unexpectedly, this maintains current functionality */
+ if(!sub_window || (&video_driver_list && strstr(video_driver_list[0], "directx")))
+ {
+ video_out->control(VOCTRL_FULLSCREEN, 0);
break;
+ }
+
+ if(!fullscreen)
+ GetWindowRect(mygui->subwindow, &old_rect);
- if(vo_fs)
+ if(fullscreen)
{
- WinID = -1;
- ShowWindow(mygui->subwindow, SW_HIDE);
- while(ShowCursor(FALSE) >= 0){}
+ fullscreen = vo_fs = 0;
+ vo_dwidth = guiIntfStruct.MovieWidth = old_rect.right-old_rect.left;
+ vo_dheight = guiIntfStruct.MovieHeight = old_rect.bottom-old_rect.top;
+ vo_dx = old_rect.left;
+ vo_dy = old_rect.top;
} else {
- WinID = mygui->subwindow;
- ShowWindow(mygui->subwindow, SW_SHOW);
- while(ShowCursor(TRUE) <= 0){}
+ fullscreen = vo_fs = 1;
+ vo_dwidth = guiIntfStruct.MovieWidth = vo_screenwidth;
+ vo_dheight = guiIntfStruct.MovieHeight = vo_screenheight;
+ vo_dx = 0;
+ vo_dy = 0;
}
+ mpcodecs_config_vo(guiIntfStruct.sh_video, guiIntfStruct.MovieWidth,
+ guiIntfStruct.MovieHeight, 0);
break;
}
case MP_CMD_QUIT:
@@ -723,24 +742,24 @@ int guiGetEvent(int type, char *arg)
guiGetEvent(guiCEvent, (void *) guiSetPlay);
break;
case MP_CMD_GUI_SKINBROWSER:
- if(vo_fs) guiSetEvent(evFullScreen);
+ if(fullscreen) guiSetEvent(evFullScreen);
PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_SKINBROWSER, 0);
break;
case MP_CMD_GUI_PLAYLIST:
- if(vo_fs) guiSetEvent(evFullScreen);
+ if(fullscreen) guiSetEvent(evFullScreen);
PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PLAYLIST, 0);
break;
case MP_CMD_GUI_PREFERENCES:
- if(vo_fs) guiSetEvent(evFullScreen);
+ if(fullscreen) guiSetEvent(evFullScreen);
PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PREFS, 0);
break;
case MP_CMD_GUI_LOADFILE:
- if(vo_fs) guiSetEvent(evFullScreen);
+ if(fullscreen) guiSetEvent(evFullScreen);
PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDFILE_OPEN, 0);
break;
#ifdef USE_SUB
case MP_CMD_GUI_LOADSUBTITLE:
- if(vo_fs) guiSetEvent(evFullScreen);
+ if(fullscreen) guiSetEvent(evFullScreen);
PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDSUBTITLE_OPEN, 0);
break;
#endif
@@ -926,7 +945,11 @@ static int update_subwindow(void)
ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
/* get our current window coordinates */
- GetWindowRect(mygui->subwindow, &rd);
+ if(fullscreen)
+ GetWindowRect(mygui->subwindow, &rd);
+ else
+ CopyRect(&rd, &old_rect);
+
x = rd.left;
y = rd.top;
@@ -952,8 +975,9 @@ static int update_subwindow(void)
sub_aspect = movie_aspect;
}
+
AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
- SetWindowPos(mygui->subwindow, HWND_NOTOPMOST, x, y, rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER);
+ SetWindowPos(mygui->subwindow, 0, x, y, rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER);
wp.hwnd = mygui->subwindow;
wp.x = rd.left;