~ctwm/ctwm/trunk

« back to all changes in this revision

Viewing changes to event_handlers.c

  • Committer: Matthew Fuller
  • Date: 2019-07-14 22:01:14 UTC
  • mfrom: (659.2.7 otp)
  • Revision ID: fullermd@over-yonder.net-20190714220114-huh46djb14mjo6g6
Fixup OTP issues around fullscreen/focused windows with transients.

Because of the focus status changes implicitly changing the OTP layer,
we have to move the window and all its transients in the OWL stack.
However, existing code didn't try to move them all, and even if it
did, it made assumptions about how to find them that aren't exactly
valid.  Instead, change over to explicit functions for the un/focus
handling of focus-sensitive windows that know the facts of that and
the innards of OTP, rather than trying to use the generic restack
functionality.

This is probably not the best solution, and may be reworked.  However,
it's pretty uninvasive, so is well positioned for backporting as
desirable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
367
367
static void
368
368
HandleFocusIn(void)
369
369
{
370
 
#ifdef EWMH
371
 
        TwmWindow *old_focus = Scr->Focus;
372
 
#endif
373
 
 
374
370
        if(! Tmp_win->wmhints->input) {
375
371
                return;
376
372
        }
377
373
        if(Scr->Focus == Tmp_win) {
378
374
                return;
379
375
        }
 
376
 
 
377
#ifdef EWMH
 
378
        // Handle focus-dependent re-stacking of what we're moving out of.
 
379
        if(Scr->Focus && OtpIsFocusDependent(Scr->Focus)) {
 
380
                OtpUnfocusWindow(Scr->Focus);
 
381
                // NULL's Scr->Focus
 
382
        }
 
383
#endif
 
384
 
380
385
        if(Tmp_win->AutoSqueeze && Tmp_win->squeezed) {
381
386
                AutoSqueeze(Tmp_win);
382
387
        }
383
388
        SetFocusVisualAttributes(Tmp_win, true);
384
389
 
 
390
#ifdef EWMH
 
391
        // Handle focus-dependent re-stacking of what we're moving in to.
 
392
        if(Tmp_win && OtpIsFocusDependent(Tmp_win)) {
 
393
                OtpFocusWindow(Tmp_win);
 
394
                // Sets Scr->Focus
 
395
        }
 
396
#endif
 
397
 
 
398
        // Redundant in EWMH case
385
399
        Scr->Focus = Tmp_win;
386
 
 
387
 
#ifdef EWMH
388
 
        /*
389
 
         * Some EWMH flags may affect stacking, so after we change
390
 
         * Scr->Focus...
391
 
         */
392
 
        if(old_focus && OtpIsFocusDependent(old_focus)) {
393
 
                OtpRestackWindow(old_focus);
394
 
        }
395
 
        if(Tmp_win && OtpIsFocusDependent(Tmp_win)) {
396
 
                OtpRestackWindow(Tmp_win);
397
 
        }
398
 
#endif
399
400
}
400
401
 
401
402
 
413
414
        }
414
415
        SetFocusVisualAttributes(Tmp_win, false);
415
416
 
416
 
        Scr->Focus = NULL;
417
 
 
418
417
#ifdef EWMH
419
418
        /*
420
419
         * X-ref HandleFocusIn() comment.  FocusOut is only leaving a window,
421
420
         * not entering a new one, so there's only one we may need to
422
421
         * restack.
423
422
         */
424
 
        if(Tmp_win && OtpIsFocusDependent(Tmp_win)) {
425
 
                OtpRestackWindow(Tmp_win);
 
423
        if(Scr->Focus && OtpIsFocusDependent(Scr->Focus)) {
 
424
                OtpUnfocusWindow(Scr->Focus);
 
425
                // NULL's Scr->Focus
426
426
        }
427
427
#endif
 
428
 
 
429
        // Redundant in EWMH case
 
430
        Scr->Focus = NULL;
428
431
}
429
432
 
430
433