Mercurial > mplayer.hg
comparison libvo/geometry.c @ 29073:a5f19a8ecc86
Get rid of nonsensical limits on -geometry x, y,w and h values, they only
cause confusion on multi-monitor setups.
author | reimar |
---|---|
date | Tue, 31 Mar 2009 16:16:12 +0000 |
parents | d97a607821f1 |
children | 0f1b5b68af32 |
comparison
equal
deleted
inserted
replaced
29072:4520c6c724a6 | 29073:a5f19a8ecc86 |
---|---|
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
19 */ | 19 */ |
20 | 20 |
21 #include <stdio.h> | 21 #include <stdio.h> |
22 #include <string.h> | 22 #include <string.h> |
23 #include <limits.h> | |
23 #include "geometry.h" | 24 #include "geometry.h" |
24 #include "mp_msg.h" | 25 #include "mp_msg.h" |
25 | 26 |
26 /* A string of the form [WxH][+X+Y] or xpos[%]:ypos[%] */ | 27 /* A string of the form [WxH][+X+Y] or xpos[%]:ypos[%] */ |
27 char *vo_geometry = NULL; | 28 char *vo_geometry = NULL; |
36 // scrw,scrh: width and height of the current screen | 37 // scrw,scrh: width and height of the current screen |
37 int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) | 38 int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) |
38 { | 39 { |
39 int width, height, xoff, yoff, xper, yper; | 40 int width, height, xoff, yoff, xper, yper; |
40 | 41 |
41 width = height = xoff = yoff = xper = yper = -1; | 42 width = height = xoff = yoff = xper = yper = INT_MIN; |
42 | 43 |
43 if(vo_geometry != NULL) { | 44 if(vo_geometry != NULL) { |
44 if(sscanf(vo_geometry, "%ix%i+%i+%i", &width, &height, &xoff, &yoff) != 4 ) | 45 if(sscanf(vo_geometry, "%ix%i+%i+%i", &width, &height, &xoff, &yoff) != 4 ) |
45 { | 46 { |
46 RESET_GEOMETRY | 47 RESET_GEOMETRY |
88 "height: %i, xoff: %i, yoff: %i, xper: %i, yper: %i\n", | 89 "height: %i, xoff: %i, yoff: %i, xper: %i, yper: %i\n", |
89 width, height, xoff, yoff, xper, yper); | 90 width, height, xoff, yoff, xper, yper); |
90 mp_msg(MSGT_VO, MSGL_V,"geometry window parameter: widw: %i," | 91 mp_msg(MSGT_VO, MSGL_V,"geometry window parameter: widw: %i," |
91 " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh); | 92 " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh); |
92 | 93 |
93 /* FIXME: better checking of bounds... */ | 94 if (xoff != INT_MIN && xpos) *xpos = xoff; |
94 if( width != -1 && (width < 0 || width > scrw)) | 95 if (yoff != INT_MIN && ypos) *ypos = yoff; |
95 width = (scrw < *widw) ? scrw : *widw; | 96 if (width > 0 && widw) *widw = width; |
96 if( height != -1 && (height < 0 || height > scrh)) | 97 if (height > 0 && widh) *widh = height; |
97 height = (scrh < *widh) ? scrh : *widh; | |
98 if(xoff != -1 && (xoff < 0 || xoff + width > scrw)) xoff = 0; | |
99 if(yoff != -1 && (yoff < 0 || yoff + height > scrh)) yoff = 0; | |
100 | 98 |
101 if(xoff != -1 && xpos) *xpos = xoff; | 99 if (width > 0 || height > 0) |
102 if(yoff != -1 && ypos) *ypos = yoff; | |
103 if(width != -1 && widw) *widw = width; | |
104 if(height != -1 && widh) *widh = height; | |
105 | |
106 if( width != -1 || height != -1) | |
107 geometry_wh_changed = 1; | 100 geometry_wh_changed = 1; |
108 if( xoff != -1 || yoff != -1) | 101 if (xoff != INT_MIN || yoff != INT_MIN) |
109 geometry_xy_changed = 1; | 102 geometry_xy_changed = 1; |
110 } | 103 } |
111 return 1; | 104 return 1; |
112 } | 105 } |
113 | 106 |