diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-05-30 15:42:42 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-05-30 15:51:33 +0300 |
commit | e74361c48822accc0413cae6911efaf6bc7a2b5f (patch) | |
tree | a851bbae7f1aac9a46f57877baa2ef72cf82487b /libvo | |
parent | 1ffe8bece5922b344d750394a0fdd4e6e5794c82 (diff) | |
parent | 0dd2ddd2bc71bb180811eae73ecc15c526520144 (diff) | |
download | mpv-e74361c48822accc0413cae6911efaf6bc7a2b5f.tar.bz2 mpv-e74361c48822accc0413cae6911efaf6bc7a2b5f.tar.xz |
Merge svn changes up to r31189
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/w32_common.c | 18 | ||||
-rw-r--r-- | libvo/x11_common.c | 4 |
2 files changed, 16 insertions, 6 deletions
diff --git a/libvo/w32_common.c b/libvo/w32_common.c index 3b9cc9ab2b..615b4e61a2 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -203,15 +203,19 @@ int vo_w32_check_events(void) { DispatchMessage(&msg); } if (WinID >= 0) { + BOOL res; RECT r; - GetClientRect(vo_window, &r); - if (r.right != vo_dwidth || r.bottom != vo_dheight) { + res = GetClientRect(vo_window, &r); + if (res && (r.right != vo_dwidth || r.bottom != vo_dheight)) { vo_dwidth = r.right; vo_dheight = r.bottom; event_flags |= VO_EVENT_RESIZE; } - GetClientRect(WinID, &r); - if (r.right != vo_dwidth || r.bottom != vo_dheight) + res = GetClientRect(WinID, &r); + if (res && (r.right != vo_dwidth || r.bottom != vo_dheight)) MoveWindow(vo_window, 0, 0, r.right, r.bottom, FALSE); + if (!IsWindow(WinID)) + // Window has probably been closed, e.g. due to program crash + mplayer_put_key(KEY_CLOSE_WIN); } return event_flags; @@ -389,7 +393,7 @@ static int createRenderingContext(void) { int vo_w32_config(uint32_t width, uint32_t height, uint32_t flags) { // we already have a fully initialized window, so nothing needs to be done if (flags & VOFLAG_HIDDEN) - return; + return 1; // store original size for videomode switching o_dwidth = width; o_dheight = height; @@ -409,6 +413,7 @@ int vo_w32_config(uint32_t width, uint32_t height, uint32_t flags) { /** * \brief return the name of the selected device if it is indepedant + * \return pointer to string, must be freed. */ static char *get_display_name(void) { DISPLAY_DEVICE disp; @@ -416,7 +421,7 @@ static char *get_display_name(void) { EnumDisplayDevices(NULL, vo_adapter_num, &disp, 0); if (disp.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP) return NULL; - return disp.DeviceName; + return strdup(disp.DeviceName); } /** @@ -493,6 +498,7 @@ int vo_w32_init(void) { dev_hdc = 0; dev = get_display_name(); if (dev) dev_hdc = CreateDC(dev, NULL, NULL, NULL); + free(dev); updateScreenProperties(); vo_hdc = vo_w32_get_dc(vo_window); diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 056c452b2d..b9da242c46 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -861,6 +861,10 @@ int vo_x11_check_events(struct vo *vo) XSetWMNormalHints(display, x11->window, &x11->vo_hint); x11->fs_flip = 0; break; + case DestroyNotify: + mp_msg(MSGT_VO, MSGL_WARN, "Our window was destroyed, exiting\n"); + mplayer_put_key(vo->key_fifo, KEY_CLOSE_WIN); + break; case ClientMessage: if (Event.xclient.message_type == x11->XAWM_PROTOCOLS && Event.xclient.data.l[0] == x11->XAWM_DELETE_WINDOW) |