~ctwm/ctwm/trunk

« back to all changes in this revision

Viewing changes to otp.c

  • Committer: Matthew Fuller
  • Date: 2018-08-19 22:55:17 UTC
  • mfrom: (617.1.3 otp)
  • Revision ID: fullermd@over-yonder.net-20180819225517-u18p7qgpu5g3yhgo
When a new transient window is created for an existing focused and
full-screen'd (and thus EWMH_PRI_FULLSCREEN'd) window, ensure the OTP
for the new transient is jammed up as high, to prevent the transient
from being stuck below the main window.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "events.h"
28
28
#include "event_handlers.h"
29
29
#include "vscreen.h"
 
30
#include "win_utils.h"
30
31
 
31
32
#define DEBUG_OTP       0
32
33
#if DEBUG_OTP
1635
1636
 
1636
1637
        /*
1637
1638
         * If FULLSCREEN and focused, jam to (nearly; let the user still win
1638
 
         * if they try) the top.
 
1639
         * if they try) the top.  We also need to handle transients; they
 
1640
         * might not have focus, but still need to be on top of the window
 
1641
         * they're coming up transient for, or else they'll be hidden
 
1642
         * forever.
1639
1643
         */
1640
 
        if(owl->pri_aflags & OTP_AFLAG_FULLSCREEN && Scr->Focus == owl->twm_win) {
1641
 
                pri = EWMH_PRI_FULLSCREEN + OTP_ZERO;
 
1644
        if(owl->pri_aflags & OTP_AFLAG_FULLSCREEN) {
 
1645
                if(Scr->Focus == owl->twm_win) {
 
1646
                        // It's focused, shift it up
 
1647
                        pri = EWMH_PRI_FULLSCREEN + OTP_ZERO;
 
1648
                }
 
1649
                else if(owl->twm_win->istransient) {
 
1650
                        // It's a transient of something else; if that something else
 
1651
                        // has the fullscreen/focus combo, we should pop this up top
 
1652
                        // too.  Technically, we should perhaps test whether its
 
1653
                        // parent is also OTP_AFLAG_FULLSCREEN, but if the transient
 
1654
                        // has it, the parent probably does too.  Worry about that
 
1655
                        // detail if it ever becomes a problem.
 
1656
                        TwmWindow *parent = GetTwmWindow(owl->twm_win->transientfor);
 
1657
                        if(Scr->Focus == parent) {
 
1658
                                // Shift this up so we stay on top
 
1659
                                pri = EWMH_PRI_FULLSCREEN + OTP_ZERO;
 
1660
                        }
 
1661
                }
1642
1662
        }
1643
1663
#endif
1644
1664