summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2017-02-02 00:37:17 -0600
committerepoch <epoch@hacking.allowed.org>2017-02-02 00:37:17 -0600
commit5919fcaaf92afcf75e11f1f059f2cdf2b01044ee (patch)
tree5f64c911e9fea635c05080fe5ae5c6b082d37f4e
parent75ac7ceb90c98595bf0a6847619df52af7f2ef3f (diff)
downloadhackvr-5919fcaaf92afcf75e11f1f059f2cdf2b01044ee.tar.gz
hackvr-5919fcaaf92afcf75e11f1f059f2cdf2b01044ee.zip
fixed viewport proportion bug
-rw-r--r--src/graphics_x11.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/graphics_x11.c b/src/graphics_x11.c
index b939673..f86b31e 100644
--- a/src/graphics_x11.c
+++ b/src/graphics_x11.c
@@ -416,12 +416,13 @@ int graphics_event_handler() {
XGetGeometry(x11_global.dpy,x11_global.w,&root,&global.x,&global.y,&gra_global.width,&gra_global.height,&gra_global.border_width,&gra_global.depth);
if(gra_global.height * AR_W / AR_H != gra_global.width / (gra_global.split_screen / (gra_global.red_and_blue ? gra_global.split_screen : 1))) {
// height / AR_H * AR_W = width / (ss / (rab ? ss : 1))
- printf("# %d != %d for some reason. probably your WM not respecting aspect ratio hints or calculating based on them differently. (would cause an off-by-one or so)\n",gra_global.height * AR_W / AR_H , gra_global.width / (gra_global.split_screen / (gra_global.red_and_blue ? gra_global.split_screen : 1)));
-
- if(gra_global.width / (gra_global.split_screen / (gra_global.red_and_blue ? gra_global.split_screen : 1)) * AR_H / AR_W < gra_global.height) {
- gra_global.height=gra_global.width / (gra_global.split_screen / (gra_global.red_and_blue ? gra_global.split_screen : 1)) * AR_H / AR_W;
+ if(global.debug >= 2) {
+ printf("# %d != %d for some reason. probably your WM not respecting aspect ratio hints or calculating based on them differently. (would cause an off-by-one or so)\n",gra_global.height * AR_W / AR_H , gra_global.width / (gra_global.split_screen / (gra_global.red_and_blue ? gra_global.split_screen : 1)));
+ }
+ if(gra_global.width / (gra_global.red_and_blue ? 1 : gra_global.split_screen) * AR_H / AR_W < gra_global.height) {
+ gra_global.height=gra_global.width / (gra_global.red_and_blue ? 1 : gra_global.split_screen) * AR_H / AR_W;
} else {
- gra_global.width=gra_global.height * AR_H / AR_W * (gra_global.split_screen / (gra_global.red_and_blue ? gra_global.split_screen : 1));
+ gra_global.width=gra_global.height * AR_W / AR_H * (gra_global.red_and_blue ? 1 : gra_global.split_screen);
}
}
gra_global.mapxoff=gra_global.width/(gra_global.split_screen / (gra_global.red_and_blue ? gra_global.split_screen : 1))/2;