summaryrefslogtreecommitdiffstats
path: root/libvo/w32_common.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2008-11-22 19:16:43 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2008-11-22 19:16:43 +0200
commit6cbca28085f1698bc7c6537631d5efbadf64abf1 (patch)
tree13a3ad21a732b168399ce9b34bbb0a57784dd54e /libvo/w32_common.c
parent1715c2a33632b333f8e8e581ef23ea5fe0234edd (diff)
parenta83e00009000c4907254daa141d491d0479e961d (diff)
downloadmpv-6cbca28085f1698bc7c6537631d5efbadf64abf1.tar.bz2
mpv-6cbca28085f1698bc7c6537631d5efbadf64abf1.tar.xz
Merge svn changes up to r27979
Diffstat (limited to 'libvo/w32_common.c')
-rw-r--r--libvo/w32_common.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/libvo/w32_common.c b/libvo/w32_common.c
index ff5312af6a..fd1fe5c36b 100644
--- a/libvo/w32_common.c
+++ b/libvo/w32_common.c
@@ -152,6 +152,23 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
return DefWindowProc(hWnd, message, wParam, lParam);
}
+/**
+ * \brief Dispatch incoming window events and handle them.
+ *
+ * This function should be placed inside libvo's function "check_events".
+ *
+ * Global libvo variables changed:
+ * vo_dwidth: new window client area width
+ * vo_dheight: new window client area height
+ *
+ * \return int with these flags possibly set, take care to handle in the right order
+ * if it matters in your driver:
+ *
+ * VO_EVENT_RESIZE = The window was resized. If necessary reinit your
+ * driver render context accordingly.
+ * VO_EVENT_EXPOSE = The window was exposed. Call e.g. flip_frame() to redraw
+ * the window if the movie is paused.
+ */
int vo_w32_check_events(void) {
MSG msg;
event_flags = 0;
@@ -181,6 +198,20 @@ static BOOL CALLBACK mon_enum(HMONITOR hmon, HDC hdc, LPRECT r, LPARAM p) {
return TRUE;
}
+/**
+ * \brief Update screen information.
+ *
+ * This function should be called in libvo's "control" callback
+ * with parameter VOCTRL_UPDATE_SCREENINFO.
+ * Note that this also enables the new API where geometry and aspect
+ * calculations are done in video_out.c:config_video_out
+ *
+ * Global libvo variables changed:
+ * xinerama_x
+ * xinerama_y
+ * vo_screenwidth
+ * vo_screenheight
+ */
void w32_update_xinerama_info(void) {
xinerama_x = xinerama_y = 0;
if (xinerama_screen < -1) {
@@ -335,6 +366,18 @@ static int createRenderingContext(void) {
return 1;
}
+/**
+ * \brief Configure and show window on the screen.
+ *
+ * This function should be called in libvo's "config" callback.
+ * It configures a window and shows it on the screen.
+ *
+ * Global libvo variables changed:
+ * vo_fs
+ * vo_vm
+ *
+ * \return 1 - Success, 0 - Failure
+ */
int vo_w32_config(uint32_t width, uint32_t height, uint32_t flags) {
// store original size for videomode switching
o_dwidth = width;
@@ -350,6 +393,23 @@ int vo_w32_config(uint32_t width, uint32_t height, uint32_t flags) {
return createRenderingContext();
}
+/**
+ * \brief Initialize w32_common framework.
+ *
+ * The first function that should be called from the w32_common framework.
+ * It handles window creation on the screen with proper title and attributes.
+ * It also initializes the framework's internal variables. The function should
+ * be called after your own preinit initialization and you shouldn't do any
+ * window management on your own.
+ *
+ * Global libvo variables changed:
+ * vo_w32_window
+ * vo_depthonscreen
+ * vo_screenwidth
+ * vo_screenheight
+ *
+ * \return 1 = Success, 0 = Failure
+ */
int vo_w32_init(void) {
HICON mplayerIcon = 0;
char exedir[MAX_PATH];
@@ -406,17 +466,48 @@ int vo_w32_init(void) {
return 1;
}
+/**
+ * \brief Toogle fullscreen / windowed mode.
+ *
+ * Should be called on VOCTRL_FULLSCREEN event. The window is
+ * always resized after this call, so the rendering context
+ * should be reinitialized with the new dimensions.
+ * It is unspecified if vo_check_events will create a resize
+ * event in addition or not.
+ *
+ * Global libvo variables changed:
+ * vo_dwidth
+ * vo_dheight
+ * vo_fs
+ */
+
void vo_w32_fullscreen(void) {
vo_fs = !vo_fs;
createRenderingContext();
}
+/**
+ * \brief Toogle window border attribute.
+ *
+ * Should be called on VOCTRL_BORDER event.
+ *
+ * Global libvo variables changed:
+ * vo_border
+ */
void vo_w32_border(void) {
vo_border = !vo_border;
createRenderingContext();
}
+/**
+ * \brief Toogle window ontop attribute.
+ *
+ * Should be called on VOCTRL_ONTOP event.
+ *
+ * Global libvo variables changed:
+ * vo_ontop
+ */
void vo_w32_ontop( void )
{
vo_ontop = !vo_ontop;
@@ -425,6 +516,13 @@ void vo_w32_ontop( void )
}
}
+/**
+ * \brief Uninitialize w32_common framework.
+ *
+ * Should be called last in video driver's uninit function. First release
+ * anything built on top of the created window e.g. rendering context inside
+ * and call vo_w32_uninit at the end.
+ */
void vo_w32_uninit(void) {
mp_msg(MSGT_VO, MSGL_V, "vo: win32: uninit\n");
resetMode();