From f21823506dcb956d62c260e6e207f1dc2ce7732a Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 14 Jul 2011 22:04:34 -0700 Subject: Whitespace fixes in src files Signed-off-by: Alan Coopersmith --- src/add_window.c | 148 +++++++++++++++++++++++++++---------------------------- 1 file changed, 74 insertions(+), 74 deletions(-) (limited to 'src/add_window.c') diff --git a/src/add_window.c b/src/add_window.c index 690354a..8cf23c5 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -94,13 +94,13 @@ static void CreateWindowTitlebarButtons ( TwmWindow *tmp_win ); char NoName[] = "Untitled"; /* name if no name is specified */ -/** - * map gravity to (x,y) offset signs for adding to x and y when window is +/** + * map gravity to (x,y) offset signs for adding to x and y when window is * mapped to get proper placement. * * \param tmp window from which to get gravity * \param xp,yp return values - * + * */ void GetGravityOffsets (TwmWindow *tmp, int *xp, int *yp) @@ -120,7 +120,7 @@ GetGravityOffsets (TwmWindow *tmp, int *xp, int *yp) { 1, 1 }, /* SouthEastGravity */ { 0, 0 }, /* StaticGravity */ }; - register int g = ((tmp->hints.flags & PWinGravity) + register int g = ((tmp->hints.flags & PWinGravity) ? tmp->hints.win_gravity : NorthWestGravity); if (g < ForgetGravity || g > StaticGravity) { @@ -134,7 +134,7 @@ GetGravityOffsets (TwmWindow *tmp, int *xp, int *yp) -/** +/** * add a new window to the twm list. * * \return pointer to the TwmWindow structure @@ -212,7 +212,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->widthEverChangedByUser = width_ever_changed_by_user; tmp_win->heightEverChangedByUser = height_ever_changed_by_user; - + if (width_ever_changed_by_user) tmp_win->attr.width = saved_width; @@ -256,7 +256,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) } } - if (tmp_win->wmhints && (tmp_win->wmhints->flags & WindowGroupHint)) + if (tmp_win->wmhints && (tmp_win->wmhints->flags & WindowGroupHint)) tmp_win->group = tmp_win->wmhints->window_group; else tmp_win->group = tmp_win->w/* NULL */; @@ -277,19 +277,19 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->full_name = strdup(tmp_win->name); namelen = strlen (tmp_win->name); - tmp_win->highlight = Scr->Highlight && - (!(short)(long) LookInList(Scr->NoHighlight, tmp_win->full_name, + tmp_win->highlight = Scr->Highlight && + (!(short)(long) LookInList(Scr->NoHighlight, tmp_win->full_name, &tmp_win->class)); tmp_win->stackmode = Scr->StackMode && - (!(short)(long) LookInList(Scr->NoStackModeL, tmp_win->full_name, + (!(short)(long) LookInList(Scr->NoStackModeL, tmp_win->full_name, &tmp_win->class)); - tmp_win->titlehighlight = Scr->TitleHighlight && - (!(short)(long) LookInList(Scr->NoTitleHighlight, tmp_win->full_name, + tmp_win->titlehighlight = Scr->TitleHighlight && + (!(short)(long) LookInList(Scr->NoTitleHighlight, tmp_win->full_name, &tmp_win->class)); - tmp_win->auto_raise = (short)(long) LookInList(Scr->AutoRaise, + tmp_win->auto_raise = (short)(long) LookInList(Scr->AutoRaise, tmp_win->full_name, &tmp_win->class); if (tmp_win->auto_raise) Scr->NumAutoRaises++; @@ -300,7 +300,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) !(short)(long) LookInList(Scr->DontIconify, tmp_win->full_name, &tmp_win->class); } - tmp_win->iconify_by_unmapping |= + tmp_win->iconify_by_unmapping |= (short)(long) LookInList(Scr->IconifyByUn, tmp_win->full_name, &tmp_win->class); @@ -324,7 +324,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) * since it is coming from the screen list */ if (HasShape) { - if (!LookInList (Scr->DontSqueezeTitleL, tmp_win->full_name, + if (!LookInList (Scr->DontSqueezeTitleL, tmp_win->full_name, &tmp_win->class)) { tmp_win->squeeze_info = (SqueezeInfo *) LookInList (Scr->SqueezeTitleL, tmp_win->full_name, @@ -387,19 +387,19 @@ AddWindow(Window w, int iconm, IconMgr *iconp) /* * Don't bother user if: - * + * * o the window is a transient, or - * + * * o a USPosition was requested, or - * + * * o a PPosition was requested and UsePPosition is ON or * NON_ZERO if the window is at other than (0,0) */ ask_user = TRUE; - if (tmp_win->transient || + if (tmp_win->transient || (tmp_win->hints.flags & USPosition) || ((tmp_win->hints.flags & PPosition) && Scr->UsePPosition && - (Scr->UsePPosition == PPOS_ON || + (Scr->UsePPosition == PPOS_ON || tmp_win->attr.x != 0 || tmp_win->attr.y != 0))) ask_user = FALSE; @@ -423,7 +423,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) { Bool firsttime = True; - /* better wait until all the mouse buttons have been + /* better wait until all the mouse buttons have been * released. */ while (TRUE) @@ -433,7 +433,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) XGrabServer(dpy); JunkMask = 0; - if (!XQueryPointer (dpy, Scr->Root, &JunkRoot, + if (!XQueryPointer (dpy, Scr->Root, &JunkRoot, &JunkChild, &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask)) JunkMask = 0; @@ -462,7 +462,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) */ if (JunkMask != 0) continue; - /* + /* * this will cause a warp to the indicated root */ stat = XGrabPointer(dpy, Scr->Root, False, @@ -478,7 +478,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) width = (SIZE_HINDENT + MyFont_TextWidth (&Scr->SizeFont, tmp_win->name, namelen)); height = Scr->SizeFont.height + SIZE_VINDENT * 2; - + XResizeWindow (dpy, Scr->SizeWindow, width + SIZE_HINDENT, height); XMapRaised(dpy, Scr->SizeWindow); InstallRootColormap(); @@ -493,16 +493,16 @@ AddWindow(Window w, int iconm, IconMgr *iconp) AddingW = tmp_win->attr.width + bw2; AddingH = tmp_win->attr.height + tmp_win->title_height + bw2; - + if (Scr->DontMoveOff) { /* - * Make sure the initial outline comes up on the screen. + * Make sure the initial outline comes up on the screen. */ if (AddingX < 0) AddingX = 0; if (AddingX > Scr->MyDisplayWidth - AddingW) AddingX = Scr->MyDisplayWidth - AddingW; - + if (AddingY < 0) AddingY = 0; if (AddingY > Scr->MyDisplayHeight - AddingH) @@ -523,29 +523,29 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (Event.type == ButtonPress) break; } - + if (event.type == ButtonPress) { AddingX = event.xbutton.x_root; AddingY = event.xbutton.y_root; - + /* DontMoveOff prohibits user form off-screen placement */ - if (Scr->DontMoveOff) + if (Scr->DontMoveOff) { int AddingR, AddingB; - + AddingR = AddingX + AddingW; AddingB = AddingY + AddingH; - + if (AddingX < 0) AddingX = 0; if (AddingR > Scr->MyDisplayWidth) AddingX = Scr->MyDisplayWidth - AddingW; - + if (AddingY < 0) AddingY = 0; if (AddingB > Scr->MyDisplayHeight) AddingY = Scr->MyDisplayHeight - AddingH; - + } break; } @@ -563,7 +563,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) AddingR = AddingX + AddingW; AddingB = AddingY + AddingH; - + if (AddingX < 0) AddingX = 0; if (AddingR > Scr->MyDisplayWidth) @@ -594,7 +594,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (0/*Scr->AutoRelativeResize*/) { int dx = (tmp_win->attr.width / 4); int dy = (tmp_win->attr.height / 4); - + #define HALF_AVE_CURSOR_SIZE 8 /* so that it is visible */ if (dx < HALF_AVE_CURSOR_SIZE) dx = HALF_AVE_CURSOR_SIZE; if (dy < HALF_AVE_CURSOR_SIZE) dy = HALF_AVE_CURSOR_SIZE; @@ -640,7 +640,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) /* * XXX - if we are going to do a loop, we ought to consider - * using multiple GXxor lines so that we don't need to + * using multiple GXxor lines so that we don't need to * grab the server. */ XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild, @@ -655,7 +655,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) } } - } + } else if (event.xbutton.button == Button3) { int maxw = Scr->MyDisplayWidth - AddingX - bw2; @@ -698,7 +698,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) #ifdef DEBUG - fprintf(stderr, " position window %d, %d %dx%d\n", + fprintf(stderr, " position window %d, %d %dx%d\n", tmp_win->attr.x, tmp_win->attr.y, tmp_win->attr.width, @@ -737,9 +737,9 @@ AddWindow(Window w, int iconm, IconMgr *iconp) /* * Make sure the client window still exists. We don't want to leave an - * orphan frame window if it doesn't. Since we now have the server - * grabbed, the window can't disappear later without having been - * reparented, so we'll get a DestroyNotify for it. We won't have + * orphan frame window if it doesn't. Since we now have the server + * grabbed, the window can't disappear later without having been + * reparented, so we'll get a DestroyNotify for it. We won't have * gotten one for anything up to here, however. */ if (XGetGeometry(dpy, tmp_win->w, &JunkRoot, &JunkX, &JunkY, @@ -798,7 +798,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) attributes.background_pixmap = None; attributes.border_pixel = tmp_win->border; attributes.cursor = Scr->FrameCursor; - attributes.event_mask = (SubstructureRedirectMask | + attributes.event_mask = (SubstructureRedirectMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask); if (tmp_win->attr.save_under) { @@ -807,14 +807,14 @@ AddWindow(Window w, int iconm, IconMgr *iconp) } tmp_win->frame = XCreateWindow (dpy, Scr->Root, tmp_win->frame_x, - tmp_win->frame_y, + tmp_win->frame_y, (unsigned int) tmp_win->frame_width, (unsigned int) tmp_win->frame_height, (unsigned int) tmp_win->frame_bw, Scr->d_depth, (unsigned int) CopyFromParent, Scr->d_visual, valuemask, &attributes); - + if (tmp_win->title_height) { valuemask = (CWEventMask | CWBorderPixel | CWBackPixel); @@ -822,10 +822,10 @@ AddWindow(Window w, int iconm, IconMgr *iconp) ButtonReleaseMask | ExposureMask); attributes.border_pixel = tmp_win->border; attributes.background_pixel = tmp_win->title.back; - tmp_win->title_w = XCreateWindow (dpy, tmp_win->frame, + tmp_win->title_w = XCreateWindow (dpy, tmp_win->frame, -tmp_win->frame_bw, -tmp_win->frame_bw, - (unsigned int) tmp_win->attr.width, + (unsigned int) tmp_win->attr.width, (unsigned int) Scr->TitleHeight, (unsigned int) tmp_win->frame_bw, Scr->d_depth, @@ -840,8 +840,8 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (tmp_win->highlight) { - tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root, - gray_bits, gray_width, gray_height, + tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root, + gray_bits, gray_width, gray_height, tmp_win->border_tile.fore, tmp_win->border_tile.back, Scr->d_depth); @@ -850,7 +850,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) else tmp_win->gray = None; - + if (tmp_win->title_w) { CreateWindowTitlebarButtons (tmp_win); ComputeTitleLocation (tmp_win); @@ -868,7 +868,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (HasShape) XShapeSelectInput (dpy, tmp_win->w, ShapeNotifyMask); - + if (tmp_win->title_w) { XMapWindow (dpy, tmp_win->title_w); } @@ -887,7 +887,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (!tmp_win->iconmgr) XAddToSaveSet(dpy, tmp_win->w); - + XReparentWindow(dpy, tmp_win->w, tmp_win->frame, 0, tmp_win->title_height); /* * Reparenting generates an UnmapNotify event, followed by a MapNotify. @@ -901,7 +901,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->frame_width, tmp_win->frame_height, -1, True); /* wait until the window is iconified and the icon window is mapped - * before creating the icon window + * before creating the icon window */ tmp_win->icon_w = (Window) 0; @@ -940,7 +940,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) XUngrabServer(dpy); /* if we were in the middle of a menu activated function, regrab - * the pointer + * the pointer */ if (RootFunction) ReGrab(); @@ -967,7 +967,7 @@ MappedNotOverride(Window w) /** - * attach default bindings so that naive users don't get messed up if they + * attach default bindings so that naive users don't get messed up if they * provide a minimal twmrc. */ static void do_add_binding (int button, int context, int modifier, int func) @@ -1023,9 +1023,9 @@ GrabButtons(TwmWindow *tmp_win) /* twm used to do this grab on the application main window, * tmp_win->w . This was not ICCCM complient and was changed. */ - XGrabButton(dpy, i, j, tmp_win->frame, + XGrabButton(dpy, i, j, tmp_win->frame, True, ButtonPressMask | ButtonReleaseMask, - GrabModeAsync, GrabModeAsync, None, + GrabModeAsync, GrabModeAsync, None, Scr->FrameCursor); } } @@ -1113,12 +1113,12 @@ static Window CreateHighlightWindow (TwmWindow *tmp_win) * Pixmaps { TitleHighlight "hline2" } * * (or whatever the horizontal line bitmap is named) in the startup - * file. If all else fails, use the foreground color to look like a + * file. If all else fails, use the foreground color to look like a * solid line. */ if (!Scr->hilitePm) { - Scr->hilitePm = XCreateBitmapFromData (dpy, tmp_win->title_w, - gray_bits, gray_width, + Scr->hilitePm = XCreateBitmapFromData (dpy, tmp_win->title_w, + gray_bits, gray_width, gray_height); Scr->hilite_pm_width = gray_width; Scr->hilite_pm_height = gray_height; @@ -1134,7 +1134,7 @@ static Window CreateHighlightWindow (TwmWindow *tmp_win) (GCForeground|GCBackground|GCGraphicsExposures), &gcv); if (gc) { - XCopyPlane (dpy, Scr->hilitePm, pm, gc, 0, 0, + XCopyPlane (dpy, Scr->hilitePm, pm, gc, 0, 0, Scr->hilite_pm_width, Scr->hilite_pm_height, 0, 0, 1); XFreeGC (dpy, gc); @@ -1181,11 +1181,11 @@ void ComputeCommonTitleOffsets () void ComputeWindowTitleOffsets (TwmWindow *tmp_win, int width, Bool squeeze) { tmp_win->highlightx = (Scr->TBInfo.titlex + tmp_win->name_width); - if (tmp_win->hilite_w || Scr->TBInfo.nright > 0) + if (tmp_win->hilite_w || Scr->TBInfo.nright > 0) tmp_win->highlightx += Scr->TitlePadding; tmp_win->rightx = width - Scr->TBInfo.rightoff; if (squeeze && tmp_win->squeeze_info) { - int rx = (tmp_win->highlightx + + int rx = (tmp_win->highlightx + (tmp_win->hilite_w ? Scr->TBInfo.width * 2 : 0) + (Scr->TBInfo.nright > 0 ? Scr->TitlePadding : 0) + @@ -1197,8 +1197,8 @@ void ComputeWindowTitleOffsets (TwmWindow *tmp_win, int width, Bool squeeze) /** - * calculate the position of the title window. We need to take the frame_bw - * into account since we want (0,0) of the title window to line up with (0,0) + * calculate the position of the title window. We need to take the frame_bw + * into account since we want (0,0) of the title window to line up with (0,0) * of the frame window. */ void ComputeTitleLocation (register TwmWindow *tmp) @@ -1289,7 +1289,7 @@ static void CreateWindowTitlebarButtons (TwmWindow *tmp_win) if (nb > 0) { tmp_win->titlebuttons = (TBWindow *) malloc (nb * sizeof(TBWindow)); if (!tmp_win->titlebuttons) { - fprintf (stderr, "%s: unable to allocate %d titlebuttons\n", + fprintf (stderr, "%s: unable to allocate %d titlebuttons\n", ProgramName, nb); } else { TBWindow *tbw; @@ -1318,7 +1318,7 @@ static void CreateWindowTitlebarButtons (TwmWindow *tmp_win) } } - tmp_win->hilite_w = (tmp_win->titlehighlight + tmp_win->hilite_w = (tmp_win->titlehighlight ? CreateHighlightWindow (tmp_win) : None); XMapSubwindows(dpy, tmp_win->title_w); @@ -1437,7 +1437,7 @@ CreateColormapWindow(Window w, Bool creating_parent, Bool property_window) return (cwin); } -void +void FetchWmColormapWindows (TwmWindow *tmp) { register int i, j; @@ -1449,14 +1449,14 @@ FetchWmColormapWindows (TwmWindow *tmp) number_cmap_windows = 0; - if (/* SUPPRESS 560 */(previously_installed = + if (/* SUPPRESS 560 */(previously_installed = (Scr->cmapInfo.cmaps == &tmp->cmaps && tmp->cmaps.number_cwins))) { cwins = tmp->cmaps.cwins; for (i = 0; i < tmp->cmaps.number_cwins; i++) cwins[i]->colormap->state = 0; } - if (XGetWMColormapWindows (dpy, tmp->w, &cmap_windows, + if (XGetWMColormapWindows (dpy, tmp->w, &cmap_windows, &number_cmap_windows) && number_cmap_windows > 0) { @@ -1472,7 +1472,7 @@ FetchWmColormapWindows (TwmWindow *tmp) (Window *) malloc (sizeof(Window) * (number_cmap_windows + 1)); if (!new_cmap_windows) { - fprintf (stderr, + fprintf (stderr, "%s: unable to allocate %d element colormap window array\n", ProgramName, number_cmap_windows+1); goto done; @@ -1548,9 +1548,9 @@ FetchWmColormapWindows (TwmWindow *tmp) tmp->cmaps.cwins = cwins; tmp->cmaps.number_cwins = number_cmap_windows; if (number_cmap_windows > 1) - tmp->cmaps.scoreboard = + tmp->cmaps.scoreboard = (char *) calloc(1, ColormapsScoreboardLength(&tmp->cmaps)); - + if (previously_installed) InstallWindowColormaps(PropertyNotify, (TwmWindow *) NULL); @@ -1583,7 +1583,7 @@ void GetWindowSizeHints (TwmWindow *tmp) NorthEastGravity, NorthWestGravity }; int right = tmp->attr.x + tmp->attr.width + 2 * tmp->old_bw; int bottom = tmp->attr.y + tmp->attr.height + 2 * tmp->old_bw; - tmp->hints.win_gravity = + tmp->hints.win_gravity = gravs[((Scr->MyDisplayHeight - bottom < tmp->title_height) ? 0 : 2) | ((Scr->MyDisplayWidth - right < tmp->title_height) ? 0 : 1)]; tmp->hints.flags |= PWinGravity; -- cgit v1.2.3