summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-06 20:24:35 +0200
committerwm4 <wm4@nowhere>2014-05-06 20:24:35 +0200
commit5eaefaa98a857f29a8ed868f8f3af03f8d71a8b6 (patch)
tree8ac814c575e0ed7ee69bcd0c1f366cbbf4ad205e
parentfeb1f8f18fc2bf1de81ea43d7b57e318c1bf4e69 (diff)
downloadmpv-5eaefaa98a857f29a8ed868f8f3af03f8d71a8b6.tar.bz2
mpv-5eaefaa98a857f29a8ed868f8f3af03f8d71a8b6.tar.xz
x11: don't use VOCTRL_UPDATE_SCREENINFO
See previous commit.
-rw-r--r--video/out/gl_x11.c4
-rw-r--r--video/out/vo_vaapi.c2
-rw-r--r--video/out/vo_vdpau.c2
-rw-r--r--video/out/vo_x11.c2
-rw-r--r--video/out/vo_xv.c2
-rw-r--r--video/out/x11_common.c53
-rw-r--r--video/out/x11_common.h7
7 files changed, 36 insertions, 36 deletions
diff --git a/video/out/gl_x11.c b/video/out/gl_x11.c
index 801e41e6d8..08a37eac89 100644
--- a/video/out/gl_x11.c
+++ b/video/out/gl_x11.c
@@ -206,7 +206,7 @@ static bool config_window_x11(struct MPGLContext *ctx, uint32_t d_width,
if (glx_ctx->context) {
// GL context and window already exist.
// Only update window geometry etc.
- vo_x11_config_vo_window(vo, glx_ctx->vinfo, d_width, d_height, flags, "gl");
+ vo_x11_config_vo_window(vo, glx_ctx->vinfo, flags, "gl");
return true;
}
@@ -271,7 +271,7 @@ static bool config_window_x11(struct MPGLContext *ctx, uint32_t d_width,
glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_GREEN_SIZE, &ctx->depth_g);
glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_BLUE_SIZE, &ctx->depth_b);
- vo_x11_config_vo_window(vo, glx_ctx->vinfo, d_width, d_height, flags, "gl");
+ vo_x11_config_vo_window(vo, glx_ctx->vinfo, flags, "gl");
bool success = false;
if (ctx->requested_gl_version >= MPGL_VER(3, 0))
diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c
index fc1a1178bd..ac8fb54540 100644
--- a/video/out/vo_vaapi.c
+++ b/video/out/vo_vaapi.c
@@ -159,7 +159,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params, int flags)
free_video_specific(p);
- vo_x11_config_vo_window(vo, NULL, vo->dwidth, vo->dheight, flags, "vaapi");
+ vo_x11_config_vo_window(vo, NULL, flags, "vaapi");
if (params->imgfmt != IMGFMT_VAAPI) {
if (!alloc_swdec_surfaces(p, params->w, params->h, params->imgfmt))
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index 053eabbe7a..d43f7a552e 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -516,7 +516,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params, int flags)
free_video_specific(vo);
- vo_x11_config_vo_window(vo, NULL, vo->dwidth, vo->dheight, flags, "vdpau");
+ vo_x11_config_vo_window(vo, NULL, flags, "vdpau");
if (initialize_vdpau_objects(vo) < 0)
return -1;
diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c
index 0da8715f5d..d1d6b6accc 100644
--- a/video/out/vo_x11.c
+++ b/video/out/vo_x11.c
@@ -308,7 +308,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *fmt, int flags)
TrueColor, &p->vinfo))
return -1;
- vo_x11_config_vo_window(vo, &p->vinfo, vo->dwidth, vo->dheight, flags, "x11");
+ vo_x11_config_vo_window(vo, &p->vinfo, flags, "x11");
if (!resize(vo))
return -1;
diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c
index cab43c8f92..bf564cb136 100644
--- a/video/out/vo_xv.c
+++ b/video/out/vo_xv.c
@@ -452,7 +452,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params, int flags)
if (!ctx->xv_format)
return -1;
- vo_x11_config_vo_window(vo, NULL, vo->dwidth, vo->dheight, flags, "xv");
+ vo_x11_config_vo_window(vo, NULL, flags, "xv");
if (ctx->xv_ck_info.method == CK_METHOD_BACKGROUND)
XSetWindowBackground(x11->display, x11->window, ctx->xv_colorkey);
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 8ebe206606..e1441e2957 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -37,7 +37,7 @@
#include <assert.h>
#include "vo.h"
-#include "aspect.h"
+#include "win_state.h"
#include "osdep/timer.h"
#include <X11/Xmd.h>
@@ -434,11 +434,7 @@ static void vo_x11_update_screeninfo(struct vo *vo)
struct mp_vo_opts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
bool all_screens = opts->fullscreen && opts->fsscreen_id == -2;
- vo->xinerama_x = vo->xinerama_y = 0;
- if (all_screens) {
- opts->screenwidth = x11->ws_width;
- opts->screenheight = x11->ws_height;
- }
+ x11->screenrc = (struct mp_rect){.x1 = x11->ws_width, .y1 = x11->ws_height};
#if HAVE_XINERAMA
if (opts->screen_id >= -1 && XineramaIsActive(x11->display) && !all_screens)
{
@@ -463,10 +459,12 @@ static void vo_x11_update_screeninfo(struct vo *vo)
}
if (screen < 0)
screen = 0;
- opts->screenwidth = screens[screen].width;
- opts->screenheight = screens[screen].height;
- vo->xinerama_x = screens[screen].x_org;
- vo->xinerama_y = screens[screen].y_org;
+ x11->screenrc = (struct mp_rect){
+ .x0 = screens[screen].x_org,
+ .y0 = screens[screen].y_org,
+ .x1 = screens[screen].x_org + screens[screen].width,
+ .y1 = screens[screen].y_org + screens[screen].height,
+ };
XFree(screens);
}
@@ -528,16 +526,13 @@ int vo_x11_init(struct vo *vo)
x11->ws_width = DisplayWidth(x11->display, x11->screen);
x11->ws_height = DisplayHeight(x11->display, x11->screen);
- opts->screenwidth = x11->ws_width;
- opts->screenheight = x11->ws_height;
-
if (strncmp(dispName, "unix:", 5) == 0)
dispName += 4;
else if (strncmp(dispName, "localhost:", 10) == 0)
dispName += 9;
x11->display_is_local = dispName[0] == ':' && atoi(dispName + 1) < 10;
MP_VERBOSE(x11, "X11 running at %dx%d (\"%s\" => %s display)\n",
- opts->screenwidth, opts->screenheight, dispName,
+ x11->ws_width, x11->ws_height, dispName,
x11->display_is_local ? "local" : "remote");
x11->wm_type = vo_wm_detect(vo);
@@ -1350,14 +1345,22 @@ static void vo_x11_highlevel_resize(struct vo *vo, int x, int y, int w, int h)
*
* If the window already exists, it just moves and resizes it.
*/
-void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis,
- unsigned int width, unsigned int height, int flags,
+void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int flags,
const char *classname)
{
struct mp_vo_opts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
- int x = vo->dx;
- int y = vo->dy;
+
+ vo_x11_update_screeninfo(vo);
+
+ struct vo_win_geometry geo;
+ vo_calc_window_geometry(vo, &x11->screenrc, &geo);
+ vo_apply_window_geometry(vo, &geo);
+
+ int x = geo.win.x0;
+ int y = geo.win.y0;
+ int width = geo.win.x1 - geo.win.x0;
+ int height = geo.win.y1 - geo.win.y0;
if (opts->WinID >= 0) {
if (opts->WinID == 0)
@@ -1442,11 +1445,9 @@ void vo_x11_clear_background(struct vo *vo, const struct mp_rect *rc)
void vo_x11_clearwindow(struct vo *vo, Window vo_window)
{
struct vo_x11_state *x11 = vo->x11;
- struct mp_vo_opts *opts = vo->opts;
if (x11->f_gc == None)
return;
- XFillRectangle(x11->display, vo_window, x11->f_gc, 0, 0,
- opts->screenwidth, opts->screenheight);
+ XFillRectangle(x11->display, vo_window, x11->f_gc, 0, 0, INT_MAX, INT_MAX);
XFlush(x11->display);
}
@@ -1580,10 +1581,10 @@ static void vo_x11_fullscreen(struct vo *vo)
vo_x11_update_screeninfo(vo);
- x = vo->xinerama_x;
- y = vo->xinerama_y;
- w = opts->screenwidth;
- h = opts->screenheight;
+ x = x11->screenrc.x0;
+ y = x11->screenrc.y0;
+ w = x11->screenrc.x1 - x;
+ h = x11->screenrc.y1 - y;
if ((x11->fs_type & vo_wm_FULLSCREEN) && opts->fsscreen_id != -1) {
// The EWMH fullscreen hint always works on the current screen, so
@@ -1663,8 +1664,6 @@ int vo_x11_control(struct vo *vo, int *events, int request, void *arg)
vo_x11_border(vo);
*events |= VO_EVENT_RESIZE;
return VO_TRUE;
- case VOCTRL_UPDATE_SCREENINFO:
- vo_x11_update_screeninfo(vo);
return VO_TRUE;
case VOCTRL_GET_WINDOW_SIZE: {
int *s = arg;
diff --git a/video/out/x11_common.h b/video/out/x11_common.h
index 23ece3f9c3..5fb413e3a1 100644
--- a/video/out/x11_common.h
+++ b/video/out/x11_common.h
@@ -24,8 +24,9 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#include "common/common.h"
+
struct vo;
-struct mp_rect;
struct mp_log;
struct vo_x11_state {
@@ -37,6 +38,7 @@ struct vo_x11_state {
int display_is_local;
int ws_width;
int ws_height;
+ struct mp_rect screenrc;
int screensaver_off;
int dpms_disabled;
@@ -147,8 +149,7 @@ void vo_x11_uninit(struct vo *vo);
int vo_x11_check_events(struct vo *vo);
bool vo_x11_screen_is_composited(struct vo *vo);
void fstype_help(struct mp_log *log);
-void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis,
- unsigned int width, unsigned int height, int flags,
+void vo_x11_config_vo_window(struct vo *vo, XVisualInfo *vis, int flags,
const char *classname);
void vo_x11_clear_background(struct vo *vo, const struct mp_rect *rc);
void vo_x11_clearwindow(struct vo *vo, Window vo_window);