mirror of
https://github.com/mpv-player/mpv
synced 2024-12-18 12:55:16 +00:00
e01eab4385
c4e8c36071
made any usage of --geometry
implicitly center the window on the screen after a resize even if the
user did not pass any x/y arguments to the option. At the time, this was
probably wanted since --geometry was primarily a startup option and
likely the window wouldn't be centered on x11 without moving
coordinates. Times have changed since then and we support full runtime
--geometry changes on all the relevant platforms but it comes with this
automatic window centering behavior (except on wayland of course hah).
It's better to make such window centering optional and user controllable
since it is entirely reasonable that someone wants --geometry=50% to
just resize and not move anything. It's already trivial for a person
that does want to move the window to just add their coordinates to the
--geometry command so there's no reason to continue to force this
behavior since it is less flexible.
Instead, move the window centering stuff out of m_geometry_apply into
vo_calc_window_geometry. We give the power to the caller to whether or
not to force centering the window here and all usage of the function is
updated to simply call it with false for now. Additionally,
--force-window-position being set will also center the window like
before. All that is left is for the windowing code to take advantage of
this. See subsequent commits.
32 lines
946 B
C
32 lines
946 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,
|
|
const struct mp_rect *monitor, double dpi_scale,
|
|
bool force_center, struct vo_win_geometry *out_geo);
|
|
void vo_apply_window_geometry(struct vo *vo, const struct vo_win_geometry *geo);
|
|
|
|
#endif
|