~ctwm/ctwm/trunk

« back to all changes in this revision

Viewing changes to win_iconify.c

  • Committer: Matthew Fuller
  • Date: 2016-09-03 05:24:57 UTC
  • mto: This revision was merged to the branch mainline in revision 521.
  • Revision ID: fullermd@over-yonder.net-20160903052457-r2v8dux7hkkkq0cg
Zoom() is only used in funcs now in win_iconify, so move it there and
staticize it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
static void SweepWindow(TwmWindow *tmp_win, Window blanket);
30
30
 
31
31
/* De/iconify utils */
 
32
static void Zoom(Window wf, Window wt);
32
33
static void ReMapOne(TwmWindow *t, TwmWindow *leader);
33
34
static void waitamoment(float timeout);
34
35
 
428
429
/*
429
430
 * Utils used by various bits above
430
431
 */
 
432
 
 
433
/***********************************************************************
 
434
 *
 
435
 *  Procedure:
 
436
 *      Zoom - zoom in or out of an icon
 
437
 *
 
438
 *  Inputs:
 
439
 *      wf      - window to zoom from
 
440
 *      wt      - window to zoom to
 
441
 *
 
442
 ***********************************************************************
 
443
 */
 
444
static void
 
445
Zoom(Window wf, Window wt)
 
446
{
 
447
        int fx, fy, tx, ty;                 /* from, to */
 
448
        unsigned int fw, fh, tw, th;        /* from, to */
 
449
        long dx, dy, dw, dh;
 
450
        long z;
 
451
        int j;
 
452
 
 
453
        if((Scr->IconifyStyle != ICONIFY_NORMAL) || !Scr->DoZoom
 
454
                        || Scr->ZoomCount < 1) {
 
455
                return;
 
456
        }
 
457
 
 
458
        if(wf == None || wt == None) {
 
459
                return;
 
460
        }
 
461
 
 
462
        XGetGeometry(dpy, wf, &JunkRoot, &fx, &fy, &fw, &fh, &JunkBW, &JunkDepth);
 
463
        XGetGeometry(dpy, wt, &JunkRoot, &tx, &ty, &tw, &th, &JunkBW, &JunkDepth);
 
464
 
 
465
        dx = (long) tx - (long) fx; /* going from -> to */
 
466
        dy = (long) ty - (long) fy; /* going from -> to */
 
467
        dw = (long) tw - (long) fw; /* going from -> to */
 
468
        dh = (long) th - (long) fh; /* going from -> to */
 
469
        z = (long)(Scr->ZoomCount + 1);
 
470
 
 
471
        for(j = 0; j < 2; j++) {
 
472
                long i;
 
473
 
 
474
                XDrawRectangle(dpy, Scr->Root, Scr->DrawGC, fx, fy, fw, fh);
 
475
                for(i = 1; i < z; i++) {
 
476
                        int x = fx + (int)((dx * i) / z);
 
477
                        int y = fy + (int)((dy * i) / z);
 
478
                        unsigned width = (unsigned)(((long) fw) + (dw * i) / z);
 
479
                        unsigned height = (unsigned)(((long) fh) + (dh * i) / z);
 
480
 
 
481
                        XDrawRectangle(dpy, Scr->Root, Scr->DrawGC,
 
482
                                       x, y, width, height);
 
483
                }
 
484
                XDrawRectangle(dpy, Scr->Root, Scr->DrawGC, tx, ty, tw, th);
 
485
        }
 
486
}
 
487
 
 
488
 
431
489
static void
432
490
ReMapOne(TwmWindow *t, TwmWindow *leader)
433
491
{