From ab9caa789e9b2ec8d13cc0a808b4c5370679b293 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 2 Oct 2009 13:35:18 -0400 Subject: [PATCH] Ammend revision 4f25c2d56107. Fixes issue #124. --- cmd/wmii/xext.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/cmd/wmii/xext.c b/cmd/wmii/xext.c index d4e52ae9..5a88928e 100644 --- a/cmd/wmii/xext.c +++ b/cmd/wmii/xext.c @@ -46,28 +46,16 @@ xext_event(XEvent *e) { handle(e, randr_handlers, randr_eventbase); } -static void -randr_applyrotation(int rotation, int width, int height) { - if(rotation+90 % 180) - scr.rect = Rect(0, 0, width, height); - else - scr.rect = Rect(0, 0, height, width); -} - static void randr_init(void) { int errorbase, major, minor; - Rotation rotation; have_RandR = XRRQueryExtension(display, &randr_eventbase, &errorbase); if(have_RandR) if(XRRQueryVersion(display, &major, &minor) && major < 1) have_RandR = false; - if(have_RandR) { + if(have_RandR) XRRSelectInput(display, scr.root.xid, RRScreenChangeNotifyMask); - XRRRotations(display, scr.screen, &rotation); - randr_applyrotation(rotation, Dx(scr.rect), Dy(scr.rect)); - } } static bool @@ -80,7 +68,10 @@ static void randr_screenchange(XRRScreenChangeNotifyEvent *ev) { XRRUpdateConfiguration((XEvent*)ev); - randr_applyrotation(ev->rotation, ev->width, ev->height); + if(ev->rotation*90 % 180) + scr.rect = Rect(0, 0, ev->width, ev->height); + else + scr.rect = Rect(0, 0, ev->height, ev->width); init_screens(); }