get rid of Client phys_screen

This commit is contained in:
Julien Danjou 2008-01-02 19:26:55 +01:00
parent 9fc22e9e4e
commit 10c257d57a
5 changed files with 24 additions and 22 deletions

View file

@ -238,10 +238,12 @@ client_detach(Client *c)
void
focus(Client *c, Bool selscreen, int screen)
{
int phys_screen = get_phys_screen(screen);
/* unfocus current selected client */
if(globalconf.focus->client)
{
window_grabbuttons(globalconf.focus->client->phys_screen,
window_grabbuttons(get_phys_screen(globalconf.focus->client->screen),
globalconf.focus->client->win, False, True);
XSetWindowBorder(globalconf.display, globalconf.focus->client->win,
globalconf.screens[screen].colors_normal[ColBorder].pixel);
@ -262,7 +264,7 @@ focus(Client *c, Bool selscreen, int screen)
if(c)
{
XSetWindowBorder(globalconf.display, c->win, globalconf.screens[screen].colors_selected[ColBorder].pixel);
window_grabbuttons(c->phys_screen, c->win, True, True);
window_grabbuttons(phys_screen, c->win, True, True);
}
if(!selscreen)
@ -285,10 +287,10 @@ focus(Client *c, Bool selscreen, int screen)
}
else
XSetInputFocus(globalconf.display,
RootWindow(globalconf.display, get_phys_screen(screen)),
RootWindow(globalconf.display, phys_screen),
RevertToPointerRoot, CurrentTime);
ewmh_update_net_active_window(get_phys_screen(screen));
ewmh_update_net_active_window(phys_screen);
}
/** Manage a new client
@ -306,6 +308,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
Area area, darea;
Tag *tag;
Rule *rule;
int phys_screen = get_phys_screen(screen);
c = p_new(Client, 1);
@ -318,7 +321,6 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
globalconf.display = globalconf.display;
c->screen = get_screen_bycoord(c->x, c->y);
c->phys_screen = get_phys_screen(c->screen);
move_client_to_screen(c, screen, True);
@ -345,7 +347,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
}
else
{
darea = get_display_area(c->phys_screen,
darea = get_display_area(phys_screen,
globalconf.screens[screen].statusbar,
&globalconf.screens[screen].padding);
@ -377,11 +379,11 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
if(globalconf.have_shape)
{
XShapeSelectInput(globalconf.display, w, ShapeNotifyMask);
window_setshape(c->phys_screen, c->win);
window_setshape(phys_screen, c->win);
}
/* grab buttons */
window_grabbuttons(c->phys_screen, c->win, False, True);
window_grabbuttons(phys_screen, c->win, False, True);
/* check for transient and set tags like its parent */
if((rettrans = XGetTransientForHint(globalconf.display, w, &trans) == Success)
@ -412,7 +414,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
focus(c, True, screen);
ewmh_update_net_client_list(c->phys_screen);
ewmh_update_net_client_list(phys_screen);
/* rearrange to display new window */
arrange(screen);
@ -479,7 +481,7 @@ client_resize(Client *c, int x, int y, int w, int h,
if(w <= 0 || h <= 0)
return;
/* offscreen appearance fixes */
area = get_display_area(c->phys_screen,
area = get_display_area(get_phys_screen(c->screen),
NULL,
&globalconf.screens[c->screen].padding);
if(x > area.width)

View file

@ -172,8 +172,6 @@ struct Client
Window win;
/** Client logical screen */
int screen;
/** Client physical screen */
int phys_screen;
};
typedef struct FocusList FocusList;

View file

@ -107,7 +107,7 @@ handle_event_buttonpress(XEvent *e)
{
restack(c->screen);
XAllowEvents(globalconf.display, ReplayPointer, CurrentTime);
window_grabbuttons(c->phys_screen, c->win, True, True);
window_grabbuttons(get_phys_screen(c->screen), c->win, True, True);
}
else
handle_mouse_button_press(c->screen, ev->button, ev->state, globalconf.buttons.client, NULL);
@ -233,7 +233,7 @@ handle_event_enternotify(XEvent * e)
curtags = get_current_tags(c->screen);
focus(c, ev->same_screen, c->screen);
if (c->isfloating || curtags[0]->layout->arrange == layout_floating)
window_grabbuttons(c->phys_screen, c->win, True, False);
window_grabbuttons(get_phys_screen(c->screen), c->win, True, False);
p_delete(&curtags);
}
else
@ -381,7 +381,7 @@ handle_event_unmapnotify(XEvent * e)
XUnmapEvent *ev = &e->xunmap;
if((c = get_client_bywin(globalconf.clients, ev->window))
&& ev->event == RootWindow(e->xany.display, c->phys_screen)
&& ev->event == RootWindow(e->xany.display, get_phys_screen(c->screen))
&& ev->send_event && window_getstate(c->win) == NormalState)
client_unmanage(c, WithdrawnState);
}
@ -393,7 +393,7 @@ handle_event_shape(XEvent * e)
Client *c = get_client_bywin(globalconf.clients, ev->window);
if(c)
window_setshape(c->phys_screen, c->win);
window_setshape(get_phys_screen(c->screen), c->win);
}
void

4
ewmh.c
View file

@ -143,13 +143,13 @@ ewmh_update_net_client_list(int phys_screen)
int n = 0;
for(c = globalconf.clients; c; c = c->next)
if(c->phys_screen == phys_screen)
if(get_phys_screen(c->screen) == phys_screen)
n++;
wins = p_new(Window, n + 1);
for(n = 0, c = globalconf.clients; c; c = c->next, n++)
if(c->phys_screen == phys_screen)
if(get_phys_screen(c->screen) == phys_screen)
wins[n] = c->win;
XChangeProperty(globalconf.display, RootWindow(globalconf.display, phys_screen),

10
mouse.c
View file

@ -43,7 +43,7 @@ extern AwesomeConf globalconf;
void
uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
{
int x1, y, ocx, ocy, di, nx, ny;
int x1, y, ocx, ocy, di, nx, ny, phys_screen;
unsigned int dui;
Window dummy;
XEvent ev;
@ -68,13 +68,14 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
ocx = nx = c->x;
ocy = ny = c->y;
phys_screen = get_phys_screen(c->screen);
if(XGrabPointer(globalconf.display,
RootWindow(globalconf.display, c->phys_screen),
RootWindow(globalconf.display, phys_screen),
False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
None, globalconf.cursor[CurMove], CurrentTime) != GrabSuccess)
return;
XQueryPointer(globalconf.display,
RootWindow(globalconf.display, c->phys_screen),
RootWindow(globalconf.display, phys_screen),
&dummy, &dummy, &x1, &y, &di, &di, &dui);
c->ismax = False;
statusbar_draw_all(c->screen);
@ -158,7 +159,8 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
else
return;
if(XGrabPointer(globalconf.display, RootWindow(globalconf.display, c->phys_screen),
if(XGrabPointer(globalconf.display, RootWindow(globalconf.display,
get_phys_screen(c->screen)),
False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
None, globalconf.cursor[CurResize], CurrentTime) != GrabSuccess)
return;