void aspect(int *srcw, int *srch, int zoom){ int fitw = zoom ? aspdat.scrw : aspdat.prew; int fith = zoom ? aspdat.scrh : aspdat.preh; if( !zoom && geometry_wh_changed ) { #ifdef ASPECT_DEBUG printf("aspect(0) no aspect forced!\n"); #endif return; // the user doesn't want to fix aspect } aspect_fit(srcw, srch, fitw, fith); }
void aspect(int *srcw, int *srch, int zoom){ int fitw; int fith; get_max_dims(&fitw, &fith, zoom); if( !zoom && geometry_wh_changed ) { #ifdef ASPECT_DEBUG printf("aspect(0) no aspect forced!\n"); #endif return; // the user doesn't want to fix aspect } aspect_fit(srcw, srch, fitw, fith); }
static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { RECT r; POINT p; int mpkey; switch (message) { case WM_ERASEBKGND: // no need to erase background seperately return 1; case WM_PAINT: event_flags |= VO_EVENT_EXPOSE; break; case WM_MOVE: p.x = 0; p.y = 0; ClientToScreen(vo_window, &p); vo_dx = p.x; vo_dy = p.y; break; case WM_SIZE: event_flags |= VO_EVENT_RESIZE; GetClientRect(vo_window, &r); vo_dwidth = r.right; vo_dheight = r.bottom; break; case WM_WINDOWPOSCHANGING: if (vo_keepaspect && !vo_fs && WinID < 0) { WINDOWPOS *wpos = lParam; int xborder, yborder; r.left = r.top = 0; r.right = wpos->cx; r.bottom = wpos->cy; AdjustWindowRect(&r, GetWindowLong(vo_window, GWL_STYLE), 0); xborder = (r.right - r.left) - wpos->cx; yborder = (r.bottom - r.top) - wpos->cy; wpos->cx -= xborder; wpos->cy -= yborder; aspect_fit(global_vo, &wpos->cx, &wpos->cy, wpos->cx, wpos->cy); wpos->cx += xborder; wpos->cy += yborder; } return 0; case WM_CLOSE: mplayer_put_key(KEY_CLOSE_WIN); break; case WM_SYSCOMMAND: switch (wParam) { case SC_SCREENSAVE: case SC_MONITORPOWER: mp_msg(MSGT_VO, MSGL_V, "vo: win32: killing screensaver\n"); return 0; } break; case WM_KEYDOWN: mpkey = lookup_keymap_table(vk_map, wParam); if (mpkey) mplayer_put_key(mpkey); break; case WM_CHAR: mplayer_put_key(wParam); break; case WM_LBUTTONDOWN: if (!vo_nomouse_input && (vo_fs || (wParam & MK_CONTROL))) { mplayer_put_key(MOUSE_BTN0); break; } if (!vo_fs) { ReleaseCapture(); SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0); return 0; } break; case WM_MBUTTONDOWN: if (!vo_nomouse_input) mplayer_put_key(MOUSE_BTN1); break; case WM_RBUTTONDOWN: if (!vo_nomouse_input) mplayer_put_key(MOUSE_BTN2); break; case WM_MOUSEMOVE: if (enable_mouse_movements) { char cmd_str[40]; snprintf(cmd_str, sizeof(cmd_str), "set_mouse_pos %i %i", GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); mp_input_queue_cmd(global_vo->input_ctx, mp_input_parse_cmd(cmd_str)); } break; case WM_MOUSEWHEEL: if (!vo_nomouse_input) { int x = GET_WHEEL_DELTA_WPARAM(wParam); if (x > 0) mplayer_put_key(MOUSE_BTN3); else mplayer_put_key(MOUSE_BTN4); break; } } return DefWindowProc(hWnd, message, wParam, lParam); }