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

wmaker: code style

This patch removes some extra curly brackets, some empty lines,
extra spaces, ... to follow wmaker's coding style
This commit is contained in:
Rodolfo García Peñas (kix)
2013-10-08 00:56:28 +02:00
committed by Carlos R. Mafra
parent 29ccfbbf20
commit 4ac65ab260
11 changed files with 52 additions and 64 deletions

View File

@@ -1624,9 +1624,9 @@ void wUnhideApplication(WApplication *wapp, Bool miniwindows, Bool bringToCurren
wapp->app_icon->y_pos, wlist, animate, bringToCurrentWS);
animate = False;
} else {
if (bringToCurrentWS && wlist->frame->workspace != scr->current_workspace) {
if (bringToCurrentWS && wlist->frame->workspace != scr->current_workspace)
wWindowChangeWorkspace(wlist, scr->current_workspace);
}
wRaiseFrame(wlist->frame->core);
}
}
@@ -1871,9 +1871,9 @@ void wMakeWindowVisible(WWindow *wwin)
if (wwin->frame->workspace != wwin->screen_ptr->current_workspace)
wWorkspaceChange(wwin->screen_ptr, wwin->frame->workspace);
if (wwin->flags.shaded) {
if (wwin->flags.shaded)
wUnshadeWindow(wwin);
}
if (wwin->flags.hidden) {
WApplication *app;

View File

@@ -375,7 +375,7 @@ void wAppIconMove(WAppIcon * aicon, int x, int y)
}
#ifdef WS_INDICATOR
static void updateDockNumbers(WScreen * scr)
static void updateDockNumbers(WScreen *scr)
{
int length;
char *ws_numbers;
@@ -807,9 +807,11 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event)
}
if (!wPreferences.flags.nodock && scr->dock != originalDock)
allDocks[ i++ ] = scr->dock;
if (!wPreferences.flags.noclip &&
originalDock != scr->workspaces[scr->current_workspace]->clip)
allDocks[ i++ ] = scr->workspaces[scr->current_workspace]->clip;
for ( ; i < scr->drawer_count + 2; i++) /* In case the clip, the dock, or both, are disabled */
allDocks[ i ] = NULL;
@@ -862,6 +864,7 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event)
for (i = 0; i < scr->workspace_count; i++) {
if (i == scr->current_workspace)
continue;
wDockShowIcons(scr->workspaces[i]->clip);
/* Note: if dock is collapsed (for instance, because it
auto-collapses), its icons still won't show up */
@@ -1067,6 +1070,7 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event)
for (i = 0; i < scr->workspace_count; i++) {
if (i == scr->current_workspace)
continue;
wDockHideIcons(scr->workspaces[i]->clip);
}
}
@@ -1148,8 +1152,10 @@ static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window m
int i;
for (i = 0; i < scr->workspace_count; i++) {
WDock *dock = scr->workspaces[i]->clip;
if (dock)
wapp->app_icon = findDockIconFor(dock, main_window);
if (wapp->app_icon)
break;
}

View File

@@ -432,7 +432,7 @@ static void miniwindowBalloon(WObjDescriptor * object)
}
}
static void appiconBalloon(WObjDescriptor * object)
static void appiconBalloon(WObjDescriptor *object)
{
WAppIcon *aicon = (WAppIcon *) object->parent;
WScreen *scr = aicon->icon->core->screen_ptr;

View File

@@ -2583,13 +2583,12 @@ static int setClipTitleFont(WScreen * scr, WDefaultEntry * entry, void *tdata, v
return REFRESH_ICON_FONT;
}
static int setLargeDisplayFont(WScreen * scr, WDefaultEntry * entry, void *tdata, void *foo)
static int setLargeDisplayFont(WScreen *scr, WDefaultEntry *entry, void *tdata, void *foo)
{
WMFont *font = tdata;
if (scr->workspace_name_font) {
if (scr->workspace_name_font)
WMReleaseFont(scr->workspace_name_font);
}
scr->workspace_name_font = font;

View File

@@ -620,10 +620,10 @@ static void toggleAutoAttractCallback(WMenu *menu, WMenuEntry *entry)
/* The newly auto-attracting dock is a drawer: disable any clip and
* previously attracting drawer */
int i;
for (i = 0; i < scr->workspace_count; i++) {
for (i = 0; i < scr->workspace_count; i++)
scr->workspaces[ i ]->clip->attract_icons = False;
/* dock menu will be updated later, when opened */
}
if (scr->attracting_drawer != NULL)
scr->attracting_drawer->attract_icons = False;
scr->attracting_drawer = dock;
@@ -818,6 +818,7 @@ static WAppIcon *mainIconCreate(WScreen *scr, int type, const char *name)
case WM_CLIP:
if (scr->clip_icon)
return scr->clip_icon;
btn = wAppIconCreateForDock(scr, NULL, "Logo", "WMClip", TILE_CLIP);
btn->icon->core->descriptor.handle_expose = clipIconExpose;
x_pos = 0;
@@ -1210,6 +1211,7 @@ static WMenu *dockMenuCreate(WScreen *scr, int type)
if (scr->clip_options == NULL)
scr->clip_options = makeClipOptionsMenu(scr);
wMenuEntrySetCascade(menu, entry, scr->clip_options);
/* The same menu is used for the dock and its appicons. If the menu
@@ -3957,9 +3959,9 @@ static void iconMouseDown(WObjDescriptor *desc, XEvent *event)
iconDblClick(desc, event);
}
} else if (event->xbutton.button == Button2 && aicon == scr->clip_icon) {
if (!scr->clip_ws_menu) {
if (!scr->clip_ws_menu)
scr->clip_ws_menu = wWorkspaceMenuMake(scr, False);
}
if (scr->clip_ws_menu) {
WMenu *wsMenu = scr->clip_ws_menu;
int xpos;

View File

@@ -838,23 +838,17 @@ static Bool checkWorkspaceChange(WWindow * wwin, MoveData * data, Bool opaqueMov
if (data->mouseX <= 1) {
if (scr->current_workspace > 0) {
crossWorkspace(scr, wwin, opaqueMove, scr->current_workspace - 1, True);
changed = True;
data->rubCount = 0;
} else if (scr->current_workspace == 0 && wPreferences.ws_cycle) {
crossWorkspace(scr, wwin, opaqueMove, scr->workspace_count - 1, True);
changed = True;
data->rubCount = 0;
}
} else if (data->mouseX >= scr->scr_width - 2) {
if (scr->current_workspace == scr->workspace_count - 1) {
if (wPreferences.ws_cycle || scr->workspace_count == MAX_WORKSPACES) {
crossWorkspace(scr, wwin, opaqueMove, 0, False);
changed = True;
data->rubCount = 0;
@@ -883,7 +877,6 @@ static Bool checkWorkspaceChange(WWindow * wwin, MoveData * data, Bool opaqueMov
data->rubCount = 0;
}
} else if (scr->current_workspace < scr->workspace_count) {
/* go to next workspace */
crossWorkspace(scr, wwin, opaqueMove, scr->current_workspace + 1, False);
changed = True;
@@ -1394,16 +1387,18 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
if (wPreferences.ws_cycle) {
if (src_x + off_x + ww < 20) {
if (!scr->current_workspace) {
if (!scr->current_workspace)
wWorkspaceChange(scr, scr->workspace_count - 1);
} else
else
wWorkspaceChange(scr, scr->current_workspace - 1);
off_x += scr_width;
} else if (src_x + off_x + 20 > scr_width) {
if (scr->current_workspace == scr->workspace_count - 1) {
if (scr->current_workspace == scr->workspace_count - 1)
wWorkspaceChange(scr, 0);
} else
else
wWorkspaceChange(scr, scr->current_workspace + 1);
off_x -= scr_width;
}
} else {

View File

@@ -755,7 +755,7 @@ static void constructPLMenuFromPipe(WMenu * menu, WMenuEntry * entry)
wfree(cmd);
}
static void cleanupWorkspaceMenu(WMenu * menu)
static void cleanupWorkspaceMenu(WMenu *menu)
{
if (menu->frame->screen_ptr->workspace_menu == menu)
menu->frame->screen_ptr->workspace_menu = NULL;

View File

@@ -819,15 +819,12 @@ void wScreenRestoreState(WScreen * scr)
wfree(path);
}
if (!scr->session_state) {
if (!scr->session_state)
scr->session_state = WMCreatePLDictionary(NULL, NULL);
}
if (!wPreferences.flags.nodock) {
state = WMGetFromPLDictionary(scr->session_state, dDock);
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
/* If clip_merged_in_dock, setting scr->clip_icon is done by
* wDockRestoreState()->wDockCreate()->mainIconCreate() */
}
if (!wPreferences.flags.noclip) {
@@ -835,12 +832,10 @@ void wScreenRestoreState(WScreen * scr)
scr->clip_icon = wClipRestoreState(scr, state);
}
if (!wPreferences.flags.nodrawer) {
if (!wPreferences.flags.nodrawer)
wDrawersRestoreState(scr);
}
wWorkspaceRestoreState(scr);
wScreenUpdateUsableArea(scr);
}

View File

@@ -198,9 +198,8 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
name = WMCreatePLString(buffer);
cmd = WMCreatePLString(command);
/*sprintf(buffer, "%d", wwin->frame->workspace+1);
workspace = WMCreatePLString(buffer); */
workspace = WMCreatePLString(scr->workspaces[wwin->frame->workspace]->name);
shaded = wwin->flags.shaded ? sYes : sNo;
miniaturized = wwin->flags.miniaturized ? sYes : sNo;
hidden = wwin->flags.hidden ? sYes : sNo;
@@ -233,22 +232,21 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
if (wapp && wapp->app_icon && wapp->app_icon->dock) {
int i;
char *name = NULL;
if (wapp->app_icon->dock == scr->dock) {
if (wapp->app_icon->dock == scr->dock)
name = "Dock";
}
if (name == NULL) // Try the clips
{
/* Try the clips */
if (name == NULL) {
for (i = 0; i < scr->workspace_count; i++)
if (scr->workspaces[i]->clip == wapp->app_icon->dock)
break;
if (i < scr->workspace_count)
name = scr->workspaces[i]->name;
}
if (name == NULL) // Try the drawers
{
/* Try the drawers */
if (name == NULL) {
WDrawerChain *dc;
for (dc = scr->drawers; dc != NULL; dc = dc->next)
{
for (dc = scr->drawers; dc != NULL; dc = dc->next) {
if (dc->adrawer == wapp->app_icon->dock)
break;
}
@@ -468,11 +466,11 @@ void wSessionRestoreState(WScreen *scr)
value = WMGetFromPLDictionary(win_info, sDock);
if (value && WMIsPLString(value) && (tmp = WMGetFromPLString(value)) != NULL) {
if (sscanf(tmp, "%i", &n) != 1) {
if (!strcasecmp(tmp, "DOCK")) {
if (!strcasecmp(tmp, "DOCK"))
dock = scr->dock;
}
if (dock == NULL) // Try the clips
{
/* Try the clips */
if (dock == NULL) {
for (j = 0; j < scr->workspace_count; j++) {
if (strcmp(scr->workspaces[j]->name, tmp) == 0) {
dock = scr->workspaces[j]->clip;

View File

@@ -571,11 +571,10 @@ static void updateMenuForWindow(WMenu * menu, WWindow * wwin)
for (i = 0; i < scr->workspace_submenu->entry_no; i++) {
scr->workspace_submenu->entries[i]->clientdata = wwin;
if (i == scr->current_workspace) {
if (i == scr->current_workspace)
wMenuSetEnabled(scr->workspace_submenu, i, False);
} else {
else
wMenuSetEnabled(scr->workspace_submenu, i, True);
}
}
menu->flags.realized = 0;

View File

@@ -259,9 +259,8 @@ static void showWorkspaceName(WScreen * scr, int workspace)
int xx, yy;
#endif
if (wPreferences.workspace_name_display_position == WD_NONE || scr->workspace_count < 2) {
if (wPreferences.workspace_name_display_position == WD_NONE || scr->workspace_count < 2)
return;
}
if (scr->workspace_name_timer) {
WMDeleteTimerHandler(scr->workspace_name_timer);
@@ -350,11 +349,9 @@ static void showWorkspaceName(WScreen * scr, int workspace)
XFillRectangle(dpy, text, WMColorGC(scr->black), 0, 0, w + 4, h + 4);
for (x = 0; x <= 4; x++) {
for (y = 0; y <= 4; y++) {
for (x = 0; x <= 4; x++)
for (y = 0; y <= 4; y++)
WMDrawString(scr->wmscreen, text, scr->white, scr->workspace_name_font, x, y, name, len);
}
}
XSetForeground(dpy, scr->mono_gc, 1);
XSetBackground(dpy, scr->mono_gc, 0);
@@ -477,9 +474,8 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
SendHelperMessage(scr, 'C', workspace + 1, NULL);
if (workspace > scr->workspace_count - 1) {
if (workspace > scr->workspace_count - 1)
wWorkspaceMake(scr, workspace - scr->workspace_count + 1);
}
wClipUpdateForWorkspaceChange(scr, workspace);
@@ -644,12 +640,12 @@ static void switchWSCommand(WMenu * menu, WMenuEntry * entry)
wWorkspaceChange(menu->frame->screen_ptr, (long)entry->clientdata);
}
static void lastWSCommand(WMenu * menu, WMenuEntry * entry)
static void lastWSCommand(WMenu *menu, WMenuEntry *entry)
{
wWorkspaceChange(menu->frame->screen_ptr, menu->frame->screen_ptr->last_workspace);
}
static void deleteWSCommand(WMenu * menu, WMenuEntry * entry)
static void deleteWSCommand(WMenu *menu, WMenuEntry *entry)
{
wWorkspaceDelete(menu->frame->screen_ptr, menu->frame->screen_ptr->workspace_count - 1);
}
@@ -768,9 +764,8 @@ void wWorkspaceMenuUpdate(WScreen * scr, WMenu * menu)
}
} else if (menu->entry_no > scr->workspace_count + MC_WORKSPACE1) {
/* removed workspace(s) */
for (i = menu->entry_no - 1; i >= scr->workspace_count + MC_WORKSPACE1; i--) {
for (i = menu->entry_no - 1; i >= scr->workspace_count + MC_WORKSPACE1; i--)
wMenuRemoveItem(menu, i);
}
}
for (i = 0; i < scr->workspace_count; i++) {
@@ -786,11 +781,10 @@ void wWorkspaceMenuUpdate(WScreen * scr, WMenu * menu)
wMenuRealize(menu);
/* don't let user destroy current workspace */
if (scr->current_workspace == scr->workspace_count - 1) {
if (scr->current_workspace == scr->workspace_count - 1)
wMenuSetEnabled(menu, MC_DESTROY_LAST, False);
} else {
else
wMenuSetEnabled(menu, MC_DESTROY_LAST, True);
}
/* back to last workspace */
if (scr->workspace_count && scr->last_workspace != scr->current_workspace)