mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
WindowMaker: Clean curly brackets
This patch removes the unneeded curly brackets in multiple files. It also add some comments in the code. In usermenu.c removes some variables not used.
This commit is contained in:
committed by
Carlos R. Mafra
parent
afe2e5d9d6
commit
761fd37e51
@@ -114,8 +114,10 @@ static void extractIcon(WWindow * wwin)
|
|||||||
{
|
{
|
||||||
char *progname;
|
char *progname;
|
||||||
|
|
||||||
|
/* Get the application name */
|
||||||
progname = GetProgramNameForWindow(wwin->client_win);
|
progname = GetProgramNameForWindow(wwin->client_win);
|
||||||
if (progname) {
|
if (progname) {
|
||||||
|
/* Save the icon path if the application is ".app" */
|
||||||
wApplicationExtractDirPackIcon(wwin->screen_ptr, progname, wwin->wm_instance, wwin->wm_class);
|
wApplicationExtractDirPackIcon(wwin->screen_ptr, progname, wwin->wm_instance, wwin->wm_class);
|
||||||
wfree(progname);
|
wfree(progname);
|
||||||
}
|
}
|
||||||
@@ -148,8 +150,8 @@ void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance, char *wm_cla
|
|||||||
|
|
||||||
key = WMCreatePLString(tmp);
|
key = WMCreatePLString(tmp);
|
||||||
wfree(tmp);
|
wfree(tmp);
|
||||||
adict = WMGetFromPLDictionary(dict, key);
|
|
||||||
|
|
||||||
|
adict = WMGetFromPLDictionary(dict, key);
|
||||||
iconk = WMCreatePLString("Icon");
|
iconk = WMCreatePLString("Icon");
|
||||||
|
|
||||||
if (adict) {
|
if (adict) {
|
||||||
@@ -161,6 +163,7 @@ void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance, char *wm_cla
|
|||||||
WMReleasePropList(adict);
|
WMReleasePropList(adict);
|
||||||
val = NULL;
|
val = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!val) {
|
if (!val) {
|
||||||
val = WMCreatePLString(iconPath);
|
val = WMCreatePLString(iconPath);
|
||||||
WMPutInPLDictionary(adict, iconk, val);
|
WMPutInPLDictionary(adict, iconk, val);
|
||||||
@@ -168,20 +171,20 @@ void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance, char *wm_cla
|
|||||||
} else {
|
} else {
|
||||||
val = NULL;
|
val = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
WMReleasePropList(key);
|
WMReleasePropList(key);
|
||||||
WMReleasePropList(iconk);
|
WMReleasePropList(iconk);
|
||||||
|
|
||||||
if (val && !wPreferences.flags.noupdates) {
|
if (val && !wPreferences.flags.noupdates)
|
||||||
UpdateDomainFile(WDWindowAttributes);
|
UpdateDomainFile(WDWindowAttributes);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function is used if the application is a .app. It checks if it has an icon in it
|
||||||
|
* like for example /usr/local/GNUstep/Applications/WPrefs.app/WPrefs.tiff
|
||||||
|
*/
|
||||||
void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char *wm_instance, char *wm_class)
|
void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char *wm_instance, char *wm_class)
|
||||||
{
|
{
|
||||||
char *iconPath = NULL;
|
char *iconPath = NULL;
|
||||||
/* Maybe the app is a .app and it has an icon in it, like
|
|
||||||
* /usr/local/GNUstep/Applications/WPrefs.app/WPrefs.tiff
|
|
||||||
*/
|
|
||||||
if (strstr(path, ".app")) {
|
if (strstr(path, ".app")) {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
|
|||||||
@@ -906,10 +906,12 @@ void wDefaultsCheckDomains(void* arg)
|
|||||||
if (stat(WDWindowMaker->path, &stbuf) >= 0 && WDWindowMaker->timestamp < stbuf.st_mtime) {
|
if (stat(WDWindowMaker->path, &stbuf) >= 0 && WDWindowMaker->timestamp < stbuf.st_mtime) {
|
||||||
WDWindowMaker->timestamp = stbuf.st_mtime;
|
WDWindowMaker->timestamp = stbuf.st_mtime;
|
||||||
|
|
||||||
/* global dictionary */
|
/* Global dictionary */
|
||||||
shared_dict = readGlobalDomain("WindowMaker", True);
|
shared_dict = readGlobalDomain("WindowMaker", True);
|
||||||
/* user dictionary */
|
|
||||||
|
/* User dictionary */
|
||||||
dict = WMReadPropListFromFile(WDWindowMaker->path);
|
dict = WMReadPropListFromFile(WDWindowMaker->path);
|
||||||
|
|
||||||
if (dict) {
|
if (dict) {
|
||||||
if (!WMIsPLDictionary(dict)) {
|
if (!WMIsPLDictionary(dict)) {
|
||||||
WMReleasePropList(dict);
|
WMReleasePropList(dict);
|
||||||
@@ -923,22 +925,25 @@ void wDefaultsCheckDomains(void* arg)
|
|||||||
dict = shared_dict;
|
dict = shared_dict;
|
||||||
shared_dict = NULL;
|
shared_dict = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < wScreenCount; i++) {
|
for (i = 0; i < wScreenCount; i++) {
|
||||||
scr = wScreenWithNumber(i);
|
scr = wScreenWithNumber(i);
|
||||||
if (scr)
|
if (scr)
|
||||||
wReadDefaults(scr, dict);
|
wReadDefaults(scr, dict);
|
||||||
}
|
}
|
||||||
if (WDWindowMaker->dictionary) {
|
|
||||||
|
if (WDWindowMaker->dictionary)
|
||||||
WMReleasePropList(WDWindowMaker->dictionary);
|
WMReleasePropList(WDWindowMaker->dictionary);
|
||||||
}
|
|
||||||
WDWindowMaker->dictionary = dict;
|
WDWindowMaker->dictionary = dict;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
|
wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
|
||||||
}
|
}
|
||||||
if (shared_dict) {
|
|
||||||
|
if (shared_dict)
|
||||||
WMReleasePropList(shared_dict);
|
WMReleasePropList(shared_dict);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat(WDWindowAttributes->path, &stbuf) >= 0 && WDWindowAttributes->timestamp < stbuf.st_mtime) {
|
if (stat(WDWindowAttributes->path, &stbuf) >= 0 && WDWindowAttributes->timestamp < stbuf.st_mtime) {
|
||||||
@@ -1051,9 +1056,9 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
|
|||||||
if (!plvalue && !old_value) {
|
if (!plvalue && !old_value) {
|
||||||
/* no default in the DB. Use builtin default */
|
/* no default in the DB. Use builtin default */
|
||||||
plvalue = entry->plvalue;
|
plvalue = entry->plvalue;
|
||||||
if (plvalue && new_dict) {
|
if (plvalue && new_dict)
|
||||||
WMPutInPLDictionary(new_dict, entry->plkey, plvalue);
|
WMPutInPLDictionary(new_dict, entry->plkey, plvalue);
|
||||||
}
|
|
||||||
} else if (!plvalue) {
|
} else if (!plvalue) {
|
||||||
/* value was deleted from DB. Keep current value */
|
/* value was deleted from DB. Keep current value */
|
||||||
continue;
|
continue;
|
||||||
@@ -1062,7 +1067,6 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
|
|||||||
} else if (!WMIsPropListEqualTo(plvalue, old_value)) {
|
} else if (!WMIsPropListEqualTo(plvalue, old_value)) {
|
||||||
/* value has changed */
|
/* value has changed */
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (strcmp(entry->key, "WorkspaceBack") == 0
|
if (strcmp(entry->key, "WorkspaceBack") == 0
|
||||||
&& update_workspace_back && scr->flags.backimage_helper_launched) {
|
&& update_workspace_back && scr->flags.backimage_helper_launched) {
|
||||||
} else {
|
} else {
|
||||||
@@ -1080,13 +1084,13 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
|
|||||||
* sure to send the default background texture config
|
* sure to send the default background texture config
|
||||||
* to the helper.
|
* to the helper.
|
||||||
*/
|
*/
|
||||||
if (strcmp(entry->key, "WorkspaceSpecificBack") == 0
|
if (strcmp(entry->key, "WorkspaceSpecificBack") == 0 &&
|
||||||
&& !scr->flags.backimage_helper_launched) {
|
!scr->flags.backimage_helper_launched)
|
||||||
update_workspace_back = 1;
|
update_workspace_back = 1;
|
||||||
}
|
|
||||||
if (entry->update) {
|
if (entry->update)
|
||||||
needs_refresh |= (*entry->update) (scr, entry, tdata, entry->extra_data);
|
needs_refresh |= (*entry->update) (scr, entry, tdata, entry->extra_data);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1116,29 +1120,23 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
|
|||||||
WMPostNotificationName(WNMenuAppearanceSettingsChanged, NULL, (void *)(uintptr_t) foo);
|
WMPostNotificationName(WNMenuAppearanceSettingsChanged, NULL, (void *)(uintptr_t) foo);
|
||||||
|
|
||||||
foo = 0;
|
foo = 0;
|
||||||
if (needs_refresh & REFRESH_WINDOW_FONT) {
|
if (needs_refresh & REFRESH_WINDOW_FONT)
|
||||||
foo |= WFontSettings;
|
foo |= WFontSettings;
|
||||||
}
|
if (needs_refresh & REFRESH_WINDOW_TEXTURES)
|
||||||
if (needs_refresh & REFRESH_WINDOW_TEXTURES) {
|
|
||||||
foo |= WTextureSettings;
|
foo |= WTextureSettings;
|
||||||
}
|
if (needs_refresh & REFRESH_WINDOW_TITLE_COLOR)
|
||||||
if (needs_refresh & REFRESH_WINDOW_TITLE_COLOR) {
|
|
||||||
foo |= WColorSettings;
|
foo |= WColorSettings;
|
||||||
}
|
|
||||||
if (foo)
|
if (foo)
|
||||||
WMPostNotificationName(WNWindowAppearanceSettingsChanged, NULL, (void *)(uintptr_t) foo);
|
WMPostNotificationName(WNWindowAppearanceSettingsChanged, NULL, (void *)(uintptr_t) foo);
|
||||||
|
|
||||||
if (!(needs_refresh & REFRESH_ICON_TILE)) {
|
if (!(needs_refresh & REFRESH_ICON_TILE)) {
|
||||||
foo = 0;
|
foo = 0;
|
||||||
if (needs_refresh & REFRESH_ICON_FONT) {
|
if (needs_refresh & REFRESH_ICON_FONT)
|
||||||
foo |= WFontSettings;
|
foo |= WFontSettings;
|
||||||
}
|
if (needs_refresh & REFRESH_ICON_TITLE_COLOR)
|
||||||
if (needs_refresh & REFRESH_ICON_TITLE_COLOR) {
|
|
||||||
foo |= WTextureSettings;
|
foo |= WTextureSettings;
|
||||||
}
|
if (needs_refresh & REFRESH_ICON_TITLE_BACK)
|
||||||
if (needs_refresh & REFRESH_ICON_TITLE_BACK) {
|
|
||||||
foo |= WTextureSettings;
|
foo |= WTextureSettings;
|
||||||
}
|
|
||||||
if (foo)
|
if (foo)
|
||||||
WMPostNotificationName(WNIconAppearanceSettingsChanged, NULL,
|
WMPostNotificationName(WNIconAppearanceSettingsChanged, NULL,
|
||||||
(void *)(uintptr_t) foo);
|
(void *)(uintptr_t) foo);
|
||||||
|
|||||||
@@ -574,9 +574,9 @@ static void execInitScript()
|
|||||||
wfree(paths);
|
wfree(paths);
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
if (system(file) != 0) {
|
if (system(file) != 0)
|
||||||
werror(_("%s:could not execute initialization script"), file);
|
werror(_("%s:could not execute initialization script"), file);
|
||||||
}
|
|
||||||
wfree(file);
|
wfree(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,9 +592,9 @@ void ExecExitScript()
|
|||||||
wfree(paths);
|
wfree(paths);
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
if (system(file) != 0) {
|
if (system(file) != 0)
|
||||||
werror(_("%s:could not execute exit script"), file);
|
werror(_("%s:could not execute exit script"), file);
|
||||||
}
|
|
||||||
wfree(file);
|
wfree(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -407,9 +407,8 @@ char *FindImage(char *paths, char *file)
|
|||||||
path = wfindfile(paths, file);
|
path = wfindfile(paths, file);
|
||||||
*tmp = ':';
|
*tmp = ':';
|
||||||
}
|
}
|
||||||
if (!tmp || !path) {
|
if (!tmp || !path)
|
||||||
path = wfindfile(paths, file);
|
path = wfindfile(paths, file);
|
||||||
}
|
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ static void legalPanelCommand(WMenu * menu, WMenuEntry * entry)
|
|||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
|
||||||
static char *getLocalizedMenuFile(char *menu)
|
static char * getLocalizedMenuFile(char *menu)
|
||||||
{
|
{
|
||||||
char *buffer, *ptr, *locale;
|
char *buffer, *ptr, *locale;
|
||||||
int len;
|
int len;
|
||||||
@@ -309,9 +309,8 @@ static char *getLocalizedMenuFile(char *menu)
|
|||||||
|
|
||||||
/* try menu.locale_name */
|
/* try menu.locale_name */
|
||||||
snprintf(buffer, len, "%s.%s", menu, Locale);
|
snprintf(buffer, len, "%s.%s", menu, Locale);
|
||||||
if (access(buffer, F_OK) == 0) {
|
if (access(buffer, F_OK) == 0)
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
|
||||||
|
|
||||||
/* position of locale in our buffer */
|
/* position of locale in our buffer */
|
||||||
locale = buffer + strlen(menu) + 1;
|
locale = buffer + strlen(menu) + 1;
|
||||||
@@ -320,17 +319,16 @@ static char *getLocalizedMenuFile(char *menu)
|
|||||||
ptr = strchr(locale, '.');
|
ptr = strchr(locale, '.');
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
if (access(buffer, F_OK) == 0) {
|
if (access(buffer, F_OK) == 0)
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now check for aa */
|
/* now check for aa */
|
||||||
ptr = strchr(locale, '_');
|
ptr = strchr(locale, '_');
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
if (access(buffer, F_OK) == 0) {
|
if (access(buffer, F_OK) == 0)
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wfree(buffer);
|
wfree(buffer);
|
||||||
|
|||||||
@@ -214,9 +214,8 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
|||||||
|
|
||||||
for (mask = 0, i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
for (mask = 0, i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||||
if (scr->shortcutWindows[i] != NULL &&
|
if (scr->shortcutWindows[i] != NULL &&
|
||||||
WMGetFirstInArray(scr->shortcutWindows[i], wwin) != WANotFound) {
|
WMGetFirstInArray(scr->shortcutWindows[i], wwin) != WANotFound)
|
||||||
mask |= 1 << i;
|
mask |= 1 << i;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), "%u", mask);
|
snprintf(buffer, sizeof(buffer), "%u", mask);
|
||||||
@@ -535,6 +534,7 @@ void wSessionRestoreLastWorkspace(WScreen * scr)
|
|||||||
|
|
||||||
tmp = WMGetFromPLString(wks);
|
tmp = WMGetFromPLString(wks);
|
||||||
|
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
WMPLSetCaseSensitive(False);
|
WMPLSetCaseSensitive(False);
|
||||||
|
|
||||||
@@ -550,7 +550,6 @@ void wSessionRestoreLastWorkspace(WScreen * scr)
|
|||||||
w--;
|
w--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w != scr->current_workspace && w < scr->workspace_count) {
|
if (w != scr->current_workspace && w < scr->workspace_count)
|
||||||
wWorkspaceChange(scr, w);
|
wWorkspaceChange(scr, w);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -540,9 +540,8 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < sizeof(atomNames) / sizeof(char *); i++) {
|
for (i = 0; i < sizeof(atomNames) / sizeof(char *); i++)
|
||||||
atom[i] = XInternAtom(dpy, atomNames[i], False);
|
atom[i] = XInternAtom(dpy, atomNames[i], False);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -591,17 +590,17 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
wCursor[WCUR_QUESTION] = XCreateFontCursor(dpy, XC_question_arrow);
|
wCursor[WCUR_QUESTION] = XCreateFontCursor(dpy, XC_question_arrow);
|
||||||
wCursor[WCUR_TEXT] = XCreateFontCursor(dpy, XC_xterm); /* odd name??? */
|
wCursor[WCUR_TEXT] = XCreateFontCursor(dpy, XC_xterm); /* odd name??? */
|
||||||
wCursor[WCUR_SELECT] = XCreateFontCursor(dpy, XC_cross);
|
wCursor[WCUR_SELECT] = XCreateFontCursor(dpy, XC_cross);
|
||||||
{
|
|
||||||
Pixmap cur = XCreatePixmap(dpy, DefaultRootWindow(dpy), 16, 16, 1);
|
Pixmap cur = XCreatePixmap(dpy, DefaultRootWindow(dpy), 16, 16, 1);
|
||||||
GC gc = XCreateGC(dpy, cur, 0, NULL);
|
GC gc = XCreateGC(dpy, cur, 0, NULL);
|
||||||
XColor black;
|
XColor black;
|
||||||
memset(&black, 0, sizeof(XColor));
|
memset(&black, 0, sizeof(XColor));
|
||||||
XSetForeground(dpy, gc, 0);
|
XSetForeground(dpy, gc, 0);
|
||||||
XFillRectangle(dpy, cur, gc, 0, 0, 16, 16);
|
XFillRectangle(dpy, cur, gc, 0, 0, 16, 16);
|
||||||
XFreeGC(dpy, gc);
|
XFreeGC(dpy, gc);
|
||||||
wCursor[WCUR_EMPTY] = XCreatePixmapCursor(dpy, cur, cur, &black, &black, 0, 0);
|
wCursor[WCUR_EMPTY] = XCreatePixmapCursor(dpy, cur, cur, &black, &black, 0, 0);
|
||||||
XFreePixmap(dpy, cur);
|
XFreePixmap(dpy, cur);
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef HAVE_INOTIFY
|
#ifndef HAVE_INOTIFY
|
||||||
/* signal handler stuff that gets called when a signal is caught */
|
/* signal handler stuff that gets called when a signal is caught */
|
||||||
@@ -668,9 +667,8 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
|
|
||||||
/* initialize defaults stuff */
|
/* initialize defaults stuff */
|
||||||
WDWindowMaker = wDefaultsInitDomain("WindowMaker", True);
|
WDWindowMaker = wDefaultsInitDomain("WindowMaker", True);
|
||||||
if (!WDWindowMaker->dictionary) {
|
if (!WDWindowMaker->dictionary)
|
||||||
wwarning(_("could not read domain \"%s\" from defaults database"), "WindowMaker");
|
wwarning(_("could not read domain \"%s\" from defaults database"), "WindowMaker");
|
||||||
}
|
|
||||||
|
|
||||||
/* read defaults that don't change until a restart and are
|
/* read defaults that don't change until a restart and are
|
||||||
* screen independent */
|
* screen independent */
|
||||||
@@ -685,15 +683,14 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
|
|
||||||
/* init other domains */
|
/* init other domains */
|
||||||
WDRootMenu = wDefaultsInitDomain("WMRootMenu", False);
|
WDRootMenu = wDefaultsInitDomain("WMRootMenu", False);
|
||||||
if (!WDRootMenu->dictionary) {
|
if (!WDRootMenu->dictionary)
|
||||||
wwarning(_("could not read domain \"%s\" from defaults database"), "WMRootMenu");
|
wwarning(_("could not read domain \"%s\" from defaults database"), "WMRootMenu");
|
||||||
}
|
|
||||||
wDefaultsMergeGlobalMenus(WDRootMenu);
|
wDefaultsMergeGlobalMenus(WDRootMenu);
|
||||||
|
|
||||||
WDWindowAttributes = wDefaultsInitDomain("WMWindowAttributes", True);
|
WDWindowAttributes = wDefaultsInitDomain("WMWindowAttributes", True);
|
||||||
if (!WDWindowAttributes->dictionary) {
|
if (!WDWindowAttributes->dictionary)
|
||||||
wwarning(_("could not read domain \"%s\" from defaults database"), "WMWindowAttributes");
|
wwarning(_("could not read domain \"%s\" from defaults database"), "WMWindowAttributes");
|
||||||
}
|
|
||||||
|
|
||||||
XSetErrorHandler((XErrorHandler) catchXError);
|
XSetErrorHandler((XErrorHandler) catchXError);
|
||||||
|
|
||||||
@@ -714,11 +711,11 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (defaultScreenOnly) {
|
if (defaultScreenOnly)
|
||||||
max = 1;
|
max = 1;
|
||||||
} else {
|
else
|
||||||
max = ScreenCount(dpy);
|
max = ScreenCount(dpy);
|
||||||
}
|
|
||||||
wScreen = wmalloc(sizeof(WScreen *) * max);
|
wScreen = wmalloc(sizeof(WScreen *) * max);
|
||||||
|
|
||||||
wScreenCount = 0;
|
wScreenCount = 0;
|
||||||
@@ -783,11 +780,10 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* go to workspace where we were before restart */
|
/* go to workspace where we were before restart */
|
||||||
if (lastDesktop >= 0) {
|
if (lastDesktop >= 0)
|
||||||
wWorkspaceForceChange(wScreen[j], lastDesktop);
|
wWorkspaceForceChange(wScreen[j], lastDesktop);
|
||||||
} else {
|
else
|
||||||
wSessionRestoreLastWorkspace(wScreen[j]);
|
wSessionRestoreLastWorkspace(wScreen[j]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wScreenCount == 0) {
|
if (wScreenCount == 0) {
|
||||||
@@ -796,10 +792,9 @@ void StartUp(Bool defaultScreenOnly)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_INOTIFY
|
#ifndef HAVE_INOTIFY
|
||||||
if (!wPreferences.flags.nopolling && !wPreferences.flags.noupdates) {
|
/* setup defaults file polling */
|
||||||
/* setup defaults file polling */
|
if (!wPreferences.flags.nopolling && !wPreferences.flags.noupdates)
|
||||||
WMAddTimerHandler(3000, wDefaultsCheckDomains, NULL);
|
WMAddTimerHandler(3000, wDefaultsCheckDomains, NULL);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ static void removeUserMenudata(void *menudata)
|
|||||||
WUserMenuData *data = menudata;
|
WUserMenuData *data = menudata;
|
||||||
if (data->key)
|
if (data->key)
|
||||||
wfree(data->key);
|
wfree(data->key);
|
||||||
|
|
||||||
wfree(data);
|
wfree(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,22 +133,21 @@ static WUserMenuData *convertShortcuts(WScreen * scr, WMPropList * shortcut)
|
|||||||
{
|
{
|
||||||
WUserMenuData *data;
|
WUserMenuData *data;
|
||||||
KeySym ksym;
|
KeySym ksym;
|
||||||
char *k;
|
char *k, *buffer, buf[MAX_SHORTCUT_LENGTH], *b;
|
||||||
char *buffer;
|
|
||||||
char buf[MAX_SHORTCUT_LENGTH], *b;
|
|
||||||
int keycount, i, j, mod;
|
int keycount, i, j, mod;
|
||||||
|
|
||||||
if (WMIsPLString(shortcut)) {
|
if (WMIsPLString(shortcut)) {
|
||||||
keycount = 1;
|
keycount = 1;
|
||||||
} else if (WMIsPLArray(shortcut)) {
|
} else if (WMIsPLArray(shortcut)) {
|
||||||
keycount = WMGetPropListItemCount(shortcut);
|
keycount = WMGetPropListItemCount(shortcut);
|
||||||
} else
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
/*for (i=0;i<keycount;i++){ */
|
}
|
||||||
|
|
||||||
data = wmalloc(sizeof(WUserMenuData));
|
data = wmalloc(sizeof(WUserMenuData));
|
||||||
if (!data)
|
if (!data)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
data->key = wmalloc(sizeof(WShortKey) * keycount);
|
data->key = wmalloc(sizeof(WShortKey) * keycount);
|
||||||
if (!data->key) {
|
if (!data->key) {
|
||||||
wfree(data);
|
wfree(data);
|
||||||
@@ -156,32 +156,30 @@ static WUserMenuData *convertShortcuts(WScreen * scr, WMPropList * shortcut)
|
|||||||
|
|
||||||
for (i = 0, j = 0; i < keycount; i++) {
|
for (i = 0, j = 0; i < keycount; i++) {
|
||||||
data->key[j].modifier = 0;
|
data->key[j].modifier = 0;
|
||||||
if (WMIsPLArray(shortcut)) {
|
if (WMIsPLArray(shortcut))
|
||||||
wstrlcpy(buf, WMGetFromPLString(WMGetFromPLArray(shortcut, i)), MAX_SHORTCUT_LENGTH);
|
wstrlcpy(buf, WMGetFromPLString(WMGetFromPLArray(shortcut, i)), MAX_SHORTCUT_LENGTH);
|
||||||
} else {
|
else
|
||||||
wstrlcpy(buf, WMGetFromPLString(shortcut), MAX_SHORTCUT_LENGTH);
|
wstrlcpy(buf, WMGetFromPLString(shortcut), MAX_SHORTCUT_LENGTH);
|
||||||
}
|
|
||||||
b = (char *)buf;
|
b = (char *)buf;
|
||||||
|
|
||||||
while ((k = strchr(b, '+')) != NULL) {
|
while ((k = strchr(b, '+')) != NULL) {
|
||||||
*k = 0;
|
*k = 0;
|
||||||
mod = wXModifierFromKey(b);
|
mod = wXModifierFromKey(b);
|
||||||
if (mod < 0) {
|
if (mod < 0)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
data->key[j].modifier |= mod;
|
data->key[j].modifier |= mod;
|
||||||
b = k + 1;
|
b = k + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ksym = XStringToKeysym(b);
|
ksym = XStringToKeysym(b);
|
||||||
if (ksym == NoSymbol) {
|
if (ksym == NoSymbol)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
data->key[j].keycode = XKeysymToKeycode(dpy, ksym);
|
data->key[j].keycode = XKeysymToKeycode(dpy, ksym);
|
||||||
if (data->key[j].keycode) {
|
if (data->key[j].keycode)
|
||||||
j++;
|
j++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
keyover:
|
keyover:
|
||||||
@@ -209,18 +207,17 @@ static WMenu *configureUserMenu(WScreen * scr, WMPropList * plum)
|
|||||||
|
|
||||||
if (!plum)
|
if (!plum)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!WMIsPLArray(plum)) {
|
|
||||||
|
if (!WMIsPLArray(plum))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
count = WMGetPropListItemCount(plum);
|
count = WMGetPropListItemCount(plum);
|
||||||
if (!count)
|
if (!count)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
elem = WMGetFromPLArray(plum, 0);
|
elem = WMGetFromPLArray(plum, 0);
|
||||||
if (!WMIsPLString(elem)) {
|
if (!WMIsPLString(elem))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
mtitle = WMGetFromPLString(elem);
|
mtitle = WMGetFromPLString(elem);
|
||||||
|
|
||||||
@@ -257,10 +254,10 @@ static WMenu *configureUserMenu(WScreen * scr, WMPropList * plum)
|
|||||||
notifyClient, data);
|
notifyClient, data);
|
||||||
|
|
||||||
if (entry) {
|
if (entry) {
|
||||||
if (WMIsPLString(params)) {
|
if (WMIsPLString(params))
|
||||||
entry->rtext =
|
entry->rtext =
|
||||||
GetShortcutString(WMGetFromPLString(params));
|
GetShortcutString(WMGetFromPLString(params));
|
||||||
}
|
|
||||||
entry->free_cdata = removeUserMenudata;
|
entry->free_cdata = removeUserMenudata;
|
||||||
|
|
||||||
if (WMGetPropListItemCount(elem) >= 4) {
|
if (WMGetPropListItemCount(elem) >= 4) {
|
||||||
@@ -323,14 +320,11 @@ void wUserMenuRefreshInstances(WMenu * menu, WWindow * wwin)
|
|||||||
|
|
||||||
static WMenu *readUserMenuFile(WScreen * scr, char *file_name)
|
static WMenu *readUserMenuFile(WScreen * scr, char *file_name)
|
||||||
{
|
{
|
||||||
WMenu *menu;
|
WMenu *menu = NULL;
|
||||||
char *mtitle;
|
WMPropList *plum;
|
||||||
WMPropList *plum, *elem, *title, *command, *params;
|
|
||||||
int count, i;
|
|
||||||
|
|
||||||
menu = NULL;
|
|
||||||
plum = WMReadPropListFromFile(file_name);
|
plum = WMReadPropListFromFile(file_name);
|
||||||
/**/ if (plum) {
|
if (plum) {
|
||||||
menu = configureUserMenu(scr, plum);
|
menu = configureUserMenu(scr, plum);
|
||||||
WMReleasePropList(plum);
|
WMReleasePropList(plum);
|
||||||
}
|
}
|
||||||
@@ -353,9 +347,8 @@ WMenu *wUserMenuGet(WScreen * scr, WWindow * wwin)
|
|||||||
if (!path)
|
if (!path)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (wwin) {
|
if (wwin)
|
||||||
menu = readUserMenuFile(scr, path);
|
menu = readUserMenuFile(scr, path);
|
||||||
}
|
|
||||||
|
|
||||||
wfree(path);
|
wfree(path);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -786,10 +786,10 @@ WWindow *wManageWindow(WScreen *scr, Window window)
|
|||||||
index = WMFindInArray(scr->fakeGroupLeaders, matchIdentifier, (void *)buffer);
|
index = WMFindInArray(scr->fakeGroupLeaders, matchIdentifier, (void *)buffer);
|
||||||
if (index != WANotFound) {
|
if (index != WANotFound) {
|
||||||
fPtr = WMGetFromArray(scr->fakeGroupLeaders, index);
|
fPtr = WMGetFromArray(scr->fakeGroupLeaders, index);
|
||||||
if (fPtr->retainCount == 0) {
|
if (fPtr->retainCount == 0)
|
||||||
fPtr->leader = createFakeWindowGroupLeader(scr, wwin->main_window,
|
fPtr->leader = createFakeWindowGroupLeader(scr, wwin->main_window,
|
||||||
instance, class);
|
instance, class);
|
||||||
}
|
|
||||||
fPtr->retainCount++;
|
fPtr->retainCount++;
|
||||||
if (fPtr->origLeader == None) {
|
if (fPtr->origLeader == None) {
|
||||||
if (ADEQUATE(wwin->main_window)) {
|
if (ADEQUATE(wwin->main_window)) {
|
||||||
|
|||||||
@@ -648,9 +648,8 @@ static void saveSettings(WMButton * button, InspectorPanel * panel)
|
|||||||
different |= different2;
|
different |= different2;
|
||||||
} else {
|
} else {
|
||||||
WMRemoveFromPLDictionary(dict, key2);
|
WMRemoveFromPLDictionary(dict, key2);
|
||||||
if (different2) {
|
if (different2)
|
||||||
WMPutInPLDictionary(dict, key2, appDic);
|
WMPutInPLDictionary(dict, key2, appDic);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
WMReleasePropList(key2);
|
WMReleasePropList(key2);
|
||||||
WMReleasePropList(appDic);
|
WMReleasePropList(appDic);
|
||||||
@@ -1053,11 +1052,10 @@ static void selectSpecification(WMWidget * bPtr, void *data)
|
|||||||
WWindow *wwin = panel->inspected;
|
WWindow *wwin = panel->inspected;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (bPtr == panel->defaultRb && (wwin->wm_instance || wwin->wm_class)) {
|
if (bPtr == panel->defaultRb && (wwin->wm_instance || wwin->wm_class))
|
||||||
WMSetButtonEnabled(panel->applyBtn, False);
|
WMSetButtonEnabled(panel->applyBtn, False);
|
||||||
} else {
|
else
|
||||||
WMSetButtonEnabled(panel->applyBtn, True);
|
WMSetButtonEnabled(panel->applyBtn, True);
|
||||||
}
|
|
||||||
|
|
||||||
len = 16 + strlen(wwin->wm_instance ? wwin->wm_instance : "?")
|
len = 16 + strlen(wwin->wm_instance ? wwin->wm_instance : "?")
|
||||||
+ strlen(wwin->wm_class ? wwin->wm_class : "?");
|
+ strlen(wwin->wm_class ? wwin->wm_class : "?");
|
||||||
|
|||||||
Reference in New Issue
Block a user