Cosmetic
This commit is contained in:
parent
29da023ce4
commit
5c58e8ced4
32
src/barwin.c
32
src/barwin.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* bar.c
|
||||
* barwin.c
|
||||
* Copyright © 2008 Martin Duquesnoy <xorg62@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -50,17 +50,18 @@ barwin_create(Window parent,
|
||||
XSetWindowAttributes at;
|
||||
BarWindow *bw;
|
||||
|
||||
/* Allocate memory */
|
||||
bw = emalloc(1, sizeof(BarWindow));
|
||||
|
||||
/* Barwin attributes */
|
||||
at.override_redirect = True;
|
||||
at.background_pixmap = ParentRelative;
|
||||
at.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
|
||||
|ButtonMask|MouseMask
|
||||
|ExposureMask|VisibilityChangeMask
|
||||
|StructureNotifyMask|SubstructureRedirectMask;
|
||||
if(entermask)
|
||||
at.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
|
||||
ButtonPressMask | ExposureMask | EnterWindowMask |
|
||||
LeaveWindowMask | StructureNotifyMask;
|
||||
else
|
||||
at.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
|
||||
ButtonPressMask | ExposureMask | StructureNotifyMask;
|
||||
at.event_mask |= EnterWindowMask|LeaveWindowMask|FocusChangeMask;
|
||||
|
||||
/* Create window */
|
||||
bw->win = XCreateWindow(dpy, parent, x, y, w, h, 0, DefaultDepth(dpy, screen),
|
||||
@ -69,11 +70,12 @@ barwin_create(Window parent,
|
||||
bw->dr = XCreatePixmap(dpy, parent, w, h, DefaultDepth(dpy, screen));
|
||||
|
||||
/* His border */
|
||||
CWIN(bw->border.left, bw->win, 0, 0, SHADH, h, 0, CWBackPixel, color_enlight(color), &at);
|
||||
CWIN(bw->border.top, bw->win, 0, 0, w, SHADH, 0, CWBackPixel, color_enlight(color), &at);
|
||||
CWIN(bw->border.left, bw->win, 0, 0, SHADH, h, 0, CWBackPixel, color_enlight(color), &at);
|
||||
CWIN(bw->border.top, bw->win, 0, 0, w, SHADH, 0, CWBackPixel, color_enlight(color), &at);
|
||||
CWIN(bw->border.bottom, bw->win, 0, h - SHADH, w, SHADH, 0, CWBackPixel, SHADC, &at);
|
||||
CWIN(bw->border.right, bw->win, w - SHADH, 0, SHADH, h, 0, CWBackPixel, SHADC, &at);
|
||||
CWIN(bw->border.right, bw->win, w - SHADH, 0, SHADH, h, 0, CWBackPixel, SHADC, &at);
|
||||
|
||||
/* Property */
|
||||
bw->geo.x = x;
|
||||
bw->geo.y = y;
|
||||
bw->geo.width = w;
|
||||
@ -96,7 +98,7 @@ barwin_delete(BarWindow *bw)
|
||||
XSelectInput(dpy, bw->win, NoEventMask);
|
||||
XDestroyWindow(dpy, bw->win);
|
||||
XFreePixmap(dpy, bw->dr);
|
||||
free(bw);
|
||||
efree(bw);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -228,10 +230,10 @@ barwin_refresh_color(BarWindow *bw)
|
||||
|
||||
draw_rectangle(bw->dr, 0, 0, bw->geo.width, bw->geo.height, bw->color);
|
||||
|
||||
XSetWindowBackground(dpy, bw->border.left , bw->border.light);
|
||||
XSetWindowBackground(dpy, bw->border.top , bw->border.light);
|
||||
XSetWindowBackground(dpy, bw->border.bottom , bw->border.dark);
|
||||
XSetWindowBackground(dpy, bw->border.right , bw->border.dark);
|
||||
XSetWindowBackground(dpy, bw->border.left, bw->border.light);
|
||||
XSetWindowBackground(dpy, bw->border.top, bw->border.light);
|
||||
XSetWindowBackground(dpy, bw->border.bottom, bw->border.dark);
|
||||
XSetWindowBackground(dpy, bw->border.right, bw->border.dark);
|
||||
|
||||
XClearWindow(dpy, bw->border.left);
|
||||
XClearWindow(dpy, bw->border.top);
|
||||
|
||||
20
src/client.c
20
src/client.c
@ -292,16 +292,16 @@ client_kill(Client *c)
|
||||
XFree(atom);
|
||||
if(canbedel)
|
||||
{
|
||||
ev.type = ClientMessage;
|
||||
ev.xclient.window = c->win;
|
||||
ev.xclient.message_type = wm_atom[WMProtocols];
|
||||
ev.xclient.format = 32;
|
||||
ev.xclient.data.l[0] = wm_atom[WMDelete];
|
||||
ev.xclient.data.l[1] = CurrentTime;
|
||||
ev.xclient.data.l[2] = 0;
|
||||
ev.xclient.data.l[3] = 0;
|
||||
ev.xclient.data.l[4] = 0;
|
||||
XSendEvent(dpy, c->win, False, NoEventMask, &ev);
|
||||
ev.type = ClientMessage;
|
||||
ev.xclient.window = c->win;
|
||||
ev.xclient.message_type = wm_atom[WMProtocols];
|
||||
ev.xclient.format = 32;
|
||||
ev.xclient.data.l[0] = wm_atom[WMDelete];
|
||||
ev.xclient.data.l[1] = CurrentTime;
|
||||
ev.xclient.data.l[2] = 0;
|
||||
ev.xclient.data.l[3] = 0;
|
||||
ev.xclient.data.l[4] = 0;
|
||||
XSendEvent(dpy, c->win, False, NoEventMask, &ev);
|
||||
}
|
||||
else
|
||||
XKillClient(dpy, c->win);
|
||||
|
||||
39
src/event.c
39
src/event.c
@ -241,13 +241,16 @@ grabkeys(void)
|
||||
{
|
||||
uint i, j;
|
||||
KeyCode code;
|
||||
uint ml[] = {LockMask,
|
||||
numlockmask,
|
||||
scrolllockmask,
|
||||
numlockmask|scrolllockmask,
|
||||
LockMask|scrolllockmask,
|
||||
LockMask|numlockmask,
|
||||
LockMask|numlockmask|scrolllockmask};
|
||||
uint ml[] =
|
||||
{
|
||||
LockMask,
|
||||
numlockmask,
|
||||
scrolllockmask,
|
||||
numlockmask|scrolllockmask,
|
||||
LockMask|scrolllockmask,
|
||||
LockMask|numlockmask,
|
||||
LockMask|numlockmask|scrolllockmask
|
||||
};
|
||||
|
||||
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
||||
for(i = 0; i < conf.nkeybind; ++i)
|
||||
@ -373,17 +376,17 @@ getevent(XEvent ev)
|
||||
|
||||
switch (ev.type)
|
||||
{
|
||||
case ButtonPress: buttonpress(&ev.xbutton); break;
|
||||
case ConfigureRequest: configureevent(&ev); break;
|
||||
case DestroyNotify: destroynotify(&ev.xdestroywindow); break;
|
||||
case EnterNotify: enternotify(&ev.xcrossing); break;
|
||||
case Expose: expose(&ev.xexpose); break;
|
||||
case FocusIn: focusin(&ev.xfocus); break;
|
||||
case KeyPress: keypress(&ev.xkey); break;
|
||||
case MapRequest: maprequest(&ev.xmaprequest); break;
|
||||
case MappingNotify: mappingnotify(&ev.xmapping); break;
|
||||
case PropertyNotify: propertynotify(&ev.xproperty); break;
|
||||
case UnmapNotify: unmapnotify(&ev.xunmap); break;
|
||||
case ButtonPress: buttonpress(&ev.xbutton); break;
|
||||
case ConfigureRequest: configureevent(&ev); break;
|
||||
case DestroyNotify: destroynotify(&ev.xdestroywindow); break;
|
||||
case EnterNotify: enternotify(&ev.xcrossing); break;
|
||||
case Expose: expose(&ev.xexpose); break;
|
||||
case FocusIn: focusin(&ev.xfocus); break;
|
||||
case KeyPress: keypress(&ev.xkey); break;
|
||||
case MapRequest: maprequest(&ev.xmaprequest); break;
|
||||
case MappingNotify: mappingnotify(&ev.xmapping); break;
|
||||
case PropertyNotify: propertynotify(&ev.xproperty); break;
|
||||
case UnmapNotify: unmapnotify(&ev.xunmap); break;
|
||||
}
|
||||
|
||||
wait(&st);
|
||||
|
||||
32
src/frame.c
32
src/frame.c
@ -51,12 +51,12 @@ frame_create(Client *c)
|
||||
|KeyMask|ButtonMask|MouseMask;
|
||||
|
||||
/* Set property */
|
||||
c->frame_geo.x = c->geo.x - BORDH;
|
||||
c->frame_geo.y = c->geo.y - TBARH;
|
||||
c->frame_geo.width = FRAMEW(c->geo.width);
|
||||
c->frame_geo.height = FRAMEH(c->geo.height);
|
||||
c->colors.frame = conf.client.bordernormal;
|
||||
c->colors.resizecorner = conf.client.resizecorner_normal;
|
||||
c->frame_geo.x = c->geo.x - BORDH;
|
||||
c->frame_geo.y = c->geo.y - TBARH;
|
||||
c->frame_geo.width = FRAMEW(c->geo.width);
|
||||
c->frame_geo.height = FRAMEH(c->geo.height);
|
||||
c->colors.frame = conf.client.bordernormal;
|
||||
c->colors.resizecorner = conf.client.resizecorner_normal;
|
||||
|
||||
/* Create frame window */
|
||||
CWIN(c->frame, root,
|
||||
@ -84,14 +84,10 @@ frame_create(Client *c)
|
||||
c->colors.resizecorner, &at);
|
||||
|
||||
/* Border (for shadow) */
|
||||
CWIN(c->left, c->frame, 0, 0, SHADH, c->frame_geo.height, 0,
|
||||
CWBackPixel, color_enlight(c->colors.frame), &at);
|
||||
CWIN(c->top, c->frame, 0, 0, c->frame_geo.width, SHADH, 0,
|
||||
CWBackPixel, color_enlight(c->colors.frame), &at);
|
||||
CWIN(c->bottom, c->frame, 0, c->frame_geo.height - SHADH, c->frame_geo.width, SHADH, 0,
|
||||
CWBackPixel, SHADC, &at);
|
||||
CWIN(c->right, c->frame, c->frame_geo.width - SHADH, 0, SHADH, c->frame_geo.height, 0,
|
||||
CWBackPixel, SHADC, &at);
|
||||
CWIN(c->left, c->frame, 0, 0, SHADH, c->frame_geo.height, 0, CWBackPixel, color_enlight(c->colors.frame), &at);
|
||||
CWIN(c->top, c->frame, 0, 0, c->frame_geo.width, SHADH, 0, CWBackPixel, color_enlight(c->colors.frame), &at);
|
||||
CWIN(c->bottom, c->frame, 0, c->frame_geo.height - SHADH, c->frame_geo.width, SHADH, 0, CWBackPixel, SHADC, &at);
|
||||
CWIN(c->right, c->frame, c->frame_geo.width - SHADH, 0, SHADH, c->frame_geo.height, 0, CWBackPixel, SHADC, &at);
|
||||
|
||||
/* Reparent window with the frame */
|
||||
XReparentWindow(dpy, c->win, c->frame, BORDH, BORDH + TBARH);
|
||||
@ -167,11 +163,11 @@ frame_update(Client *c)
|
||||
barwin_refresh_color(c->titlebar);
|
||||
}
|
||||
|
||||
XSetWindowBackground(dpy, c->frame, c->colors.frame);
|
||||
XSetWindowBackground(dpy, c->frame, c->colors.frame);
|
||||
XSetWindowBackground(dpy, c->resize, c->colors.resizecorner);
|
||||
XSetWindowBackground(dpy, c->left, color_enlight(c->colors.frame));
|
||||
XSetWindowBackground(dpy, c->top, color_enlight(c->colors.frame));
|
||||
XSetWindowBackground(dpy, c->right, SHADC);
|
||||
XSetWindowBackground(dpy, c->left, color_enlight(c->colors.frame));
|
||||
XSetWindowBackground(dpy, c->top, color_enlight(c->colors.frame));
|
||||
XSetWindowBackground(dpy, c->right, SHADC);
|
||||
XSetWindowBackground(dpy, c->bottom, SHADC);
|
||||
|
||||
XClearWindow(dpy, c->resize);
|
||||
|
||||
@ -160,7 +160,7 @@ uicb_infobar_togglepos(uicb_t cmd)
|
||||
conf.bartop = !conf.bartop;
|
||||
|
||||
if(conf.bartop)
|
||||
sgeo.y = infobar->geo.height + TBARH;
|
||||
sgeo.y = infobar->geo.height + TBARH;
|
||||
else
|
||||
sgeo.y = TBARH;
|
||||
|
||||
|
||||
17
src/mouse.c
17
src/mouse.c
@ -187,13 +187,16 @@ mouse_grabbuttons(Client *c, Bool focused)
|
||||
int i, j;
|
||||
uint mod = conf.client.mod;
|
||||
uint bl[] = {Button1, Button2, Button3, Button4, Button5};
|
||||
uint ml[] = {mod, mod|LockMask,
|
||||
mod|numlockmask,
|
||||
mod|scrolllockmask,
|
||||
mod|numlockmask|scrolllockmask,
|
||||
mod|LockMask|scrolllockmask,
|
||||
mod|LockMask|numlockmask,
|
||||
mod|LockMask|numlockmask|scrolllockmask};
|
||||
uint ml[] =
|
||||
{
|
||||
mod, mod|LockMask,
|
||||
mod|numlockmask,
|
||||
mod|scrolllockmask,
|
||||
mod|numlockmask|scrolllockmask,
|
||||
mod|LockMask|scrolllockmask,
|
||||
mod|LockMask|numlockmask,
|
||||
mod|LockMask|numlockmask|scrolllockmask
|
||||
};
|
||||
|
||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user