~ctwm/ctwm/trunk

« back to all changes in this revision

Viewing changes to add_window.c

  • Committer: Matthew Fuller
  • Date: 2023-01-28 01:02:55 UTC
  • Revision ID: fullermd@over-yonder.net-20230128010255-7y550i4n37xy9x4k
Bypass BorderedLayout for strut'd windows.

This is a hack, and does the wrong thing.  However, due to the way we
currently handle struts, the previous behavior would force a window to
move outside its own strut, which is nonsense.  A proper implementation
would require evaluating struts individually, not cramming them into
BorderedLayout (which already means something similar but distinct), and
encapsulating those checks in all the places that do window positioning.

That's a major change though; this at least avoids the extra-dumb
behavior, and works no worse than 4.0.3 and pre-r644 code for those
corner cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1465
1465
                {
1466
1466
                        RArea area;
1467
1467
                        int min_x, min_y, max_bottom, max_right;
 
1468
                        const RLayout *layout = Scr->BorderedLayout;
1468
1469
 
1469
1470
                        area = RAreaNew(tmp_win->frame_x, tmp_win->frame_y,
1470
1471
                                        (int)tmp_win->frame_width,
1471
1472
                                        (int)tmp_win->frame_height);
1472
1473
 
1473
 
                        RLayoutFindTopBottomEdges(Scr->BorderedLayout, &area,
 
1474
#ifdef EWMH
 
1475
                        // Hack: windows with EWMH struts defined are trying to
 
1476
                        // reserve a bit of the screen for themselves.  We currently
 
1477
                        // do that by hacking strut'ed space into the BorderedLayout,
 
1478
                        // which is a bogus way of doing things.  But it also means
 
1479
                        // that here we're forcing the windows to be outside their
 
1480
                        // own struts, which is nonsensical.
 
1481
                        //
 
1482
                        // Hack around that by making strut'd windows just use
 
1483
                        // Layout, rather than BorderedLayout.  This is Wrong(tm)
 
1484
                        // because the whole point of BorderedLayout is space
 
1485
                        // reservation by the user, which we'd now be ignoring.  Also
 
1486
                        // just because a window has its own struts doesn't mean it
 
1487
                        // should get to ignore everyone else's struts too. However,
 
1488
                        // this is at least consistent with pre-4.1.0 behavior, so
 
1489
                        // it's not a _new_ bug.  And forcing windows outside their
 
1490
                        // own reservation is way stupider...
 
1491
                        if(tmp_win->ewmhFlags & EWMH_HAS_STRUT) {
 
1492
                                layout = Scr->Layout;
 
1493
                        }
 
1494
#endif
 
1495
 
 
1496
                        RLayoutFindTopBottomEdges(layout, &area,
1474
1497
                                                  &min_y, &max_bottom);
1475
 
                        RLayoutFindLeftRightEdges(Scr->BorderedLayout, &area,
 
1498
                        RLayoutFindLeftRightEdges(layout, &area,
1476
1499
                                                  &min_x, &max_right);
1477
1500
 
1478
1501
                        // These conditions would only be true if the window was