Code cosmetic..

This commit is contained in:
Martin Duquesnoy 2010-04-12 18:33:32 +02:00
parent b31d54b7e6
commit b0b74b46eb
9 changed files with 47 additions and 32 deletions

View File

@ -67,6 +67,7 @@ barwin_create(Window parent,
|ButtonMask|MouseMask |ButtonMask|MouseMask
|ExposureMask|VisibilityChangeMask |ExposureMask|VisibilityChangeMask
|StructureNotifyMask|SubstructureRedirectMask; |StructureNotifyMask|SubstructureRedirectMask;
if(entermask) if(entermask)
at.event_mask |= EnterWindowMask|LeaveWindowMask|FocusChangeMask; at.event_mask |= EnterWindowMask|LeaveWindowMask|FocusChangeMask;
@ -219,10 +220,7 @@ barwin_move(BarWindow *bw, int x, int y)
{ {
CHECK(bw); CHECK(bw);
bw->geo.x = x; XMoveWindow(dpy, bw->win, (bw->geo.x = x), (bw->geo.y = y));
bw->geo.y = y;
XMoveWindow(dpy, bw->win, x, y);
return; return;
} }

View File

@ -40,6 +40,7 @@ client_attach(Client *c)
{ {
if(clients) if(clients)
clients->prev = c; clients->prev = c;
c->next = clients; c->next = clients;
clients = c; clients = c;
@ -96,6 +97,7 @@ client_get_next(void)
return NULL; return NULL;
for(c = sel->next; c && ishide(c, selscreen); c = c->next); for(c = sel->next; c && ishide(c, selscreen); c = c->next);
if(!c && conf.client_round) if(!c && conf.client_round)
for(c = clients; c && ishide(c, selscreen); c = c->next); for(c = clients; c && ishide(c, selscreen); c = c->next);
@ -290,7 +292,7 @@ client_focus(Client *c)
return; return;
} }
/* The following function have the same point : /* The following functions have the same point :
* find a client member with a Window {{{ * find a client member with a Window {{{
*/ */
@ -386,6 +388,8 @@ client_get_name(Client *c)
int rf; int rf;
ulong ir, il; ulong ir, il;
IFREE(c->title);
/* This one instead XFetchName for utf8 name support */ /* This one instead XFetchName for utf8 name support */
if(XGetWindowProperty(dpy, c->win, net_atom[net_wm_name], 0, 4096, if(XGetWindowProperty(dpy, c->win, net_atom[net_wm_name], 0, 4096,
False, net_atom[utf8_string], &rt, &rf, &ir, &il, (uchar**)&c->title) != Success) False, net_atom[utf8_string], &rt, &rf, &ir, &il, (uchar**)&c->title) != Success)
@ -396,6 +400,7 @@ client_get_name(Client *c)
if(!c->title) if(!c->title)
{ {
XFetchName(dpy, c->win, &(c->title)); XFetchName(dpy, c->win, &(c->title));
if(!c->title) if(!c->title)
c->title = _strdup("WMFS"); c->title = _strdup("WMFS");
} }
@ -583,13 +588,21 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
frame_create(c); frame_create(c);
client_size_hints(c); client_size_hints(c);
XChangeWindowAttributes(dpy, c->win, CWEventMask, &at); XChangeWindowAttributes(dpy, c->win, CWEventMask, &at);
XSetWindowBorderWidth(dpy, c->win, 0); /* client win sould _not_ have borders */
/* client win should _not_ have borders */
XSetWindowBorderWidth(dpy, c->win, 0);
mouse_grabbuttons(c, False); mouse_grabbuttons(c, False);
/* Transient */
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success)) if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
for(t = clients; t && t->win != trans; t = t->next); for(t = clients; t && t->win != trans; t = t->next);
if(t) if(t)
{
c->tag = t->tag; c->tag = t->tag;
c->screen = t->screen;
}
if(!(c->flags & FreeFlag) if(!(c->flags & FreeFlag)
&& (rettrans == Success || (c->flags & HintFlag))) && (rettrans == Success || (c->flags & HintFlag)))
c->flags |= FreeFlag; c->flags |= FreeFlag;
@ -892,7 +905,7 @@ client_update_attributes(Client *c)
XChangeProperty(dpy, c->win, ATOM("_WMFS_SCREEN"), XA_CARDINAL, 32, XChangeProperty(dpy, c->win, ATOM("_WMFS_SCREEN"), XA_CARDINAL, 32,
PropModeReplace, (uchar*)&(c->screen), 1); PropModeReplace, (uchar*)&(c->screen), 1);
f = (c->flags & FreeFlag) ? True : False; f = (c->flags & FreeFlag);
XChangeProperty(dpy, c->win, ATOM("_WMFS_ISFREE"), XA_CARDINAL, 32, XChangeProperty(dpy, c->win, ATOM("_WMFS_ISFREE"), XA_CARDINAL, 32,
PropModeReplace, (uchar*)&f, 1); PropModeReplace, (uchar*)&f, 1);
@ -920,6 +933,8 @@ client_raise(Client *c)
void void
uicb_client_raise(uicb_t cmd) uicb_client_raise(uicb_t cmd)
{ {
CHECK(sel);
client_raise(sel); client_raise(sel);
return; return;

View File

@ -95,6 +95,7 @@ key_name_list_t key_list[] =
{"Mod3", Mod3Mask }, {"Mod3", Mod3Mask },
{"Mod4", Mod4Mask }, {"Mod4", Mod4Mask },
{"Super", Mod4Mask }, {"Super", Mod4Mask },
{"Home", Mod4Mask },
{"Mod5", Mod5Mask }, {"Mod5", Mod5Mask },
{NULL, NoSymbol } {NULL, NoSymbol }
}; };

View File

@ -49,6 +49,8 @@ buttonpress(XButtonEvent *ev)
{ {
client_focus(c); client_focus(c);
client_raise(c); client_raise(c);
return;
} }
/* Titlebar */ /* Titlebar */
@ -436,6 +438,8 @@ keypress(XKeyPressedEvent *ev)
void void
mappingnotify(XMappingEvent *ev) mappingnotify(XMappingEvent *ev)
{ {
XRefreshKeyboardMapping(ev);
if(ev->request == MappingKeyboard) if(ev->request == MappingKeyboard)
grabkeys(); grabkeys();

View File

@ -149,13 +149,11 @@ void
ewmh_update_current_tag_prop(void) ewmh_update_current_tag_prop(void)
{ {
int t; int t;
char *s = NULL; char s[8] = { 0 };
screen_get_sel(); screen_get_sel();
t = seltag[selscreen] - 1; t = seltag[selscreen] - 1;
s = emalloc(8, sizeof(char));
/* Get current desktop (tag) */ /* Get current desktop (tag) */
XChangeProperty(dpy, ROOT, net_atom[net_current_desktop], XA_CARDINAL, 32, XChangeProperty(dpy, ROOT, net_atom[net_current_desktop], XA_CARDINAL, 32,
PropModeReplace, (uchar*)&t, 1); PropModeReplace, (uchar*)&t, 1);
@ -180,8 +178,6 @@ ewmh_update_current_tag_prop(void)
PropModeReplace, (uchar*)tags[selscreen][seltag[selscreen]].layout.symbol, PropModeReplace, (uchar*)tags[selscreen][seltag[selscreen]].layout.symbol,
strlen(tags[selscreen][seltag[selscreen]].layout.symbol)); strlen(tags[selscreen][seltag[selscreen]].layout.symbol));
free(s);
return; return;
} }
@ -203,7 +199,7 @@ ewmh_get_client_list(void)
XChangeProperty(dpy, ROOT, net_atom[net_client_list], XA_WINDOW, 32, XChangeProperty(dpy, ROOT, net_atom[net_client_list], XA_WINDOW, 32,
PropModeReplace, (uchar *)list, win_n); PropModeReplace, (uchar *)list, win_n);
free(list); XFree(list);
return; return;
} }

View File

@ -35,23 +35,23 @@
const func_name_list_t layout_list[] = const func_name_list_t layout_list[] =
{ {
{"tile", tile }, {"tile", tile },
{"tile_right", tile }, {"tile_right", tile },
{"tile_left", tile_left }, {"tile_left", tile_left },
{"tile_top", tile_top }, {"tile_top", tile_top },
{"tile_bottom", tile_bottom }, {"tile_bottom", tile_bottom },
{"tile_grid", grid }, {"tile_grid", grid },
{"grid", grid }, {"grid", grid },
{"mirror_vertical", mirror_vertical }, {"mirror_vertical", mirror_vertical },
{"tile_mirror_vertical", mirror_vertical }, {"tile_mirror_vertical", mirror_vertical },
{"mirror_horizontal", mirror_horizontal }, {"mirror_horizontal", mirror_horizontal },
{"tile_mirror_horizontal", mirror_horizontal }, {"tile_mirror_horizontal", mirror_horizontal },
{"layer", layer }, {"layer", layer },
{"max", maxlayout }, {"max", maxlayout },
{"maxlayout", maxlayout }, {"maxlayout", maxlayout },
{"freelayout", freelayout }, {"freelayout", freelayout },
{"free", freelayout }, {"free", freelayout },
{ NULL, NULL } { NULL, NULL }
}; };
/** Init WMFS /** Init WMFS

View File

@ -35,7 +35,6 @@
void void
menu_init(Menu *menu, char *name, int nitem, uint bg_f, char *fg_f, uint bg_n, char *fg_n) menu_init(Menu *menu, char *name, int nitem, uint bg_f, char *fg_f, uint bg_n, char *fg_n)
{ {
/* Item */ /* Item */
menu->nitem = nitem; menu->nitem = nitem;
menu->item = emalloc(sizeof(MenuItem), nitem); menu->item = emalloc(sizeof(MenuItem), nitem);

View File

@ -262,6 +262,8 @@ void
uicb_spawn(uicb_t cmd) uicb_spawn(uicb_t cmd)
{ {
spawn("%s", cmd); spawn("%s", cmd);
return;
} }
#ifdef HAVE_IMLIB #ifdef HAVE_IMLIB

View File

@ -91,7 +91,7 @@
#define DEF_CONF ".config/wmfs/wmfsrc" #define DEF_CONF ".config/wmfs/wmfsrc"
#define DEF_STATUS ".config/wmfs/status.sh" #define DEF_STATUS ".config/wmfs/status.sh"
#define PAD conf.pad #define PAD conf.pad
#define MAXSTATUS 4096 #define MAXSTATUS (4096)
#define CWIN(win, parent, x, y, w, h, b, mask, col, at) \ #define CWIN(win, parent, x, y, w, h, b, mask, col, at) \
do { \ do { \