From: Laurent Aimar Date: Sat, 26 Sep 2009 18:39:47 +0000 (+0200) Subject: Changed the prototype of vout_display_SendEventDisplaySize. X-Git-Tag: 1.1.0-ff~3187 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=904ef7825caee32772ecbbb9a8706ca9aee54eb7;p=vlc Changed the prototype of vout_display_SendEventDisplaySize. It is needed to avoid problems with threaded event. --- diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h index 5106716af8..0f8a7a536e 100644 --- a/include/vlc_vout_display.h +++ b/include/vlc_vout_display.h @@ -174,7 +174,7 @@ enum { VOUT_DISPLAY_EVENT_FULLSCREEN, - VOUT_DISPLAY_EVENT_DISPLAY_SIZE, /* The display size need to change : int i_width, int i_height */ + VOUT_DISPLAY_EVENT_DISPLAY_SIZE, /* The display size need to change : int i_width, int i_height, bool is_fullscreen */ /* */ VOUT_DISPLAY_EVENT_CLOSE, @@ -315,9 +315,9 @@ static inline void vout_display_SendEvent(vout_display_t *vd, int query, ...) va_end(args); } -static inline void vout_display_SendEventDisplaySize(vout_display_t *vd, int width, int height) +static inline void vout_display_SendEventDisplaySize(vout_display_t *vd, int width, int height, bool is_fullscreen) { - vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_DISPLAY_SIZE, width, height); + vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_DISPLAY_SIZE, width, height, is_fullscreen); } static inline void vout_display_SendEventPicturesInvalid(vout_display_t *vd) { diff --git a/src/video_output/display.c b/src/video_output/display.c index 40c42136e2..83e3e197d7 100644 --- a/src/video_output/display.c +++ b/src/video_output/display.c @@ -314,6 +314,7 @@ struct vout_display_owner_sys_t { bool ch_display_size; int display_width; int display_height; + bool display_is_fullscreen; bool ch_display_filled; bool is_display_filled; @@ -554,12 +555,15 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args) case VOUT_DISPLAY_EVENT_DISPLAY_SIZE: { const int width = (int)va_arg(args, int); const int height = (int)va_arg(args, int); - msg_Dbg(vd, "VoutDisplayEvent 'resize' %dx%d", width, height); + const bool is_fullscreen = (bool)va_arg(args, int); + msg_Dbg(vd, "VoutDisplayEvent 'resize' %dx%d %s", + width, height, is_fullscreen ? "fullscreen" : "window"); /* */ - osys->ch_display_size = true; - osys->display_width = width; - osys->display_height = height; + osys->ch_display_size = true; + osys->display_width = width; + osys->display_height = height; + osys->display_is_fullscreen = is_fullscreen; break; } @@ -647,8 +651,10 @@ void vout_ManageDisplay(vout_display_t *vd) cfg.display.width = osys->display_width; cfg.display.height = osys->display_height; - if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_DISPLAY_SIZE, &cfg)) { - msg_Err(vd, "Failed to resize display"); + if (!cfg.is_fullscreen != !osys->display_is_fullscreen || + vout_display_Control(vd, VOUT_DISPLAY_CHANGE_DISPLAY_SIZE, &cfg)) { + if (!cfg.is_fullscreen == !osys->display_is_fullscreen) + msg_Err(vd, "Failed to resize display"); /* We ignore the resized */ osys->display_width = osys->cfg.display.width; @@ -657,7 +663,7 @@ void vout_ManageDisplay(vout_display_t *vd) osys->cfg.display.width = osys->display_width; osys->cfg.display.height = osys->display_height; - if (!osys->is_fullscreen) { + if (!osys->display_is_fullscreen) { osys->width_saved = osys->display_width; osys->height_saved = osys->display_height; } @@ -698,9 +704,10 @@ void vout_ManageDisplay(vout_display_t *vd) osys->zoom.num = osys->cfg.zoom.num; osys->zoom.den = osys->cfg.zoom.den; } else if (cfg.is_display_filled) { - osys->ch_display_size = true; - osys->display_width = (int64_t)vd->source.i_width * osys->zoom.num / osys->zoom.den; - osys->display_height = (int64_t)vd->source.i_height * osys->zoom.num / osys->zoom.den; + const int display_width = (int64_t)vd->source.i_width * osys->zoom.num / osys->zoom.den; + const int display_height = (int64_t)vd->source.i_height * osys->zoom.num / osys->zoom.den; + + vout_display_SendEventDisplaySize(vd, display_width, display_height, osys->cfg.is_fullscreen); } osys->cfg.zoom.num = osys->zoom.num;