From 659adaab5e0d5602bb1a4d2939bb68fbc5659cac Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 28 Sep 2007 11:55:08 +0200 Subject: [PATCH] use get_real_screen() in a lot of places --- awesome.c | 7 +------ event.c | 20 +++++--------------- statusbar.c | 7 ++----- 3 files changed, 8 insertions(+), 26 deletions(-) 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);