1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

wmspec code clean - style

This patch do these changes:

1. Removes the extra curly brackets
2. Add curly brackets if needed (code style)
3. Removes spaces in the function prototypes/declaration
   I think this is the best moment to do it, all together
   in a style clean patch.
4. Moves variable definition with the same type to the same line
This commit is contained in:
Rodolfo García Peñas (kix)
2012-10-23 23:59:51 +02:00
committed by Carlos R. Mafra
parent 8b6f884d36
commit ac4362a88f

View File

@@ -541,18 +541,17 @@ void wNETWMInitStuff(WScreen * scr)
Atom atoms[atomNr];
char *names[atomNr];
for (i = 0; i < atomNr; ++i) {
for (i = 0; i < atomNr; ++i)
names[i] = atomNames[i].name;
}
XInternAtoms(dpy, &names[0], atomNr, False, atoms);
for (i = 0; i < atomNr; ++i) {
for (i = 0; i < atomNr; ++i)
*atomNames[i].atom = atoms[i];
}
}
#else
for (i = 0; i < atomNr; i++) {
for (i = 0; i < atomNr; i++)
*atomNames[i].atom = XInternAtom(dpy, atomNames[i].name, False);
}
#endif
data = wmalloc(sizeof(NetData));
@@ -701,12 +700,10 @@ static void updateClientList(WScreen * scr)
static void updateClientListStacking(WScreen *scr, WWindow *wwin_excl)
{
WWindow *wwin;
Window *client_list;
Window *client_list_reverse;
int client_count;
Window *client_list, *client_list_reverse;
int client_count, i;
WCoreWindow *tmp;
WMBagIterator iter;
int i;
/* update client list */
i = scr->window_count + 1;
@@ -859,8 +856,7 @@ static Bool updateStrut(WWindow * wwin, Bool adding)
if (adding) {
Atom type_ret;
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
unsigned long nitems_ret, bytes_after_ret;
long *data = NULL;
if (XGetWindowProperty(dpy, wwin->client_win, net_wm_strut, 0, 4, False,
@@ -881,7 +877,6 @@ static Bool updateStrut(WWindow * wwin, Bool adding)
XFree(data);
hasState = True;
}
} else {
/* deleting */
area = scr->netdata->strut;
@@ -928,10 +923,9 @@ static int getWindowLayer(WWindow * wwin)
} else if (wwin->type == net_wm_window_type_dialog) {
if (wwin->transient_for) {
WWindow *parent = wWindowFor(wwin->transient_for);
if (parent && parent->flags.fullscreen) {
if (parent && parent->flags.fullscreen)
layer = WMFullscreenLevel;
}
}
/* //layer = WMPopUpLevel; // this seems a bad idea -Dan */
} else if (wwin->type == net_wm_window_type_normal) {
}
@@ -946,93 +940,87 @@ static int getWindowLayer(WWindow * wwin)
static void doStateAtom(WWindow *wwin, Atom state, int set, Bool init)
{
if (state == net_wm_state_sticky) {
if (set == _NET_WM_STATE_TOGGLE) {
if (set == _NET_WM_STATE_TOGGLE)
set = !IS_OMNIPRESENT(wwin);
}
if (set != wwin->flags.omnipresent) {
if (set != wwin->flags.omnipresent)
wWindowSetOmnipresent(wwin, set);
}
} else if (state == net_wm_state_shaded) {
if (set == _NET_WM_STATE_TOGGLE) {
if (set == _NET_WM_STATE_TOGGLE)
set = !wwin->flags.shaded;
}
if (init) {
wwin->flags.shaded = set;
} else {
if (set) {
if (set)
wShadeWindow(wwin);
} else {
else
wUnshadeWindow(wwin);
}
}
} else if (state == net_wm_state_skip_taskbar) {
if (set == _NET_WM_STATE_TOGGLE) {
if (set == _NET_WM_STATE_TOGGLE)
set = !wwin->client_flags.skip_window_list;
}
wwin->client_flags.skip_window_list = set;
} else if (state == net_wm_state_skip_pager) {
if (set == _NET_WM_STATE_TOGGLE) {
if (set == _NET_WM_STATE_TOGGLE)
set = !wwin->flags.net_skip_pager;
}
wwin->flags.net_skip_pager = set;
} else if (state == net_wm_state_maximized_vert) {
if (set == _NET_WM_STATE_TOGGLE) {
if (set == _NET_WM_STATE_TOGGLE)
set = !(wwin->flags.maximized & MAX_VERTICAL);
}
if (init) {
wwin->flags.maximized |= (set ? MAX_VERTICAL : 0);
} else {
if (set) {
if (set)
wMaximizeWindow(wwin, wwin->flags.maximized | MAX_VERTICAL);
} else {
else
wMaximizeWindow(wwin, wwin->flags.maximized & ~MAX_VERTICAL);
}
}
} else if (state == net_wm_state_maximized_horz) {
if (set == _NET_WM_STATE_TOGGLE) {
if (set == _NET_WM_STATE_TOGGLE)
set = !(wwin->flags.maximized & MAX_HORIZONTAL);
}
if (init) {
wwin->flags.maximized |= (set ? MAX_HORIZONTAL : 0);
} else {
if (set) {
if (set)
wMaximizeWindow(wwin, wwin->flags.maximized | MAX_HORIZONTAL);
} else {
else
wMaximizeWindow(wwin, wwin->flags.maximized & ~MAX_HORIZONTAL);
}
}
} else if (state == net_wm_state_hidden) {
if (set == _NET_WM_STATE_TOGGLE) {
if (set == _NET_WM_STATE_TOGGLE)
set = !(wwin->flags.miniaturized);
}
if (init) {
wwin->flags.miniaturized = set;
} else {
if (set) {
if (set)
wIconifyWindow(wwin);
} else {
else
wDeiconifyWindow(wwin);
}
}
} else if (state == net_wm_state_fullscreen) {
if (set == _NET_WM_STATE_TOGGLE) {
if (set == _NET_WM_STATE_TOGGLE)
set = !(wwin->flags.fullscreen);
}
if (init) {
wwin->flags.fullscreen = set;
} else {
if (set) {
if (set)
wFullscreenWindow(wwin);
} else {
else
wUnfullscreenWindow(wwin);
}
}
} else if (state == net_wm_state_above) {
if (set == _NET_WM_STATE_TOGGLE) {
if (set == _NET_WM_STATE_TOGGLE)
set = !(wwin->client_flags.floating);
}
if (init) {
wwin->client_flags.floating = set;
} else {
@@ -1041,9 +1029,9 @@ static void doStateAtom(WWindow * wwin, Atom state, int set, Bool init)
}
} else if (state == net_wm_state_below) {
if (set == _NET_WM_STATE_TOGGLE) {
if (set == _NET_WM_STATE_TOGGLE)
set = !(wwin->client_flags.sunken);
}
if (init) {
wwin->client_flags.sunken = set;
} else {
@@ -1166,11 +1154,10 @@ void wNETWMPositionSplash(WWindow * wwin, int *x, int *y, int width, int height)
static void updateWindowType(WWindow *wwin)
{
Atom type_ret;
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
int fmt_ret, layer;
unsigned long nitems_ret, bytes_after_ret;
long *data = NULL;
int layer;
if (XGetWindowProperty(dpy, wwin->client_win, net_wm_window_type, 0, 1,
False, XA_ATOM, &type_ret, &fmt_ret, &nitems_ret,
&bytes_after_ret, (unsigned char **)&data) == Success && data) {
@@ -1245,11 +1232,9 @@ void wNETWMCheckClientHints(WWindow *wwin, int *layer, int *workspace)
static Bool updateNetIconInfo(WWindow *wwin)
{
Atom type_ret;
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
unsigned long nitems_ret, bytes_after_ret;
long *data = NULL;
Bool hasState = False;
Bool old_state = wwin->flags.net_handle_icon;
@@ -1262,8 +1247,9 @@ static Bool updateNetIconInfo(WWindow * wwin)
XFree(data);
hasState = True;
} else
} else {
wwin->flags.net_handle_icon = False;
}
if (XGetWindowProperty(dpy, wwin->client_win, net_wm_icon_geometry, 0, 4, False,
XA_CARDINAL, &type_ret, &fmt_ret, &nitems_ret,
@@ -1284,8 +1270,9 @@ static Bool updateNetIconInfo(WWindow * wwin)
XFree(data);
hasState = True;
} else
} else {
wwin->flags.net_handle_icon = False;
}
if (wwin->flags.miniaturized && old_state != wwin->flags.net_handle_icon) {
if (wwin->flags.net_handle_icon) {
@@ -1321,9 +1308,8 @@ static void handleDesktopNames(XClientMessageEvent * event, WScreen * scr)
if (XGetWindowProperty(dpy, scr->root_win, net_desktop_names, 0, 1, False,
utf8_string, &type_ret, &fmt_ret, &nitems_ret,
&bytes_after_ret, (unsigned char **)&data) != Success) {
&bytes_after_ret, (unsigned char **)&data) != Success)
return;
}
if (data == NULL)
return;
@@ -1376,10 +1362,9 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent * event)
}
}
if (rebuild) {
if (rebuild)
updateWorkspaceCount(scr);
}
}
} else if (event->message_type == net_showing_desktop) {
wNETWMShowingDesktop(scr, event->data.l[0]);
} else if (event->message_type == net_desktop_names) {
@@ -1490,15 +1475,13 @@ int wNETWMGetPidForWindow(Window window)
{
Atom type_ret;
int fmt_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
unsigned long nitems_ret, bytes_after_ret;
long *data = NULL;
int pid;
if (XGetWindowProperty(dpy, window, net_wm_pid, 0, 1, False,
XA_CARDINAL, &type_ret, &fmt_ret, &nitems_ret,
&bytes_after_ret, (unsigned char **)&data) == Success && data) {
pid = *data;
XFree(data);
} else {
@@ -1518,8 +1501,10 @@ char *wNETWMGetWindowName(Window window)
if (name) {
ret = wstrndup(name, size);
XFree(name);
} else
} else {
ret = NULL;
}
return ret;
}
@@ -1533,8 +1518,10 @@ char *wNETWMGetIconName(Window window)
if (name) {
ret = wstrndup(name, size);
XFree(name);
} else
} else {
ret = NULL;
}
return ret;
}