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

changed indentation to use spaces only

This commit is contained in:
dan
2004-10-12 21:28:27 +00:00
parent 5912898b06
commit 6830b05716
240 changed files with 35951 additions and 35773 deletions

View File

@@ -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.
*/
@@ -44,7 +44,8 @@ extern XContext wStackContext;
extern WPreferences wPreferences;
static void notifyStackChange(WCoreWindow *frame, char *detail)
static void
notifyStackChange(WCoreWindow *frame, char *detail)
{
WWindow *wwin = wWindowFor(frame->window);
@@ -53,17 +54,17 @@ static void notifyStackChange(WCoreWindow *frame, char *detail)
/*
*----------------------------------------------------------------------
*----------------------------------------------------------------------
* RemakeStackList--
* Remakes the stacking_list for the screen, getting the real
* stacking order from the server and reordering windows that are not
* in the correct stacking.
*
*
* Side effects:
* The stacking order list and the actual window stacking
* The stacking order list and the actual window stacking
* may be changed (corrected)
*
*----------------------------------------------------------------------
*
*----------------------------------------------------------------------
*/
void
RemakeStackList(WScreen *scr)
@@ -75,39 +76,39 @@ RemakeStackList(WScreen *scr)
WCoreWindow *tmp;
int level;
int i, c;
if (!XQueryTree(dpy, scr->root_win, &junkr, &junkp, &windows, &nwindows)) {
wwarning(_("could not get window list!!"));
return;
} else {
WMEmptyBag(scr->stacking_list);
/* verify list integrity */
c=0;
for (i=0; i<nwindows; i++) {
if (XFindContext(dpy, windows[i], wStackContext, (XPointer*)&frame)
==XCNOENT) {
continue;
}
if (!frame) continue;
c++;
level = frame->stacking->window_level;
tmp = WMGetFromBag(scr->stacking_list, level);
if (tmp)
tmp->stacking->above = frame;
frame->stacking->under = tmp;
frame->stacking->above = NULL;
WMSetInBag(scr->stacking_list, level, frame);
if (!XQueryTree(dpy, scr->root_win, &junkr, &junkp, &windows, &nwindows)) {
wwarning(_("could not get window list!!"));
return;
} else {
WMEmptyBag(scr->stacking_list);
/* verify list integrity */
c=0;
for (i=0; i<nwindows; i++) {
if (XFindContext(dpy, windows[i], wStackContext, (XPointer*)&frame)
==XCNOENT) {
continue;
}
if (!frame) continue;
c++;
level = frame->stacking->window_level;
tmp = WMGetFromBag(scr->stacking_list, level);
if (tmp)
tmp->stacking->above = frame;
frame->stacking->under = tmp;
frame->stacking->above = NULL;
WMSetInBag(scr->stacking_list, level, frame);
}
XFree(windows);
#ifdef DEBUG
if (c!=scr->window_count) {
puts("Found different number of windows than in window lists!!!");
}
if (c!=scr->window_count) {
puts("Found different number of windows than in window lists!!!");
}
#endif
scr->window_count = c;
}
scr->window_count = c;
}
CommitStacking(scr);
}
@@ -119,10 +120,10 @@ RemakeStackList(WScreen *scr)
* Reorders the actual window stacking, so that it has the stacking
* order in the internal window stacking lists. It does the opposite
* of RemakeStackList().
*
*
* Side effects:
* Windows may be restacked.
*----------------------------------------------------------------------
*----------------------------------------------------------------------
*/
void
CommitStacking(WScreen *scr)
@@ -131,24 +132,24 @@ CommitStacking(WScreen *scr)
int nwindows, i;
Window *windows;
WMBagIterator iter;
nwindows = scr->window_count;
windows = wmalloc(sizeof(Window)*nwindows);
i = 0;
WM_ETARETI_BAG(scr->stacking_list, tmp, iter) {
while (tmp) {
while (tmp) {
#ifdef DEBUG
if (i>=nwindows) {
puts("Internal inconsistency! window_count is incorrect!!!");
printf("window_count says %i windows\n", nwindows);
wfree(windows);
return;
}
if (i>=nwindows) {
puts("Internal inconsistency! window_count is incorrect!!!");
printf("window_count says %i windows\n", nwindows);
wfree(windows);
return;
}
#endif
windows[i++] = tmp->window;
tmp = tmp->stacking->under;
}
windows[i++] = tmp->window;
tmp = tmp->stacking->under;
}
}
XRestackWindows(dpy, windows, i);
wfree(windows);
@@ -156,7 +157,7 @@ CommitStacking(WScreen *scr)
#ifdef VIRTUAL_DESKTOP
wWorkspaceRaiseEdge(scr);
#endif
WMPostNotificationName(WMNResetStacking, scr, NULL);
}
@@ -164,10 +165,10 @@ CommitStacking(WScreen *scr)
*----------------------------------------------------------------------
* moveFrameToUnder--
* Reestacks windows so that "frame" is under "under".
*
*
* Returns:
* None
*
*
* Side effects:
* Changes the stacking order of frame.
*----------------------------------------------------------------------
@@ -185,17 +186,17 @@ moveFrameToUnder(WCoreWindow *under, WCoreWindow *frame)
/*
*----------------------------------------------------------------------
* wRaiseFrame--
* Raises a frame taking the window level into account.
*
* Raises a frame taking the window level into account.
*
* Returns:
* None
*
*
* Side effects:
* Window stacking order and stacking list are changed.
*
*----------------------------------------------------------------------
*
*----------------------------------------------------------------------
*/
void
void
wRaiseFrame(WCoreWindow *frame)
{
WCoreWindow *wlist = frame;
@@ -204,14 +205,14 @@ wRaiseFrame(WCoreWindow *frame)
/* already on top */
if (frame->stacking->above == NULL) {
return;
return;
}
/* insert it on top of other windows on the same level */
if (frame->stacking->under)
frame->stacking->under->stacking->above = frame->stacking->above;
frame->stacking->under->stacking->above = frame->stacking->above;
if (frame->stacking->above)
frame->stacking->above->stacking->under = frame->stacking->under;
frame->stacking->above->stacking->under = frame->stacking->under;
frame->stacking->above = NULL;
frame->stacking->under = WMGetFromBag(scr->stacking_list, level);
@@ -220,44 +221,44 @@ wRaiseFrame(WCoreWindow *frame)
}
WMSetInBag(scr->stacking_list, level, frame);
/* raise transients under us from bottom to top
/* raise transients under us from bottom to top
* so that the order is kept */
again:
wlist = frame->stacking->under;
while (wlist && wlist->stacking->under)
wlist = wlist->stacking->under;
wlist = wlist->stacking->under;
while (wlist && wlist!=frame) {
if (wlist->stacking->child_of == frame) {
wRaiseFrame(wlist);
goto again;
}
wlist = wlist->stacking->above;
if (wlist->stacking->child_of == frame) {
wRaiseFrame(wlist);
goto again;
}
wlist = wlist->stacking->above;
}
/* try to optimize things a little */
if (frame->stacking->above == NULL) {
WMBagIterator iter;
WCoreWindow *above = WMBagLast(scr->stacking_list, &iter);
int i, last = above->stacking->window_level;
WMBagIterator iter;
WCoreWindow *above = WMBagLast(scr->stacking_list, &iter);
int i, last = above->stacking->window_level;
/* find the 1st level above us which has windows in it */
for (i = level+1, above = NULL; i <= last; i++) {
above = WMGetFromBag(scr->stacking_list, i);
if (above != NULL)
break;
}
/* find the 1st level above us which has windows in it */
for (i = level+1, above = NULL; i <= last; i++) {
above = WMGetFromBag(scr->stacking_list, i);
if (above != NULL)
break;
}
if (above != frame && above != NULL) {
while (above->stacking->under)
above = above->stacking->under;
moveFrameToUnder(above, frame);
} else {
/* no window above us */
above = NULL;
XRaiseWindow(dpy, frame->window);
}
if (above != frame && above != NULL) {
while (above->stacking->under)
above = above->stacking->under;
moveFrameToUnder(above, frame);
} else {
/* no window above us */
above = NULL;
XRaiseWindow(dpy, frame->window);
}
} else {
moveFrameToUnder(frame->stacking->above, frame);
moveFrameToUnder(frame->stacking->above, frame);
}
notifyStackChange(frame, "raise");
@@ -272,37 +273,37 @@ void
wRaiseLowerFrame(WCoreWindow *frame)
{
if (!frame->stacking->above
||(frame->stacking->window_level
!=frame->stacking->above->stacking->window_level)) {
||(frame->stacking->window_level
!=frame->stacking->above->stacking->window_level)) {
wLowerFrame(frame);
wLowerFrame(frame);
} else {
WCoreWindow *scan = frame->stacking->above;
WWindow *frame_wwin = (WWindow*) frame->descriptor.parent;
WCoreWindow *scan = frame->stacking->above;
WWindow *frame_wwin = (WWindow*) frame->descriptor.parent;
while (scan) {
while (scan) {
if (scan->descriptor.parent_type == WCLASS_WINDOW) {
WWindow *scan_wwin = (WWindow*)scan->descriptor.parent;
if (wWindowObscuresWindow(scan_wwin, frame_wwin)
&& scan_wwin->flags.mapped) {
break;
}
}
scan = scan->stacking->above;
}
if (scan->descriptor.parent_type == WCLASS_WINDOW) {
WWindow *scan_wwin = (WWindow*)scan->descriptor.parent;
if (scan) {
wRaiseFrame(frame);
} else {
wLowerFrame(frame);
}
if (wWindowObscuresWindow(scan_wwin, frame_wwin)
&& scan_wwin->flags.mapped) {
break;
}
}
scan = scan->stacking->above;
}
if (scan) {
wRaiseFrame(frame);
} else {
wLowerFrame(frame);
}
}
}
void
void
wLowerFrame(WCoreWindow *frame)
{
WScreen *scr = frame->screen_ptr;
@@ -311,38 +312,38 @@ wLowerFrame(WCoreWindow *frame)
/* already in bottom */
if (wlist->stacking->under == NULL) {
return;
return;
}
/* cant lower transient below below its owner */
if (wlist->stacking->under == wlist->stacking->child_of) {
return;
return;
}
/* remove from the list */
if (WMGetFromBag(scr->stacking_list, level) == frame) {
/* it was the top window */
WMSetInBag(scr->stacking_list, level, frame->stacking->under);
frame->stacking->under->stacking->above = NULL;
/* it was the top window */
WMSetInBag(scr->stacking_list, level, frame->stacking->under);
frame->stacking->under->stacking->above = NULL;
} else {
if (frame->stacking->under)
frame->stacking->under->stacking->above = frame->stacking->above;
if (frame->stacking->above)
frame->stacking->above->stacking->under = frame->stacking->under;
if (frame->stacking->under)
frame->stacking->under->stacking->above = frame->stacking->above;
if (frame->stacking->above)
frame->stacking->above->stacking->under = frame->stacking->under;
}
wlist = WMGetFromBag(scr->stacking_list, level);
/* look for place to put this window */
if (wlist) {
WCoreWindow *owner = frame->stacking->child_of;
WCoreWindow *owner = frame->stacking->child_of;
if (owner != wlist) {
while (wlist->stacking->under) {
/* if this is a transient, it should not be placed under
* it's owner */
if (owner == wlist->stacking->under)
break;
wlist = wlist->stacking->under;
}
}
if (owner != wlist) {
while (wlist->stacking->under) {
/* if this is a transient, it should not be placed under
* it's owner */
if (owner == wlist->stacking->under)
break;
wlist = wlist->stacking->under;
}
}
}
/* insert under the place found */
frame->stacking->above = wlist;
@@ -356,31 +357,31 @@ wLowerFrame(WCoreWindow *frame)
}
if (frame->stacking->above == NULL) {
WMBagIterator iter;
WCoreWindow *above = WMBagLast(scr->stacking_list, &iter);
int i, last = above->stacking->window_level;
WMBagIterator iter;
WCoreWindow *above = WMBagLast(scr->stacking_list, &iter);
int i, last = above->stacking->window_level;
/* find the 1st level above us which has windows in it */
for (i = level+1, above = NULL; i <= last; i++) {
above = WMGetFromBag(scr->stacking_list, i);
if (above != NULL)
break;
}
/* find the 1st level above us which has windows in it */
for (i = level+1, above = NULL; i <= last; i++) {
above = WMGetFromBag(scr->stacking_list, i);
if (above != NULL)
break;
}
if (above != frame && above != NULL) {
while (above->stacking->under)
above = above->stacking->under;
moveFrameToUnder(above, frame);
} else {
/* no window below us */
XLowerWindow(dpy, frame->window);
}
if (above != frame && above != NULL) {
while (above->stacking->under)
above = above->stacking->under;
moveFrameToUnder(above, frame);
} else {
/* no window below us */
XLowerWindow(dpy, frame->window);
}
} else {
moveFrameToUnder(frame->stacking->above, frame);
moveFrameToUnder(frame->stacking->above, frame);
}
notifyStackChange(frame, "lower");
notifyStackChange(frame, "lower");
#ifdef VIRTUAL_DESKTOP
wWorkspaceRaiseEdge(scr);
#endif
@@ -392,13 +393,13 @@ wLowerFrame(WCoreWindow *frame)
* AddToStackList--
* Inserts the frame in the top of the stacking list. The
* stacking precedence is obeyed.
*
*
* Returns:
* None
*
*
* Side effects:
* The frame is added to it's screen's window list.
*----------------------------------------------------------------------
*----------------------------------------------------------------------
*/
void
AddToStackList(WCoreWindow *frame)
@@ -407,47 +408,47 @@ AddToStackList(WCoreWindow *frame)
int index = frame->stacking->window_level;
WScreen *scr = frame->screen_ptr;
WCoreWindow *trans = NULL;
frame->screen_ptr->window_count++;
XSaveContext(dpy, frame->window, wStackContext, (XPointer)frame);
curtop = WMGetFromBag(scr->stacking_list, index);
/* first window in this level */
if (curtop == NULL) {
WMSetInBag(scr->stacking_list, index, frame);
frame->stacking->above = NULL;
frame->stacking->under = NULL;
CommitStacking(scr);
return;
WMSetInBag(scr->stacking_list, index, frame);
frame->stacking->above = NULL;
frame->stacking->under = NULL;
CommitStacking(scr);
return;
}
/* check if this is a transient owner */
wlist = curtop;
while (wlist) {
if (wlist->stacking->child_of == frame)
trans = wlist;
wlist = wlist->stacking->under;
if (wlist->stacking->child_of == frame)
trans = wlist;
wlist = wlist->stacking->under;
}
/* trans will hold the transient in the lowest position
* in stacking list */
frame->stacking->above = trans;
if (trans != NULL) {
/* window is owner of a transient.. put it below
* the lowest transient */
frame->stacking->under = trans->stacking->under;
if (trans->stacking->under) {
trans->stacking->under->stacking->above = frame;
}
trans->stacking->under = frame;
/* window is owner of a transient.. put it below
* the lowest transient */
frame->stacking->under = trans->stacking->under;
if (trans->stacking->under) {
trans->stacking->under->stacking->above = frame;
}
trans->stacking->under = frame;
} else {
/* window is not owner of transients.. just put it in the
* top of other windows */
frame->stacking->under = curtop;
curtop->stacking->above = frame;
WMSetInBag(scr->stacking_list, index, frame);
/* window is not owner of transients.. just put it in the
* top of other windows */
frame->stacking->under = curtop;
curtop->stacking->above = frame;
WMSetInBag(scr->stacking_list, index, frame);
}
CommitStacking(scr);
CommitStacking(scr);
}
@@ -455,14 +456,14 @@ AddToStackList(WCoreWindow *frame)
*----------------------------------------------------------------------
* MoveInStackListAbove--
* Moves the frame above "next".
*
*
* Returns:
* None
*
*
* Side effects:
* Stacking order may be changed.
* Window level for frame may be changed.
*----------------------------------------------------------------------
*----------------------------------------------------------------------
*/
void
MoveInStackListAbove(WCoreWindow *next, WCoreWindow *frame)
@@ -481,7 +482,7 @@ MoveInStackListAbove(WCoreWindow *next, WCoreWindow *frame)
tmpw = WMGetFromBag(scr->stacking_list, index);
if (tmpw == frame)
WMSetInBag(scr->stacking_list, index, frame->stacking->under);
WMSetInBag(scr->stacking_list, index, frame->stacking->under);
if (frame->stacking->under)
frame->stacking->under->stacking->above = frame->stacking->above;
if (frame->stacking->above)
@@ -492,21 +493,21 @@ MoveInStackListAbove(WCoreWindow *next, WCoreWindow *frame)
frame->stacking->above = next->stacking->above;
next->stacking->above = frame;
if (tmpw == next)
WMSetInBag(scr->stacking_list, index, frame);
WMSetInBag(scr->stacking_list, index, frame);
/* try to optimize things a little */
if (frame->stacking->above == NULL) {
WCoreWindow *above = NULL;
WMBagIterator iter;
WMBagIterator iter;
for (above = WMBagIteratorAtIndex(scr->stacking_list, index+1, &iter);
above != NULL;
above = WMBagNext(scr->stacking_list, &iter)) {
for (above = WMBagIteratorAtIndex(scr->stacking_list, index+1, &iter);
above != NULL;
above = WMBagNext(scr->stacking_list, &iter)) {
/* can't optimize */
while (above->stacking->under)
above = above->stacking->under;
break;
/* can't optimize */
while (above->stacking->under)
above = above->stacking->under;
break;
}
if (above == NULL) {
XRaiseWindow(dpy, frame->window);
@@ -518,7 +519,7 @@ MoveInStackListAbove(WCoreWindow *next, WCoreWindow *frame)
}
WMPostNotificationName(WMNResetStacking, scr, NULL);
#ifdef VIRTUAL_DESKTOP
wWorkspaceRaiseEdge(scr);
#endif
@@ -529,14 +530,14 @@ MoveInStackListAbove(WCoreWindow *next, WCoreWindow *frame)
*----------------------------------------------------------------------
* MoveInStackListUnder--
* Moves the frame to under "prev".
*
*
* Returns:
* None
*
*
* Side effects:
* Stacking order may be changed.
* Window level for frame may be changed.
*----------------------------------------------------------------------
*----------------------------------------------------------------------
*/
void
MoveInStackListUnder(WCoreWindow *prev, WCoreWindow *frame)
@@ -566,7 +567,7 @@ MoveInStackListUnder(WCoreWindow *prev, WCoreWindow *frame)
frame->stacking->under = prev->stacking->under;
prev->stacking->under = frame;
moveFrameToUnder(prev, frame);
WMPostNotificationName(WMNResetStacking, scr, NULL);
}
@@ -577,17 +578,17 @@ RemoveFromStackList(WCoreWindow *frame)
int index = frame->stacking->window_level;
if (XDeleteContext(dpy, frame->window, wStackContext)==XCNOENT) {
wwarning("RemoveFromStackingList(): window not in list ");
return;
wwarning("RemoveFromStackingList(): window not in list ");
return;
}
/* remove from the window stack list */
if (frame->stacking->under)
frame->stacking->under->stacking->above = frame->stacking->above;
frame->stacking->under->stacking->above = frame->stacking->above;
if (frame->stacking->above)
frame->stacking->above->stacking->under = frame->stacking->under;
frame->stacking->above->stacking->under = frame->stacking->under;
else /* this was the first window on the list */
WMSetInBag(frame->screen_ptr->stacking_list, index,
frame->stacking->under);
WMSetInBag(frame->screen_ptr->stacking_list, index,
frame->stacking->under);
frame->screen_ptr->window_count--;
@@ -601,15 +602,16 @@ ChangeStackingLevel(WCoreWindow *frame, int new_level)
int old_level;
if (frame->stacking->window_level == new_level)
return;
return;
old_level = frame->stacking->window_level;
RemoveFromStackList(frame);
frame->stacking->window_level = new_level;
AddToStackList(frame);
if (old_level > new_level) {
wRaiseFrame(frame);
wRaiseFrame(frame);
} else {
wLowerFrame(frame);
wLowerFrame(frame);
}
}