diff --git a/app.c b/app.c index e95bde4..2236046 100644 --- a/app.c +++ b/app.c @@ -321,10 +321,12 @@ int appRun(App *app) { break; } default: - if (app->xron && event.type == app->xrev + RRScreenChangeNotify) { + if (app->xron && event.type == app->xrev + RRScreenChangeNotify && XRRUpdateConfiguration(&event)) { LOGDBG("app: screen change event"); + Rotation r = 0; XRRScreenChangeNotifyEvent *ev = (XRRScreenChangeNotifyEvent*)&event; - appUpdateScreenSize(app, ev->width, ev->height, ev->rotation); + XRRRotations(app->dpy, app->screen, &r); // seems rotation in event is wrong + appUpdateScreenSize(app, ev->width, ev->height, r); } break; } @@ -429,7 +431,7 @@ void appUpdateScreenSize(App *app, int sw, int sh, Rotation sr) { if (sw <= 0 || sh <= 0) return; if (sw == app->sw && sh == app->sh && sr == app->sr) return; - LOGDBG("app: update screen size: w=%d, h=%d, r=%d", sw, sh, sr); + LOGDBG("app: update screen size: w=%d, h=%d, r=%02x", sw, sh, sr); app->sr = sr; if (sw == app->sw && sh == app->sh) return; diff --git a/touch.c b/touch.c index a98600f..5c357c3 100644 --- a/touch.c +++ b/touch.c @@ -87,11 +87,11 @@ int touchGet(Touch *touch, int *x, int *y, int *p) { App *app = touch->app; if (app->sr & RR_Rotate_90) - { double v = fx; fx = fy; fy = 1-v; } + { double v = fx; fx = 1-fy; fy = v; } if (app->sr & RR_Rotate_180) { fx = 1-fx; fy = 1-fy; } if (app->sr & RR_Rotate_270) - { double v = fx; fx = 1-fy; fy = v; } + { double v = fx; fx = fy; fy = 1-v; } if (app->sr & RR_Reflect_X) fx = 1-fx; if (app->sr & RR_Reflect_Y)