Merge branch 'master' of github.com:xorg62/wmfs into bacardi55

This commit is contained in:
Raphael Khaiat 2011-02-23 23:19:40 +01:00
commit 34f2cb5b03
21 changed files with 1016 additions and 836 deletions

View File

@ -27,12 +27,13 @@ src/systray.c \
src/tag.c \
src/util.c \
src/viwmfs.c \
src/color.c \
src/wmfs.c
# flags
CFLAGS+= -DXDG_CONFIG_DIR=\"${XDG_CONFIG_DIR}\"
CFLAGS+= -DWMFS_VERSION=\"${VERSION}\"
CFLAGS+= -W -Wall -Wextra
CFLAGS+= -Wall -Wextra
OBJS= ${SRCS:.c=.o}

View File

@ -81,11 +81,13 @@ barwin_create(Window parent,
if(border)
{
bw->bord = True;
bw->border.light = color_shade(bg, conf.colors.bar_light_shade);
bw->border.dark = color_shade(bg, conf.colors.bar_dark_shade);
CWIN(bw->border.left, bw->win, 0, 0, SHADH, h, 0, CWBackPixel, color_enlight(bg), &at);
CWIN(bw->border.top, bw->win, 0, 0, w, SHADH, 0, CWBackPixel, color_enlight(bg), &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.left, bw->win, 0, 0, SHADH, h, 0, CWBackPixel, bg, &at);
CWIN(bw->border.top, bw->win, 0, 0, w, SHADH, 0, CWBackPixel, bg, &at);
CWIN(bw->border.bottom, bw->win, 0, h - SHADH, w, SHADH, 0, CWBackPixel, bg, &at);
CWIN(bw->border.right, bw->win, w - SHADH, 0, SHADH, h, 0, CWBackPixel, bg, &at);
}
/* Property */
@ -95,8 +97,6 @@ barwin_create(Window parent,
bw->geo.height = h;
bw->bg = bg;
bw->fg = fg;
bw->border.light = color_enlight(bg);
bw->border.dark = SHADC;
bw->stipple = stipple;
bw->stipple_color = -1;
@ -143,6 +143,23 @@ barwin_draw_image_ofset_text(BarWindow *bw, int x, int y, char *text, int x_imag
return;
}
void
barwin_color_set(BarWindow *bw, uint bg, char *fg)
{
CHECK(bw);
bw->bg = bg;
bw->fg = fg;
if(bw->bord)
{
bw->border.light = color_shade(bg, conf.colors.bar_light_shade);
bw->border.dark = color_shade(bg, conf.colors.bar_dark_shade);
}
return;
}
/** Delete a BarWindow
* \param bw BarWindow pointer
*/

View File

@ -88,7 +88,7 @@ client_detach(Client *c)
/** Get the next client
*\return The next client or NULL
*/
Client*
static Client*
client_get_next(void)
{
Client *c = NULL;
@ -109,7 +109,7 @@ client_get_next(void)
/** Get the previous client
*\return The previous client or NULL
*/
Client*
static Client*
client_get_prev(void)
{
Client *c = NULL, *d;
@ -135,7 +135,7 @@ client_get_prev(void)
*\param pos Position (Left/Right/Top/Bottom
*\return Client found
*/
Client*
static Client*
client_get_next_with_direction(Position pos)
{
Client *c = NULL;
@ -322,7 +322,7 @@ uicb_client_focus_bottom(uicb_t cmd)
/** Set the client c above
*\param c Client pointer
*/
void
static void
client_above(Client *c)
{
XRectangle geo;
@ -360,19 +360,13 @@ client_focus(Client *c)
if(sel && sel != c)
{
sel->colors.frame = conf.client.bordernormal;
sel->colors.fg = conf.titlebar.fg_normal;
sel->colors.resizecorner = conf.client.resizecorner_normal;
if(TBARH - BORDH && sel->titlebar->stipple)
sel->titlebar->stipple_color = conf.titlebar.stipple.colors.normal;
if(sel->flags & AboveFlag)
sel->flags &= ~AboveFlag;
XChangeProperty(dpy, sel->frame, net_atom[net_wm_window_opacity], XA_CARDINAL,
32, PropModeReplace, (uchar *)&conf.opacity, 1);
frame_update_color(sel, True);
frame_update(sel);
mouse_grabbuttons(sel, !conf.focus_pclick);
@ -380,10 +374,6 @@ client_focus(Client *c)
if((sel = c))
{
c->colors.frame = conf.client.borderfocus;
c->colors.fg = conf.titlebar.fg_focus;
c->colors.resizecorner = conf.client.resizecorner_focus;
/* Set focusontag option */
for(cc = clients; cc; cc = cc->next)
if(cc->focusontag == (int)c->tag)
@ -391,11 +381,9 @@ client_focus(Client *c)
c->focusontag = seltag[selscreen];
if(TBARH - BORDH && c->titlebar->stipple)
c->titlebar->stipple_color = conf.titlebar.stipple.colors.focus;
XDeleteProperty(dpy, c->frame, net_atom[net_wm_window_opacity]);
frame_update_color(c, False);
frame_update(c);
mouse_grabbuttons(c, True);
@ -676,6 +664,143 @@ client_map(Client *c)
return;
}
/** Set the wanted tag or autofree/max of a client
*\param c Client pointer
*/
static void
client_set_rules(Client *c)
{
XClassHint xch;
int i, j, k, f;
Atom rf;
ulong n, il;
uchar *data = NULL;
char wwrole[256] = { 0 };
Bool applied_tag_rule = False;
Bool applied_screen_rule = False;
memset(&xch, 0, sizeof(xch));
if(conf.ignore_next_client_rules)
{
conf.ignore_next_client_rules = False;
return;
}
/* Get WM_CLASS */
XGetClassHint(dpy, c->win, &xch);
/* Get WM_WINDOW_ROLE */
if(XGetWindowProperty(dpy, c->win, ATOM("WM_WINDOW_ROLE"), 0L, 0x7FFFFFFFL, False,
XA_STRING, &rf, &f, &n, &il, &data) == Success && data)
{
strncpy(wwrole, (char*)data, sizeof(wwrole));
XFree(data);
}
/* Following features is *DEPRECATED*, will be removed in some revision. {{{ */
/* Auto free */
if(conf.client.autofree && ((xch.res_name && strstr(conf.client.autofree, xch.res_name))
|| (xch.res_class && strstr(conf.client.autofree, xch.res_class))))
c->flags |= FreeFlag;
/* Auto maximize */
if(conf.client.automax && ((xch.res_name && strstr(conf.client.automax, xch.res_name))
|| (xch.res_class && strstr(conf.client.automax, xch.res_class))))
{
client_maximize(c);
c->flags |= MaxFlag;
}
/* Wanted tag */
for(i = 0; i < screen_count(); ++i)
for(j = 1; j < conf.ntag[i] + 1; ++j)
if(tags[i][j].clients)
for(k = 0; k < tags[i][j].nclients; ++k)
if((xch.res_name && strstr(xch.res_name, tags[i][j].clients[k]))
|| (xch.res_class && strstr(xch.res_class, tags[i][j].clients[k])))
{
c->screen = i;
c->tag = j;
if(c->tag != (uint)seltag[selscreen])
tags[c->screen][c->tag].request_update = True;
else
tags[c->screen][c->tag].layout.func(c->screen);
/* Deprecated but still in use */
applied_tag_rule = True;
applied_screen_rule = True;
}
/* }}} */
/* Apply Rule if class || instance || role match */
for(i = 0; i < conf.nrule; ++i)
{
if((xch.res_class && conf.rule[i].class && !strcmp(xch.res_class, conf.rule[i].class))
|| (xch.res_name && conf.rule[i].instance && !strcmp(xch.res_name, conf.rule[i].instance)))
{
if((strlen(wwrole) && conf.rule[i].role && !strcmp(wwrole, conf.rule[i].role)) || (!strlen(wwrole) || !conf.rule[i].role))
{
if(conf.rule[i].screen != -1)
c->screen = conf.rule[i].screen;
if(conf.rule[i].tag != -1)
{
c->tag = conf.rule[i].tag;
applied_tag_rule = True;
}
if(conf.rule[i].free)
c->flags |= FreeFlag;
if(conf.rule[i].ignoretags)
c->tag = MAXTAG + 1;
if(conf.rule[i].max)
{
client_maximize(c);
c->flags |= MaxFlag;
}
if(c->tag != (uint)seltag[selscreen])
{
tags[c->screen][c->tag].request_update = True;
client_focus(NULL);
}
if(!conf.rule[i].ignoretags)
tags[c->screen][c->tag].layout.func(c->screen);
if(conf.rule[i].follow_client)
seltag[c->screen] = c->tag;
}
}
}
if(!applied_tag_rule && conf.client.default_open_tag > 0
&& conf.client.default_open_tag < (uint)conf.ntag[selscreen])
{
c->tag = conf.client.default_open_tag;
client_focus_next(c);
tags[c->screen][c->tag].request_update = True;
}
if(!applied_screen_rule && conf.client.default_open_screen > -1
&& conf.client.default_open_screen < screen_count())
{
c->screen = conf.client.default_open_screen;
client_focus_next(c);
tags[c->screen][c->tag].request_update = True;
}
return;
}
/** Manage a client with a window and his attributes
* \param w Cient's futur Window
* \param wa XWindowAttributes pointer, Window w attributes
@ -1046,143 +1171,6 @@ client_swap(Client *c1, Client *c2)
return;
}
/** Set the wanted tag or autofree/max of a client
*\param c Client pointer
*/
void
client_set_rules(Client *c)
{
XClassHint xch;
int i, j, k, f;
Atom rf;
ulong n, il;
uchar *data = NULL;
char wwrole[256] = { 0 };
Bool applied_tag_rule = False;
Bool applied_screen_rule = False;
memset(&xch, 0, sizeof(xch));
if(conf.ignore_next_client_rules)
{
conf.ignore_next_client_rules = False;
return;
}
/* Get WM_CLASS */
XGetClassHint(dpy, c->win, &xch);
/* Get WM_WINDOW_ROLE */
if(XGetWindowProperty(dpy, c->win, ATOM("WM_WINDOW_ROLE"), 0L, 0x7FFFFFFFL, False,
XA_STRING, &rf, &f, &n, &il, &data) == Success && data)
{
strncpy(wwrole, (char*)data, sizeof(wwrole));
XFree(data);
}
/* Following features is *DEPRECATED*, will be removed in some revision. {{{ */
/* Auto free */
if(conf.client.autofree && ((xch.res_name && strstr(conf.client.autofree, xch.res_name))
|| (xch.res_class && strstr(conf.client.autofree, xch.res_class))))
c->flags |= FreeFlag;
/* Auto maximize */
if(conf.client.automax && ((xch.res_name && strstr(conf.client.automax, xch.res_name))
|| (xch.res_class && strstr(conf.client.automax, xch.res_class))))
{
client_maximize(c);
c->flags |= MaxFlag;
}
/* Wanted tag */
for(i = 0; i < screen_count(); ++i)
for(j = 1; j < conf.ntag[i] + 1; ++j)
if(tags[i][j].clients)
for(k = 0; k < tags[i][j].nclients; ++k)
if((xch.res_name && strstr(xch.res_name, tags[i][j].clients[k]))
|| (xch.res_class && strstr(xch.res_class, tags[i][j].clients[k])))
{
c->screen = i;
c->tag = j;
if(c->tag != (uint)seltag[selscreen])
tags[c->screen][c->tag].request_update = True;
else
tags[c->screen][c->tag].layout.func(c->screen);
/* Deprecated but still in use */
applied_tag_rule = True;
applied_screen_rule = True;
}
/* }}} */
/* Apply Rule if class || instance || role match */
for(i = 0; i < conf.nrule; ++i)
{
if((xch.res_class && conf.rule[i].class && !strcmp(xch.res_class, conf.rule[i].class))
|| (xch.res_name && conf.rule[i].instance && !strcmp(xch.res_name, conf.rule[i].instance)))
{
if((strlen(wwrole) && conf.rule[i].role && !strcmp(wwrole, conf.rule[i].role)) || (!strlen(wwrole) || !conf.rule[i].role))
{
if(conf.rule[i].screen != -1)
c->screen = conf.rule[i].screen;
if(conf.rule[i].tag != -1)
{
c->tag = conf.rule[i].tag;
applied_tag_rule = True;
}
if(conf.rule[i].free)
c->flags |= FreeFlag;
if(conf.rule[i].ignoretags)
c->tag = MAXTAG + 1;
if(conf.rule[i].max)
{
client_maximize(c);
c->flags |= MaxFlag;
}
if(c->tag != (uint)seltag[selscreen])
{
tags[c->screen][c->tag].request_update = True;
client_focus(NULL);
}
if(!conf.rule[i].ignoretags)
tags[c->screen][c->tag].layout.func(c->screen);
if(conf.rule[i].follow_client)
seltag[c->screen] = c->tag;
}
}
}
if(!applied_tag_rule && conf.client.default_open_tag > 0
&& conf.client.default_open_tag < (uint)conf.ntag[selscreen])
{
c->tag = conf.client.default_open_tag;
client_focus_next(c);
tags[c->screen][c->tag].request_update = True;
}
if(!applied_screen_rule && conf.client.default_open_screen > -1
&& conf.client.default_open_screen < screen_count())
{
c->screen = conf.client.default_open_screen;
client_focus_next(c);
tags[c->screen][c->tag].request_update = True;
}
return;
}
/** Update client attributes (_WMFS_TAG _WMFS_SCREEN)
*\param c Client pointer
*/
@ -1271,7 +1259,6 @@ client_focus_next(Client *c)
return;
}
/** Unmanage a client
* \param c Client pointer
*/
@ -1365,7 +1352,7 @@ client_unmap(Client *c)
*\param c Client pointer
*\param s Screen id
*/
void
static void
client_set_screen(Client *c, int s)
{
int os;
@ -1432,7 +1419,6 @@ uicb_client_screen_prev(uicb_t cmd)
return;
}
/** Move a client
*\param cmd uicb_t type
*/
@ -1503,6 +1489,39 @@ uicb_ignore_next_client_rules(uicb_t cmd)
return;
}
/** Select client
*\param cmd uicb_t type clientlist index
*/
static void
uicb_client_select(uicb_t cmd)
{
int i;
Window w;
int d, x, y;
for(i = 0; i < MAXCLIST && clist_index[i].client; ++i)
if(!strcmp(cmd, clist_index[i].key))
{
if(clist_index[i].client->screen != selscreen)
screen_set_sel(clist_index[i].client->screen);
if(clist_index[i].client->tag != (uint)seltag[clist_index[i].client->screen])
tag_set(clist_index[i].client->tag);
client_focus(clist_index[i].client);
client_raise(clist_index[i].client);
/* Move pointer on client */
XQueryPointer(dpy, ROOT, &w, &w, &x, &y, &d, &d, (uint *)&d);
XWarpPointer(dpy, ROOT, ROOT, x, y, d, d,
clist_index[i].client->geo.x + clist_index[i].client->geo.width / 2,
clist_index[i].client->geo.y + clist_index[i].client->geo.height / 2);
}
return;
}
/** Show clientlist menu
*\param cmd uicb_t type
*/
@ -1562,39 +1581,6 @@ uicb_clientlist(uicb_t cmd)
return;
}
/** Select client
*\param cmd uicb_t type clientlist index
*/
void
uicb_client_select(uicb_t cmd)
{
int i;
Window w;
int d, x, y;
for(i = 0; i < MAXCLIST && clist_index[i].client; ++i)
if(!strcmp(cmd, clist_index[i].key))
{
if(clist_index[i].client->screen != selscreen)
screen_set_sel(clist_index[i].client->screen);
if(clist_index[i].client->tag != (uint)seltag[clist_index[i].client->screen])
tag_set(clist_index[i].client->tag);
client_focus(clist_index[i].client);
client_raise(clist_index[i].client);
/* Move pointer on client */
XQueryPointer(dpy, ROOT, &w, &w, &x, &y, &d, &d, (uint *)&d);
XWarpPointer(dpy, ROOT, ROOT, x, y, d, d,
clist_index[i].client->geo.x + clist_index[i].client->geo.width / 2,
clist_index[i].client->geo.y + clist_index[i].client->geo.height / 2);
}
return;
}
/** Check clientlist menu fake function
* \param cmd uicb_t type unused
*/
@ -1622,4 +1608,3 @@ uicb_client_ignore_tag(uicb_t cmd)
return;
}

223
src/color.c Normal file
View File

@ -0,0 +1,223 @@
/*
* color.c
* Copyright © 2011 Brian Mock <mock.brian@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of the nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "wmfs.h"
/** Clamp a number x within the range [a, b].
* \param x the number which to clamp
* \param a the lowest possible value
* \param b the highest possible value
* \return the clamped number
*/
static double
color_clamp(double x, double a, double b)
{
if(x < a)
return a;
else if(x > b)
return b;
else
return x;
}
/** Pack a triplet of RGB values into a single uint
* \param r the red value
* \param g the green value
* \param b the blue value
* \return the packed RGB value
*/
static uint
color_pack_rgb(uint r, uint g, uint b)
{
return (r << 16) | (g << 8) | b;
}
/** Unpack an RGB uint into three separate values
* \param rgb the packed color
* \param r a pointer to a uint where the red value will be stored
* \param g a pointer to a uint where the green value will be stored
* \param b a pointer to a uint where the blue value will be stored
*/
static void
color_unpack_rgb(uint rgb, uint *r, uint *g, uint *b)
{
*r = (rgb >> 16) & 0xFF;
*g = (rgb >> 8) & 0xFF;
*b = rgb & 0xFF;
}
/** Convert unpacked RGB values into HSL, storing in the doubles referenced
* by the pointers h, s, l
*/
static void
color_rgb_to_hsl(uint xr, uint xg, uint xb, double *h, double *s, double *l)
{
double r = xr/255.0;
double g = xg/255.0;
double b = xb/255.0;
double v;
double m;
double vm;
double r2, g2, b2;
*h = 0;
*s = 0;
*l = 0;
/* v is max(r, g, b)
* m is min(r, g, b)
*/
v = r > g ? r : g;
v = v > b ? v : b;
m = r < g ? r : g;
m = m < b ? m : b;
*l = (m + v)/2.0;
if(*l <= 0.0)
return;
vm = v - m;
*s = vm;
if(*s > 0.0)
*s /= (*l <= 0.5) ? (v + m) : (2.0 - v - m);
else
return;
r2 = (v - r)/vm;
g2 = (v - g)/vm;
b2 = (v - b)/vm;
if(r == v)
*h = (g == m ? 5.0 + b2 : 1.0 - g2);
else if(g == v)
*h = (b == m ? 1.0 + r2 : 3.0 - b2);
else
*h = (r == m ? 3.0 + g2 : 5.0 - r2);
*h /= 6.0;
}
/** Convert h, s, l values to RGB and store them in the three uint
* referenced by the last three parameters.
*/
static void
color_hsl_to_rgb(double h, double sl, double l, uint *rx, uint *gx, uint *bx)
{
double v;
double r,g,b;
r = l;
g = l;
b = l;
v = (l <= 0.5) ? (l * (1.0 + sl)) : (l + sl - l * sl);
if(v > 0)
{
double m;
double sv;
int sextant;
double fract, vsf, mid1, mid2;
m = l + l - v;
sv = (v - m ) / v;
h *= 6.0;
sextant = (int) h;
fract = h - sextant;
vsf = v * sv * fract;
mid1 = m + vsf;
mid2 = v - vsf;
switch(sextant)
{
case 0:
r = v;
g = mid1;
b = m;
break;
case 1:
r = mid2;
g = v;
b = m;
break;
case 2:
r = m;
g = v;
b = mid1;
break;
case 3:
r = m;
g = mid2;
b = v;
break;
case 4:
r = mid1;
g = m;
b = v;
break;
case 5:
r = v;
g = m;
b = mid2;
break;
}
}
*rx = r * 255.0;
*gx = g * 255.0;
*bx = b * 255.0;
}
/** Shades a color by the amount. This works by converting a packed RGB
* color to HSL, adding the amount to the lightness,
* and then converting back to RGB. 1.0 is max lightness, 0.0 is min lightness.
* \param shadeVal the amount to shade the lightness by.
* \return the shaded color
*/
uint
color_shade(uint rgb, double shadeVal)
{
uint r, g, b;
double h, s, l;
color_unpack_rgb(rgb, &r, &g, &b);
color_rgb_to_hsl(r, g, b, &h, &s, &l);
l += shadeVal;
l = color_clamp(l, 0, 1);
color_hsl_to_rgb(h, s, l, &r, &g, &b);
rgb = color_pack_rgb(r, g, b);
return rgb;
}

View File

@ -100,7 +100,7 @@ const func_name_list_t func_list[] =
{NULL, NULL}
};
key_name_list_t key_list[] =
static key_name_list_t key_list[] =
{
{"Control", ControlMask },
{"Shift", ShiftMask },
@ -115,7 +115,7 @@ key_name_list_t key_list[] =
{NULL, NoSymbol }
};
name_to_uint_t mouse_button_list[] =
static name_to_uint_t mouse_button_list[] =
{
{"Button1", Button1 },
{"Button2", Button2 },
@ -203,6 +203,9 @@ conf_bar_section(void)
conf.colors.bar = getcolor((barbg = fetch_opt_first(bar, "#000000", "bg").str));
conf.colors.text = fetch_opt_first(bar, "#ffffff", "fg").str;
conf.colors.bar_light_shade = fetch_opt_first(bar, "0.25", "light_shade").fnum;
conf.colors.bar_dark_shade = fetch_opt_first(bar, "-0.25", "dark_shade").fnum;
mouse = fetch_section(bar, "mouse");
if ((conf.bars.nmouse = fetch_section_count(mouse)) > 0)
@ -301,6 +304,9 @@ conf_client_section(void)
conf.client.default_open_screen = fetch_opt_first(sec, "-1", "default_open_screen").num;
conf.client.new_client_get_mouse = fetch_opt_first(sec, "false", "new_client_get_mouse").bool;
conf.colors.client_light_shade = fetch_opt_first(sec, "0.25", "light_shade").fnum;
conf.colors.client_dark_shade = fetch_opt_first(sec, "-0.25", "dark_shade").fnum;
mouse = fetch_section(sec, "mouse");
if((conf.client.nmouse = fetch_section_count(mouse)) > 0)
@ -789,12 +795,12 @@ conf_keybind_section(void)
void
init_conf(void)
{
if (get_conf(conf.confpath) == -1)
if(get_conf(conf.confpath) == -1)
{
warnx("parsing configuration file (%s) failed.", conf.confpath);
sprintf(conf.confpath, "%s/wmfs/wmfsrc", XDG_CONFIG_DIR);
warnx("Use the default configuration (%s).", conf.confpath);
if (get_conf(conf.confpath) == -1)
if(get_conf(conf.confpath) == -1)
errx(1, "parsing configuration file (%s) failed.", conf.confpath);
}

View File

@ -32,6 +32,47 @@
#include "wmfs.h"
#ifdef HAVE_IMLIB
/** Draw an image in a drawable
* \param dr Drawable
* \param x X position
* \param y Y position
* \param name Path of the image
*/
static void draw_image(Drawable dr, int x, int y, int w, int h, char *name)
{
Imlib_Image image;
if(!name)
return;
imlib_set_cache_size(2048 * 1024);
imlib_context_set_display(dpy);
imlib_context_set_visual(DefaultVisual(dpy, DefaultScreen(dpy)));
imlib_context_set_colormap(DefaultColormap(dpy, DefaultScreen(dpy)));
imlib_context_set_drawable(dr);
image = imlib_load_image(patht(name));
imlib_context_set_image(image);
if(w <= 0)
w = imlib_image_get_width();
if(h <= 0)
h = imlib_image_get_height();
if(image)
{
imlib_render_image_on_drawable_at_size(x, y, w, h);
imlib_free_image();
}
else
warnx("Can't draw image: '%s'", name);
return;
}
#endif /* HAVE_IMLIB */
void
draw_text(Drawable d, int x, int y, char* fg, char *str)
{
@ -151,48 +192,6 @@ draw_graph(Drawable dr, int x, int y, uint w, uint h, uint color, char *data)
return;
}
#ifdef HAVE_IMLIB
/** Draw an image in a drawable
* \param dr Drawable
* \param x X position
* \param y Y position
* \param name Path of the image
*/
void
draw_image(Drawable dr, int x, int y, int w, int h, char *name)
{
Imlib_Image image;
if(!name)
return;
imlib_set_cache_size(2048 * 1024);
imlib_context_set_display(dpy);
imlib_context_set_visual(DefaultVisual(dpy, DefaultScreen(dpy)));
imlib_context_set_colormap(DefaultColormap(dpy, DefaultScreen(dpy)));
imlib_context_set_drawable(dr);
image = imlib_load_image(patht(name));
imlib_context_set_image(image);
if(w <= 0)
w = imlib_image_get_width();
if(h <= 0)
h = imlib_image_get_height();
if(image)
{
imlib_render_image_on_drawable_at_size(x, y, w, h);
imlib_free_image();
}
else
warnx("Can't draw image: '%s'", name);
return;
}
#endif /* HAVE_IMLIB */
/** Calculates the text's size relatively to the font
* \param text Text string
* \return final text width
@ -231,5 +230,3 @@ textw(char *text)
return gl.width + font->descent;
}

View File

@ -35,7 +35,7 @@
/** ButtonPress handle event
* \param ev XButtonEvent pointer
*/
void
static void
buttonpress(XButtonEvent *ev)
{
Client *c;
@ -162,7 +162,7 @@ buttonpress(XButtonEvent *ev)
/* ClientMessage handle event
*\param ev XClientMessageEvent pointer
*/
void
static void
clientmessageevent(XClientMessageEvent *ev)
{
Client *c;
@ -289,7 +289,7 @@ clientmessageevent(XClientMessageEvent *ev)
/** ConfigureRequesthandle events
* \param ev XConfigureRequestEvent pointer
*/
void
static void
configureevent(XConfigureRequestEvent *ev)
{
XWindowChanges wc;
@ -342,7 +342,7 @@ configureevent(XConfigureRequestEvent *ev)
/** DestroyNotify handle event
* \param ev XDestroyWindowEvent pointer
*/
void
static void
destroynotify(XDestroyWindowEvent *ev)
{
Client *c;
@ -366,7 +366,7 @@ destroynotify(XDestroyWindowEvent *ev)
/** EnterNotify handle event
* \param ev XCrossingEvent pointer
*/
void
static void
enternotify(XCrossingEvent *ev)
{
Client *c;
@ -399,7 +399,7 @@ enternotify(XCrossingEvent *ev)
/** ExposeEvent handle event
* \param ev XExposeEvent pointer
*/
void
static void
expose(XExposeEvent *ev)
{
Client *c;
@ -430,7 +430,7 @@ expose(XExposeEvent *ev)
* \param ev XFocusChangeEvent pointer
* \return
*/
void
static void
focusin(XFocusChangeEvent *ev)
{
if(sel && ev->window != sel->win)
@ -439,31 +439,10 @@ focusin(XFocusChangeEvent *ev)
return;
}
/** Key grabbing function
*/
void
grabkeys(void)
{
int i;
KeyCode code;
XUngrabKey(dpy, AnyKey, AnyModifier, ROOT);
for(i = 0; i < conf.nkeybind; ++i)
if((code = XKeysymToKeycode(dpy, keys[i].keysym)))
{
XGrabKey(dpy, code, keys[i].mod, ROOT, True, GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, keys[i].mod | LockMask, ROOT, True, GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, keys[i].mod | numlockmask, ROOT, True, GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, keys[i].mod | LockMask | numlockmask, ROOT, True, GrabModeAsync, GrabModeAsync);
}
return;
}
/** KeyPress handle event
* \param ev XKeyPressedEvent pointer
*/
void
static void
keypress(XKeyPressedEvent *ev)
{
int i;
@ -483,7 +462,7 @@ keypress(XKeyPressedEvent *ev)
/** MappingNotify handle event
* \param ev XMappingEvent pointer
*/
void
static void
mappingnotify(XMappingEvent *ev)
{
XRefreshKeyboardMapping(ev);
@ -497,7 +476,7 @@ mappingnotify(XMappingEvent *ev)
/** MapNotify handle event
* \param ev XMapEvent pointer
*/
void
static void
mapnotify(XMapEvent *ev)
{
Client *c;
@ -520,7 +499,7 @@ mapnotify(XMapEvent *ev)
/** MapRequest handle event
* \param ev XMapRequestEvent pointer
*/
void
static void
maprequest(XMapRequestEvent *ev)
{
XWindowAttributes at;
@ -543,7 +522,7 @@ maprequest(XMapRequestEvent *ev)
/** PropertyNotify handle event
* \param ev XPropertyEvent pointer
*/
void
static void
propertynotify(XPropertyEvent *ev)
{
Client *c;
@ -597,7 +576,7 @@ propertynotify(XPropertyEvent *ev)
/** XReparentEvent handle event
* \param ev XReparentEvent pointer
*/
void
static void
reparentnotify(XReparentEvent *ev)
{
(void)ev;
@ -605,11 +584,10 @@ reparentnotify(XReparentEvent *ev)
return;
}
/** SelectionClearEvent handle event
* \param ev XSelectionClearEvent pointer
*/
void
static void
selectionclearevent(XSelectionClearEvent *ev)
{
/* Getting selection if lost it */
@ -621,11 +599,10 @@ selectionclearevent(XSelectionClearEvent *ev)
return;
}
/** UnmapNotify handle event
* \param ev XUnmapEvent pointer
*/
void
static void
unmapnotify(XUnmapEvent *ev)
{
Client *c;
@ -648,6 +625,27 @@ unmapnotify(XUnmapEvent *ev)
return;
}
/** Key grabbing function
*/
void
grabkeys(void)
{
int i;
KeyCode code;
XUngrabKey(dpy, AnyKey, AnyModifier, ROOT);
for(i = 0; i < conf.nkeybind; ++i)
if((code = XKeysymToKeycode(dpy, keys[i].keysym)))
{
XGrabKey(dpy, code, keys[i].mod, ROOT, True, GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, keys[i].mod | LockMask, ROOT, True, GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, keys[i].mod | numlockmask, ROOT, True, GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, keys[i].mod | LockMask | numlockmask, ROOT, True, GrabModeAsync, GrabModeAsync);
}
return;
}
/** Event handle function: execute every function
* handle by event
* \param ev Event

View File

@ -118,10 +118,13 @@ frame_create(Client *c)
/* Border (for shadow) */
if(conf.client.border_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);
c->colors.borddark = color_shade(c->colors.frame, conf.colors.client_dark_shade);
c->colors.bordlight = color_shade(c->colors.frame, conf.colors.client_light_shade);
CWIN(c->left, c->frame, 0, 0, SHADH, c->frame_geo.height, 0, CWBackPixel, c->colors.bordlight, &at);
CWIN(c->top, c->frame, 0, 0, c->frame_geo.width, SHADH, 0, CWBackPixel, c->colors.bordlight, &at);
CWIN(c->bottom, c->frame, 0, c->frame_geo.height - SHADH, c->frame_geo.width, SHADH, 0, CWBackPixel, c->colors.borddark, &at);
CWIN(c->right, c->frame, c->frame_geo.width - SHADH, 0, SHADH, c->frame_geo.height, 0, CWBackPixel, c->colors.borddark, &at);
}
/* Reparent window with the frame */
@ -191,6 +194,44 @@ frame_moveresize(Client *c, XRectangle geo)
return;
}
/** Update frame colors for focus event
*\param c Client pointer
*/
void
frame_update_color(Client *c, Bool focused)
{
CHECK(c);
/* Not focused client */
if(focused)
{
c->colors.frame = conf.client.bordernormal;
c->colors.fg = conf.titlebar.fg_normal;
c->colors.resizecorner = conf.client.resizecorner_normal;
if(TBARH - BORDH && c->titlebar->stipple)
c->titlebar->stipple_color = conf.titlebar.stipple.colors.normal;
}
/* Focused */
else
{
c->colors.frame = conf.client.borderfocus;
c->colors.fg = conf.titlebar.fg_focus;
c->colors.resizecorner = conf.client.resizecorner_focus;
if(TBARH - BORDH && c->titlebar->stipple)
c->titlebar->stipple_color = conf.titlebar.stipple.colors.focus;
}
if(conf.client.border_shadow)
{
c->colors.borddark = color_shade(c->colors.frame, conf.colors.client_dark_shade);
c->colors.bordlight = color_shade(c->colors.frame, conf.colors.client_light_shade);
}
return;
}
/** Update the client frame; Set the new color
* and the title --> refresh
* \param c Client pointer
@ -258,10 +299,10 @@ frame_update(Client *c)
if(conf.client.border_shadow)
{
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);
XSetWindowBackground(dpy, c->left, c->colors.bordlight);
XSetWindowBackground(dpy, c->top, c->colors.bordlight);
XSetWindowBackground(dpy, c->right, c->colors.borddark);
XSetWindowBackground(dpy, c->bottom, c->colors.borddark);
XClearWindow(dpy, c->left);
XClearWindow(dpy, c->top);

View File

@ -135,6 +135,24 @@ infobar_init(void)
return;
}
/** Draw the layout button in the InfoBar
*\param sc Screen number
*/
static void
infobar_draw_layout(int sc)
{
if(!conf.layout_placement)
barwin_move(infobar[sc].layout_button, infobar[sc].tags_board->geo.width + PAD / 2, 0);
barwin_resize(infobar[sc].layout_button, ((conf.layout_button_width > 0) ? (uint)conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)), infobar[sc].geo.height);
barwin_refresh_color(infobar[sc].layout_button);
if(tags[sc][seltag[sc]].layout.symbol)
barwin_draw_text(infobar[sc].layout_button, PAD / 2, FHINFOBAR, tags[sc][seltag[sc]].layout.symbol);
return;
}
/** Draw the Infobar
*\param sc Screen number
*/
@ -150,24 +168,6 @@ infobar_draw(int sc)
return;
}
/** Draw the layout button in the InfoBar
*\param sc Screen number
*/
void
infobar_draw_layout(int sc)
{
if(!conf.layout_placement)
barwin_move(infobar[sc].layout_button, infobar[sc].tags_board->geo.width + PAD / 2, 0);
barwin_resize(infobar[sc].layout_button, ((conf.layout_button_width > 0) ? (uint)conf.layout_button_width : (textw(tags[sc][seltag[sc]].layout.symbol) + PAD)), infobar[sc].geo.height);
barwin_refresh_color(infobar[sc].layout_button);
if(tags[sc][seltag[sc]].layout.symbol)
barwin_draw_text(infobar[sc].layout_button, PAD / 2, FHINFOBAR, tags[sc][seltag[sc]].layout.symbol);
return;
}
/** Draw Selbar (selected client title bar in infobar
*\param sc Screen Number
*/
@ -272,6 +272,7 @@ infobar_draw_taglist(int sc)
? conf.colors.tag_occupied_fg
: conf.colors.text));
barwin_color_set(infobar[sc].tags[i], infobar[sc].tags[i]->bg, infobar[sc].tags[i]->fg);
barwin_refresh_color(infobar[sc].tags[i]);
if(tags[sc][i].name)
@ -320,7 +321,6 @@ infobar_update_taglist(int sc)
return;
}
/** Destroy the InfoBar
*/
void
@ -417,7 +417,7 @@ uicb_infobar_toggledisplay(uicb_t cmd)
? 0 : (tags[selscreen][seltag[selscreen]].prev_barpos
? tags[selscreen][seltag[selscreen]].prev_barpos : 2
));
tags[selscreen][seltag[selscreen]].prev_barpos = tags[selscreen][seltag[selscreen]].barpos;
tags[selscreen][seltag[selscreen]].barpos = new_pos;

View File

@ -32,10 +32,153 @@
#include "wmfs.h"
static char *complete_on_command(char*, size_t);
static char *complete_on_files(char*, size_t);
/*
* Just search command in PATH.
* Return the characters to complete the command.
*/
static char *
complete_on_command(char *start, size_t hits)
{
char *path;
char *dirname;
char *ret = NULL;
DIR *dir;
struct dirent *content;
void
char **namelist = NULL;
int n = 0, i;
if (!getenv("PATH") || !start || hits <= 0)
return NULL;
path = xstrdup(getenv("PATH"));
dirname = strtok(path, ":");
/* recursively open PATH */
while (dirname != NULL)
{
if ((dir = opendir(dirname)))
{
while ((content = readdir(dir)))
{
if(strncmp(content->d_name, ".", 1))
{
if (!strncmp(content->d_name, start, strlen(start)))
{
namelist = xrealloc(namelist, ++n, sizeof(*namelist));
namelist[n-1] = xstrdup(content->d_name);
}
}
}
closedir(dir);
}
dirname = strtok(NULL, ":");
}
free(path);
if(n > 0)
{
qsort(namelist, n, sizeof(char *), qsort_string_compare);
ret = xstrdup(namelist[((hits > 0) ? hits - 1 : 0) % n] + strlen(start));
for(i = 0; i < n; i++)
free(namelist[i]);
free(namelist);
}
return ret;
}
/*
* Complete a filename or directory name.
* works like complete_on_command.
*/
static char *
complete_on_files(char *start, size_t hits)
{
char *ret = NULL;
char *p = NULL;
char *dirname = NULL;
char *path = NULL;
char *filepath = NULL;
DIR *dir = NULL;
struct dirent *content = NULL;
struct stat st;
size_t count = 0;
if (!start || hits <= 0 || !(p = strrchr(start, ' ')))
return NULL;
/*
* Search the directory to open and set
* the beginning of file to complete on pointer 'p'.
*/
if (*(++p) == '\0' || !strrchr(p, '/'))
path = xstrdup(".");
else
{
/* remplace ~ by $HOME in dirname */
if (!strncmp(p, "~/", 2) && getenv("HOME"))
xasprintf(&dirname, "%s%s", getenv("HOME"), p+1);
else
dirname = xstrdup(p);
/* Set p to filename to be complete
* and path the directory containing the file
* /foooooo/baaaaaar/somethinglikethis<tab>
* <---- path - ---><------- p ------>
*/
p = strrchr(dirname, '/');
if (p != dirname)
{
*(p++) = '\0';
path = xstrdup(dirname);
}
else
{
path = xstrdup("/");
p++;
}
}
if ((dir = opendir(path)))
{
while ((content = readdir(dir)))
{
if (!strcmp(content->d_name, ".") || !strcmp(content->d_name, ".."))
continue;
if (!strncmp(content->d_name, p, strlen(p)) && ++count == hits)
{
/* If it's a directory append '/' to the completion */
xasprintf(&filepath, "%s/%s", path, content->d_name);
if (filepath && stat(filepath, &st) != -1)
{
if (S_ISDIR(st.st_mode))
xasprintf(&ret, "%s/", content->d_name + strlen(p));
else
ret = xstrdup(content->d_name + strlen(p));
}
else
warn("%s", filepath);
free(filepath);
break;
}
}
closedir(dir);
}
free(dirname);
free(path);
return ret;
}
static void
launcher_execute(Launcher *launcher)
{
BarWindow *bw;
@ -237,149 +380,3 @@ uicb_launcher(uicb_t cmd)
return;
}
/*
* Just search command in PATH.
* Return the characters to complete the command.
*/
static char *
complete_on_command(char *start, size_t hits)
{
char *path;
char *dirname;
char *ret = NULL;
DIR *dir;
struct dirent *content;
char **namelist = NULL;
int n = 0, i;
if (!getenv("PATH") || !start || hits <= 0)
return NULL;
path = xstrdup(getenv("PATH"));
dirname = strtok(path, ":");
/* recursively open PATH */
while (dirname != NULL)
{
if ((dir = opendir(dirname)))
{
while ((content = readdir(dir)))
{
if(strncmp(content->d_name, ".", 1))
{
if (!strncmp(content->d_name, start, strlen(start)))
{
namelist = xrealloc(namelist, ++n, sizeof(*namelist));
namelist[n-1] = xstrdup(content->d_name);
}
}
}
closedir(dir);
}
dirname = strtok(NULL, ":");
}
free(path);
if(n > 0)
{
qsort(namelist, n, sizeof(char *), qsort_string_compare);
ret = xstrdup(namelist[((hits > 0) ? hits - 1 : 0) % n] + strlen(start));
for(i = 0; i < n; i++)
free(namelist[i]);
free(namelist);
}
return ret;
}
/*
* Complete a filename or directory name.
* works like complete_on_command.
*/
static char *
complete_on_files(char *start, size_t hits)
{
char *ret = NULL;
char *p = NULL;
char *dirname = NULL;
char *path = NULL;
char *filepath = NULL;
DIR *dir = NULL;
struct dirent *content = NULL;
struct stat st;
size_t count = 0;
if (!start || hits <= 0 || !(p = strrchr(start, ' ')))
return NULL;
/*
* Search the directory to open and set
* the beginning of file to complete on pointer 'p'.
*/
if (*(++p) == '\0' || !strrchr(p, '/'))
path = xstrdup(".");
else
{
/* remplace ~ by $HOME in dirname */
if (!strncmp(p, "~/", 2) && getenv("HOME"))
xasprintf(&dirname, "%s%s", getenv("HOME"), p+1);
else
dirname = xstrdup(p);
/* Set p to filename to be complete
* and path the directory containing the file
* /foooooo/baaaaaar/somethinglikethis<tab>
* <---- path - ---><------- p ------>
*/
p = strrchr(dirname, '/');
if (p != dirname)
{
*(p++) = '\0';
path = xstrdup(dirname);
}
else
{
path = xstrdup("/");
p++;
}
}
if ((dir = opendir(path)))
{
while ((content = readdir(dir)))
{
if (!strcmp(content->d_name, ".") || !strcmp(content->d_name, ".."))
continue;
if (!strncmp(content->d_name, p, strlen(p)) && ++count == hits)
{
/* If it's a directory append '/' to the completion */
xasprintf(&filepath, "%s/%s", path, content->d_name);
if (filepath && stat(filepath, &st) != -1)
{
if (S_ISDIR(st.st_mode))
xasprintf(&ret, "%s/", content->d_name + strlen(p));
else
ret = xstrdup(content->d_name + strlen(p));
}
else
warn("%s", filepath);
free(filepath);
break;
}
}
closedir(dir);
}
free(dirname);
free(path);
return ret;
}

View File

@ -143,6 +143,27 @@ uicb_layout_prev(uicb_t cmd)
return;
}
/** Sort all the client that can be
* tiled
* \param c Client pointer
* \return a client pointer
*/
static Client*
tiled_client(int screen, Client *c)
{
for(;c && ((c->flags & MaxFlag)
|| (c->flags & FreeFlag)
|| (c->flags & FSSFlag)
|| (c->flags & AboveFlag)
|| c->screen != screen
|| ishide(c, screen)); c = c->next);
if(c)
c->flags |= FLayFlag;
return c;
}
/** Max layout function
*/
void
@ -163,27 +184,6 @@ maxlayout(int screen)
return;
}
/** Sort all the client that can be
* tiled
* \param c Client pointer
* \return a client pointer
*/
Client*
tiled_client(int screen, Client *c)
{
for(;c && ((c->flags & MaxFlag)
|| (c->flags & FreeFlag)
|| (c->flags & FSSFlag)
|| (c->flags & AboveFlag)
|| c->screen != screen
|| ishide(c, screen)); c = c->next);
if(c)
c->flags |= FLayFlag;
return c;
}
/** Set the mwfact
* \param cmd Mwfact (string)
*/
@ -235,7 +235,7 @@ uicb_set_nmaster(uicb_t cmd)
/** Grid layout function
*/
void
static void
grid(int screen, Bool horizontal)
{
Client *c;
@ -300,7 +300,7 @@ grid(int screen, Bool horizontal)
/** Multi tile function
* \param type Postion type { Top, Bottom, Left, Right }
*/
void
static void
multi_tile(int screen, Position type)
{
Client *c;
@ -430,7 +430,7 @@ multi_tile(int screen, Position type)
* \param screen Screen to execute this function
* \param horizont To specify the mirror mode (vertical/horizontal)
*/
void
static void
mirror(int screen, Bool horizontal)
{
Client *c;
@ -689,13 +689,6 @@ grid_vertical(int screen)
/** Put the selected client to the master postion
* \param cmd uicb_t type unused
*/
void
uicb_tile_switch(uicb_t cmd)
{
(void)cmd;
layout_set_client_master (sel);
return;
}
/** Toggle the selected client to free
* \param cmd uicb_t type unused
@ -729,7 +722,6 @@ uicb_togglefree(uicb_t cmd)
return;
}
/** Toggle the selected client to max
* \param cmd uicb_t type unused
*/
@ -748,7 +740,9 @@ uicb_togglemax(uicb_t cmd)
sel->free_geo = sel->geo;
sel->flags &= ~(TileFlag | FreeFlag);
client_maximize(sel);
XRaiseWindow(dpy, sel->frame);
sel->flags |= MaxFlag;
}
else
{

View File

@ -32,98 +32,118 @@
#include "wmfs.h"
void
menu_init(Menu *menu, char *name, int nitem, uint bg_f, char *fg_f, uint bg_n, char *fg_n)
static int
menu_get_longer_string(MenuItem *mi, int nitem)
{
/* Item */
menu->nitem = nitem;
menu->item = xcalloc(nitem, sizeof(*menu->item));
menu->name = name;
int i, w, l = 0;
/* Colors */
menu->colors.focus.bg = bg_f;
menu->colors.focus.fg = fg_f;
menu->colors.normal.bg = bg_n;
menu->colors.normal.fg = fg_n;
for(i = 0; i < nitem; ++i)
if((w = textw(mi[i].name)) > l)
l = w;
return l;
}
static Bool
menu_get_checkstring_needed(MenuItem *mi, int nitem)
{
(void)mi;
(void)nitem;
return True;
}
static void
menu_draw_item_name(Menu *menu, int item, BarWindow *winitem[], int chcklen)
{
int x;
int width = menu_get_longer_string(menu->item, menu->nitem) + chcklen + PAD / 3;
switch(menu->align)
{
case MA_Left:
x = chcklen + PAD / 2;
break;
case MA_Right:
x = width - textw(menu->item[item].name) + PAD * 3 / 2;
break;
default:
case MA_Center:
x = (width - (chcklen + PAD / 3)) / 2 - textw(menu->item[item].name) / 2 + chcklen + PAD / 3;
break;
}
barwin_draw_image_ofset_text(winitem[item], x, FHINFOBAR, menu->item[item].name, chcklen + PAD / 2, 0);
if(menu->item[item].check)
if(menu->item[item].check(menu->item[item].cmd))
barwin_draw_image_ofset_text(winitem[item], PAD / 3, FHINFOBAR, conf.selected_layout_symbol, PAD / 3, 0);
if(menu->item[item].submenu)
barwin_draw_text(winitem[item], width + PAD * 2, FHINFOBAR, ">");
return;
}
void
menu_new_item(MenuItem *mi, char *name, void *func, char *cmd)
static Bool
menu_activate_item(Menu *menu, int i)
{
mi->name = name;
mi->func = func;
mi->cmd = cmd;
return;
}
void
menu_draw(Menu menu, int x, int y)
{
int i, width, height, out;
XEvent ev;
BarWindow *item[menu.nitem];
BarWindow *frame;
int j, x, y;
int chcklen = 0;
if(menu_get_checkstring_needed(menu.item, menu.nitem))
if(menu_get_checkstring_needed(menu->item, menu->nitem))
chcklen = textw(conf.selected_layout_symbol) + PAD / 3;
width = menu_get_longer_string(menu.item, menu.nitem) + chcklen + textw(">") + PAD * 3;
height = menu.nitem * (INFOBARH - SHADH);
/* Frame barwin */
screen_get_sel();
if((out = x + width - MAXW) > 0)
x -= out;
if((out = y + height - MAXH) > 0)
y -= out;
frame = barwin_create(ROOT, x, y, width + SHADH, height + SHADH * 3,
menu.colors.normal.bg, menu.colors.normal.fg, False, False, True);
barwin_map(frame);
barwin_map_subwin(frame);
barwin_refresh_color(frame);
for(i = 0; i < menu.nitem; ++i)
if(menu->item[i].submenu)
{
item[i] = barwin_create(frame->win,
SHADH,
(i * (INFOBARH - SHADH) + SHADH),
width - SHADH,
INFOBARH,
menu.colors.normal.bg,
menu.colors.normal.fg,
True, False, False);
for(j = 0; j < conf.nmenu; ++j)
if(!strcmp(menu->item[i].submenu, conf.menu[j].name))
{
y = menu->y + ((i - 1) * INFOBARH + PAD) - SHADH * 2;
x = menu->x + menu_get_longer_string(menu->item, menu->nitem) + chcklen + textw(">") + PAD * 3;
barwin_map(item[i]);
barwin_refresh_color(item[i]);
menu_draw_item_name(&menu, i, item, chcklen);
barwin_refresh(item[i]);
menu_draw(conf.menu[j], x, y);
return True;
}
}
else if(menu->item[i].func)
{
menu->item[i].func(menu->item[i].cmd);
return True;
}
/* Select the first item */
menu_focus_item(&menu, 0, item);
return False;
}
XGrabKeyboard(dpy, ROOT, True, GrabModeAsync, GrabModeAsync, CurrentTime);
static void
menu_focus_item(Menu *menu, int item, BarWindow *winitem[])
{
int i;
while(!menu_manage_event(&ev, &menu, item));
int chcklen = 0;
if(menu_get_checkstring_needed(menu->item, menu->nitem))
chcklen = textw(conf.selected_layout_symbol) + PAD / 3;
XUngrabKeyboard(dpy, CurrentTime);
menu->focus_item = item;
for(i = 0; i < menu.nitem; ++i)
barwin_delete(item[i]);
barwin_delete(frame);
if(menu->focus_item > menu->nitem - 1)
menu->focus_item = 0;
else if(menu->focus_item < 0)
menu->focus_item = menu->nitem - 1;
for(i = 0; i < menu->nitem; ++i)
{
winitem[i]->fg = ((i == menu->focus_item) ? menu->colors.focus.fg : menu->colors.normal.fg);
winitem[i]->bg = ((i == menu->focus_item) ? menu->colors.focus.bg : menu->colors.normal.bg);
barwin_refresh_color(winitem[i]);
menu_draw_item_name(menu, i, winitem, chcklen);
barwin_refresh(winitem[i]);
}
return;
}
Bool
static Bool
menu_manage_event(XEvent *ev, Menu *menu, BarWindow *winitem[])
{
int i, c = 0;
@ -209,109 +229,6 @@ menu_manage_event(XEvent *ev, Menu *menu, BarWindow *winitem[])
return quit;
}
Bool
menu_activate_item(Menu *menu, int i)
{
int j, x, y;
int chcklen = 0;
if(menu_get_checkstring_needed(menu->item, menu->nitem))
chcklen = textw(conf.selected_layout_symbol) + PAD / 3;
if(menu->item[i].submenu)
{
for(j = 0; j < conf.nmenu; ++j)
if(!strcmp(menu->item[i].submenu, conf.menu[j].name))
{
y = menu->y + ((i - 1) * INFOBARH + PAD) - SHADH * 2;
x = menu->x + menu_get_longer_string(menu->item, menu->nitem) + chcklen + textw(">") + PAD * 3;
menu_draw(conf.menu[j], x, y);
return True;
}
}
else if(menu->item[i].func)
{
menu->item[i].func(menu->item[i].cmd);
return True;
}
return False;
}
void
menu_focus_item(Menu *menu, int item, BarWindow *winitem[])
{
int i;
int chcklen = 0;
if(menu_get_checkstring_needed(menu->item, menu->nitem))
chcklen = textw(conf.selected_layout_symbol) + PAD / 3;
menu->focus_item = item;
if(menu->focus_item > menu->nitem - 1)
menu->focus_item = 0;
else if(menu->focus_item < 0)
menu->focus_item = menu->nitem - 1;
for(i = 0; i < menu->nitem; ++i)
{
winitem[i]->fg = ((i == menu->focus_item) ? menu->colors.focus.fg : menu->colors.normal.fg);
winitem[i]->bg = ((i == menu->focus_item) ? menu->colors.focus.bg : menu->colors.normal.bg);
barwin_refresh_color(winitem[i]);
menu_draw_item_name(menu, i, winitem, chcklen);
barwin_refresh(winitem[i]);
}
return;
}
void
menu_draw_item_name(Menu *menu, int item, BarWindow *winitem[], int chcklen)
{
int x;
int width = menu_get_longer_string(menu->item, menu->nitem) + chcklen + PAD / 3;
switch(menu->align)
{
case MA_Left:
x = chcklen + PAD / 2;
break;
case MA_Right:
x = width - textw(menu->item[item].name) + PAD * 3 / 2;
break;
default:
case MA_Center:
x = (width - (chcklen + PAD / 3)) / 2 - textw(menu->item[item].name) / 2 + chcklen + PAD / 3;
break;
}
barwin_draw_image_ofset_text(winitem[item], x, FHINFOBAR, menu->item[item].name, chcklen + PAD / 2, 0);
if(menu->item[item].check)
if(menu->item[item].check(menu->item[item].cmd))
barwin_draw_image_ofset_text(winitem[item], PAD / 3, FHINFOBAR, conf.selected_layout_symbol, PAD / 3, 0);
if(menu->item[item].submenu)
barwin_draw_text(winitem[item], width + PAD * 2, FHINFOBAR, ">");
return;
}
int
menu_get_longer_string(MenuItem *mi, int nitem)
{
int i, w, l = 0;
for(i = 0; i < nitem; ++i)
if((w = textw(mi[i].name)) > l)
l = w;
return l;
}
void
uicb_menu(uicb_t cmd)
{
@ -351,11 +268,92 @@ menu_clear(Menu *menu)
return;
}
Bool
menu_get_checkstring_needed(MenuItem *mi, int nitem)
void
menu_init(Menu *menu, char *name, int nitem, uint bg_f, char *fg_f, uint bg_n, char *fg_n)
{
(void)mi;
(void)nitem;
return True;
/* Item */
menu->nitem = nitem;
menu->item = xcalloc(nitem, sizeof(*menu->item));
menu->name = name;
/* Colors */
menu->colors.focus.bg = bg_f;
menu->colors.focus.fg = fg_f;
menu->colors.normal.bg = bg_n;
menu->colors.normal.fg = fg_n;
return;
}
void
menu_new_item(MenuItem *mi, char *name, void *func, char *cmd)
{
mi->name = name;
mi->func = func;
mi->cmd = cmd;
return;
}
void
menu_draw(Menu menu, int x, int y)
{
int i, width, height, out;
XEvent ev;
BarWindow *item[menu.nitem];
BarWindow *frame;
int chcklen = 0;
if(menu_get_checkstring_needed(menu.item, menu.nitem))
chcklen = textw(conf.selected_layout_symbol) + PAD / 3;
width = menu_get_longer_string(menu.item, menu.nitem) + chcklen + textw(">") + PAD * 3;
height = menu.nitem * (INFOBARH - SHADH);
/* Frame barwin */
screen_get_sel();
if((out = x + width - MAXW) > 0)
x -= out;
if((out = y + height - MAXH) > 0)
y -= out;
frame = barwin_create(ROOT, x, y, width + SHADH, height + SHADH * 3,
menu.colors.normal.bg, menu.colors.normal.fg, False, False, True);
barwin_map(frame);
barwin_map_subwin(frame);
barwin_refresh_color(frame);
for(i = 0; i < menu.nitem; ++i)
{
item[i] = barwin_create(frame->win,
SHADH,
(i * (INFOBARH - SHADH) + SHADH),
width - SHADH,
INFOBARH,
menu.colors.normal.bg,
menu.colors.normal.fg,
True, False, False);
barwin_map(item[i]);
barwin_refresh_color(item[i]);
menu_draw_item_name(&menu, i, item, chcklen);
barwin_refresh(item[i]);
}
/* Select the first item */
menu_focus_item(&menu, 0, item);
XGrabKeyboard(dpy, ROOT, True, GrabModeAsync, GrabModeAsync, CurrentTime);
while(!menu_manage_event(&ev, &menu, item));
XUngrabKeyboard(dpy, CurrentTime);
for(i = 0; i < menu.nitem; ++i)
barwin_delete(item[i]);
barwin_delete(frame);
return;
}

View File

@ -34,7 +34,7 @@
/** Draw the border when a client in dragging/resizing with mouse
*/
void
static void
mouse_dragborder(XRectangle geo, GC g)
{
XDrawRectangle(dpy, ROOT, g,
@ -49,7 +49,7 @@ mouse_dragborder(XRectangle geo, GC g)
/** Move a client in tile grid with the mouse
*\param c Client double pointer
*/
void
static void
mouse_move_tile_client(Client **c)
{
Client *sc;
@ -76,7 +76,7 @@ mouse_move_tile_client(Client **c)
/** Move a client from one tag to another with dah mouse
*\param c client pointer
*/
void
static void
mouse_move_tag_client(Client *c)
{
Window w;
@ -110,7 +110,7 @@ mouse_move_tag_client(Client *c)
/** Move the client with the mouse
* \param c Client pointer
*/
void
static void
mouse_move(Client *c)
{
int ocx, ocy, mx, my;

View File

@ -38,7 +38,7 @@
*\param str String
*\return n Length of r
*/
int
static int
statustext_rectangle(StatusRec *r, char *str)
{
char as;
@ -62,7 +62,7 @@ statustext_rectangle(StatusRec *r, char *str)
*\param str String
*\return n Length of g
*/
int
static int
statustext_graph(StatusGraph *g, char *str)
{
char as, c, *p;
@ -112,7 +112,7 @@ statustext_graph(StatusGraph *g, char *str)
*\param str String
*\return n Length of s
*/
int
static int
statustext_text(StatusText *s, char *str)
{
char as;
@ -135,7 +135,7 @@ statustext_text(StatusText *s, char *str)
*\param sc Screen
*\param str String
*/
void
static void
statustext_normal(int sc, char *str)
{
char strwc[MAXSTATUS] = { 0 };

View File

@ -216,6 +216,7 @@ struct Client
uint frame;
char *fg;
uint resizecorner;
uint bordlight, borddark;
} colors;
/* Client Information by flags */
uint flags;
@ -410,6 +411,10 @@ typedef struct
uint tagbord;
char *layout_fg;
uint layout_bg;
float client_light_shade;
float client_dark_shade;
float bar_light_shade;
float bar_dark_shade;
} colors;
struct
{

108
src/tag.c
View File

@ -303,6 +303,58 @@ uicb_tag_last(uicb_t cmd)
return;
}
/**
*\param selscreen int
*/
static void
remove_old_last_tag(int selscreen)
{
int i;
for(i = 0; i <= conf.ntag[selscreen]; i++)
{
if(tags[selscreen][i].stay_last)
{
tags[selscreen][i].stay_last = False;
break;
}
}
return;
}
/** Swap 2 tags
*\param s Screen
*\param t1 Tag 1
*\param t2 Tag 2
*/
static void
tag_swap(int s, int t1, int t2)
{
Client *c;
Tag t;
if(t1 > conf.ntag[s] || t1 < 1
|| t2 > conf.ntag[s] || t2 < 1 || t1 == t2)
return;
t = tags[s][t1];
tags[s][t1] = tags[s][t2];
tags[s][t2] = t;
for(c = clients; c; c = c->next)
{
if(c->screen == s && c->tag == (uint)t1)
c->tag = t2;
else if(c->screen == s && c->tag == (uint)t2)
c->tag = t1;
}
infobar_update_taglist(s);
tag_set(t2);
return;
}
/** Keep that tag the last one
*\param cmd uicb_t type unused
*/
@ -466,39 +518,6 @@ uicb_tag_toggle_additional(uicb_t cmd)
return;
}
/** Swap 2 tags
*\param s Screen
*\param t1 Tag 1
*\param t2 Tag 2
*/
void
tag_swap(int s, int t1, int t2)
{
Client *c;
Tag t;
if(t1 > conf.ntag[s] || t1 < 1
|| t2 > conf.ntag[s] || t2 < 1 || t1 == t2)
return;
t = tags[s][t1];
tags[s][t1] = tags[s][t2];
tags[s][t2] = t;
for(c = clients; c; c = c->next)
{
if(c->screen == s && c->tag == (uint)t1)
c->tag = t2;
else if(c->screen == s && c->tag == (uint)t2)
c->tag = t1;
}
infobar_update_taglist(s);
tag_set(t2);
return;
}
/** Swap current tag with a specified tag
*\param cmd uicb_t type
*/
@ -552,7 +571,7 @@ uicb_tag_swap_previous(uicb_t cmd)
*\param s Screen number
*\param name New tag name
*/
void
static void
tag_new(int s, char *name)
{
char * displayedName;
@ -623,7 +642,7 @@ uicb_tag_new(uicb_t cmd)
*\param s Screen number
*\param tag Tag number
*/
void
static void
tag_delete(int s, int tag)
{
Tag t;
@ -715,22 +734,3 @@ uicb_tag_rename(uicb_t cmd)
return;
}
/**
*\param selscreen int
*/
void
remove_old_last_tag(int selscreen)
{
int i;
for(i = 0; i <= conf.ntag[selscreen]; i++)
{
if(tags[selscreen][i].stay_last)
{
tags[selscreen][i].stay_last = False;
break;
}
}
return;
}

View File

@ -142,21 +142,6 @@ getcolor(char *color)
return xcolor.pixel;
}
/** Enlight an hexadecimal color
* \param col Color
* \return The clarified color
*/
ulong
color_enlight(ulong col)
{
if((col + 0x330000) < 0xffffff
&& (col + 0x003300) < 0xffffff
&& (col + 0x000033) < 0xffffff)
return col + 0x333333;
else
return col;
}
/** Set the window WM State
* \param win Window target
* \param state WM State
@ -225,28 +210,6 @@ layout_name_to_struct(Layout lt[], char *name, int n, const func_name_list_t lli
return lt[0];
}
char*
alias_to_str(char *conf_choice)
{
int i;
char *tmpchar = NULL;
if(!conf_choice)
return 0;
if(conf.alias)
for(i = 0; conf.alias[i].name; i++)
if(!strcmp(conf_choice, conf.alias[i].name))
tmpchar = conf.alias[i].content;
if(tmpchar)
return xstrdup(tmpchar);
else
return xstrdup(conf_choice);
return NULL;
}
/* }}} */
/** Execute a sh command
@ -375,9 +338,9 @@ patht(char *path)
return NULL;
strncpy(ret, path, sizeof(ret));
ret[sizeof(ret) - 1] = 0;
if(strstr(path, "~/"))
sprintf(ret, "%s/%s", getenv("HOME"), path + 2);
snprintf(ret, sizeof(ret), "%s/%s", getenv("HOME"), path + 2);
return ret;
}

View File

@ -32,7 +32,7 @@
#include "wmfs.h"
vicmd_to_uicb vicmd[] =
static vicmd_to_uicb vicmd[] =
{
{"r", "reload"},
{"q", "quit"},
@ -62,7 +62,7 @@ vicmd_to_uicb vicmd[] =
{"tf", "toggle_free"},
};
void
static void
viwmfs_help(void)
{
size_t i;

View File

@ -35,8 +35,6 @@
static volatile Bool exiting = False, sig_chld = False;
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
static void signal_handle(int);
int
errorhandler(Display *d, XErrorEvent *event)
{
@ -159,7 +157,7 @@ wait_childs_and_status(void)
pthread_mutex_unlock(&mtx);
}
void *
static void *
thread_status(void *arg)
{
(void)arg;
@ -186,7 +184,7 @@ thread_status(void *arg)
/** WMFS main loop.
*/
void
static void
mainloop(void)
{
XEvent ev;
@ -227,7 +225,7 @@ uicb_quit(uicb_t cmd)
/** Scan if there are windows on X
* for manage it
*/
void
static void
scan(void)
{
uint n;
@ -374,7 +372,7 @@ exec_uicb_function(char *func, char *cmd)
/** Set statustext
*\param str Statustext string
*/
void
static void
set_statustext(int s, char *str)
{
int i;
@ -410,7 +408,7 @@ set_statustext(int s, char *str)
/** Update status script by ewmh hint
*/
void
static void
update_status(void)
{
if(!check_wmfs_running())

View File

@ -86,7 +86,6 @@
#define INFOBARH ((conf.bars.height > 0) ? conf.bars.height : (font->height * 1.5))
#define FHINFOBAR ((font->height - font->descent) + (INFOBARH - font->height) / 2)
#define SHADH (1)
#define SHADC (0x000000) /* 'Cause i don't know how darken a color yet */
#define BORDH conf.client.borderheight
#define TBARH ((conf.titlebar.height < BORDH) ? BORDH : conf.titlebar.height)
#define RESHW (6 * (BORDH))
@ -121,6 +120,7 @@ BarWindow *barwin_create(Window parent,
Bool border);
void barwin_draw_text(BarWindow *bw, int x, int y, char *text);
void barwin_draw_image_ofset_text(BarWindow *bw, int x, int y, char *text, int x_image_ofset, int y_image_ofset);
void barwin_color_set(BarWindow *bw, uint bg, char *fg);
void barwin_delete(BarWindow *bw);
void barwin_delete_subwin(BarWindow *bw);
void barwin_map(BarWindow *bw);
@ -138,16 +138,11 @@ void draw_image_ofset_text(Drawable d, int x, int y, char* fg, char *str, int x_
void draw_rectangle(Drawable dr, int x, int y, uint w, uint h, uint color);
void draw_graph(Drawable dr, int x, int y, uint w, uint h, uint color, char *data);
#ifdef HAVE_IMLIB
void draw_image(Drawable dr, int x, int y, int w, int h, char *name);
#endif /* HAVE_IMLIB */
ushort textw(char *text);
/* infobar.c */
void infobar_init(void);
void infobar_draw(int sc);
void infobar_draw_layout(int sc);
void infobar_draw_selbar(int sc);
void infobar_draw_taglist(int sc);
void infobar_update_taglist(int sc);
@ -161,11 +156,7 @@ void uicb_toggle_tagautohide(uicb_t);
void client_attach(Client *c);
void client_configure(Client *c);
void client_detach(Client *c);
void client_above(Client *c);
void client_focus(Client *c);
Client* client_get_next(void);
Client* client_get_prev(void);
Client* client_get_next_with_direction(Position pos);
/* client_gb_*() {{{ */
Client* client_gb_win(Window w);
Client* client_gb_frame(Window w);
@ -189,7 +180,6 @@ void client_unhide(Client *c);
void client_focus_next(Client *c);
void client_unmanage(Client *c);
void client_unmap(Client *c);
void client_set_rules(Client *c);
void client_update_attributes(Client *c);
void client_urgent(Client *c, Bool u);
void uicb_client_raise(uicb_t);
@ -208,7 +198,6 @@ void uicb_client_move(uicb_t cmd);
void uicb_client_resize(uicb_t cmd);
void uicb_ignore_next_client_rules(uicb_t cmd);
void uicb_clientlist(uicb_t cmd);
void uicb_client_select(uicb_t cmd);
Bool uicb_checkclist(uicb_t);
void uicb_client_ignore_tag(uicb_t);
@ -228,52 +217,30 @@ void ewmh_manage_window_type(Client *c);
void frame_create(Client *c);
void frame_delete(Client *c);
void frame_moveresize(Client *c, XRectangle geo);
void frame_update_color(Client *c, Bool focused);
void frame_update(Client *c);
/* config.c */
void init_conf(void);
/* color.c */
uint color_shade(uint, double);
/* event.c */
void buttonpress(XButtonEvent *ev);
void configureevent(XConfigureRequestEvent *ev);
void clientmessageevent(XClientMessageEvent *ev);
void destroynotify(XDestroyWindowEvent *ev);
void enternotify(XCrossingEvent *ev);
void expose(XExposeEvent *ev);
void focusin(XFocusChangeEvent *ev);
void grabkeys(void);
void keypress(XKeyPressedEvent *ev);
void mappingnotify(XMappingEvent *ev);
void mapnotify(XMapEvent *ev);
void maprequest(XMapRequestEvent *ev);
void reparentnotify(XReparentEvent *ev);
void selectionclearevent(XSelectionClearEvent *ev);
void propertynotify(XPropertyEvent *ev);
void unmapnotify(XUnmapEvent *ev);
void getevent(XEvent ev);
/* menu.c */
void menu_init(Menu *menu, char *name, int nitem, uint bg_f, char *fg_f, uint bg_n, char *fg_n);
void menu_new_item(MenuItem *mi, char *name, void *func, char *cmd);
void menu_draw(Menu menu, int x, int y);
Bool menu_manage_event(XEvent *ev, Menu *menu, BarWindow *winitem[]);
Bool menu_activate_item(Menu *menu, int i);
void menu_focus_item(Menu *menu, int item, BarWindow *winitem[]);
void menu_draw_item_name(Menu *menu, int item, BarWindow *winitem[], int chcklen);
int menu_get_longer_string(MenuItem *mi, int nitem);
void uicb_menu(uicb_t cmd);
void menu_clear(Menu *menu);
Bool menu_get_checkstring_needed(MenuItem *mi, int nitem);
/* launcher.c */
void launcher_execute(Launcher *launcher);
void uicb_launcher(uicb_t);
/* mouse.c */
void mouse_dragborder(XRectangle geo, GC g);
void mouse_move_tile_client(Client **c);
void mouse_move_tag_client(Client *c);
void mouse_move(Client *c);
void mouse_resize(Client *c);
void mouse_grabbuttons(Client *c, Bool focused);
void uicb_mouse_move(uicb_t);
@ -289,7 +256,6 @@ void *xrealloc(void *, size_t, size_t);
#define zrealloc(ptr, size) xrealloc((ptr), 1, (size))
char *xstrdup(const char *);
int xasprintf(char **, const char *, ...);
ulong color_enlight(ulong col);
long getcolor(char *color);
void setwinstate(Window win, long state);
/* Conf usage {{{ */
@ -297,7 +263,6 @@ void* name_to_func(char *name, const func_name_list_t *l);
ulong char_to_modkey(char *name, key_name_list_t key_l[]);
uint char_to_button(char *name, name_to_uint_t blist[]);
Layout layout_name_to_struct(Layout lt[], char *name, int n, const func_name_list_t llist[]);
char* alias_to_str(char *conf_choice);
/* }}} */
char *char_to_str(const char c);
pid_t spawn(const char *str, ...);
@ -326,18 +291,14 @@ void uicb_tagtransfert_prev(uicb_t);
void uicb_tag_urgent(uicb_t cmd);
void tag_additional(int sc, int tag, int adtag);
void uicb_tag_toggle_additional(uicb_t);
void tag_swap(int s, int t1, int t2);
void uicb_tag_swap(uicb_t);
void uicb_tag_swap_next(uicb_t);
void uicb_tag_swap_previous(uicb_t);
void tag_new(int s, char *name);
void uicb_tag_new(uicb_t);
void tag_delete(int s, int tag);
void uicb_tag_del(uicb_t);
void uicb_tag_rename(uicb_t cmd);
void uicb_tag_last(uicb_t cmd);
void uicb_tag_stay_last(uicb_t cmd);
void remove_old_last_tag(int selscreen);
/* screen.c */
int screen_count(void);
@ -352,10 +313,6 @@ void uicb_screen_prev(uicb_t);
void uicb_screen_prev_sel(uicb_t);
/* status.c */
int statustext_rectangle(StatusRec *r, char *str);
int statustext_graph(StatusGraph *g, char *str);
int statustext_text(StatusText *s, char *str);
void statustext_normal(int sc, char *str);
void statustext_handle(int sc, char *str);
/* systray.c */
@ -373,9 +330,7 @@ void arrange(int screen, Bool update_layout);
void freelayout(int screen);
void layoutswitch(Bool b);
void maxlayout(int screen);
Client *tiled_client(int screen, Client *c);
/* tile {{{ */
void grid(int screen, Bool horizontal);
void tile(int screen);
void tile_left(int screen);
void tile_top(int screen);
@ -413,12 +368,8 @@ int errorhandler(Display *d, XErrorEvent *event);
int errorhandlerdummy(Display *d, XErrorEvent *event);
void quit(void);
void *thread_process(void *arg);
void mainloop(void);
void scan(void);
Bool check_wmfs_running(void);
void exec_uicb_function(char *func, char *cmd);
void set_statustext(int s, char *str);
void update_status(void);
void handle_signal(int signum);
void uicb_quit(uicb_t);
void uicb_reload(uicb_t);

6
wmfsrc
View File

@ -26,6 +26,9 @@
border = true
#height = "-1"
light_shade = 0.10
dark_shade = -0.10
[systray]
# Enable/disable systray
active = true
@ -189,6 +192,9 @@
# Modifier for mouse use
modifier = "Alt"
light_shade = 0.10
dark_shade = -0.10
# *DEPRECATED* but works, see [rules] section
# Set automatic free or max client
# autofree = "xterm|MPlayer"