diff --git a/awesome.c b/awesome.c index 980e2063..c7162f9a 100644 --- a/awesome.c +++ b/awesome.c @@ -189,12 +189,7 @@ static void setup(Display *disp, int screen, DC *drawcontext, awesome_config *awesomeconf) { XSetWindowAttributes wa; - int real_screen; - - if(XineramaIsActive(disp)) - real_screen = DefaultScreen(disp); - else - real_screen = screen; + int real_screen = get_real_screen(disp, screen); /* init cursors */ drawcontext->cursor[CurNormal] = XCreateFontCursor(disp, XC_left_ptr); diff --git a/event.c b/event.c index 46e23da3..3235d04c 100644 --- a/event.c +++ b/event.c @@ -60,10 +60,7 @@ movemouse(Client * c, awesome_config *awesomeconf) XEvent ev; ScreenInfo *si; - if(XineramaIsActive(c->display)) - real_screen = DefaultScreen(c->display); - else - real_screen = awesomeconf->screen; + real_screen = get_real_screen(c->display, awesomeconf->screen); si = get_display_info(c->display, real_screen, NULL); @@ -108,17 +105,13 @@ movemouse(Client * c, awesome_config *awesomeconf) static void resizemouse(Client * c, awesome_config *awesomeconf) { - int ocx, ocy, nw, nh, real_screen; + int ocx, ocy, nw, nh; XEvent ev; - if(XineramaIsActive(c->display)) - real_screen = DefaultScreen(c->display); - else - real_screen = awesomeconf->screen; - ocx = c->x; ocy = c->y; - if(XGrabPointer(c->display, RootWindow(c->display, real_screen), False, MOUSEMASK, GrabModeAsync, GrabModeAsync, + if(XGrabPointer(c->display, RootWindow(c->display, get_real_screen(c->display, awesomeconf->screen)), + False, MOUSEMASK, GrabModeAsync, GrabModeAsync, None, dc[c->screen].cursor[CurResize], CurrentTime) != GrabSuccess) return; c->ismax = False; @@ -243,10 +236,7 @@ handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf) c->border = ev->border_width; if(c->isfixed || c->isfloating || IS_ARRANGE(layout_floating)) { - if(XineramaIsActive(c->display)) - real_screen = DefaultScreen(c->display); - else - real_screen = c->screen; + real_screen = get_real_screen(c->display, c->screen); if(ev->value_mask & CWX) c->x = ev->x; if(ev->value_mask & CWY) diff --git a/statusbar.c b/statusbar.c index 8c48ada5..4fa653ff 100644 --- a/statusbar.c +++ b/statusbar.c @@ -111,12 +111,9 @@ initstatusbar(Display *disp, int screen, DC *drawcontext, Statusbar *statusbar) int screen_number, real_screen; ScreenInfo *si; - statusbar->screen = screen; + real_screen = get_real_screen(disp, screen); - if(XineramaIsActive(disp)) - real_screen = DefaultScreen(disp); - else - real_screen = screen; + statusbar->screen = screen; si = get_screen_info(disp, screen, NULL, &screen_number);