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:
committed by
Carlos R. Mafra
parent
1a0e665e58
commit
aab9028fc2
@@ -120,6 +120,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
|
||||
|
||||
if (!old_scr)
|
||||
old_scr = scr;
|
||||
|
||||
old_focused = old_scr->focused_window;
|
||||
|
||||
LastFocusChange = timestamp;
|
||||
@@ -131,6 +132,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
|
||||
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
|
||||
if (old_focused)
|
||||
wWindowUnfocus(old_focused);
|
||||
|
||||
if (oapp) {
|
||||
wAppMenuUnmap(oapp->menu);
|
||||
wApplicationDeactivate(oapp);
|
||||
@@ -138,18 +140,17 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
|
||||
|
||||
WMPostNotificationName(WMNChangedFocus, NULL, (void *)True);
|
||||
return;
|
||||
} else if (old_scr != scr && old_focused) {
|
||||
wWindowUnfocus(old_focused);
|
||||
}
|
||||
|
||||
if (old_scr != scr && old_focused)
|
||||
wWindowUnfocus(old_focused);
|
||||
|
||||
wasfocused = wwin->flags.focused;
|
||||
napp = wApplicationOf(wwin->main_window);
|
||||
|
||||
/* remember last workspace where the app has been */
|
||||
if (napp) {
|
||||
/*napp->last_workspace = wwin->screen_ptr->current_workspace; */
|
||||
if (napp)
|
||||
napp->last_workspace = wwin->frame->workspace;
|
||||
}
|
||||
|
||||
if (wwin->flags.mapped && !WFLAGP(wwin, no_focusable)) {
|
||||
/* install colormap if colormap mode is lock mode */
|
||||
@@ -161,23 +162,23 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
|
||||
case WFM_NO_INPUT:
|
||||
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
|
||||
break;
|
||||
|
||||
case WFM_PASSIVE:
|
||||
case WFM_LOCALLY_ACTIVE:
|
||||
XSetInputFocus(dpy, wwin->client_win, RevertToParent, CurrentTime);
|
||||
break;
|
||||
|
||||
case WFM_GLOBALLY_ACTIVE:
|
||||
break;
|
||||
}
|
||||
|
||||
XFlush(dpy);
|
||||
if (wwin->protocols.TAKE_FOCUS) {
|
||||
if (wwin->protocols.TAKE_FOCUS)
|
||||
wClientSendProtocol(wwin, _XA_WM_TAKE_FOCUS, timestamp);
|
||||
}
|
||||
|
||||
XSync(dpy, False);
|
||||
} else {
|
||||
XSetInputFocus(dpy, scr->no_focus_win, RevertToParent, CurrentTime);
|
||||
}
|
||||
|
||||
if (WFLAGP(wwin, no_focusable))
|
||||
return;
|
||||
|
||||
@@ -206,7 +207,7 @@ void wSetFocusTo(WScreen *scr, WWindow *wwin)
|
||||
if (napp && !wasfocused) {
|
||||
#ifdef USER_MENU
|
||||
wUserMenuRefreshInstances(napp->menu, wwin);
|
||||
#endif /* USER_MENU */
|
||||
#endif /* USER_MENU */
|
||||
|
||||
if (wwin->flags.mapped)
|
||||
wAppMenuMap(napp->menu, wwin);
|
||||
@@ -908,14 +909,11 @@ void wIconifyWindow(WWindow * wwin)
|
||||
XWindowAttributes attribs;
|
||||
int present;
|
||||
|
||||
if (!XGetWindowAttributes(dpy, wwin->client_win, &attribs)) {
|
||||
/* the window doesn't exist anymore */
|
||||
return;
|
||||
}
|
||||
if (!XGetWindowAttributes(dpy, wwin->client_win, &attribs))
|
||||
return; /* the window doesn't exist anymore */
|
||||
|
||||
if (wwin->flags.miniaturized) {
|
||||
return;
|
||||
}
|
||||
if (wwin->flags.miniaturized)
|
||||
return; /* already miniaturized */
|
||||
|
||||
if (wwin->transient_for != None && wwin->transient_for != wwin->screen_ptr->root_win) {
|
||||
WWindow *owner = wWindowFor(wwin->transient_for);
|
||||
@@ -935,11 +933,10 @@ void wIconifyWindow(WWindow * wwin)
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
wwin->icon = wIconCreate(wwin);
|
||||
|
||||
wwin->icon = wIconCreate(wwin);
|
||||
wwin->icon->mapped = 1;
|
||||
}
|
||||
|
||||
@@ -947,7 +944,6 @@ void wIconifyWindow(WWindow * wwin)
|
||||
wwin->flags.mapped = 0;
|
||||
|
||||
/* unmap transients */
|
||||
|
||||
unmapTransientsFor(wwin);
|
||||
|
||||
if (present) {
|
||||
@@ -997,11 +993,9 @@ void wIconifyWindow(WWindow * wwin)
|
||||
if (!wPreferences.disable_miniwindows && !wwin->flags.net_handle_icon) {
|
||||
if (wwin->screen_ptr->current_workspace == wwin->frame->workspace ||
|
||||
IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)
|
||||
|
||||
XMapWindow(dpy, wwin->icon->core->window);
|
||||
|
||||
AddToStackList(wwin->icon->core);
|
||||
|
||||
wLowerFrame(wwin->icon->core);
|
||||
}
|
||||
|
||||
@@ -1085,9 +1079,8 @@ void wDeiconifyWindow(WWindow *wwin)
|
||||
|
||||
wwin->flags.miniaturized = 0;
|
||||
|
||||
if (!netwm_hidden && !wwin->flags.shaded) {
|
||||
if (!netwm_hidden && !wwin->flags.shaded)
|
||||
wwin->flags.mapped = 1;
|
||||
}
|
||||
|
||||
if (!netwm_hidden || wPreferences.sticky_icons) {
|
||||
/* maybe we want to do this regardless of net_handle_icon
|
||||
@@ -1135,14 +1128,14 @@ void wDeiconifyWindow(WWindow *wwin)
|
||||
#endif /* ANIMATIONS */
|
||||
wwin->flags.skip_next_animation = 0;
|
||||
XGrabServer(dpy);
|
||||
if (!wwin->flags.shaded) {
|
||||
if (!wwin->flags.shaded)
|
||||
XMapWindow(dpy, wwin->client_win);
|
||||
}
|
||||
|
||||
XMapWindow(dpy, wwin->frame->core->window);
|
||||
wRaiseFrame(wwin->frame->core);
|
||||
if (!wwin->flags.shaded) {
|
||||
if (!wwin->flags.shaded)
|
||||
wClientSetState(wwin, NormalState, None);
|
||||
}
|
||||
|
||||
mapTransientsFor(wwin);
|
||||
}
|
||||
|
||||
@@ -1167,16 +1160,14 @@ void wDeiconifyWindow(WWindow *wwin)
|
||||
ProcessPendingEvents();
|
||||
|
||||
/* the window can disappear while ProcessPendingEvents() runs */
|
||||
if (!wWindowFor(clientwin)) {
|
||||
if (!wWindowFor(clientwin))
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (wPreferences.auto_arrange_icons) {
|
||||
if (wPreferences.auto_arrange_icons)
|
||||
wArrangeIcons(wwin->screen_ptr, True);
|
||||
}
|
||||
|
||||
WMPostNotificationName(WMNChangedState, wwin, "iconify");
|
||||
|
||||
|
||||
@@ -193,19 +193,20 @@ void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char *wm_instance
|
||||
if (access(tmp, R_OK) == 0)
|
||||
iconPath = tmp;
|
||||
}
|
||||
|
||||
if (!iconPath) {
|
||||
strcpy(tmp, path);
|
||||
strcat(tmp, ".xpm");
|
||||
if (access(tmp, R_OK) == 0)
|
||||
iconPath = tmp;
|
||||
}
|
||||
|
||||
if (!iconPath)
|
||||
wfree(tmp);
|
||||
}
|
||||
|
||||
if (iconPath) {
|
||||
wApplicationSaveIconPathFor(iconPath, wm_instance, wm_class);
|
||||
|
||||
wfree(iconPath);
|
||||
}
|
||||
}
|
||||
@@ -263,20 +264,19 @@ WApplication *wApplicationCreate(WWindow * wwin)
|
||||
extractIcon(wapp->main_window_desc);
|
||||
|
||||
leader = wWindowFor(main_window);
|
||||
if (leader) {
|
||||
if (leader)
|
||||
leader->main_window = main_window;
|
||||
}
|
||||
|
||||
wapp->menu = wAppMenuGet(scr, main_window);
|
||||
#ifdef USER_MENU
|
||||
if (!wapp->menu)
|
||||
wapp->menu = wUserMenuGet(scr, wapp->main_window_desc);
|
||||
#endif /* USER_MENU */
|
||||
#endif /* USER_MENU */
|
||||
|
||||
/*
|
||||
* Set application wide attributes from the leader.
|
||||
*/
|
||||
wapp->flags.hidden = WFLAGP(wapp->main_window_desc, start_hidden);
|
||||
|
||||
wapp->flags.emulated = WFLAGP(wapp->main_window_desc, emulate_appicon);
|
||||
|
||||
/* application descriptor */
|
||||
@@ -286,10 +286,11 @@ WApplication *wApplicationCreate(WWindow * wwin)
|
||||
wapp->app_icon = NULL;
|
||||
if (scr->last_dock)
|
||||
wapp->app_icon = findDockIconFor(scr->last_dock, main_window);
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
/* finally check clips */
|
||||
if (!wapp->app_icon) {
|
||||
int i;
|
||||
@@ -319,9 +320,8 @@ WApplication *wApplicationCreate(WWindow * wwin)
|
||||
wapp->app_icon = NULL;
|
||||
}
|
||||
|
||||
if (wapp->app_icon) {
|
||||
if (wapp->app_icon)
|
||||
wapp->app_icon->main_window = main_window;
|
||||
}
|
||||
|
||||
if (wapp->app_icon && !wapp->app_icon->docked) {
|
||||
WIcon *icon = wapp->app_icon->icon;
|
||||
@@ -341,13 +341,13 @@ WApplication *wApplicationCreate(WWindow * wwin)
|
||||
wAppIconMove(wapp->app_icon, x, y);
|
||||
wLowerFrame(icon->core);
|
||||
}
|
||||
|
||||
if (!clip || !wapp->app_icon->attracted || !clip->collapsed)
|
||||
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);
|
||||
}
|
||||
|
||||
if (wapp->app_icon) {
|
||||
char *tmp, *path;
|
||||
|
||||
@@ -63,4 +63,3 @@ int wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class);
|
||||
void wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file);
|
||||
|
||||
#endif /* WMDEFAULTS_H_ */
|
||||
|
||||
|
||||
@@ -160,9 +160,8 @@ WIcon *wIconCreate(WWindow * wwin)
|
||||
icon->file_image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class, wPreferences.icon_size);
|
||||
|
||||
file = wDefaultGetIconFile(scr, wwin->wm_instance, wwin->wm_class, False);
|
||||
if (file) {
|
||||
if (file)
|
||||
icon->file = wstrdup(file);
|
||||
}
|
||||
|
||||
icon->icon_name = wNETWMGetIconName(wwin->client_win);
|
||||
if (icon->icon_name)
|
||||
@@ -476,7 +475,8 @@ char *wIconStore(WIcon * icon)
|
||||
RImage *image = NULL;
|
||||
WWindow *wwin = icon->owner;
|
||||
|
||||
if (!wwin) return NULL;
|
||||
if (!wwin)
|
||||
return NULL;
|
||||
|
||||
path = getnameforicon(wwin);
|
||||
if (!path)
|
||||
@@ -490,6 +490,7 @@ char *wIconStore(WIcon * icon)
|
||||
wwin->wm_hints->icon_pixmap, (wwin->wm_hints->flags & IconMaskHint)
|
||||
? wwin->wm_hints->icon_mask : None);
|
||||
}
|
||||
|
||||
if (!image) {
|
||||
wfree(path);
|
||||
return NULL;
|
||||
@@ -499,6 +500,7 @@ char *wIconStore(WIcon * icon)
|
||||
wfree(path);
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
RReleaseImage(image);
|
||||
|
||||
return path;
|
||||
@@ -561,6 +563,7 @@ void wIconUpdate(WIcon * icon)
|
||||
|
||||
if (icon->pixmap != None)
|
||||
XFreePixmap(dpy, icon->pixmap);
|
||||
|
||||
icon->pixmap = None;
|
||||
|
||||
if (wwin && WFLAGP(wwin, always_user_icon)) {
|
||||
|
||||
@@ -387,14 +387,14 @@ static WMArray *makeWindowListArray(WWindow *curwin, int include_unmapped, Bool
|
||||
if (((!fl && canReceiveFocus(wwin) > 0) || (fl && canReceiveFocus(wwin) < 0)) &&
|
||||
(wwin->flags.mapped || include_unmapped)) {
|
||||
if (class_only) {
|
||||
if (!wwin->wm_class || !curwin->wm_class)
|
||||
continue;
|
||||
if (strcmp(wwin->wm_class, curwin->wm_class))
|
||||
continue;
|
||||
if (!wwin->wm_class || !curwin->wm_class)
|
||||
continue;
|
||||
if (strcmp(wwin->wm_class, curwin->wm_class))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!WFLAGP(wwin, skip_switchpanel))
|
||||
WMAddToArray(windows, wwin);
|
||||
WMAddToArray(windows, wwin);
|
||||
}
|
||||
}
|
||||
wwin = curwin;
|
||||
|
||||
@@ -199,9 +199,8 @@ wDefaultFillAttributes(WScreen * scr, char *instance, char *class,
|
||||
else
|
||||
key3 = NULL;
|
||||
|
||||
if (!ANoTitlebar) {
|
||||
if (!ANoTitlebar)
|
||||
init_wdefaults(scr);
|
||||
}
|
||||
|
||||
WMPLSetCaseSensitive(True);
|
||||
|
||||
@@ -327,6 +326,7 @@ static WMPropList *get_generic_value(WScreen *scr, char *instance, char *class,
|
||||
|
||||
WMPLSetCaseSensitive(True);
|
||||
|
||||
/* Search the icon name using class and instance */
|
||||
if (class && instance) {
|
||||
char *buffer;
|
||||
|
||||
@@ -338,38 +338,39 @@ static WMPropList *get_generic_value(WScreen *scr, char *instance, char *class,
|
||||
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
|
||||
WMReleasePropList(key);
|
||||
|
||||
if (dict) {
|
||||
if (dict)
|
||||
value = WMGetFromPLDictionary(dict, option);
|
||||
}
|
||||
}
|
||||
|
||||
/* Search the icon name using instance */
|
||||
if (!value && instance) {
|
||||
key = WMCreatePLString(instance);
|
||||
|
||||
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
|
||||
WMReleasePropList(key);
|
||||
if (dict) {
|
||||
|
||||
if (dict)
|
||||
value = WMGetFromPLDictionary(dict, option);
|
||||
}
|
||||
}
|
||||
|
||||
/* Search the icon name using class */
|
||||
if (!value && class) {
|
||||
key = WMCreatePLString(class);
|
||||
|
||||
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
|
||||
WMReleasePropList(key);
|
||||
|
||||
if (dict) {
|
||||
if (dict)
|
||||
value = WMGetFromPLDictionary(dict, option);
|
||||
}
|
||||
}
|
||||
|
||||
/* Search the default icon name - See noDefault argument! */
|
||||
if (!value && !noDefault) {
|
||||
/* AnyWindow is "*" - see wdefaults.c */
|
||||
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, AnyWindow);
|
||||
|
||||
if (dict) {
|
||||
if (dict)
|
||||
value = WMGetFromPLDictionary(dict, option);
|
||||
}
|
||||
}
|
||||
|
||||
WMPLSetCaseSensitive(False);
|
||||
@@ -377,14 +378,14 @@ static WMPropList *get_generic_value(WScreen *scr, char *instance, char *class,
|
||||
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)
|
||||
{
|
||||
WMPropList *value;
|
||||
char *tmp;
|
||||
|
||||
if (!ANoTitlebar) {
|
||||
if (!ANoTitlebar)
|
||||
init_wdefaults(scr);
|
||||
}
|
||||
|
||||
if (!WDWindowAttributes->dictionary)
|
||||
return NULL;
|
||||
@@ -405,10 +406,12 @@ RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int max_s
|
||||
char *path;
|
||||
RImage *image;
|
||||
|
||||
/* Get the file name of the image, using instance and class */
|
||||
file_name = wDefaultGetIconFile(scr, winstance, wclass, False);
|
||||
if (!file_name)
|
||||
return NULL;
|
||||
|
||||
/* Search the file image in the icon paths */
|
||||
path = FindImage(wPreferences.icon_path, file_name);
|
||||
|
||||
if (!path) {
|
||||
@@ -417,9 +420,9 @@ RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int max_s
|
||||
}
|
||||
|
||||
image = RLoadImage(scr->rcontext, path, 0);
|
||||
if (!image) {
|
||||
if (!image)
|
||||
wwarning(_("error loading image file \"%s\": %s"), path, RMessageForError(RErrorCode));
|
||||
}
|
||||
|
||||
wfree(path);
|
||||
|
||||
image = wIconValidateIconSize(scr, image, max_size);
|
||||
@@ -433,9 +436,8 @@ int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class)
|
||||
int w, i;
|
||||
char *tmp;
|
||||
|
||||
if (!ANoTitlebar) {
|
||||
if (!ANoTitlebar)
|
||||
init_wdefaults(scr);
|
||||
}
|
||||
|
||||
if (!WDWindowAttributes->dictionary)
|
||||
return -1;
|
||||
@@ -474,11 +476,10 @@ void wDefaultChangeIcon(WScreen * scr, char *instance, char *class, char *file)
|
||||
|
||||
if (!dict) {
|
||||
dict = WMCreatePLDictionary(NULL, NULL);
|
||||
if (dict) {
|
||||
if (dict)
|
||||
db->dictionary = dict;
|
||||
} else {
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
WMPLSetCaseSensitive(True);
|
||||
@@ -502,9 +503,8 @@ void wDefaultChangeIcon(WScreen * scr, char *instance, char *class, char *file)
|
||||
icon_value = WMCreatePLDictionary(AIcon, value, NULL);
|
||||
WMReleasePropList(value);
|
||||
|
||||
if ((def_win = WMGetFromPLDictionary(dict, AnyWindow)) != NULL) {
|
||||
if ((def_win = WMGetFromPLDictionary(dict, AnyWindow)) != NULL)
|
||||
def_icon = WMGetFromPLDictionary(def_win, AIcon);
|
||||
}
|
||||
|
||||
if (def_icon && !strcmp(WMGetFromPLString(def_icon), file))
|
||||
same = 1;
|
||||
@@ -520,9 +520,9 @@ void wDefaultChangeIcon(WScreen * scr, char *instance, char *class, char *file)
|
||||
} else if (icon_value != NULL && !same) {
|
||||
WMPutInPLDictionary(dict, key, icon_value);
|
||||
}
|
||||
if (!wPreferences.flags.noupdates) {
|
||||
|
||||
if (!wPreferences.flags.noupdates)
|
||||
UpdateDomainFile(db);
|
||||
}
|
||||
|
||||
WMReleasePropList(key);
|
||||
if (icon_value)
|
||||
|
||||
Reference in New Issue
Block a user