1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00

Coding-style cleanup

Code style cleanup in multiple files. Tabs, spaces, curly brackets,...
This commit is contained in:
Rodolfo García Peñas (kix)
2012-03-30 15:35:19 +02:00
committed by Carlos R. Mafra
parent 1a0e665e58
commit aab9028fc2
6 changed files with 69 additions and 76 deletions

View File

@@ -120,6 +120,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
if (!old_scr) if (!old_scr)
old_scr = scr; old_scr = scr;
old_focused = old_scr->focused_window; old_focused = old_scr->focused_window;
LastFocusChange = timestamp; LastFocusChange = timestamp;
@@ -131,6 +132,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime); XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
if (old_focused) if (old_focused)
wWindowUnfocus(old_focused); wWindowUnfocus(old_focused);
if (oapp) { if (oapp) {
wAppMenuUnmap(oapp->menu); wAppMenuUnmap(oapp->menu);
wApplicationDeactivate(oapp); wApplicationDeactivate(oapp);
@@ -138,18 +140,17 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
WMPostNotificationName(WMNChangedFocus, NULL, (void *)True); WMPostNotificationName(WMNChangedFocus, NULL, (void *)True);
return; return;
} else if (old_scr != scr && old_focused) {
wWindowUnfocus(old_focused);
} }
if (old_scr != scr && old_focused)
wWindowUnfocus(old_focused);
wasfocused = wwin->flags.focused; wasfocused = wwin->flags.focused;
napp = wApplicationOf(wwin->main_window); napp = wApplicationOf(wwin->main_window);
/* remember last workspace where the app has been */ /* remember last workspace where the app has been */
if (napp) { if (napp)
/*napp->last_workspace = wwin->screen_ptr->current_workspace; */
napp->last_workspace = wwin->frame->workspace; napp->last_workspace = wwin->frame->workspace;
}
if (wwin->flags.mapped && !WFLAGP(wwin, no_focusable)) { if (wwin->flags.mapped && !WFLAGP(wwin, no_focusable)) {
/* install colormap if colormap mode is lock mode */ /* install colormap if colormap mode is lock mode */
@@ -161,23 +162,23 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
case WFM_NO_INPUT: case WFM_NO_INPUT:
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime); XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
break; break;
case WFM_PASSIVE: case WFM_PASSIVE:
case WFM_LOCALLY_ACTIVE: case WFM_LOCALLY_ACTIVE:
XSetInputFocus(dpy, wwin->client_win, RevertToParent, CurrentTime); XSetInputFocus(dpy, wwin->client_win, RevertToParent, CurrentTime);
break; break;
case WFM_GLOBALLY_ACTIVE: case WFM_GLOBALLY_ACTIVE:
break; break;
} }
XFlush(dpy); XFlush(dpy);
if (wwin->protocols.TAKE_FOCUS) { if (wwin->protocols.TAKE_FOCUS)
wClientSendProtocol(wwin, _XA_WM_TAKE_FOCUS, timestamp); wClientSendProtocol(wwin, _XA_WM_TAKE_FOCUS, timestamp);
}
XSync(dpy, False); XSync(dpy, False);
} else { } else {
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime); XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
} }
if (WFLAGP(wwin, no_focusable)) if (WFLAGP(wwin, no_focusable))
return; return;
@@ -206,7 +207,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
if (napp && !wasfocused) { if (napp && !wasfocused) {
#ifdef USER_MENU #ifdef USER_MENU
wUserMenuRefreshInstances(napp->menu, wwin); wUserMenuRefreshInstances(napp->menu, wwin);
#endif /* USER_MENU */ #endif /* USER_MENU */
if (wwin->flags.mapped) if (wwin->flags.mapped)
wAppMenuMap(napp->menu, wwin); wAppMenuMap(napp->menu, wwin);
@@ -908,14 +909,11 @@ void wIconifyWindow(WWindow * wwin)
XWindowAttributes attribs; XWindowAttributes attribs;
int present; int present;
if (!XGetWindowAttributes(dpy, wwin->client_win, &attribs)) { if (!XGetWindowAttributes(dpy, wwin->client_win, &attribs))
/* the window doesn't exist anymore */ return; /* the window doesn't exist anymore */
return;
}
if (wwin->flags.miniaturized) { if (wwin->flags.miniaturized)
return; return; /* already miniaturized */
}
if (wwin->transient_for != None && wwin->transient_for != wwin->screen_ptr->root_win) { if (wwin->transient_for != None && wwin->transient_for != wwin->screen_ptr->root_win) {
WWindow *owner = wWindowFor(wwin->transient_for); WWindow *owner = wWindowFor(wwin->transient_for);
@@ -935,11 +933,10 @@ void wIconifyWindow(WWindow * wwin)
} }
if (!wPreferences.disable_miniwindows && !wwin->flags.net_handle_icon) { if (!wPreferences.disable_miniwindows && !wwin->flags.net_handle_icon) {
if (!wwin->flags.icon_moved) { if (!wwin->flags.icon_moved)
PlaceIcon(wwin->screen_ptr, &wwin->icon_x, &wwin->icon_y, wGetHeadForWindow(wwin)); PlaceIcon(wwin->screen_ptr, &wwin->icon_x, &wwin->icon_y, wGetHeadForWindow(wwin));
}
wwin->icon = wIconCreate(wwin);
wwin->icon = wIconCreate(wwin);
wwin->icon->mapped = 1; wwin->icon->mapped = 1;
} }
@@ -947,7 +944,6 @@ void wIconifyWindow(WWindow * wwin)
wwin->flags.mapped = 0; wwin->flags.mapped = 0;
/* unmap transients */ /* unmap transients */
unmapTransientsFor(wwin); unmapTransientsFor(wwin);
if (present) { if (present) {
@@ -997,11 +993,9 @@ void wIconifyWindow(WWindow * wwin)
if (!wPreferences.disable_miniwindows && !wwin->flags.net_handle_icon) { if (!wPreferences.disable_miniwindows && !wwin->flags.net_handle_icon) {
if (wwin->screen_ptr->current_workspace == wwin->frame->workspace || if (wwin->screen_ptr->current_workspace == wwin->frame->workspace ||
IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons) IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)
XMapWindow(dpy, wwin->icon->core->window); XMapWindow(dpy, wwin->icon->core->window);
AddToStackList(wwin->icon->core); AddToStackList(wwin->icon->core);
wLowerFrame(wwin->icon->core); wLowerFrame(wwin->icon->core);
} }
@@ -1085,9 +1079,8 @@ void wDeiconifyWindow(WWindow *wwin)
wwin->flags.miniaturized = 0; wwin->flags.miniaturized = 0;
if (!netwm_hidden && !wwin->flags.shaded) { if (!netwm_hidden && !wwin->flags.shaded)
wwin->flags.mapped = 1; wwin->flags.mapped = 1;
}
if (!netwm_hidden || wPreferences.sticky_icons) { if (!netwm_hidden || wPreferences.sticky_icons) {
/* maybe we want to do this regardless of net_handle_icon /* maybe we want to do this regardless of net_handle_icon
@@ -1135,14 +1128,14 @@ void wDeiconifyWindow(WWindow *wwin)
#endif /* ANIMATIONS */ #endif /* ANIMATIONS */
wwin->flags.skip_next_animation = 0; wwin->flags.skip_next_animation = 0;
XGrabServer(dpy); XGrabServer(dpy);
if (!wwin->flags.shaded) { if (!wwin->flags.shaded)
XMapWindow(dpy, wwin->client_win); XMapWindow(dpy, wwin->client_win);
}
XMapWindow(dpy, wwin->frame->core->window); XMapWindow(dpy, wwin->frame->core->window);
wRaiseFrame(wwin->frame->core); wRaiseFrame(wwin->frame->core);
if (!wwin->flags.shaded) { if (!wwin->flags.shaded)
wClientSetState(wwin, NormalState, None); wClientSetState(wwin, NormalState, None);
}
mapTransientsFor(wwin); mapTransientsFor(wwin);
} }
@@ -1167,16 +1160,14 @@ void wDeiconifyWindow(WWindow *wwin)
ProcessPendingEvents(); ProcessPendingEvents();
/* the window can disappear while ProcessPendingEvents() runs */ /* the window can disappear while ProcessPendingEvents() runs */
if (!wWindowFor(clientwin)) { if (!wWindowFor(clientwin))
return; return;
}
} }
#endif #endif
} }
if (wPreferences.auto_arrange_icons) { if (wPreferences.auto_arrange_icons)
wArrangeIcons(wwin->screen_ptr, True); wArrangeIcons(wwin->screen_ptr, True);
}
WMPostNotificationName(WMNChangedState, wwin, "iconify"); WMPostNotificationName(WMNChangedState, wwin, "iconify");

View File

@@ -193,19 +193,20 @@ void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char *wm_instance
if (access(tmp, R_OK) == 0) if (access(tmp, R_OK) == 0)
iconPath = tmp; iconPath = tmp;
} }
if (!iconPath) { if (!iconPath) {
strcpy(tmp, path); strcpy(tmp, path);
strcat(tmp, ".xpm"); strcat(tmp, ".xpm");
if (access(tmp, R_OK) == 0) if (access(tmp, R_OK) == 0)
iconPath = tmp; iconPath = tmp;
} }
if (!iconPath) if (!iconPath)
wfree(tmp); wfree(tmp);
} }
if (iconPath) { if (iconPath) {
wApplicationSaveIconPathFor(iconPath, wm_instance, wm_class); wApplicationSaveIconPathFor(iconPath, wm_instance, wm_class);
wfree(iconPath); wfree(iconPath);
} }
} }
@@ -263,20 +264,19 @@ WApplication *wApplicationCreate(WWindow * wwin)
extractIcon(wapp->main_window_desc); extractIcon(wapp->main_window_desc);
leader = wWindowFor(main_window); leader = wWindowFor(main_window);
if (leader) { if (leader)
leader->main_window = main_window; leader->main_window = main_window;
}
wapp->menu = wAppMenuGet(scr, main_window); wapp->menu = wAppMenuGet(scr, main_window);
#ifdef USER_MENU #ifdef USER_MENU
if (!wapp->menu) if (!wapp->menu)
wapp->menu = wUserMenuGet(scr, wapp->main_window_desc); wapp->menu = wUserMenuGet(scr, wapp->main_window_desc);
#endif /* USER_MENU */ #endif /* USER_MENU */
/* /*
* Set application wide attributes from the leader. * Set application wide attributes from the leader.
*/ */
wapp->flags.hidden = WFLAGP(wapp->main_window_desc, start_hidden); wapp->flags.hidden = WFLAGP(wapp->main_window_desc, start_hidden);
wapp->flags.emulated = WFLAGP(wapp->main_window_desc, emulate_appicon); wapp->flags.emulated = WFLAGP(wapp->main_window_desc, emulate_appicon);
/* application descriptor */ /* application descriptor */
@@ -286,10 +286,11 @@ WApplication *wApplicationCreate(WWindow * wwin)
wapp->app_icon = NULL; wapp->app_icon = NULL;
if (scr->last_dock) if (scr->last_dock)
wapp->app_icon = findDockIconFor(scr->last_dock, main_window); wapp->app_icon = findDockIconFor(scr->last_dock, main_window);
/* check main dock if we did not find it in last dock */ /* check main dock if we did not find it in last dock */
if (!wapp->app_icon && scr->dock) { if (!wapp->app_icon && scr->dock)
wapp->app_icon = findDockIconFor(scr->dock, main_window); wapp->app_icon = findDockIconFor(scr->dock, main_window);
}
/* finally check clips */ /* finally check clips */
if (!wapp->app_icon) { if (!wapp->app_icon) {
int i; int i;
@@ -319,9 +320,8 @@ WApplication *wApplicationCreate(WWindow * wwin)
wapp->app_icon = NULL; wapp->app_icon = NULL;
} }
if (wapp->app_icon) { if (wapp->app_icon)
wapp->app_icon->main_window = main_window; wapp->app_icon->main_window = main_window;
}
if (wapp->app_icon && !wapp->app_icon->docked) { if (wapp->app_icon && !wapp->app_icon->docked) {
WIcon *icon = wapp->app_icon->icon; WIcon *icon = wapp->app_icon->icon;
@@ -341,13 +341,13 @@ WApplication *wApplicationCreate(WWindow * wwin)
wAppIconMove(wapp->app_icon, x, y); wAppIconMove(wapp->app_icon, x, y);
wLowerFrame(icon->core); wLowerFrame(icon->core);
} }
if (!clip || !wapp->app_icon->attracted || !clip->collapsed) if (!clip || !wapp->app_icon->attracted || !clip->collapsed)
XMapWindow(dpy, icon->core->window); XMapWindow(dpy, icon->core->window);
} }
if (wPreferences.auto_arrange_icons && wapp->app_icon && !wapp->app_icon->attracted) { if (wPreferences.auto_arrange_icons && wapp->app_icon && !wapp->app_icon->attracted)
wArrangeIcons(scr, True); wArrangeIcons(scr, True);
}
if (wapp->app_icon) { if (wapp->app_icon) {
char *tmp, *path; char *tmp, *path;

View File

@@ -63,4 +63,3 @@ int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file); void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
#endif /* WMDEFAULTS_H_ */ #endif /* WMDEFAULTS_H_ */

View File

@@ -160,9 +160,8 @@ WIcon *wIconCreate(WWindow * wwin)
icon->file_image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class, wPreferences.icon_size); icon->file_image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class, wPreferences.icon_size);
file = wDefaultGetIconFile(scr, wwin->wm_instance, wwin->wm_class, False); file = wDefaultGetIconFile(scr, wwin->wm_instance, wwin->wm_class, False);
if (file) { if (file)
icon->file = wstrdup(file); icon->file = wstrdup(file);
}
icon->icon_name = wNETWMGetIconName(wwin->client_win); icon->icon_name = wNETWMGetIconName(wwin->client_win);
if (icon->icon_name) if (icon->icon_name)
@@ -476,7 +475,8 @@ char *wIconStore(WIcon * icon)
RImage *image = NULL; RImage *image = NULL;
WWindow *wwin = icon->owner; WWindow *wwin = icon->owner;
if (!wwin) return NULL; if (!wwin)
return NULL;
path = getnameforicon(wwin); path = getnameforicon(wwin);
if (!path) if (!path)
@@ -490,6 +490,7 @@ char *wIconStore(WIcon * icon)
wwin->wm_hints->icon_pixmap, (wwin->wm_hints->flags & IconMaskHint) wwin->wm_hints->icon_pixmap, (wwin->wm_hints->flags & IconMaskHint)
? wwin->wm_hints->icon_mask : None); ? wwin->wm_hints->icon_mask : None);
} }
if (!image) { if (!image) {
wfree(path); wfree(path);
return NULL; return NULL;
@@ -499,6 +500,7 @@ char *wIconStore(WIcon * icon)
wfree(path); wfree(path);
path = NULL; path = NULL;
} }
RReleaseImage(image); RReleaseImage(image);
return path; return path;
@@ -561,6 +563,7 @@ void wIconUpdate(WIcon * icon)
if (icon->pixmap != None) if (icon->pixmap != None)
XFreePixmap(dpy, icon->pixmap); XFreePixmap(dpy, icon->pixmap);
icon->pixmap = None; icon->pixmap = None;
if (wwin && WFLAGP(wwin, always_user_icon)) { if (wwin && WFLAGP(wwin, always_user_icon)) {

View File

@@ -387,14 +387,14 @@ static WMArray *makeWindowListArray(WWindow *curwin, int include_unmapped, Bool
if (((!fl && canReceiveFocus(wwin) > 0) || (fl && canReceiveFocus(wwin) < 0)) && if (((!fl && canReceiveFocus(wwin) > 0) || (fl && canReceiveFocus(wwin) < 0)) &&
(wwin->flags.mapped || include_unmapped)) { (wwin->flags.mapped || include_unmapped)) {
if (class_only) { if (class_only) {
if (!wwin->wm_class || !curwin->wm_class) if (!wwin->wm_class || !curwin->wm_class)
continue; continue;
if (strcmp(wwin->wm_class, curwin->wm_class)) if (strcmp(wwin->wm_class, curwin->wm_class))
continue; continue;
} }
if (!WFLAGP(wwin, skip_switchpanel)) if (!WFLAGP(wwin, skip_switchpanel))
WMAddToArray(windows, wwin); WMAddToArray(windows, wwin);
} }
} }
wwin = curwin; wwin = curwin;

View File

@@ -199,9 +199,8 @@ wDefaultFillAttributes(WScreen * scr, char *instance, char *class,
else else
key3 = NULL; key3 = NULL;
if (!ANoTitlebar) { if (!ANoTitlebar)
init_wdefaults(scr); init_wdefaults(scr);
}
WMPLSetCaseSensitive(True); WMPLSetCaseSensitive(True);
@@ -327,6 +326,7 @@ static WMPropList *get_generic_value(WScreen *scr, char *instance, char *class,
WMPLSetCaseSensitive(True); WMPLSetCaseSensitive(True);
/* Search the icon name using class and instance */
if (class && instance) { if (class && instance) {
char *buffer; char *buffer;
@@ -338,38 +338,39 @@ static WMPropList *get_generic_value(WScreen *scr, char *instance, char *class,
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key); dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
WMReleasePropList(key); WMReleasePropList(key);
if (dict) { if (dict)
value = WMGetFromPLDictionary(dict, option); value = WMGetFromPLDictionary(dict, option);
}
} }
/* Search the icon name using instance */
if (!value && instance) { if (!value && instance) {
key = WMCreatePLString(instance); key = WMCreatePLString(instance);
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key); dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
WMReleasePropList(key); WMReleasePropList(key);
if (dict) {
if (dict)
value = WMGetFromPLDictionary(dict, option); value = WMGetFromPLDictionary(dict, option);
}
} }
/* Search the icon name using class */
if (!value && class) { if (!value && class) {
key = WMCreatePLString(class); key = WMCreatePLString(class);
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key); dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
WMReleasePropList(key); WMReleasePropList(key);
if (dict) { if (dict)
value = WMGetFromPLDictionary(dict, option); value = WMGetFromPLDictionary(dict, option);
}
} }
/* Search the default icon name - See noDefault argument! */
if (!value && !noDefault) { if (!value && !noDefault) {
/* AnyWindow is "*" - see wdefaults.c */
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, AnyWindow); dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, AnyWindow);
if (dict) { if (dict)
value = WMGetFromPLDictionary(dict, option); value = WMGetFromPLDictionary(dict, option);
}
} }
WMPLSetCaseSensitive(False); WMPLSetCaseSensitive(False);
@@ -377,14 +378,14 @@ static WMPropList *get_generic_value(WScreen *scr, char *instance, char *class,
return value; return value;
} }
/* Get the name of the Icon File. If noDefault is False, then, default value included */
char *wDefaultGetIconFile(WScreen * scr, char *instance, char *class, Bool noDefault) char *wDefaultGetIconFile(WScreen * scr, char *instance, char *class, Bool noDefault)
{ {
WMPropList *value; WMPropList *value;
char *tmp; char *tmp;
if (!ANoTitlebar) { if (!ANoTitlebar)
init_wdefaults(scr); init_wdefaults(scr);
}
if (!WDWindowAttributes->dictionary) if (!WDWindowAttributes->dictionary)
return NULL; return NULL;
@@ -405,10 +406,12 @@ RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int max_s
char *path; char *path;
RImage *image; RImage *image;
/* Get the file name of the image, using instance and class */
file_name = wDefaultGetIconFile(scr, winstance, wclass, False); file_name = wDefaultGetIconFile(scr, winstance, wclass, False);
if (!file_name) if (!file_name)
return NULL; return NULL;
/* Search the file image in the icon paths */
path = FindImage(wPreferences.icon_path, file_name); path = FindImage(wPreferences.icon_path, file_name);
if (!path) { if (!path) {
@@ -417,9 +420,9 @@ RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int max_s
} }
image = RLoadImage(scr->rcontext, path, 0); image = RLoadImage(scr->rcontext, path, 0);
if (!image) { if (!image)
wwarning(_("error loading image file \"%s\": %s"), path, RMessageForError(RErrorCode)); wwarning(_("error loading image file \"%s\": %s"), path, RMessageForError(RErrorCode));
}
wfree(path); wfree(path);
image = wIconValidateIconSize(scr, image, max_size); image = wIconValidateIconSize(scr, image, max_size);
@@ -433,9 +436,8 @@ int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class)
int w, i; int w, i;
char *tmp; char *tmp;
if (!ANoTitlebar) { if (!ANoTitlebar)
init_wdefaults(scr); init_wdefaults(scr);
}
if (!WDWindowAttributes->dictionary) if (!WDWindowAttributes->dictionary)
return -1; return -1;
@@ -474,11 +476,10 @@ void wDefaultChangeIcon(WScreen * scr, char *instance, char *class, char *file)
if (!dict) { if (!dict) {
dict = WMCreatePLDictionary(NULL, NULL); dict = WMCreatePLDictionary(NULL, NULL);
if (dict) { if (dict)
db->dictionary = dict; db->dictionary = dict;
} else { else
return; return;
}
} }
WMPLSetCaseSensitive(True); WMPLSetCaseSensitive(True);
@@ -502,9 +503,8 @@ void wDefaultChangeIcon(WScreen * scr, char *instance, char *class, char *file)
icon_value = WMCreatePLDictionary(AIcon, value, NULL); icon_value = WMCreatePLDictionary(AIcon, value, NULL);
WMReleasePropList(value); WMReleasePropList(value);
if ((def_win = WMGetFromPLDictionary(dict, AnyWindow)) != NULL) { if ((def_win = WMGetFromPLDictionary(dict, AnyWindow)) != NULL)
def_icon = WMGetFromPLDictionary(def_win, AIcon); def_icon = WMGetFromPLDictionary(def_win, AIcon);
}
if (def_icon && !strcmp(WMGetFromPLString(def_icon), file)) if (def_icon && !strcmp(WMGetFromPLString(def_icon), file))
same = 1; same = 1;
@@ -520,9 +520,9 @@ void wDefaultChangeIcon(WScreen * scr, char *instance, char *class, char *file)
} else if (icon_value != NULL && !same) { } else if (icon_value != NULL && !same) {
WMPutInPLDictionary(dict, key, icon_value); WMPutInPLDictionary(dict, key, icon_value);
} }
if (!wPreferences.flags.noupdates) {
if (!wPreferences.flags.noupdates)
UpdateDomainFile(db); UpdateDomainFile(db);
}
WMReleasePropList(key); WMReleasePropList(key);
if (icon_value) if (icon_value)