cfg.use_desktop = sys->use_desktop;
#endif
#ifdef MODULE_NAME_IS_directx
- cfg.use_overlay = sys->b_using_overlay;
+ cfg.use_overlay = sys->use_overlay;
#endif
cfg.win.type = VOUT_WINDOW_TYPE_HWND;
- cfg.win.x = 0;
- cfg.win.y = 0;
+ cfg.win.x = var_InheritInteger(vd, "video-x");
+ cfg.win.y = var_InheritInteger(vd, "video-y");
cfg.win.width = vd->cfg->display.width;
cfg.win.height = vd->cfg->display.height;
/* If we do not control our window, we check for geometry changes
* ourselves because the parent might not send us its events. */
- if (sys->hparent && !vd->cfg->is_fullscreen) {
+ if (sys->hparent) {
RECT rect_parent;
POINT point;
/* FIXME I find such #ifdef quite weirds. Are they really needed ? */
-#if defined(MODULE_NAME_IS_direct3d)
+#if defined(MODULE_NAME_IS_direct3d) || defined(MODULE_NAME_IS_wingdi) || defined(MODULE_NAME_IS_wingapi)
SetWindowPos(sys->hwnd, 0, 0, 0,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top,
rect_parent.right - rect_parent.left,
rect_parent.bottom - rect_parent.top, 0);
-#if defined(MODULE_NAME_IS_wingdi) || defined(MODULE_NAME_IS_wingapi)
- unsigned int i_x, i_y, i_width, i_height;
- vout_PlacePicture(vd, rect_parent.right - rect_parent.left,
- rect_parent.bottom - rect_parent.top,
- &i_x, &i_y, &i_width, &i_height);
-
- SetWindowPos(sys->hvideownd, HWND_TOP,
- i_x, i_y, i_width, i_height, 0);
-#endif
#endif
}
}
sys->is_first_display = false;
}
+void AlignRect(RECT *r, int align_boundary, int align_size)
+{
+ if (align_boundary)
+ r->left = (r->left + align_boundary/2) & ~align_boundary;
+ if (align_size)
+ r->right = ((r->right - r->left + align_size/2) & ~align_size) + r->left;
+}
+
/*****************************************************************************
* UpdateRects: update clipping rectangles
*****************************************************************************
RECT rect;
POINT point;
+ /* */
+ if (!cfg)
+ cfg = vd->cfg;
+ if (!source)
+ source = &vd->source;
+
/* Retrieve the window size */
GetClientRect(sys->hwnd, &rect);
ClientToScreen(sys->hwnd, &point);
/* If nothing changed, we can return */
- bool has_changed;
- EventThreadUpdateWindowPosition(sys->event, &has_changed,
+ bool has_moved;
+ bool is_resized;
+ EventThreadUpdateWindowPosition(sys->event, &has_moved, &is_resized,
point.x, point.y,
rect.right, rect.bottom);
- if (!is_forced && !has_changed)
+ if (is_resized)
+ vout_display_SendEventDisplaySize(vd, rect.right, rect.bottom, cfg->is_fullscreen);
+ if (!is_forced && !has_moved && !is_resized )
return;
- /* */
- if (!cfg)
- cfg = vd->cfg;
- if (!source)
- source = &vd->source;
-
/* Update the window position and size */
vout_display_cfg_t place_cfg = *cfg;
place_cfg.display.width = rect.right;
vout_display_PlacePicture(&place, source, &place_cfg, true);
EventThreadUpdateSourceAndPlace(sys->event, source, &place);
+#if defined(MODULE_NAME_IS_wingapi)
+ if (place.width != vd->fmt.i_width || place.height != vd->fmt.i_height)
+ vout_display_SendEventPicturesInvalid(vd);
+#endif
if (sys->hvideownd)
SetWindowPos(sys->hvideownd, 0,
#ifdef MODULE_NAME_IS_directx
/* Apply overlay hardware constraints */
- if (sys->b_using_overlay) {
- if (sys->i_align_dest_boundary)
- rect_dest.left = (rect_dest.left +
- sys->i_align_dest_boundary / 2) &
- ~sys->i_align_dest_boundary;
-
- if (sys->i_align_dest_size)
- rect_dest.right = ((rect_dest.right -
- rect_dest.left +
- sys->i_align_dest_size / 2) &
- ~sys->i_align_dest_size) + rect_dest.left;
- }
+ if (sys->use_overlay)
+ AlignRect(&rect_dest, sys->i_align_dest_boundary, sys->i_align_dest_size);
#endif
#endif
#ifdef MODULE_NAME_IS_directx
/* Apply overlay hardware constraints */
- if (sys->b_using_overlay) {
- if (sys->i_align_src_boundary)
- rect_src_clipped.left =
- (rect_src_clipped.left +
- sys->i_align_src_boundary / 2) &
- ~sys->i_align_src_boundary;
-
- if (sys->i_align_src_size)
- rect_src_clipped.right =
- ((rect_src_clipped.right - rect_src_clipped.left +
- sys->i_align_src_size / 2) &
- ~sys->i_align_src_size) + rect_src_clipped.left;
- }
+ if (sys->use_overlay)
+ AlignRect(&rect_src_clipped, sys->i_align_src_boundary, sys->i_align_src_size);
#elif defined(MODULE_NAME_IS_direct3d)
/* Needed at least with YUV content */
rect_src_clipped.left &= ~1;
rect_dest_clipped.right -= sys->rect_display.left;
rect_dest_clipped.top -= sys->rect_display.top;
rect_dest_clipped.bottom -= sys->rect_display.top;
-
- if (sys->b_using_overlay)
- DirectDrawUpdateOverlay(vd);
#endif
#ifndef UNDER_CE
UpdateRects(vd, cfg, source, is_forced);
return VLC_SUCCESS;
}
- case VOUT_DISPLAY_CHANGE_ON_TOP: { /* int b_on_top */
- const bool is_on_top = va_arg(args, int);
+ case VOUT_DISPLAY_CHANGE_WINDOW_STATE: { /* unsigned state */
+ const unsigned state = va_arg(args, unsigned);
+ const bool is_on_top = (state & VOUT_WINDOW_STATE_ABOVE) != 0;
#ifdef MODULE_NAME_IS_direct3d
if (sys->use_desktop && is_on_top)
return VLC_EGENERIC;
#endif
if (sys->parent_window) {
- if (vout_window_SetState(sys->parent_window, is_on_top))
+ if (vout_window_SetState(sys->parent_window, state))
return VLC_EGENERIC;
} else {
HMENU hMenu = GetSystemMenu(sys->hwnd, FALSE);