frame: Remove buttons stuff and add border "shadow" but no color defined for now.
This commit is contained in:
parent
5ba931d1d6
commit
b28327f7af
15
src/client.c
15
src/client.c
@ -240,21 +240,6 @@ client_focus(Client *c)
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/** Get a client->button[button_number] with a window
|
||||
* \param b Button type
|
||||
* \param w Window
|
||||
* \return The client
|
||||
*/
|
||||
Client* client_gb_button(ButtonType b, Window w)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
for(c = clients; c && c->button[b] != w; c = c->next);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/** Get a client name
|
||||
|
||||
@ -378,7 +378,8 @@ init_conf(void)
|
||||
}
|
||||
|
||||
/* client */
|
||||
conf.client.borderheight = cfg_getint(cfg_client, "border_height");
|
||||
conf.client.borderheight = (cfg_getint(cfg_client, "border_height"))
|
||||
? cfg_getint(cfg_client, "border_height") : 1;
|
||||
conf.client.bordernormal = getcolor(var_to_str(cfg_getstr(cfg_client, "border_normal")));
|
||||
conf.client.borderfocus = getcolor(var_to_str(cfg_getstr(cfg_client, "border_focus")));
|
||||
conf.client.resizecorner_normal = getcolor(var_to_str(cfg_getstr(cfg_client, "resize_corner_normal")));
|
||||
|
||||
77
src/frame.c
77
src/frame.c
@ -40,15 +40,16 @@ void
|
||||
frame_create(Client *c)
|
||||
{
|
||||
XSetWindowAttributes at;
|
||||
int i;
|
||||
|
||||
at.background_pixel = conf.client.bordernormal;
|
||||
at.background_pixmap = ParentRelative;
|
||||
at.override_redirect = True;
|
||||
at.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|ExposureMask|
|
||||
VisibilityChangeMask|EnterWindowMask|FocusChangeMask|KeyMask|ButtonMask|MouseMask;
|
||||
at.event_mask = SubstructureRedirectMask|SubstructureNotifyMask
|
||||
|ExposureMask|VisibilityChangeMask
|
||||
|EnterWindowMask|LeaveWindowMask|FocusChangeMask
|
||||
|KeyMask|ButtonMask|MouseMask;
|
||||
|
||||
/* Set size */
|
||||
/* 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);
|
||||
@ -66,34 +67,31 @@ frame_create(Client *c)
|
||||
|
||||
/* Create titlebar window */
|
||||
if(TBARH)
|
||||
{
|
||||
CWIN(c->titlebar, c->frame, 0, 0,
|
||||
c->frame_geo.width,
|
||||
TBARH + BORDH,
|
||||
0, CWEventMask|CWBackPixel,
|
||||
(TBARH - SHADH*2) + BORDH,
|
||||
1, CWEventMask|CWBackPixel,
|
||||
c->colors.frame, &at);
|
||||
|
||||
XSetWindowBorder(dpy, c->titlebar, 0x212121);
|
||||
}
|
||||
/* Titlebar buttons */
|
||||
at.event_mask &= ~EnterWindowMask; /* <- Delete the EnterWindow mask */
|
||||
if(CTBAR)
|
||||
for(i = 0; i < LastButton; ++i)
|
||||
{
|
||||
CWIN(c->button[i], c->frame,
|
||||
BUTX(i), 2,
|
||||
BUTHW, BUTHW,
|
||||
1, CWEventMask|CWBackPixel,
|
||||
c->colors.frame, &at);
|
||||
XSetWindowBorder(dpy, c->button[i], getcolor(conf.titlebar.fg));
|
||||
}
|
||||
at.event_mask &= ~(EnterWindowMask | LeaveWindowMask); /* <- Delete useless mask */
|
||||
|
||||
/* Create resize area */
|
||||
at.cursor = cursor[CurResize];
|
||||
if(BORDH)
|
||||
CWIN(c->resize, c->frame,
|
||||
c->frame_geo.width - RESHW,
|
||||
c->frame_geo.height - RESHW,
|
||||
RESHW,
|
||||
RESHW, 0,
|
||||
CWEventMask|CWBackPixel|CWCursor, c->colors.resizecorner, &at);
|
||||
CWIN(c->resize, c->frame,
|
||||
c->frame_geo.width - RESHW,
|
||||
c->frame_geo.height - RESHW,
|
||||
RESHW,
|
||||
RESHW, 0,
|
||||
CWEventMask|CWBackPixel|CWCursor, c->colors.resizecorner, &at);
|
||||
|
||||
/* Border (for shadow) */
|
||||
CWIN(c->left, c->frame, 0, 0, SHADH, c->frame_geo.height, 0, CWBackPixel, 0x585858, &at);
|
||||
CWIN(c->top, c->frame, 0, 0, c->frame_geo.width, SHADH, 0, CWBackPixel, 0x585858, &at);
|
||||
CWIN(c->bottom, c->frame, 0, c->frame_geo.height, c->frame_geo.width, SHADH, 0, CWBackPixel, 0x212121, &at);
|
||||
CWIN(c->right, c->frame, c->frame_geo.width - SHADH, 0, SHADH, c->frame_geo.height, 0, CWBackPixel, 0x212121, &at);
|
||||
|
||||
/* Reparent window with the frame */
|
||||
XReparentWindow(dpy, c->win, c->frame, BORDH, BORDH + TBARH);
|
||||
@ -118,13 +116,19 @@ frame_moveresize(Client *c, XRectangle geo)
|
||||
c->frame_geo.y,
|
||||
c->frame_geo.width,
|
||||
c->frame_geo.height);
|
||||
|
||||
/* Titlebar */
|
||||
if(TBARH)
|
||||
XResizeWindow(dpy, c->titlebar, c->frame_geo.width, TBARH + BORDH);
|
||||
XResizeWindow(dpy, c->titlebar, c->frame_geo.width, (TBARH - SHADH*2) + BORDH);
|
||||
|
||||
/* Resize area */
|
||||
if(BORDH)
|
||||
XMoveWindow(dpy, c->resize, c->frame_geo.width - RESHW, c->frame_geo.height - RESHW);
|
||||
XMoveWindow(dpy, c->resize, c->frame_geo.width - RESHW, c->frame_geo.height - RESHW);
|
||||
|
||||
/* Border */
|
||||
XResizeWindow(dpy, c->left, SHADH, c->frame_geo.height - SHADH);
|
||||
XResizeWindow(dpy, c->top, c->frame_geo.width, SHADH);
|
||||
XMoveResizeWindow(dpy, c->bottom, 0, c->frame_geo.height - SHADH, c->frame_geo.width, SHADH);
|
||||
XMoveResizeWindow(dpy, c->right, c->frame_geo.width - SHADH, 0, SHADH, c->frame_geo.height);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -135,19 +139,6 @@ frame_moveresize(Client *c, XRectangle geo)
|
||||
void
|
||||
frame_update(Client *c)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(CTBAR)
|
||||
for(i = 0; i < LastButton; ++i)
|
||||
{
|
||||
XSetWindowBackground(dpy, c->button[i], c->colors.frame);
|
||||
XClearWindow(dpy, c->button[i]);
|
||||
}
|
||||
if(BORDH)
|
||||
{
|
||||
XSetWindowBackground(dpy, c->resize, c->colors.resizecorner);
|
||||
XClearWindow(dpy, c->resize);
|
||||
}
|
||||
if(TBARH)
|
||||
{
|
||||
XSetWindowBackground(dpy, c->titlebar, c->colors.frame);
|
||||
@ -155,12 +146,14 @@ frame_update(Client *c)
|
||||
}
|
||||
|
||||
XSetWindowBackground(dpy, c->frame, c->colors.frame);
|
||||
XSetWindowBackground(dpy, c->resize, c->colors.resizecorner);
|
||||
XClearWindow(dpy, c->resize);
|
||||
XClearWindow(dpy, c->frame);
|
||||
|
||||
if((TBARH + BORDH + 1) > font->height)
|
||||
draw_text(c->titlebar,
|
||||
(c->frame_geo.width / 2) - (textw(c->title) / 2),
|
||||
(font->height - (font->descent )) + (((TBARH + BORDH) - font->height) / 2),
|
||||
(font->height - (font->descent)) + (((TBARH + BORDH) - font->height) / 2),
|
||||
conf.titlebar.fg, c->colors.frame, 0, c->title);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -86,9 +86,8 @@ struct Client
|
||||
int minax, maxax, minay, maxay;
|
||||
/* Client composant */
|
||||
Window win;
|
||||
Window frame;
|
||||
Window resize, titlebar;
|
||||
Window button[LastButton];
|
||||
Window frame, resize, titlebar;
|
||||
Window right, left, top, bottom;
|
||||
struct
|
||||
{
|
||||
uint frame;
|
||||
|
||||
@ -67,6 +67,7 @@
|
||||
#define MAXH DisplayHeight(dpy, screen)
|
||||
#define MAXW DisplayWidth(dpy, screen)
|
||||
|
||||
#define SHADH 1
|
||||
#define BORDH conf.client.borderheight
|
||||
#define TBARH conf.titlebar.height
|
||||
#define FRAMEW(w) w + BORDH * 2
|
||||
@ -117,7 +118,6 @@ Client* client_gb_win(Window w);
|
||||
Client* client_gb_frame(Window w);
|
||||
Client* client_gb_titlebar(Window w);
|
||||
Client* client_gb_resize(Window w);
|
||||
Client* client_gb_button(ButtonType b, Window w);
|
||||
/* }}} */
|
||||
void client_get_name(Client *c);
|
||||
void client_hide(Client *c);
|
||||
|
||||
4
wmfsrc
4
wmfsrc
@ -70,9 +70,9 @@ client
|
||||
border_normal = "#191919"
|
||||
border_focus = "#003366"
|
||||
resize_corner_normal = "#191919"
|
||||
resize_corner_focus = "#771103"
|
||||
modifier = "Alt"
|
||||
resize_corner_focus = "#003366"
|
||||
|
||||
modifier = "Alt"
|
||||
mouse { button = "1" func = "client_raise" }
|
||||
mouse { button = "1" func = "mouse_move" }
|
||||
mouse { button = "2" func = "tile_switch" }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user