[MPlayer-cvslog] CVS: main/libvo vo_winvidix.c,1.7,1.8
Sascha Sommer CVS
syncmail at mplayerhq.hu
Sun Jun 26 19:44:09 CEST 2005
CVS change done by Sascha Sommer CVS
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv30824/libvo
Modified Files:
vo_winvidix.c
Log Message:
keep aspect when resizing, quit MPlayer when closing the window patch by Erik Lunchpail <erik_27can at yahoo.com>
Index: vo_winvidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_winvidix.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- vo_winvidix.c 3 Jun 2005 05:16:02 -0000 1.7
+++ vo_winvidix.c 26 Jun 2005 17:44:07 -0000 1.8
@@ -50,6 +50,7 @@
static HWND hWnd;
/* Window parameters */
static HWND hWnd=NULL,hWndFS=NULL;
+static float window_aspect;
static vidix_grkey_t gr_key;
@@ -62,11 +63,15 @@
{
switch (message){
case WM_DESTROY:
+ PostQuitMessage(0);
+ return 0;
+ case WM_CLOSE:
mp_input_queue_cmd(mp_input_parse_cmd("quit"));
break;
case WM_WINDOWPOSCHANGED:
{
- /*calculate new window rect*/
+ int tmpheight=0;
+ /*calculate new window rect*/
if(!vo_fs){
RECT rd;
POINT point_window;
@@ -82,6 +87,26 @@
vo_dx =point_window.x;
vo_dy =point_window.y;
// aspect(&vo_dwidth, &vo_dheight, A_NOZOOM);
+
+ /* keep aspect on resize, borrowed from vo_directx.c */
+ tmpheight = ((float)vo_dwidth/window_aspect);
+ tmpheight += tmpheight % 2;
+ if(tmpheight > vo_dheight)
+ {
+ vo_dwidth = ((float)vo_dheight*window_aspect);
+ vo_dwidth += vo_dwidth % 2;
+ }
+ else vo_dheight = tmpheight;
+ rd.right = rd.left + vo_dwidth;
+ rd.bottom = rd.top + vo_dheight;
+
+ if(rd.left < 0) rd.left = 0;
+ if(rd.right > vo_screenwidth) rd.right = vo_screenwidth;
+ if(rd.top < 0) rd.top = 0;
+ if(rd.bottom > vo_screenheight) rd.bottom = vo_screenheight;
+
+ AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
+ SetWindowPos(hWnd, HWND_TOPMOST, vo_dx+rd.left, vo_dy+rd.top, rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER);
}
else {
if(ShowCursor(FALSE)>=0)while(ShowCursor(FALSE)>=0){}
@@ -184,7 +209,7 @@
aspect(&d_width, &d_height, A_NOZOOM);
vo_dwidth=d_width; vo_dheight=d_height;
-
+ window_aspect = (float)d_width / (float)d_height;
if(!vo_config_count){
More information about the MPlayer-cvslog
mailing list