~ubuntu-branches/ubuntu/jaunty/ctwm/jaunty

« back to all changes in this revision

Viewing changes to add_window.c

  • Committer: Bazaar Package Importer
  • Author(s): Branden Robinson
  • Date: 2006-07-21 10:27:56 UTC
  • mfrom: (3.1.2 edgy)
  • Revision ID: james.westby@ubuntu.com-20060721102756-w0ilcq7u9101ypsi
Tags: 3.7-3
* Merge Luk Claes's NMU.  Thanks, Luk!  Luk's changes are:
  + Make ctwm pre-depend on x11-common (>= 1:7.0.0).
  + Correct comment in the menu-method file.
  + I reverted Luk's deletion of the SVN Id keyword and Vim modeline in this
    changelog.  (We finally got a comment character for control files, now
    we need one for changelogs as well.  Lesson?  Never, ever, ever, ever
    make a file format that will be machine-parsed by anything without
    supporting comments.  ALGOL 60 called and wants its innovations back.)
* I had already done the following in SVN but was too slow to release.
  Shame on me.
  + Build-depend on xutils-dev instead of xutils for the X11R7 transition.
  + Adjust debian/rules and debian/postinst to use FHS paths, moving from
    /usr/X11R6 to /usr.  Based on a patch by Steve Langasek.  Thanks, Steve!
    (Closes: #364239)
  + Point menu-method to install-menu interpreter in /usr/bin, not
    /usr/sbin, per Lintian.
  + Add empty binary-indep target in debian/rules to quiet Lintian error.
* Fix SEGV when attempting to bring up the TwmWindows menu when no workspace
  manager is active.  Thanks to Mike O'Connor for the analysis and the
  patch! (Closes: #375240)
* Bump Standards-Version from 3.6.2 to 3.7.2; required changes involving
  placement of files in X11 paths and pre-dependency on x11-common made as
  described above.

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
#include "screen.h"
96
96
#include "icons.h"
97
97
#include "iconmgr.h"
 
98
#ifdef X11R6
 
99
#  include "session.h"
 
100
#endif
98
101
 
99
102
#define gray_width 2
100
103
#define gray_height 2
105
108
 
106
109
int AddingX;
107
110
int AddingY;
108
 
int AddingW;
109
 
int AddingH;
 
111
unsigned int AddingW;
 
112
unsigned int AddingH;
110
113
 
111
114
static int PlaceX = 50;
112
115
static int PlaceY = 50;
113
 
static void CreateWindowTitlebarButtons();
 
116
static void CreateWindowTitlebarButtons(TwmWindow *tmp_win);
114
117
 
115
 
static void             splitWindowRegionEntry ();
116
 
static WindowEntry      *findWindowEntry ();
117
 
static WindowEntry      *prevWindowEntry ();
118
 
static void             mergeWindowEntries ();
 
118
static void             splitWindowRegionEntry (WindowEntry     *we,
 
119
                                                int grav1, int grav2,
 
120
                                                int w, int h);
 
121
static WindowEntry      *findWindowEntry (WorkSpace    *wl,
 
122
                                          TwmWindow    *tmp_win,
 
123
                                          WindowRegion **wrp);
 
124
static WindowEntry      *prevWindowEntry (WindowEntry   *we,
 
125
                                          WindowRegion  *wr);
 
126
static void             mergeWindowEntries (WindowEntry *old, WindowEntry *we);
119
127
 
120
128
char NoName[] = "Untitled"; /* name if no name is specified */
121
129
int  resizeWhenAdd;
137
145
 ************************************************************************
138
146
 */
139
147
 
140
 
GetGravityOffsets (tmp, xp, yp)
141
 
    TwmWindow *tmp;                     /* window from which to get gravity */
142
 
    int *xp, *yp;                       /* return values */
 
148
void GetGravityOffsets (TwmWindow *tmp, /* window from which to get gravity */
 
149
                        int *xp, int *yp)       /* return values */
143
150
{
144
151
    static struct _gravity_offset {
145
152
        int x, y;
191
198
 ***********************************************************************
192
199
 */
193
200
 
194
 
TwmWindow *
195
 
AddWindow(w, iconm, iconp)
196
 
Window w;
197
 
int iconm;
198
 
IconMgr *iconp;
 
201
TwmWindow *AddWindow(Window w, int iconm, IconMgr *iconp)
199
202
{
 
203
    virtualScreen *vs;
200
204
    TwmWindow *tmp_win;                 /* new twm window structure */
201
205
    int stat;
202
206
    XEvent event;
223
227
    int saved_occupation; /* <== [ Matthew McNeill Feb 1997 ] == */
224
228
#endif
225
229
    Bool        random_placed = False;
226
 
    int         found;
 
230
    int         found = 0;
227
231
#ifndef VMS
228
232
    fd_set      mask;
229
233
    int         fd;
234
238
    XRectangle logical_rect;
235
239
#endif
236
240
    WindowBox *winbox;
237
 
    int iswinbox;
 
241
    int iswinbox = 0;
 
242
    int iswman = 0;
 
243
    Window vroot;
238
244
 
239
245
#ifdef DEBUG
240
246
    fprintf(stderr, "AddWindow: w = 0x%x\n", w);
253
259
    switch (iconm) {
254
260
        case  0 : iswinbox = 0; break;
255
261
        case  1 : iswinbox = 0; break;
256
 
        case  2 : iswinbox = 1; iconm = 0; break;
257
 
        default : iswinbox = 0; iconm = 1; break;
 
262
        case  2 : iswinbox = 1; iconm  = 0; break;
 
263
        case  3 : iswman   = 1; iconm  = 0; break;
 
264
        default : iswinbox = 0; iswman = 0; iconm = 1; break;
258
265
    }
259
266
    tmp_win->w = w;
260
267
    tmp_win->zoomed = ZOOM_NONE;
261
268
    tmp_win->iconmgr = iconm;
262
269
    tmp_win->iconmgrp = iconp;
 
270
    tmp_win->wspmgr = iswman;
263
271
    tmp_win->iswinbox = iswinbox;
 
272
    tmp_win->vs = NULL;
264
273
    tmp_win->cmaps.number_cwins = 0;
265
274
    tmp_win->savegeometry.width = -1;
266
275
 
267
276
    XSelectInput(dpy, tmp_win->w, PropertyChangeMask);
268
277
    XGetWindowAttributes(dpy, tmp_win->w, &tmp_win->attr);
269
278
#ifndef NO_LOCALE
270
 
    tmp_win->name = GetWMPropertyString(tmp_win->w, XA_WM_NAME);
 
279
    tmp_win->name = (char*) GetWMPropertyString(tmp_win->w, XA_WM_NAME);
271
280
#else /* NO_LOCALE */
272
281
    XFetchName(dpy, tmp_win->w, &tmp_win->name);
273
282
#endif /* NO_LOCALE */
365
374
        tmp_win->class.res_class = NoName;
366
375
 
367
376
    tmp_win->full_name = tmp_win->name;
 
377
#ifdef CLAUDE
 
378
    if (strstr (tmp_win->name, " - Mozilla")) {
 
379
      char *moz = strstr (tmp_win->name, " - Mozilla");
 
380
      *moz = '\0';
 
381
    }
 
382
#endif
368
383
    namelen = strlen (tmp_win->name);
369
384
 
 
385
    if (LookInList(Scr->IgnoreTransientL, tmp_win->full_name, &tmp_win->class))
 
386
      tmp_win->transient = 0;
 
387
 
370
388
    tmp_win->highlight = Scr->Highlight && 
371
389
        (!LookInList(Scr->NoHighlight, tmp_win->full_name, 
372
390
            &tmp_win->class));
379
397
        tmp_win->full_name, &tmp_win->class)) ? ONTOP_MAX : ONTOP_DEFAULT;
380
398
 
381
399
    tmp_win->titlehighlight = Scr->TitleHighlight && 
382
 
        (!(short)(int) LookInList(Scr->NoTitleHighlight, tmp_win->full_name, 
 
400
        (!LookInList(Scr->NoTitleHighlight, tmp_win->full_name, 
383
401
            &tmp_win->class));
384
402
 
385
403
    tmp_win->auto_raise = Scr->AutoRaiseDefault ||
396
414
    if (Scr->IconifyByUnmapping)
397
415
    {
398
416
        tmp_win->iconify_by_unmapping = iconm ? FALSE :
399
 
            !(short)(int) LookInList(Scr->DontIconify, tmp_win->full_name,
 
417
            !LookInList(Scr->DontIconify, tmp_win->full_name,
400
418
                &tmp_win->class);
401
419
    }
402
 
    tmp_win->iconify_by_unmapping |= 
403
 
        (short)(int) LookInList(Scr->IconifyByUn, tmp_win->full_name,
404
 
            &tmp_win->class);
 
420
    tmp_win->iconify_by_unmapping = tmp_win->iconify_by_unmapping ||
 
421
        LookInList(Scr->IconifyByUn, tmp_win->full_name, &tmp_win->class);
405
422
 
406
423
    if (LookInList (Scr->UnmapByMovingFarAway, tmp_win->full_name, &tmp_win->class))
407
424
        tmp_win->UnmapByMovingFarAway = True;
423
440
    else
424
441
        tmp_win->StartSqueezed = False;
425
442
 
 
443
    if (Scr->AlwaysSqueezeToGravity
 
444
        || LookInList (Scr->AlwaysSqueezeToGravityL, tmp_win->full_name, &tmp_win->class))
 
445
        tmp_win->AlwaysSqueezeToGravity = True;
 
446
    else
 
447
        tmp_win->AlwaysSqueezeToGravity = False;
 
448
 
426
449
    if (tmp_win->transient || tmp_win->group) {
427
450
        TwmWindow *t;
428
451
        for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
431
454
        }
432
455
        if (t) tmp_win->UnmapByMovingFarAway = t->UnmapByMovingFarAway;
433
456
    }
434
 
    if ((Scr->WindowRingAll &&
 
457
    if ((Scr->WindowRingAll && !iswman &&
435
458
        !LookInList(Scr->WindowRingExcludeL, tmp_win->full_name, &tmp_win->class)) ||
436
459
        LookInList(Scr->WindowRingL, tmp_win->full_name, &tmp_win->class)) {
437
460
        if (Scr->Ring) {
568
591
#ifdef X11R6
569
592
    if (restoredFromPrevSession) {
570
593
      SetupOccupation (tmp_win, saved_occupation);
571
 
    } else {
572
 
      SetupOccupation (tmp_win, 0);
573
 
    }
574
 
#else
575
 
      SetupOccupation (tmp_win, 0);
 
594
    } else
576
595
#endif      
 
596
      SetupOccupation (tmp_win, 0);
577
597
    /*=================================================================*/
578
598
 
579
599
    tmp_win->frame_width  = tmp_win->attr.width  + 2 * tmp_win->frame_bw3D;
586
606
    }
587
607
    if (LookInList (Scr->WindowGeometries, tmp_win->full_name, &tmp_win->class)) {
588
608
        char *geom;
589
 
        int mask;
 
609
        int mask_;
590
610
        geom = LookInList (Scr->WindowGeometries, tmp_win->full_name, &tmp_win->class);
591
 
        mask= XParseGeometry (geom, &tmp_win->attr.x, &tmp_win->attr.y,
592
 
                              (unsigned int*) &tmp_win->attr.width,
593
 
                              (unsigned int*) &tmp_win->attr.height);
 
611
        mask_ = XParseGeometry (geom, &tmp_win->attr.x, &tmp_win->attr.y,
 
612
                                (unsigned int*) &tmp_win->attr.width,
 
613
                                (unsigned int*) &tmp_win->attr.height);
594
614
 
595
 
        if (mask & XNegative) tmp_win->attr.x += Scr->MyDisplayWidth  - tmp_win->attr.width;
596
 
        if (mask & YNegative) tmp_win->attr.y += Scr->MyDisplayHeight - tmp_win->attr.height;
 
615
        if (mask_ & XNegative) tmp_win->attr.x += Scr->rootw - tmp_win->attr.width;
 
616
        if (mask_ & YNegative) tmp_win->attr.y += Scr->rooth - tmp_win->attr.height;
597
617
        ask_user = False;
598
618
    }
 
619
 
 
620
    if (XFindContext (dpy, w, VirtScreenContext, (XPointer *)&vs) == XCSUCCESS)
 
621
      vroot = vs->window;
 
622
    else
 
623
    if (tmp_win->vs)
 
624
      vroot = tmp_win->vs->window;
 
625
    else
 
626
      vroot = Scr->Root;
 
627
    if (winbox) vroot = winbox->window;
 
628
 
599
629
    /*
600
630
     * do any prompting for position
601
631
     */
608
638
      if ((Scr->RandomPlacement == RP_ALL) ||
609
639
          ((Scr->RandomPlacement == RP_UNMAPPED) &&
610
640
           ((tmp_win->wmhints && (tmp_win->wmhints->initial_state == IconicState)) ||
611
 
            (! OCCUPY (tmp_win, Scr->workSpaceMgr.activeWSPC))))) { /* just stick it somewhere */
612
 
        if ((PlaceX + tmp_win->attr.width) > Scr->MyDisplayWidth)
613
 
            PlaceX = 50;
614
 
        if ((PlaceY + tmp_win->attr.height) > Scr->MyDisplayHeight)
615
 
            PlaceY = 50;
616
 
 
 
641
            (! visible (tmp_win))))) { /* just stick it somewhere */
 
642
 
 
643
#ifdef DEBUG
 
644
        fprintf(stderr,
 
645
                "DEBUG[RandomPlacement]: win: %dx%d+%d+%d, screen: %dx%d, title height: %d, random: +%d+%d\n",
 
646
                tmp_win->attr.width, tmp_win->attr.height,
 
647
                tmp_win->attr.x, tmp_win->attr.y,
 
648
                Scr->rootw, Scr->rooth,
 
649
                tmp_win->title_height,
 
650
                PlaceX, PlaceY);
 
651
#endif
 
652
 
 
653
        /* If the right edge of the window would fall outside of the
 
654
           screen, start over by placing the left edge of the window
 
655
           50 pixels inside the left edge of the screen.*/
 
656
        if ((PlaceX + tmp_win->attr.width)  > Scr->rootw)
 
657
          PlaceX = 50;
 
658
 
 
659
        /* If the bottom edge of the window would fall outside of the
 
660
           screen, start over by placing the top edge of the window
 
661
           50 pixels inside the top edge of the screen.  Because we
 
662
           add the title height further down, we need to count with
 
663
           it here as well.  */
 
664
        if ((PlaceY + tmp_win->attr.height
 
665
                 + tmp_win->title_height) > Scr->rooth)
 
666
          PlaceY = 50;
 
667
 
 
668
        /* Assign the current random placement to the new window, as
 
669
           a preliminary measure.  Add the title height so things will
 
670
           look right.  */
617
671
        tmp_win->attr.x = PlaceX;
618
 
        tmp_win->attr.y = PlaceY;
619
 
        PlaceX += 30;
620
 
        PlaceY += 30;
 
672
        tmp_win->attr.y = PlaceY + tmp_win->title_height;
 
673
 
 
674
        /* If the window is not supposed to move off the screen, check
 
675
           that it's still within the screen, and if not, attempt to
 
676
           correct the situation. */
 
677
        if (Scr->DontMoveOff) {
 
678
            int available;
 
679
 
 
680
#ifdef DEBUG
 
681
            fprintf(stderr,
 
682
                    "DEBUG[DontMoveOff]: win: %dx%d+%d+%d, screen: %dx%d, bw2: %d, bw3D: %d\n",
 
683
                    tmp_win->attr.width, tmp_win->attr.height,
 
684
                    tmp_win->attr.x, tmp_win->attr.y,
 
685
                    Scr->rootw, Scr->rooth,
 
686
                    bw2, tmp_win->frame_bw3D);
 
687
#endif
 
688
 
 
689
            /* If the right edge of the window is outside the right edge
 
690
               of the screen, we need to move the window left.  Note that
 
691
               this can only happen with windows that are less than 50
 
692
               pixels less wide than the screen. */
 
693
            if ((tmp_win->attr.x + tmp_win->attr.width)  > Scr->rootw) {
 
694
              available = Scr->rootw - tmp_win->attr.width
 
695
                - 2 * (bw2 + tmp_win->frame_bw3D);
 
696
 
 
697
#ifdef DEBUG
 
698
              fprintf(stderr, "DEBUG[DontMoveOff]: availableX: %d\n",
 
699
                      available);
 
700
#endif
 
701
 
 
702
              /* If the window is wider than the screen or exactly the width
 
703
                 of the screen, the availability is exactly 0.  The result
 
704
                 will be to have the window placed as much to the left as
 
705
                 possible. */
 
706
              if (available <= 0) available = 0;
 
707
 
 
708
              /* Place the window exactly between the left and right edge of
 
709
                 the screen when possible.  If available was originally less
 
710
                 than zero, it means the window's left edge will be against
 
711
                 the screen's left edge, and the window's right edge will be
 
712
                 outside the screen.  */
 
713
              tmp_win->attr.x = available / 2;
 
714
            }
 
715
 
 
716
            /* If the bottom edge of the window is outside the bottom edge
 
717
               of the screen, we need to move the window up.  Note that
 
718
               this can only happen with windows that are less than 50
 
719
               pixels less tall than the screen.  Don't forget to count
 
720
               with the title height and the frame widths.  */
 
721
            if ((tmp_win->attr.y + tmp_win->attr.height)  > Scr->rooth) {
 
722
              available = Scr->rooth - tmp_win->attr.height
 
723
                - tmp_win->title_height - 2 * (bw2 + tmp_win->frame_bw3D);
 
724
 
 
725
#ifdef DEBUG
 
726
              fprintf(stderr, "DEBUG[DontMoveOff]: availableY: %d\n",
 
727
                      available);
 
728
#endif
 
729
 
 
730
              /* If the window is taller than the screen or exactly the
 
731
                 height of the screen, the availability is exactly 0.
 
732
                 The result will be to have the window placed as much to
 
733
                 the top as possible. */
 
734
              if (available <= 0) available = 0;
 
735
 
 
736
              /* Place the window exactly between the top and bottom edge of
 
737
                 the screen when possible.  If available was originally less
 
738
                 than zero, it means the window's top edge will be against
 
739
                 the screen's top edge, and the window's bottom edge will be
 
740
                 outside the screen.  Again, don't forget to add the title
 
741
                 height.  */
 
742
              tmp_win->attr.y = available / 2 + tmp_win->title_height;
 
743
            }
 
744
 
 
745
#ifdef DEBUG
 
746
            fprintf(stderr,
 
747
                    "DEBUG[DontMoveOff]: win: %dx%d+%d+%d, screen: %dx%d\n",
 
748
                    tmp_win->attr.width, tmp_win->attr.height,
 
749
                    tmp_win->attr.x, tmp_win->attr.y,
 
750
                    Scr->rootw, Scr->rooth);
 
751
#endif
 
752
        }
 
753
 
 
754
        /* We know that if the window's left edge has moved compared to
 
755
           PlaceX, it will have moved to the left.  If it was moved less
 
756
           than 15 pixel either way, change the next "random position"
 
757
           30 pixels down and right. */
 
758
        if (PlaceX - tmp_win->attr.x < 15
 
759
            || PlaceY - tmp_win->attr.y < 15) {
 
760
          PlaceX += 30;
 
761
          PlaceY += 30;
 
762
        }
621
763
 
622
764
        random_placed = True;
623
765
      } else {                          /* else prompt */
650
792
                if (firsttime) {
651
793
                    if (JunkRoot != Scr->Root) {
652
794
                        register int scrnum;
653
 
 
654
795
                        for (scrnum = 0; scrnum < NumScreens; scrnum++) {
655
796
                            if (JunkRoot == RootWindow (dpy, scrnum)) break;
656
797
                        }
657
 
 
658
798
                        if (scrnum != NumScreens) PreviousScreen = scrnum;
659
799
                    }
 
800
                    if (Scr->currentvs) {
 
801
                      vroot = Scr->currentvs->window;
 
802
                    }
660
803
                    firsttime = False;
661
804
                }
 
805
                if (winbox) vroot = winbox->window;
662
806
 
663
807
                /*
664
808
                 * wait for buttons to come up; yuck
668
812
                /* 
669
813
                 * this will cause a warp to the indicated root
670
814
                 */
671
 
                stat = XGrabPointer(dpy, winbox ? winbox->window : Scr->Root, False,
 
815
                stat = XGrabPointer(dpy, vroot, False,
672
816
                    ButtonPressMask | ButtonReleaseMask |
673
817
                    PointerMotionMask | PointerMotionHintMask,
674
818
                    GrabModeAsync, GrabModeAsync,
675
 
                    winbox ? winbox->window : Scr->Root, UpperLeftCursor, CurrentTime);
676
 
 
677
 
                if (stat == GrabSuccess)
678
 
                    break;
 
819
                    vroot, UpperLeftCursor, CurrentTime);
 
820
                if (stat == GrabSuccess) break;
679
821
            }
680
822
 
681
823
#ifdef I18N
712
854
                              SIZE_HINDENT,
713
855
                              SIZE_VINDENT + Scr->SizeFont.font->ascent,
714
856
                              tmp_win->name, namelen);
715
 
#endif      
 
857
#endif
716
858
 
717
 
            if (winbox) {
718
 
                XTranslateCoordinates (dpy, Scr->Root, winbox->window,
719
 
                        AddingX, AddingY, &AddingX, &AddingY, &JunkChild);
720
 
                ConstrainedToWinBox (tmp_win, AddingX, AddingY, &AddingX, &AddingY);
721
 
            }
 
859
            if (winbox) ConstrainedToWinBox (tmp_win, AddingX, AddingY, &AddingX, &AddingY);
722
860
 
723
861
            AddingW = tmp_win->attr.width + bw2 + 2 * tmp_win->frame_bw3D;
724
862
            AddingH = tmp_win->attr.height + tmp_win->title_height +
725
863
                                bw2 + 2 * tmp_win->frame_bw3D;
726
 
                MoveOutline(winbox ? winbox->window : Scr->Root,
727
 
                        AddingX, AddingY, AddingW, AddingH,
728
 
                            tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D);
 
864
            MoveOutline(vroot,AddingX, AddingY, AddingW, AddingH,
 
865
                        tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D);
729
866
 
730
867
#ifdef I18N
731
868
            XmbDrawImageString (dpy, Scr->SizeWindow, Scr->SizeFont.font_set,
768
905
                        if (event.type == ButtonPress)
769
906
                            break;
770
907
                }
771
 
                event.xbutton.x_root -= Scr->MyDisplayX;
772
 
                event.xbutton.y_root -= Scr->MyDisplayY;
773
 
                
 
908
                if (Scr->Root != Scr->RealRoot) FixRootEvent (&event);
774
909
                if (event.type == ButtonPress) {
775
910
                  AddingX = event.xbutton.x_root;
776
911
                  AddingY = event.xbutton.y_root;
777
912
 
778
 
                  if (winbox) {
779
 
                    XTranslateCoordinates (dpy, Scr->Root, winbox->window,
780
 
                    AddingX, AddingY, &AddingX, &AddingY, &JunkChild);
781
 
                  }
782
913
                  TryToGrid (tmp_win, &AddingX, &AddingY);
783
914
                  if (Scr->PackNewWindows) TryToPack (tmp_win, &AddingX, &AddingY);
784
915
 
794
925
                    continue;
795
926
                }
796
927
 
797
 
                XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild,
 
928
                XQueryPointer(dpy, vroot, &JunkRoot, &JunkChild,
798
929
                    &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask);
799
930
 
800
 
                if (winbox) {
801
 
                    XTranslateCoordinates (dpy, Scr->Root, winbox->window,
802
 
                        AddingX, AddingY, &AddingX, &AddingY, &JunkChild);
803
 
                }
804
931
                TryToGrid (tmp_win, &AddingX, &AddingY);
805
932
                if (Scr->PackNewWindows) TryToPack (tmp_win, &AddingX, &AddingY);
806
933
                if (Scr->DontMoveOff)
807
934
                {
808
935
                    ConstrainByBorders (tmp_win, &AddingX, AddingW, &AddingY, AddingH);
809
936
                }
810
 
                MoveOutline(winbox ? winbox->window : Scr->Root,
811
 
                        AddingX, AddingY, AddingW, AddingH,
 
937
                MoveOutline(vroot, AddingX, AddingY, AddingW, AddingH,
812
938
                            tmp_win->frame_bw, tmp_win->title_height + tmp_win->frame_bw3D);
813
939
 
814
940
                DisplayPosition (tmp_win, AddingX, AddingY);
852
978
#undef HALF_AVE_CURSOR_SIZE
853
979
                    dx += (tmp_win->frame_bw + 1);
854
980
                    dy += (bw2 + tmp_win->title_height + 1);
855
 
                    if (AddingX + dx >= Scr->MyDisplayWidth - Scr->BorderRight)
856
 
                      dx = Scr->MyDisplayWidth - Scr->BorderRight - AddingX - 1;
857
 
                    if (AddingY + dy >= Scr->MyDisplayHeight - Scr->BorderBottom)
858
 
                      dy = Scr->MyDisplayHeight - Scr->BorderBottom - AddingY - 1;
 
981
                    if (AddingX + dx >= Scr->rootw - Scr->BorderRight)
 
982
                      dx = Scr->rootw - Scr->BorderRight - AddingX - 1;
 
983
                    if (AddingY + dy >= Scr->rooth - Scr->BorderBottom)
 
984
                      dy = Scr->rooth - Scr->BorderBottom - AddingY - 1;
859
985
                    if (dx > 0 && dy > 0)
860
986
                      XWarpPointer (dpy, None, None, 0, 0, 0, 0, dx, dy);
861
987
                } else {
862
 
                    XWarpPointer (dpy, None, Scr->Root, 0, 0, 0, 0,
 
988
                    XWarpPointer (dpy, None, vroot, 0, 0, 0, 0,
863
989
                                  AddingX + AddingW/2, AddingY + AddingH/2);
864
990
                }
865
991
                AddStartResize(tmp_win, AddingX, AddingY, AddingW, AddingH);
878
1004
                            if (event.type == ButtonRelease)
879
1005
                                break;
880
1006
                    }
881
 
                    event.xbutton.x_root -= Scr->MyDisplayX;
882
 
                    event.xbutton.y_root -= Scr->MyDisplayY;
 
1007
                    if (Scr->Root != Scr->RealRoot) FixRootEvent (&event);
883
1008
 
884
1009
                    if (event.type == ButtonRelease)
885
1010
                    {
896
1021
                     * using multiple GXxor lines so that we don't need to 
897
1022
                     * grab the server.
898
1023
                     */
899
 
                    XQueryPointer(dpy, Scr->Root, &JunkRoot, &JunkChild,
900
 
                        &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask);
901
 
                    if (winbox) {
902
 
                        XTranslateCoordinates (dpy, Scr->Root, winbox->window,
903
 
                            AddingX, AddingY, &AddingX, &AddingY, &JunkChild);
904
 
                    }
 
1024
                    XQueryPointer(dpy, vroot, &JunkRoot, &JunkChild,
 
1025
                                  &JunkX, &JunkY, &AddingX, &AddingY, &JunkMask);
905
1026
 
906
1027
                    if (lastx != AddingX || lasty != AddingY)
907
1028
                    {
917
1038
            } 
918
1039
            else if (event.xbutton.button == Button3)
919
1040
            {
920
 
                int maxw = Scr->MyDisplayWidth  - Scr->BorderRight  - AddingX - bw2;
921
 
                int maxh = Scr->MyDisplayHeight - Scr->BorderBottom - AddingY - bw2;
 
1041
                int maxw = Scr->rootw - Scr->BorderRight  - AddingX - bw2;
 
1042
                int maxh = Scr->rooth - Scr->BorderBottom - AddingY - bw2;
922
1043
 
923
1044
                /*
924
1045
                 * Make window go to bottom of screen, and clip to right edge.
938
1059
                XMaskEvent(dpy, ButtonReleaseMask, &event);
939
1060
            }
940
1061
          }
941
 
            MoveOutline(winbox ? winbox->window : Scr->Root, 0, 0, 0, 0, 0, 0);
 
1062
            MoveOutline(vroot, 0, 0, 0, 0, 0, 0);
942
1063
            XUnmapWindow(dpy, Scr->SizeWindow);
943
1064
            UninstallRootColormap();
944
1065
            XUngrabPointer(dpy, CurrentTime);
955
1076
    } else {                            /* put it where asked, mod title bar */
956
1077
        /* if the gravity is towards the top, move it by the title height */
957
1078
        if (gravy < 0) tmp_win->attr.y -= gravy * tmp_win->title_height;
958
 
        if (winbox) {
959
 
          XTranslateCoordinates (dpy, Scr->Root, winbox->window,
960
 
                       tmp_win->attr.x,  tmp_win->attr.y,
961
 
                      &tmp_win->attr.x, &tmp_win->attr.y, &JunkChild);
962
 
        }
963
1079
    }
964
1080
 
965
1081
#ifdef DEBUG
978
1094
 
979
1095
    tmp_win->title_width = tmp_win->attr.width;
980
1096
 
 
1097
#ifndef NO_LOCALE
 
1098
    tmp_win->icon_name = (char*) GetWMPropertyString(tmp_win->w, XA_WM_ICON_NAME);
 
1099
#else /* NO_LOCALE */
 
1100
    if (XGetWindowProperty (dpy, tmp_win->w, XA_WM_ICON_NAME, 0L, 200L, False,
 
1101
                            XA_STRING, &actual_type, &actual_format, &nitems,
 
1102
                            &bytesafter,(unsigned char **)&tmp_win->icon_name))
 
1103
        tmp_win->icon_name = tmp_win->name;
 
1104
#endif /* NO_LOCALE */
 
1105
 
 
1106
    if (tmp_win->icon_name == NULL) tmp_win->icon_name = tmp_win->name;
 
1107
#ifdef CLAUDE
 
1108
    if (strstr (tmp_win->icon_name, " - Mozilla")) {
 
1109
      char *moz = strstr (tmp_win->icon_name, " - Mozilla");
 
1110
      *moz = '\0';
 
1111
    }
 
1112
#endif
 
1113
 
981
1114
#ifdef I18N
982
 
    XmbTextExtents(Scr->TitleBarFont.font_set, tmp_win->name, namelen,
983
 
                   &ink_rect, &logical_rect);
984
 
    
 
1115
    XmbTextExtents (Scr->TitleBarFont.font_set, tmp_win->name, namelen, &ink_rect, &logical_rect);
985
1116
    tmp_win->name_width = logical_rect.width;
986
1117
#else    
987
 
    tmp_win->name_width = XTextWidth(Scr->TitleBarFont.font, tmp_win->name,
988
 
                                     namelen);
 
1118
    tmp_win->name_width = XTextWidth (Scr->TitleBarFont.font, tmp_win->name, namelen);
989
1119
#endif    
990
1120
 
991
 
#ifndef NO_LOCALE
992
 
    tmp_win->icon_name = GetWMPropertyString(tmp_win->w, XA_WM_ICON_NAME);
993
 
#else /* NO_LOCALE */
994
 
    if (XGetWindowProperty (dpy, tmp_win->w, XA_WM_ICON_NAME, 0L, 200L, False,
995
 
                            XA_STRING, &actual_type, &actual_format, &nitems,
996
 
                            &bytesafter,(unsigned char **)&tmp_win->icon_name))
997
 
        tmp_win->icon_name = tmp_win->name;
998
 
#endif /* NO_LOCALE */
999
 
 
1000
 
    if (tmp_win->icon_name == NULL)
1001
 
        tmp_win->icon_name = tmp_win->name;
1002
 
#ifdef CLAUDE
1003
 
    else if ((strlen (tmp_win->icon_name) > 11) &&
1004
 
            (strncmp (tmp_win->icon_name, "Netscape: ", 10) == 0)) {
1005
 
        char *tmp;
1006
 
 
1007
 
        tmp = strdup (tmp_win->icon_name + 10);
1008
 
        XFree ((char*) tmp_win->icon_name);
1009
 
        tmp_win->icon_name = tmp;
1010
 
    }
1011
 
#endif
1012
 
 
1013
1121
    if (tmp_win->old_bw) XSetWindowBorderWidth (dpy, tmp_win->w, 0);
1014
1122
 
1015
1123
    tmp_win->squeezed = FALSE;
1108
1216
        valuemask |= CWWinGravity;
1109
1217
    }
1110
1218
 
1111
 
    tmp_win->frame = XCreateWindow (dpy, winbox ? winbox->window : Scr->Root, tmp_win->frame_x,
1112
 
                                    tmp_win->frame_y, 
 
1219
    if ((tmp_win->frame_x > Scr->rootw) ||
 
1220
        (tmp_win->frame_y > Scr->rooth) ||
 
1221
        ((int)(tmp_win->frame_x + tmp_win->frame_width)  < 0) ||
 
1222
        ((int)(tmp_win->frame_y + tmp_win->frame_height) < 0)) {
 
1223
      tmp_win->frame_x = 0;
 
1224
      tmp_win->frame_y = 0;
 
1225
    }
 
1226
    tmp_win->frame = XCreateWindow (dpy, vroot, tmp_win->frame_x, tmp_win->frame_y, 
1113
1227
                                    (unsigned int) tmp_win->frame_width,
1114
1228
                                    (unsigned int) tmp_win->frame_height,
1115
1229
                                    (unsigned int) tmp_win->frame_bw,
1144
1258
    if (tmp_win->highlight)
1145
1259
    {
1146
1260
        if (Scr->use3Dtitles && (Scr->Monochrome != COLOR))
1147
 
            tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root, 
 
1261
            tmp_win->gray = XCreatePixmapFromBitmapData(dpy, vroot, 
1148
1262
                (char*)black_bits, gray_width, gray_height, 
1149
1263
                tmp_win->border_tile.fore, tmp_win->border_tile.back,
1150
1264
                Scr->d_depth);
1151
1265
        else
1152
 
            tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root, 
 
1266
            tmp_win->gray = XCreatePixmapFromBitmapData(dpy, vroot, 
1153
1267
                (char*)gray_bits, gray_width, gray_height, 
1154
1268
                tmp_win->border_tile.fore, tmp_win->border_tile.back,
1155
1269
                Scr->d_depth);
1201
1315
        tmp_win->wShaped = boundingShaped;
1202
1316
    }
1203
1317
 
1204
 
    if (!tmp_win->iconmgr &&
1205
 
        (tmp_win->w != Scr->workSpaceMgr.workspaceWindow.w) &&
1206
 
        (tmp_win->w != Scr->workSpaceMgr.occupyWindow.w))
 
1318
    if (!tmp_win->iconmgr &&! iswman &&
 
1319
        (tmp_win->w != Scr->workSpaceMgr.occupyWindow->w))
1207
1320
        XAddToSaveSet(dpy, tmp_win->w);
1208
 
        
 
1321
 
1209
1322
    XReparentWindow(dpy, tmp_win->w, tmp_win->frame, tmp_win->frame_bw3D,
1210
1323
                tmp_win->title_height + tmp_win->frame_bw3D);
1211
1324
    /*
1273
1386
        }
1274
1387
    }
1275
1388
 
 
1389
    if (tmp_win->group && tmp_win->group != tmp_win->w) {
 
1390
      /*
 
1391
       * GTK windows often have a spurious "group leader" window which is
 
1392
       * never reported to us and therefore does not really exist. Look for
 
1393
       * that here. It is in fact a duplicate of the WM_CLIENT_LEADER
 
1394
       * property.
 
1395
       */
 
1396
 
 
1397
      TwmWindow *groupleader; /* the current twm window */
 
1398
      stat = XFindContext(dpy, tmp_win->group, TwmContext, (XPointer *)&groupleader);
 
1399
      if (stat == XCNOENT)
 
1400
        groupleader = NULL;
 
1401
      if (!groupleader) {
 
1402
        tmp_win->group = tmp_win->w;
 
1403
      }
 
1404
    } 
 
1405
 
1276
1406
    XUngrabServer(dpy);
1277
1407
 
1278
1408
    /* if we were in the middle of a menu activated function, regrab
1279
1409
     * the pointer 
1280
1410
     */
1281
 
    if (RootFunction)
1282
 
        ReGrab();
1283
 
    WMapAddWindow (tmp_win);
 
1411
    if (RootFunction) ReGrab();
 
1412
    if (!iswman) WMapAddWindow (tmp_win);
1284
1413
    SetPropsIfCaptiveCtwm (tmp_win);
1285
1414
    savegeometry (tmp_win);
1286
1415
    return (tmp_win);
1303
1432
 ***********************************************************************
1304
1433
 */
1305
1434
 
1306
 
int
1307
 
MappedNotOverride(w)
1308
 
    Window w;
 
1435
int MappedNotOverride(Window w)
1309
1436
{
1310
1437
    XWindowAttributes wa;
1311
1438
 
1315
1442
 
1316
1443
 
1317
1444
/***********************************************************************
1318
 
 * 
 
1445
 *
1319
1446
 *  Procedure:
1320
1447
 *      AddDefaultBindings - attach default bindings so that naive users
1321
1448
 *      don't get messed up if they provide a minimal twmrc.
1322
1449
 */
1323
 
static void do_add_binding (button, context, modifier, func)
1324
 
    int button, context, modifier;
1325
 
    int func;
1326
 
 
1450
static void do_add_binding (int button, int context, int modifier, int func)
 
1451
{
1327
1452
    AddFuncButton (button, context, modifier, func, NULL, NULL);
1328
1453
}
1329
1454
 
1330
 
AddDefaultBindings ()
 
1455
void AddDefaultBindings (void)
1331
1456
{
1332
1457
#define NoModifierMask 0
1333
1458
 
1363
1488
                pointer_mode, GrabModeAsync, None,  \
1364
1489
                Scr->FrameCursor);
1365
1490
 
1366
 
void
1367
 
GrabButtons(tmp_win)
1368
 
TwmWindow *tmp_win;
 
1491
void GrabButtons(TwmWindow *tmp_win)
1369
1492
{
1370
1493
    FuncButton *tmp;
1371
1494
    int i;
1419
1542
#define ungrabkey(funckey, modifier, window) \
1420
1543
        XUngrabKey (dpy, funckey->keycode, funckey->mods | modifier, window);
1421
1544
 
1422
 
void
1423
 
GrabKeys(tmp_win)
1424
 
TwmWindow *tmp_win;
 
1545
void GrabKeys(TwmWindow *tmp_win)
1425
1546
{
1426
1547
    FuncKey *tmp;
1427
1548
    IconMgr *p;
1435
1556
        switch (tmp->cont)
1436
1557
        {
1437
1558
        case C_WINDOW:
 
1559
        /* case C_WORKSPACE: */
1438
1560
            if (tmp->mods & AltMask) break;
1439
1561
            grabkey (tmp, 0, tmp_win->w);
1440
1562
            if (Scr->IgnoreLockModifier && !(tmp->mods & LockMask))
1441
 
                grabkey (tmp, LockMask, tmp_win->w);
 
1563
                grabkey (tmp, LockMask, tmp_win->w);
1442
1564
            for (i = 0 ; i < 8 ; i++) {
1443
1565
                if ((Scr->IgnoreModifier & ModifierMask [i]) &&
1444
1566
                    !(tmp->mods & ModifierMask [i]))
1527
1649
    }
1528
1650
}
1529
1651
 
1530
 
void ComputeCommonTitleOffsets ()
 
1652
void ComputeCommonTitleOffsets (void)
1531
1653
{
1532
1654
    int buttonwidth = (Scr->TBInfo.width + Scr->TBInfo.pad);
1533
1655
 
1543
1665
                                Scr->TitlePadding);
1544
1666
}
1545
1667
 
1546
 
static void CreateHighlightWindows (tmp_win)
1547
 
    TwmWindow *tmp_win;
 
1668
static void CreateHighlightWindows (TwmWindow *tmp_win)
1548
1669
{
1549
1670
    XSetWindowAttributes attributes;    /* attributes for create windows */
1550
1671
    GC gc;
1636
1757
                       Scr->d_visual, valuemask, &attributes);
1637
1758
}
1638
1759
 
1639
 
static void CreateLowlightWindows (tmp_win)
1640
 
    TwmWindow *tmp_win;
 
1760
static void CreateLowlightWindows (TwmWindow *tmp_win)
1641
1761
{
1642
1762
    XSetWindowAttributes attributes;    /* attributes for create windows */
1643
1763
    unsigned long valuemask;
1701
1821
}
1702
1822
 
1703
1823
 
1704
 
void ComputeWindowTitleOffsets (tmp_win, width, squeeze)
1705
 
    TwmWindow *tmp_win;
1706
 
    Bool squeeze;
 
1824
void ComputeWindowTitleOffsets (TwmWindow *tmp_win, unsigned int width,
 
1825
                                Bool squeeze)
1707
1826
{
1708
1827
    int titlew = width - Scr->TBInfo.titlex - Scr->TBInfo.rightoff;
1709
1828
 
1754
1873
 * to take the frame_bw into account since we want (0,0) of the title window
1755
1874
 * to line up with (0,0) of the frame window.
1756
1875
 */
1757
 
void ComputeTitleLocation (tmp)
1758
 
    register TwmWindow *tmp;
 
1876
void ComputeTitleLocation (register TwmWindow *tmp)
1759
1877
{
1760
1878
    tmp->title_x = tmp->frame_bw3D - tmp->frame_bw;
1761
1879
    tmp->title_y = tmp->frame_bw3D - tmp->frame_bw;
1805
1923
}
1806
1924
 
1807
1925
 
1808
 
static void CreateWindowTitlebarButtons (tmp_win)
1809
 
    TwmWindow *tmp_win;
 
1926
static void CreateWindowTitlebarButtons (TwmWindow *tmp_win)
1810
1927
{
1811
1928
    unsigned long valuemask;            /* mask for create windows */
1812
1929
    XSetWindowAttributes attributes;    /* attributes for create windows */
1895
2012
}
1896
2013
 
1897
2014
 
1898
 
SetHighlightPixmap (filename)
1899
 
    char *filename;
 
2015
void SetHighlightPixmap (char *filename)
1900
2016
{
1901
2017
#ifdef VMS
1902
2018
    char *ftemp;
1908
2024
}
1909
2025
 
1910
2026
 
1911
 
FetchWmProtocols (tmp)
1912
 
    TwmWindow *tmp;
 
2027
void FetchWmProtocols (TwmWindow *tmp)
1913
2028
{
1914
2029
    unsigned long flags = 0L;
1915
2030
    Atom *protocols = NULL;
1929
2044
    tmp->protocols = flags;
1930
2045
}
1931
2046
 
1932
 
TwmColormap *
1933
 
CreateTwmColormap(c)
1934
 
    Colormap c;
 
2047
TwmColormap *CreateTwmColormap(Colormap c)
1935
2048
{
1936
2049
    TwmColormap *cmap;
1937
2050
    cmap = (TwmColormap *) malloc(sizeof(TwmColormap));
1948
2061
    return (cmap);
1949
2062
}
1950
2063
 
1951
 
ColormapWindow *
1952
 
CreateColormapWindow(w, creating_parent, property_window)
1953
 
    Window w;
1954
 
    Bool creating_parent;
1955
 
    Bool property_window;
 
2064
ColormapWindow *CreateColormapWindow(Window w,
 
2065
                                     Bool creating_parent,
 
2066
                                     Bool property_window)
1956
2067
{
1957
2068
    ColormapWindow *cwin;
1958
2069
    TwmColormap *cmap;
2004
2115
 
2005
2116
    return (cwin);
2006
2117
}
2007
 
                
2008
 
FetchWmColormapWindows (tmp)
2009
 
    TwmWindow *tmp;
 
2118
 
 
2119
int FetchWmColormapWindows (TwmWindow *tmp)
2010
2120
{
2011
2121
    register int i, j;
2012
2122
    Window *cmap_windows = NULL;
2014
2124
    int number_cmap_windows = 0;
2015
2125
    ColormapWindow **cwins = NULL;
2016
2126
    int previously_installed;
2017
 
    extern void free_cwins();
2018
2127
 
2019
2128
    number_cmap_windows = 0;
2020
2129
 
2021
 
    if (/* SUPPRESS 560 */previously_installed = 
2022
 
       (Scr->cmapInfo.cmaps == &tmp->cmaps && tmp->cmaps.number_cwins)) {
 
2130
    if (/* SUPPRESS 560 */
 
2131
        (previously_installed =
 
2132
         (Scr->cmapInfo.cmaps == &tmp->cmaps && tmp->cmaps.number_cwins))) {
2023
2133
        cwins = tmp->cmaps.cwins;
2024
2134
        for (i = 0; i < tmp->cmaps.number_cwins; i++)
2025
2135
            cwins[i]->colormap->state = 0;
2135
2245
}
2136
2246
 
2137
2247
 
2138
 
void GetWindowSizeHints (tmp)
2139
 
    TwmWindow *tmp;
 
2248
void GetWindowSizeHints (TwmWindow *tmp)
2140
2249
{
2141
2250
    long supplied = 0;
2142
2251
 
2154
2263
        int right =  tmp->attr.x + tmp->attr.width + 2 * tmp->old_bw;
2155
2264
        int bottom = tmp->attr.y + tmp->attr.height + 2 * tmp->old_bw;
2156
2265
        tmp->hints.win_gravity = 
2157
 
          gravs[((Scr->MyDisplayHeight - bottom <
 
2266
          gravs[((Scr->rooth - bottom <
2158
2267
                tmp->title_height + 2 * tmp->frame_bw3D) ? 0 : 2) |
2159
 
                ((Scr->MyDisplayWidth - right   <
 
2268
                ((Scr->rootw - right   <
2160
2269
                tmp->title_height + 2 * tmp->frame_bw3D) ? 0 : 1)];
2161
2270
        tmp->hints.flags |= PWinGravity;
2162
2271
    }
2163
2272
}
2164
2273
 
2165
 
AnimateButton (tbw)
2166
 
TBWindow *tbw;
 
2274
void AnimateButton (TBWindow *tbw)
2167
2275
{
2168
2276
    Image       *image;
2169
2277
    XSetWindowAttributes attr;
2175
2283
    tbw->image = image->next;
2176
2284
}
2177
2285
 
2178
 
AnimateHighlight (t)
2179
 
TwmWindow *t;
 
2286
void AnimateHighlight (TwmWindow *t)
2180
2287
{
2181
2288
    Image       *image;
2182
2289
    XSetWindowAttributes attr;
2194
2301
    t->HiliteImage = image->next;
2195
2302
}
2196
2303
 
2197
 
name_list **AddWindowRegion (geom, grav1, grav2)
2198
 
char *geom;
2199
 
int  grav1, grav2;
 
2304
name_list **AddWindowRegion (char *geom, int grav1, int grav2)
2200
2305
{
2201
2306
    WindowRegion *wr;
2202
2307
    int mask;
2215
2320
    mask = XParseGeometry (geom, &wr->x, &wr->y, (unsigned int*) &wr->w,
2216
2321
                                                 (unsigned int*) &wr->h);
2217
2322
 
2218
 
    if (mask & XNegative) wr->x += Scr->MyDisplayWidth  - wr->w;
2219
 
    if (mask & YNegative) wr->y += Scr->MyDisplayHeight - wr->h;
 
2323
    if (mask & XNegative) wr->x += Scr->rootw - wr->w;
 
2324
    if (mask & YNegative) wr->y += Scr->rooth - wr->h;
2220
2325
 
2221
2326
    return (&(wr->clientlist));
2222
2327
}
2223
2328
 
2224
 
void CreateWindowRegions () {
 
2329
void CreateWindowRegions (void) {
2225
2330
    WindowRegion  *wr, *wr1 = NULL, *wr2 = NULL;
2226
 
    WorkSpaceList *wl;
 
2331
    WorkSpace *wl;
2227
2332
 
2228
2333
    for (wl = Scr->workSpaceMgr.workSpaceList; wl != NULL; wl = wl->next) {
2229
2334
        wl->FirstWindowRegion = NULL;
2247
2352
}
2248
2353
 
2249
2354
 
2250
 
Bool PlaceWindowInRegion (tmp_win, final_x, final_y)
2251
 
TwmWindow *tmp_win;
2252
 
int       *final_x, *final_y;
 
2355
Bool PlaceWindowInRegion (TwmWindow *tmp_win, int *final_x, int *final_y)
2253
2356
{
2254
2357
    WindowRegion  *wr;
2255
2358
    WindowEntry   *we;
2256
 
    int            w, h;
2257
 
    WorkSpaceList *wl;
 
2359
    int           w, h;
 
2360
    WorkSpace     *wl;
2258
2361
 
2259
2362
    if (!Scr->FirstWindowRegion) return (False);
2260
2363
    for (wl = Scr->workSpaceMgr.workSpaceList; wl != NULL; wl = wl->next) {
2285
2388
    return (True);
2286
2389
}
2287
2390
 
2288
 
static void splitWindowRegionEntry (we, grav1, grav2, w, h)
2289
 
WindowEntry     *we;
2290
 
int             grav1, grav2;
2291
 
int             w, h;
 
2391
static void splitWindowRegionEntry (WindowEntry *we, int grav1, int grav2,
 
2392
                                    int w, int h)
2292
2393
{
2293
2394
    WindowEntry *new;
2294
2395
    int         save;
2339
2440
    }
2340
2441
}
2341
2442
 
2342
 
static WindowEntry *findWindowEntry (wl, tmp_win, wrp)
2343
 
WorkSpaceList   *wl;
2344
 
TwmWindow       *tmp_win;
2345
 
WindowRegion    **wrp;
 
2443
static WindowEntry *findWindowEntry (WorkSpace *wl, TwmWindow *tmp_win,
 
2444
                                     WindowRegion **wrp)
2346
2445
{
2347
2446
    WindowRegion *wr;
2348
2447
    WindowEntry  *we;
2358
2457
    return (WindowEntry*) 0;
2359
2458
}
2360
2459
 
2361
 
static WindowEntry *prevWindowEntry (we, wr)
2362
 
WindowEntry     *we;
2363
 
WindowRegion    *wr;
 
2460
static WindowEntry *prevWindowEntry (WindowEntry *we, WindowRegion *wr)
2364
2461
{
2365
2462
    WindowEntry *wp;
2366
2463
 
2369
2466
    return wp;
2370
2467
}
2371
2468
 
2372
 
static void mergeWindowEntries (old, we)
2373
 
WindowEntry     *old, *we;
 
2469
static void mergeWindowEntries (WindowEntry *old, WindowEntry *we)
2374
2470
{
2375
2471
    if (old->y == we->y) {
2376
2472
        we->w = old->w + we->w;
2381
2477
    }
2382
2478
}
2383
2479
 
2384
 
void RemoveWindowFromRegion (tmp_win)
2385
 
TwmWindow       *tmp_win;
 
2480
void RemoveWindowFromRegion (TwmWindow *tmp_win)
2386
2481
{
2387
 
    WindowEntry   *we, *wp, *wn;
2388
 
    WindowRegion  *wr;
2389
 
    WorkSpaceList *wl;
 
2482
    WindowEntry  *we, *wp, *wn;
 
2483
    WindowRegion *wr;
 
2484
    WorkSpace    *wl;
2390
2485
 
2391
2486
    if (!Scr->FirstWindowRegion) return;
2392
2487
    we = (WindowEntry*) 0;