mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-21 05:18:06 +01:00
changed indentation to use spaces only
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Window Maker window manager
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1997-2003 Alfredo K. Kojima
|
||||
* Copyright (c) 1998-2003 Dan Pascu
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
#include "wconfig.h"
|
||||
@@ -71,7 +71,7 @@ makeMainWindow(WScreen *scr, Window window)
|
||||
XWindowAttributes attr;
|
||||
|
||||
if (!XGetWindowAttributes(dpy, window, &attr)) {
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wwin = wWindowCreate();
|
||||
@@ -79,18 +79,18 @@ makeMainWindow(WScreen *scr, Window window)
|
||||
wwin->client_win = window;
|
||||
wwin->main_window = window;
|
||||
wwin->wm_hints = XGetWMHints(dpy, window);
|
||||
/* if (!MyXFetchName(dpy, window, &(wwin->frame->title))) {
|
||||
wwin->frame->title = NULL;
|
||||
}
|
||||
*/
|
||||
/* if (!MyXFetchName(dpy, window, &(wwin->frame->title))) {
|
||||
wwin->frame->title = NULL;
|
||||
}
|
||||
*/
|
||||
PropGetWMClass(window, &wwin->wm_class, &wwin->wm_instance);
|
||||
|
||||
|
||||
wDefaultFillAttributes(scr, wwin->wm_instance, wwin->wm_class,
|
||||
&wwin->user_flags, &wwin->defined_user_flags, True);
|
||||
|
||||
&wwin->user_flags, &wwin->defined_user_flags, True);
|
||||
|
||||
XSelectInput(dpy, window, attr.your_event_mask | PropertyChangeMask
|
||||
| StructureNotifyMask);
|
||||
| StructureNotifyMask);
|
||||
return wwin;
|
||||
}
|
||||
|
||||
@@ -100,10 +100,10 @@ wApplicationOf(Window window)
|
||||
{
|
||||
WApplication *wapp;
|
||||
|
||||
if (window == None)
|
||||
return NULL;
|
||||
if (window == None)
|
||||
return NULL;
|
||||
if (XFindContext(dpy, window, wAppWinContext, (XPointer*)&wapp)!=XCSUCCESS)
|
||||
return NULL;
|
||||
return NULL;
|
||||
return wapp;
|
||||
}
|
||||
|
||||
@@ -147,40 +147,40 @@ saveIconNameFor(char *iconPath, char *wm_instance, char *wm_class)
|
||||
|
||||
i = 0;
|
||||
if (wm_instance)
|
||||
i += strlen(wm_instance);
|
||||
i += strlen(wm_instance);
|
||||
if (wm_class)
|
||||
i += strlen(wm_class);
|
||||
i += strlen(wm_class);
|
||||
|
||||
tmp = wmalloc(i+8);
|
||||
*tmp = 0;
|
||||
if (wm_class && wm_instance) {
|
||||
sprintf(tmp, "%s.%s", wm_instance, wm_class);
|
||||
sprintf(tmp, "%s.%s", wm_instance, wm_class);
|
||||
} else {
|
||||
if (wm_instance)
|
||||
strcat(tmp, wm_instance);
|
||||
if (wm_class)
|
||||
strcat(tmp, wm_class);
|
||||
if (wm_instance)
|
||||
strcat(tmp, wm_instance);
|
||||
if (wm_class)
|
||||
strcat(tmp, wm_class);
|
||||
}
|
||||
|
||||
key = WMCreatePLString(tmp);
|
||||
|
||||
key = WMCreatePLString(tmp);
|
||||
wfree(tmp);
|
||||
adict = WMGetFromPLDictionary(dict, key);
|
||||
|
||||
|
||||
iconk = WMCreatePLString("Icon");
|
||||
|
||||
|
||||
if (adict) {
|
||||
val = WMGetFromPLDictionary(adict, iconk);
|
||||
val = WMGetFromPLDictionary(adict, iconk);
|
||||
} else {
|
||||
/* no dictionary for app, so create one */
|
||||
adict = WMCreatePLDictionary(NULL, NULL);
|
||||
WMPutInPLDictionary(dict, key, adict);
|
||||
WMReleasePropList(adict);
|
||||
val = NULL;
|
||||
/* no dictionary for app, so create one */
|
||||
adict = WMCreatePLDictionary(NULL, NULL);
|
||||
WMPutInPLDictionary(dict, key, adict);
|
||||
WMReleasePropList(adict);
|
||||
val = NULL;
|
||||
}
|
||||
if (!val) {
|
||||
val = WMCreatePLString(iconPath);
|
||||
WMPutInPLDictionary(adict, iconk, val);
|
||||
WMReleasePropList(val);
|
||||
val = WMCreatePLString(iconPath);
|
||||
WMPutInPLDictionary(adict, iconk, val);
|
||||
WMReleasePropList(val);
|
||||
}
|
||||
WMReleasePropList(key);
|
||||
WMReleasePropList(iconk);
|
||||
@@ -192,38 +192,38 @@ saveIconNameFor(char *iconPath, char *wm_instance, char *wm_class)
|
||||
|
||||
|
||||
void
|
||||
wApplicationExtractDirPackIcon(WScreen *scr, char *path,
|
||||
char *wm_instance, char *wm_class)
|
||||
wApplicationExtractDirPackIcon(WScreen *scr, char *path,
|
||||
char *wm_instance, char *wm_class)
|
||||
{
|
||||
char *iconPath=NULL;
|
||||
/* Maybe the app is a .app and it has an icon in it, like
|
||||
* /usr/local/GNUstep/Apps/WPrefs.app/WPrefs.tiff
|
||||
*/
|
||||
if (strstr(path, ".app")) {
|
||||
char *tmp;
|
||||
|
||||
tmp = wmalloc(strlen(path)+16);
|
||||
|
||||
if (scr->flags.supports_tiff) {
|
||||
strcpy(tmp, path);
|
||||
strcat(tmp, ".tiff");
|
||||
if (access(tmp, R_OK)==0)
|
||||
iconPath = tmp;
|
||||
}
|
||||
if (!path) {
|
||||
strcpy(tmp, path);
|
||||
strcat(tmp, ".xpm");
|
||||
if (access(tmp, R_OK)==0)
|
||||
iconPath = tmp;
|
||||
}
|
||||
if (!iconPath)
|
||||
wfree(tmp);
|
||||
}
|
||||
|
||||
if (iconPath) {
|
||||
saveIconNameFor(iconPath, wm_instance, wm_class);
|
||||
char *tmp;
|
||||
|
||||
wfree(iconPath);
|
||||
tmp = wmalloc(strlen(path)+16);
|
||||
|
||||
if (scr->flags.supports_tiff) {
|
||||
strcpy(tmp, path);
|
||||
strcat(tmp, ".tiff");
|
||||
if (access(tmp, R_OK)==0)
|
||||
iconPath = tmp;
|
||||
}
|
||||
if (!path) {
|
||||
strcpy(tmp, path);
|
||||
strcat(tmp, ".xpm");
|
||||
if (access(tmp, R_OK)==0)
|
||||
iconPath = tmp;
|
||||
}
|
||||
if (!iconPath)
|
||||
wfree(tmp);
|
||||
}
|
||||
|
||||
if (iconPath) {
|
||||
saveIconNameFor(iconPath, wm_instance, wm_class);
|
||||
|
||||
wfree(iconPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ extractClientIcon(WAppIcon *icon)
|
||||
|
||||
path = wIconStore(icon->icon);
|
||||
if (!path)
|
||||
return False;
|
||||
return False;
|
||||
|
||||
saveIconNameFor(path, icon->wm_instance, icon->wm_class);
|
||||
|
||||
@@ -255,22 +255,22 @@ wApplicationCreate(WWindow *wwin)
|
||||
|
||||
if (main_window==None || main_window==scr->root_win) {
|
||||
#ifdef DEBUG0
|
||||
wwarning("trying to create application for %x",(unsigned)main_window);
|
||||
wwarning("trying to create application for %x",(unsigned)main_window);
|
||||
#endif
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
Window root;
|
||||
int foo;
|
||||
unsigned int bar;
|
||||
/* check if the window is valid */
|
||||
if (!XGetGeometry(dpy, main_window, &root, &foo, &foo, &bar, &bar,
|
||||
&bar, &bar)) {
|
||||
return NULL;
|
||||
}
|
||||
Window root;
|
||||
int foo;
|
||||
unsigned int bar;
|
||||
/* check if the window is valid */
|
||||
if (!XGetGeometry(dpy, main_window, &root, &foo, &foo, &bar, &bar,
|
||||
&bar, &bar)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wapp = wApplicationOf(main_window);
|
||||
if (wapp) {
|
||||
wapp->refcount++;
|
||||
@@ -281,32 +281,32 @@ wApplicationCreate(WWindow *wwin)
|
||||
|
||||
return wapp;
|
||||
}
|
||||
|
||||
|
||||
wapp = wmalloc(sizeof(WApplication));
|
||||
memset(wapp, 0, sizeof(WApplication));
|
||||
|
||||
wapp->refcount = 1;
|
||||
wapp->last_focused = NULL;
|
||||
|
||||
|
||||
wapp->last_workspace = 0;
|
||||
|
||||
|
||||
wapp->main_window = main_window;
|
||||
wapp->main_window_desc = makeMainWindow(scr, main_window);
|
||||
if (!wapp->main_window_desc) {
|
||||
wfree(wapp);
|
||||
return NULL;
|
||||
wfree(wapp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
wapp->main_window_desc->fake_group = wwin->fake_group;
|
||||
#ifdef NETWM_HINTS
|
||||
wapp->main_window_desc->net_icon_image = RRetainImage(wwin->net_icon_image);
|
||||
#endif
|
||||
|
||||
|
||||
extractIcon(wapp->main_window_desc);
|
||||
|
||||
leader = wWindowFor(main_window);
|
||||
if (leader) {
|
||||
leader->main_window = main_window;
|
||||
leader->main_window = main_window;
|
||||
}
|
||||
wapp->menu = wAppMenuGet(scr, main_window);
|
||||
#ifdef USER_MENU
|
||||
@@ -318,7 +318,7 @@ wApplicationCreate(WWindow *wwin)
|
||||
* 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 */
|
||||
@@ -330,8 +330,8 @@ wApplicationCreate(WWindow *wwin)
|
||||
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) {
|
||||
wapp->app_icon = findDockIconFor(scr->dock, main_window);
|
||||
}
|
||||
wapp->app_icon = findDockIconFor(scr->dock, main_window);
|
||||
}
|
||||
/* finally check clips */
|
||||
if (!wapp->app_icon) {
|
||||
int i;
|
||||
@@ -354,12 +354,12 @@ wApplicationCreate(WWindow *wwin)
|
||||
wapp->app_icon->icon->icon_win = mainw->wm_hints->icon_window;
|
||||
wAppIconPaint(wapp->app_icon);
|
||||
} else {
|
||||
wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
|
||||
}
|
||||
wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
|
||||
}
|
||||
} else {
|
||||
wapp->app_icon = NULL;
|
||||
wapp->app_icon = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (wapp->app_icon) {
|
||||
wapp->app_icon->main_window = main_window;
|
||||
}
|
||||
@@ -379,24 +379,24 @@ wApplicationCreate(WWindow *wwin)
|
||||
wDockAttachIcon(clip, wapp->app_icon, x, y);
|
||||
} else {
|
||||
PlaceIcon(scr, &x, &y, wGetHeadForWindow(wapp->main_window_desc));
|
||||
wAppIconMove(wapp->app_icon, x, y);
|
||||
wLowerFrame(icon->core);
|
||||
wAppIconMove(wapp->app_icon, x, y);
|
||||
wLowerFrame(icon->core);
|
||||
}
|
||||
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) {
|
||||
wArrangeIcons(scr, True);
|
||||
wArrangeIcons(scr, True);
|
||||
}
|
||||
|
||||
if (wapp->app_icon) {
|
||||
char *tmp, *path;
|
||||
char *tmp, *path;
|
||||
struct stat dummy;
|
||||
RImage *image;
|
||||
|
||||
tmp = wDefaultGetIconFile(scr, wapp->app_icon->wm_instance,
|
||||
wapp->app_icon->wm_class, True);
|
||||
tmp = wDefaultGetIconFile(scr, wapp->app_icon->wm_instance,
|
||||
wapp->app_icon->wm_class, True);
|
||||
|
||||
/* If the icon was saved by us from the client supplied icon, but is
|
||||
* missing, recreate it. */
|
||||
@@ -420,9 +420,9 @@ wApplicationCreate(WWindow *wwin)
|
||||
}
|
||||
}
|
||||
|
||||
/* if the displayed icon was supplied by the client, save the icon */
|
||||
/* if the displayed icon was supplied by the client, save the icon */
|
||||
if (!tmp)
|
||||
extractClientIcon(wapp->app_icon);
|
||||
extractClientIcon(wapp->app_icon);
|
||||
}
|
||||
|
||||
wSoundPlay(WSOUND_APPSTART);
|
||||
@@ -442,11 +442,11 @@ wApplicationDestroy(WApplication *wapp)
|
||||
WScreen *scr;
|
||||
|
||||
if (!wapp)
|
||||
return;
|
||||
|
||||
return;
|
||||
|
||||
wapp->refcount--;
|
||||
if (wapp->refcount>0)
|
||||
return;
|
||||
return;
|
||||
|
||||
|
||||
scr = wapp->main_window_desc->screen_ptr;
|
||||
@@ -467,34 +467,34 @@ wApplicationDestroy(WApplication *wapp)
|
||||
wAppMenuDestroy(wapp->menu);
|
||||
if (wapp->app_icon) {
|
||||
if (wapp->app_icon->docked && !wapp->app_icon->attracted) {
|
||||
wapp->app_icon->running = 0;
|
||||
/* since we keep it, we don't care if it was attracted or not */
|
||||
wapp->app_icon->attracted = 0;
|
||||
wapp->app_icon->icon->shadowed = 0;
|
||||
wapp->app_icon->main_window = None;
|
||||
wapp->app_icon->pid = 0;
|
||||
wapp->app_icon->icon->owner = NULL;
|
||||
wapp->app_icon->icon->icon_win = None;
|
||||
wapp->app_icon->icon->force_paint = 1;
|
||||
wAppIconPaint(wapp->app_icon);
|
||||
wapp->app_icon->running = 0;
|
||||
/* since we keep it, we don't care if it was attracted or not */
|
||||
wapp->app_icon->attracted = 0;
|
||||
wapp->app_icon->icon->shadowed = 0;
|
||||
wapp->app_icon->main_window = None;
|
||||
wapp->app_icon->pid = 0;
|
||||
wapp->app_icon->icon->owner = NULL;
|
||||
wapp->app_icon->icon->icon_win = None;
|
||||
wapp->app_icon->icon->force_paint = 1;
|
||||
wAppIconPaint(wapp->app_icon);
|
||||
} else if (wapp->app_icon->docked) {
|
||||
wapp->app_icon->running = 0;
|
||||
wDockDetach(wapp->app_icon->dock, wapp->app_icon);
|
||||
wapp->app_icon->running = 0;
|
||||
wDockDetach(wapp->app_icon->dock, wapp->app_icon);
|
||||
} else {
|
||||
wAppIconDestroy(wapp->app_icon);
|
||||
}
|
||||
wAppIconDestroy(wapp->app_icon);
|
||||
}
|
||||
}
|
||||
wwin = wWindowFor(wapp->main_window_desc->client_win);
|
||||
|
||||
wWindowDestroy(wapp->main_window_desc);
|
||||
if (wwin) {
|
||||
/* undelete client window context that was deleted in
|
||||
* wWindowDestroy */
|
||||
XSaveContext(dpy, wwin->client_win, wWinContext,
|
||||
(XPointer)&wwin->client_descriptor);
|
||||
/* undelete client window context that was deleted in
|
||||
* wWindowDestroy */
|
||||
XSaveContext(dpy, wwin->client_win, wWinContext,
|
||||
(XPointer)&wwin->client_descriptor);
|
||||
}
|
||||
wfree(wapp);
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("Destroyed application for %x\n", (unsigned)main_window);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user