summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-20 23:29:28 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-23 13:46:40 +0300
commiteaab1ce896adbcb58e6503ea2dcf789d99bd29f5 (patch)
tree40a03206817797e1e293185e6df304c4cb63165f /command.c
parent7521aac66509d18666b7737160153986cc1437ac (diff)
downloadmpv-eaab1ce896adbcb58e6503ea2dcf789d99bd29f5.tar.bz2
mpv-eaab1ce896adbcb58e6503ea2dcf789d99bd29f5.tar.xz
Move vo_dx,vo_dy,vo_dwidth,vo_dheight to vo struct
Diffstat (limited to 'command.c')
-rw-r--r--command.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/command.c b/command.c
index 0b4312aba9..4b3bc28476 100644
--- a/command.c
+++ b/command.c
@@ -66,32 +66,34 @@
extern int use_menu;
-static void rescale_input_coordinates(int ix, int iy, double *dx, double *dy)
+static void rescale_input_coordinates(struct MPContext *mpctx, int ix, int iy,
+ double *dx, double *dy)
{
+ struct vo *vo = mpctx->video_out;
//remove the borders, if any, and rescale to the range [0,1],[0,1]
if (vo_fs) { //we are in full-screen mode
- if (vo_screenwidth > vo_dwidth) //there are borders along the x axis
- ix -= (vo_screenwidth - vo_dwidth) / 2;
- if (vo_screenheight > vo_dheight) //there are borders along the y axis (usual way)
- iy -= (vo_screenheight - vo_dheight) / 2;
+ if (vo_screenwidth > vo->dwidth) //there are borders along the x axis
+ ix -= (vo_screenwidth - vo->dwidth) / 2;
+ if (vo_screenheight > vo->dheight) //there are borders along the y axis (usual way)
+ iy -= (vo_screenheight - vo->dheight) / 2;
- if (ix < 0 || ix > vo_dwidth) {
+ if (ix < 0 || ix > vo->dwidth) {
*dx = *dy = -1.0;
return;
} //we are on one of the borders
- if (iy < 0 || iy > vo_dheight) {
+ if (iy < 0 || iy > vo->dheight) {
*dx = *dy = -1.0;
return;
} //we are on one of the borders
}
- *dx = (double) ix / (double) vo_dwidth;
- *dy = (double) iy / (double) vo_dheight;
+ *dx = (double) ix / (double) vo->dwidth;
+ *dy = (double) iy / (double) vo->dheight;
mp_msg(MSGT_CPLAYER, MSGL_V,
"\r\nrescaled coordinates: %.3lf, %.3lf, screen (%d x %d), vodisplay: (%d, %d), fullscreen: %d\r\n",
- *dx, *dy, vo_screenwidth, vo_screenheight, vo_dwidth,
- vo_dheight, vo_fs);
+ *dx, *dy, vo_screenwidth, vo_screenheight, vo->dwidth,
+ vo->dheight, vo_fs);
}
static int sub_source_by_pos(MPContext * mpctx, int pos)
@@ -3076,7 +3078,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
double dx, dy;
pointer_x = cmd->args[0].v.i;
pointer_y = cmd->args[1].v.i;
- rescale_input_coordinates(pointer_x, pointer_y, &dx, &dy);
+ rescale_input_coordinates(mpctx, pointer_x, pointer_y, &dx, &dy);
#ifdef USE_DVDNAV
if (mpctx->stream->type == STREAMTYPE_DVDNAV
&& dx > 0.0 && dy > 0.0) {