Reapplied multihead patch that I backed out. No merge, unfortunately.

This commit is contained in:
Kris Maglione 2006-06-16 02:52:13 -04:00
parent b5b00caa66
commit 0104091f56
4 changed files with 38 additions and 12 deletions

View File

@ -128,12 +128,19 @@ update_client_grab(Client *c, Bool is_sel)
void
focus_client(Client *c, Bool restack)
{
Client *old = sel_client();
Frame *f = c->sel;
Client *old_in_area = sel_client_of_area(f->area);
View *v = f->area->view;
Client *old;
Frame *f;
Client *old_in_area;
View *v;
static char buf[256];
if(!sel_screen)
return;
old = sel_client();
f = c->sel;
old_in_area = sel_client_of_area(f->area);
v = f->area->view;
v->sel = f->area;
f->area->sel = f;
c->floating = (f->area == v->area);
@ -286,7 +293,7 @@ draw_client(Client *c)
d.font = blitzfont;
d.gc = c->gc;
if(c == sel_client())
if(sel_screen && (c == sel_client()))
d.color = def.sel;
else
d.color = def.norm;
@ -323,7 +330,7 @@ draw_client(Client *c)
blitz_drawborder(&d);
d.rect.x = 0;
if(c == sel_client())
if(sel_screen && (c == sel_client()))
d.color = def.sel;
else
d.color = def.norm;

View File

@ -16,6 +16,7 @@ static void handle_buttonrelease(XEvent * e);
static void handle_configurerequest(XEvent * e);
static void handle_destroynotify(XEvent * e);
static void handle_enternotify(XEvent * e);
static void handle_leavenotify(XEvent * e);
static void handle_expose(XEvent * e);
static void handle_keypress(XEvent * e);
static void handle_keymapnotify(XEvent * e);
@ -35,6 +36,7 @@ init_x_event_handler()
handler[ConfigureRequest] = handle_configurerequest;
handler[DestroyNotify] = handle_destroynotify;
handler[EnterNotify] = handle_enternotify;
handler[LeaveNotify] = handle_leavenotify;
handler[Expose] = handle_expose;
handler[KeyPress] = handle_keypress;
handler[KeymapNotify] = handle_keymapnotify;
@ -204,16 +206,27 @@ handle_enternotify(XEvent *e)
return;
if((c = client_of_win(ev->window))) {
Client *old = selected_client();
Frame *f = c->sel;
Area *a = f->area;
if(a->mode == Colmax)
c = a->sel->client;
if(c != old)
focus(c, False);
focus(c, False);
}
else if(ev->window == root) {
sel_screen = True;
draw_clients();
}
}
static void
handle_leavenotify(XEvent *e)
{
XCrossingEvent *ev = &e->xcrossing;
if((ev->window == root) && !ev->same_screen) {
sel_screen = True;
draw_clients();
}
else if(ev->window == root)
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
}
static void

View File

@ -141,6 +141,9 @@ init_cursors()
static void
init_screen()
{
Window w;
int ret;
unsigned mask;
XGCValues gcv;
gcv.subwindow_mode = IncludeInferiors;
@ -155,6 +158,8 @@ init_screen()
rect.width = DisplayWidth(dpy, screen);
rect.height = DisplayHeight(dpy, screen);
def.snap = rect.height / 63;
sel_screen = XQueryPointer(dpy, root, &w, &w, &ret, &ret, &ret, &ret, &mask);
}
/*
@ -315,7 +320,7 @@ main(int argc, char *argv[])
init_lock_keys();
init_screen();
wa.event_mask = SubstructureRedirectMask;
wa.event_mask = SubstructureRedirectMask | EnterWindowMask | LeaveWindowMask;
wa.cursor = cursor[CurNormal];
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);

View File

@ -237,6 +237,7 @@ Atom net_atom[NetLast];
Cursor cursor[CurLast];
unsigned int valid_mask;
unsigned int num_lock_mask;
Bool sel_screen;
void (*handler[LASTEvent]) (XEvent *);