mirror of
https://github.com/mpv-player/mpv
synced 2024-12-11 09:25:56 +00:00
feb1f8f18f
Currently, vo_reconfig() calculates the requested window size and sets the vo->dwidth/dheight fields _if_ VOCTRL_UPDATE_SCREENINFO is implemented by the VO or the windowing backend. The window size can be different from the display size if e.g. the --geometry option is used. It will also set the vo->dx/dy fields and read vo->xinerama_x/y. It turned out that this is very backwards and actually requires the windowing backends to workaround these things. There's also MPOpts.screenwidth/screenheight, which used to map to actual options, but is now used only to communicate the screen size to the vo.c code calculating the window size and position. Change this by making the window geometry calculations available as separate functions. This commit doesn't change any VO code yet, and just emulates the old way using the new functions. VO code will remove its usage of VOCTRL_UPDATE_SCREENINFO and use the new functions directly.
31 lines
849 B
C
31 lines
849 B
C
#ifndef MP_WIN_STATE_H_
|
|
#define MP_WIN_STATE_H_
|
|
|
|
#include "common/common.h"
|
|
|
|
struct vo;
|
|
|
|
enum {
|
|
// By user settings, the window manager's chosen window position should
|
|
// be overridden.
|
|
VO_WIN_FORCE_POS = (1 << 0),
|
|
};
|
|
|
|
struct vo_win_geometry {
|
|
// Bitfield of VO_WIN_* flags
|
|
int flags;
|
|
// Position & size of the window. In xinerama coordinates, i.e. they're
|
|
// relative to the virtual desktop encompassing all screens, not the
|
|
// current screen.
|
|
struct mp_rect win;
|
|
// Aspect ratio of the current monitor.
|
|
// (calculated from screen size and options.)
|
|
double monitor_par;
|
|
};
|
|
|
|
void vo_calc_window_geometry(struct vo *vo, const struct mp_rect *screen,
|
|
struct vo_win_geometry *out_geo);
|
|
void vo_apply_window_geometry(struct vo *vo, const struct vo_win_geometry *geo);
|
|
|
|
#endif
|