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