about summary refs log tree commit diff stats
path: root/event.c
Commit message (Collapse)AuthorAgeFilesLines
* renames swim[ming] into versatileAnselm R. Garbe2007-02-191-4/+4
|
* renamed floating into swimming (this does not clash with C naming ↵Anselm R. Garbe2007-02-191-4/+4
| | | | conventions and fits better the fish symbol) - also in man page
* introduced Layout structAnselm R. Garbe2007-02-191-6/+6
|
* removed procevent, more refactoringAnselm R. Garbe2007-02-191-11/+0
|
* draw.c is useless (belongs to main.c now)Anselm R. Garbe2007-02-191-0/+8
|
* simplified configurerequest to a bare minimum, removed wrong ban() callsAnselm R. Garbe2007-02-191-8/+1
|
* fixed configurerequest according to Jukkas complainsAnselm R. Garbe2007-02-191-8/+9
|
* fixed configurerequest according to the problem Jukka reportedAnselm R. Garbe2007-02-191-11/+16
|
* removed useless spaceAnselm R. Garbe2007-02-161-1/+1
|
* removed ugly ban(), extended resize() that it only resets the size if ↵Anselm R. Garbe2007-02-161-22/+20
| | | | necessary, added border_width commit to manage()
* added ban() which takes care than a banned window is not banned again... ↵Anselm R. Garbe2007-02-141-1/+1
| | | | (this reduces the overall ConfigureNotify's to clients)
* made for/if/else constructs more consistent, some code polishingAnselm R. Garbe2007-02-141-6/+6
|
* made configurerequest more tidyAnselm R. Garbe2007-02-141-5/+10
|
* I didn't knew of c->isfixed, that should fix Jukkas issue with gkrellm ;)Anselm R. Garbe2007-02-131-6/+8
|
* stupid me, one needs to set c->{x,y,w,h} in configurerequest obviously ;)Anselm R. Garbe2007-02-131-16/+20
|
* simplified configurerequestAnselm R. Garbe2007-02-131-35/+16
|
* I don't see any reason why we should select for input on override-redirect ↵Anselm R. Garbe2007-02-121-4/+1
| | | | windows?
* removing all EnterNotifys after resizeAnselm R. Garbe2007-02-121-0/+1
|
* added pointer warp on drop in resizeAnselm R. Garbe2007-02-121-0/+2
|
* replaced getproto with a saner function, now old-school artifacts of WM ↵Anselm R. Garbe2007-02-071-4/+0
| | | | times in the early 90s completely disappeared, no punned pointer warning anymore ;)
* renamed activescreen into selscreen 3.2Anselm R. Garbe2007-01-231-2/+2
|
* small changesAnselm R. Garbe2007-01-231-2/+2
|
* I think this is the best solution of multihead supportAnselm R. Garbe2007-01-231-1/+1
|
* this variant is known to work, but focus() is ugly - we need in general a ↵Anselm R. Garbe2007-01-221-1/+1
| | | | better way to handle multihead, this issel-stuff looks awkward (maybe it might be a good idea to set sel to NULL but to introduce a Client *revert which is set if a screen is unfocused, have to think about it further).
* applied Sanders all5.patch (thanks for your weekend session, Sander!)Anselm R. Garbe2007-01-221-26/+24
|
* leavenotify also don't needs the checkAnselm R. Garbe2007-01-191-5/+2
|
* deciding for focus(NULL);Anselm R. Garbe2007-01-191-2/+2
|
* replaced XSetBorder.../focus()Anselm R. Garbe2007-01-191-1/+1
|
* yet another multihead fix by Christof MusikAnselm R. Garbe2007-01-191-0/+2
|
* applied a modified version of Christof Musik's multihead patch (though this ↵Anselm R. Garbe2007-01-181-1/+4
| | | | is not sure if it works in all cases, have to wait for an ACK by Christof)
* Jukka, thanks for being faster than me!Anselm R. Garbe2007-01-151-1/+0
|
* removed drawclient and drawall (they performed useless operations/consumed ↵Anselm R. Garbe2007-01-151-5/+3
| | | | useless cpu cycles)
* removed client title barAnselm R. Garbe2007-01-141-5/+2
|
* added comment to %u in config.default.h, added Button{4.5} support on mode labelAnselm R. Garbe2007-01-101-2/+14
|
* renamed drawtitle into drawclientAnselm R. Garbe2007-01-041-2/+2
|
* correctionsarg@mig292007-01-021-1/+1
|
* next version will contain updated copyright noticearg@mig292007-01-021-1/+1
|
* renamed updatesize into updatesizehints (thx to Sander for this hint)arg@mig292007-01-011-1/+1
|
* removed gravitate for the momentarg@mig292006-12-111-2/+0
|
* applied Alex Elide's tricky patch, thanks!arg@mig292006-11-271-1/+0
|
* returning to old Key structarg@mig292006-11-271-5/+4
|
* changing Key.func into Key.func[NFUNCS], this allows sequences execution of ↵arg@mig292006-11-271-4/+5
| | | | functions per keypress (avoids implementing useless masterfunctions which call atomic ones)
* applied Jukka's sizeof K&R compliance patch, applied Manuels' last-line ↵arg@mig292006-11-261-2/+2
| | | | printage proposal for stdin reading.
* applied Gottox' windowarea patcharg@mig292006-11-161-8/+8
|
* make sure that changing sx has no impact on snapping 2.0arg@mig292006-10-311-1/+1
|
* fixed stupid bug of snap-to-screenarg@mig292006-10-301-4/+4
|
* changing snap priorityarg@mig292006-10-301-3/+3
|
* removed useless abs() callsarg@mig292006-10-301-2/+2
|
* added screen-border snapping in floating mode, feels quite wellarg@mig292006-10-301-0/+8
|
* and another fixarg@mig292006-10-271-1/+2
|
"> if (!issel) return; Client *old = sel; sel = c; if(old && old != c) drawtitle(old); drawtitle(c); XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); } void focusnext(Arg *arg) { Client *c; if(!sel) return; if(sel->ismax) togglemax(NULL); if(!(c = getnext(sel->next))) c = getnext(clients); if(c) { focus(c); restack(); } } void focusprev(Arg *arg) { Client *c; if(!sel) return; if(sel->ismax) togglemax(NULL); if(!(c = getprev(sel->prev))) { for(c = clients; c && c->next; c = c->next); c = getprev(c); } if(c) { focus(c); restack(); } } Client * getclient(Window w) { Client *c; for(c = clients; c; c = c->next) if(c->win == w) return c; return NULL; } Client * getctitle(Window w) { Client *c; for(c = clients; c; c = c->next) if(c->title == w) return c; return NULL; } void gravitate(Client *c, Bool invert) { int dx = 0, dy = 0; switch(c->grav) { default: break; case StaticGravity: case NorthWestGravity: case NorthGravity: case NorthEastGravity: dy = c->border; break; case EastGravity: case CenterGravity: case WestGravity: dy = -(c->h / 2) + c->border; break; case SouthEastGravity: case SouthGravity: case SouthWestGravity: dy = -(c->h); break; } switch (c->grav) { default: break; case StaticGravity: case NorthWestGravity: case WestGravity: case SouthWestGravity: dx = c->border; break; case NorthGravity: case CenterGravity: case SouthGravity: dx = -(c->w / 2) + c->border; break; case NorthEastGravity: case EastGravity: case SouthEastGravity: dx = -(c->w + c->border); break; } if(invert) { dx = -dx; dy = -dy; } c->x += dx; c->y += dy; } void killclient(Arg *arg) { if(!sel) return; if(sel->proto & PROTODELWIN) sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]); else XKillClient(dpy, sel->win); } void manage(Window w, XWindowAttributes *wa) { Client *c; Window trans; XSetWindowAttributes twa; c = emallocz(sizeof(Client)); c->tags = emallocz(ntags * sizeof(Bool)); c->win = w; c->x = c->tx = wa->x; c->y = c->ty = wa->y; c->w = c->tw = wa->width; c->h = wa->height; c->th = bh; c->border = 0; setsize(c); if(c->h != sh && c->y < bh) c->y = c->ty = bh; c->proto = getproto(c->win); XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | EnterWindowMask); XGetTransientForHint(dpy, c->win, &trans); twa.override_redirect = 1; twa.background_pixmap = ParentRelative; twa.event_mask = ExposureMask | EnterWindowMask; c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, 0, DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); if(clients) clients->prev = c; c->next = clients; clients = c; XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button1, MODKEY | NUMLOCKMASK, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button1, MODKEY | NUMLOCKMASK | LockMask, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button2, MODKEY, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button2, MODKEY | LockMask, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button2, MODKEY | NUMLOCKMASK, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button2, MODKEY | NUMLOCKMASK | LockMask, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button3, MODKEY, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button3, MODKEY | LockMask, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button3, MODKEY | NUMLOCKMASK, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(dpy, Button3, MODKEY | NUMLOCKMASK | LockMask, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); settags(c); if(!c->isfloat) c->isfloat = trans || (c->maxw && c->minw && c->maxw == c->minw && c->maxh == c->minh); settitle(c); XMapWindow(dpy, c->win); XMapWindow(dpy, c->title); if(isvisible(c)) focus(c); arrange(NULL); } void resize(Client *c, Bool sizehints, Corner sticky) { int bottom = c->y + c->h; int right = c->x + c->w; /*XConfigureEvent e;*/ XWindowChanges wc; if(sizehints) { if(c->incw) c->w -= (c->w - c->basew) % c->incw; if(c->inch) c->h -= (c->h - c->baseh) % c->inch; if(c->minw && c->w < c->minw) c->w = c->minw; if(c->minh && c->h < c->minh) c->h = c->minh; if(c->maxw && c->w > c->maxw) c->w = c->maxw; if(c->maxh && c->h > c->maxh) c->h = c->maxh; } if(c->x > right) /* might happen on restart */ c->x = right - c->w; if(c->y > bottom) c->y = bottom - c->h; if(sticky == TopRight || sticky == BotRight) c->x = right - c->w; if(sticky == BotLeft || sticky == BotRight) c->y = bottom - c->h; resizetitle(c); wc.x = c->x; wc.y = c->y; wc.width = c->w; wc.height = c->h; if(c->w == sw && c->h == sh) wc.border_width = 0; else wc.border_width = 1; XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); XSync(dpy, False); } void setsize(Client *c) { long msize; XSizeHints size; if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags) size.flags = PSize; c->flags = size.flags; if(c->flags & PBaseSize) { c->basew = size.base_width; c->baseh = size.base_height; } else c->basew = c->baseh = 0; if(c->flags & PResizeInc) { c->incw = size.width_inc; c->inch = size.height_inc; } else c->incw = c->inch = 0; if(c->flags & PMaxSize) { c->maxw = size.max_width; c->maxh = size.max_height; } else c->maxw = c->maxh = 0; if(c->flags & PMinSize) { c->minw = size.min_width; c->minh = size.min_height; } else c->minw = c->minh = 0; if(c->flags & PWinGravity) c->grav = size.win_gravity; else c->grav = NorthWestGravity; } void settitle(Client *c) { char **list = NULL; int n; XTextProperty name; name.nitems = 0; c->name[0] = 0; XGetTextProperty(dpy, c->win, &name, netatom[NetWMName]); if(!name.nitems) XGetWMName(dpy, c->win, &name); if(!name.nitems) return; if(name.encoding == XA_STRING) strncpy(c->name, (char *)name.value, sizeof(c->name)); else { if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) { strncpy(c->name, *list, sizeof(c->name)); XFreeStringList(list); } } XFree(name.value); resizetitle(c); } void togglemax(Arg *arg) { int ox, oy, ow, oh; XEvent ev; if(!sel) return; if((sel->ismax = !sel->ismax)) { ox = sel->x; oy = sel->y; ow = sel->w; oh = sel->h; sel->x = sx; sel->y = sy + bh; sel->w = sw - 2; sel->h = sh - 2 - bh; restack(); resize(sel, arrange == dofloat, TopLeft); sel->x = ox; sel->y = oy; sel->w = ow; sel->h = oh; } else resize(sel, False, TopLeft); while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); } void unmanage(Client *c) { XGrabServer(dpy); XSetErrorHandler(xerrordummy); XUngrabButton(dpy, AnyButton, AnyModifier, c->win); XDestroyWindow(dpy, c->title); if(c->prev) c->prev->next = c->next; if(c->next) c->next->prev = c->prev; if(c == clients) clients = c->next; if(sel == c) sel = getnext(clients); free(c->tags); free(c); XSync(dpy, False); XSetErrorHandler(xerror); XUngrabServer(dpy); if(sel) focus(sel); arrange(NULL); } void zoom(Arg *arg) { Client *c; if(!sel || (arrange != dotile) || sel->isfloat || sel->ismax) return; if(sel == getnext(clients)) { if((c = getnext(sel->next))) sel = c; else return; } /* pop */ sel->prev->next = sel->next; if(sel->next) sel->next->prev = sel->prev; sel->prev = NULL; clients->prev = sel; sel->next = clients; clients = sel; focus(sel); arrange(NULL); }