[vlc-devel] [PATCH 11/41] vout:win32: check the display area change using a RECT
Steve Lhomme
robux4 at ycbcr.xyz
Fri Mar 22 16:13:49 CET 2019
---
modules/video_output/win32/common.c | 6 +++---
modules/video_output/win32/events.c | 22 ++++++++++++----------
modules/video_output/win32/events.h | 3 +--
3 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 56e18b7d29..204b1c1af0 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -181,9 +181,9 @@ static void UpdateRectsInternal(vout_display_t *vd, bool is_forced)
/* Retrieve the window position */
ClientToScreen(sys->hwnd, &window_pos);
- moved_or_resized = EventThreadUpdateWindowPosition(sys->event,
- &window_pos,
- new_display_rect.right, new_display_rect.bottom);
+ OffsetRect(&new_display_rect, window_pos.x, window_pos.y);
+
+ moved_or_resized = EventThreadUpdateWindowPosition(sys->event, &new_display_rect);
}
#endif
if (!is_forced && !moved_or_resized)
diff --git a/modules/video_output/win32/events.c b/modules/video_output/win32/events.c
index 16dc4d9870..be08df5258 100644
--- a/modules/video_output/win32/events.c
+++ b/modules/video_output/win32/events.c
@@ -413,19 +413,21 @@ int EventThreadGetWindowStyle( event_thread_t *p_event )
return p_event->i_window_style;
}
-bool EventThreadUpdateWindowPosition( event_thread_t *p_event,
- const POINT *pos, unsigned w, unsigned h )
+bool EventThreadUpdateWindowPosition( event_thread_t *p_event, const RECT *area )
{
vlc_mutex_lock( &p_event->lock );
- bool moved_or_resized = pos->x != p_event->x || pos->y != p_event->y ||
- w != p_event->width || h != p_event->height;
-
- p_event->x = pos->x;
- p_event->y = pos->y;
- p_event->width = w;
- p_event->height = h;
+ RECT current_area;
+ current_area.left = p_event->x;
+ current_area.right = p_event->x + p_event->width;
+ current_area.top = p_event->y;
+ current_area.bottom = p_event->y + p_event->height;
+
+ p_event->x = area->left;
+ p_event->y = area->top;
+ p_event->width = RECTWidth(*area);
+ p_event->height = RECTHeight(*area);
vlc_mutex_unlock( &p_event->lock );
- return moved_or_resized;
+ return !EqualRect(¤t_area, area);
}
void EventThreadUpdateSourceAndPlace( event_thread_t *p_event,
diff --git a/modules/video_output/win32/events.h b/modules/video_output/win32/events.h
index 25b9b3de0e..25c9a27041 100644
--- a/modules/video_output/win32/events.h
+++ b/modules/video_output/win32/events.h
@@ -52,8 +52,7 @@ void EventThreadStop( event_thread_t * );
void EventThreadUpdateTitle( event_thread_t *, const char *psz_fallback );
int EventThreadGetWindowStyle( event_thread_t * );
-bool EventThreadUpdateWindowPosition( event_thread_t *,
- const POINT *window_pos, unsigned w, unsigned h );
+bool EventThreadUpdateWindowPosition( event_thread_t *, const RECT * );
void EventThreadUpdateSourceAndPlace( event_thread_t *p_event,
const video_format_t *p_source,
const vout_display_place_t *p_place );
--
2.17.1
More information about the vlc-devel
mailing list