@@ -506,10 +506,6 @@ export class Space extends Array {
506
506
let resizable = ! mw . fullscreen &&
507
507
mw . get_maximized ( ) !== Meta . MaximizeFlags . BOTH ;
508
508
509
- if ( mw . _fullscreen_frame ?. tiledWidth ) {
510
- targetWidth = mw . _fullscreen_frame . tiledWidth ;
511
- }
512
-
513
509
if ( mw . preferredWidth ) {
514
510
let prop = mw . preferredWidth ;
515
511
if ( prop . value <= 0 ) {
@@ -640,14 +636,24 @@ export class Space extends Array {
640
636
if ( column . length === 0 )
641
637
continue ;
642
638
643
- let selectedInColumn = i === selectedIndex ? this . selectedWindow : null ;
639
+ // selected window in column
640
+ const selectedInColumn = i === selectedIndex ? this . selectedWindow : null ;
644
641
645
642
let targetWidth ;
646
- if ( i === selectedIndex ) {
647
- targetWidth = selectedInColumn . get_frame_rect ( ) . width ;
648
- } else {
649
- targetWidth = Math . max ( ...column . map ( w => w . get_frame_rect ( ) . width ) ) ;
643
+ if ( selectedInColumn ) {
644
+ // if selected window - use tiledWidth or frame.width (fallback)
645
+ targetWidth =
646
+ selectedInColumn ?. _fullscreen_frame ?. tiledWidth ??
647
+ selectedInColumn . get_frame_rect ( ) . width ;
648
+ }
649
+ else {
650
+ // otherwise get max of tiledWith or frame.with (fallback)
651
+ targetWidth = Math . max ( ...column . map ( w => {
652
+ return w ?. _fullscreen_frame ?. tiledWidth ?? w . get_frame_rect ( ) . width ;
653
+ } ) ) ;
650
654
}
655
+
656
+ // enforce minimum
651
657
targetWidth = Math . min ( targetWidth , workArea . width - 2 * Settings . prefs . minimum_margin ) ;
652
658
653
659
let resultingWidth , relayout ;
@@ -3018,6 +3024,9 @@ export function registerWindow(metaWindow) {
3018
3024
signals . connect ( metaWindow , 'size-changed' , allocateClone ) ;
3019
3025
// Note: runs before gnome-shell's minimize handling code
3020
3026
signals . connect ( metaWindow , 'notify::fullscreen' , ( ) => {
3027
+ // if window is in a column, expel it
3028
+ barfThis ( metaWindow ) ;
3029
+
3021
3030
Topbar . fixTopBar ( ) ;
3022
3031
spaces . spaceOfWindow ( metaWindow ) ?. setSpaceTopbarElementsVisible ( true ) ;
3023
3032
} ) ;
@@ -3196,7 +3205,7 @@ export function nonTiledSizeHandler(metaWindow) {
3196
3205
return ;
3197
3206
}
3198
3207
3199
- // if pwm fullscreen previously
3208
+ // if here then was previously in fullscreen (and came out of)
3200
3209
if ( metaWindow . _fullscreen_lock ) {
3201
3210
delete metaWindow . _fullscreen_lock ;
3202
3211
let fsf = metaWindow . _fullscreen_frame ;
@@ -3894,7 +3903,7 @@ export function getDefaultFocusMode() {
3894
3903
}
3895
3904
3896
3905
// `MetaWindow::focus` handling
3897
- export function focus_handler ( metaWindow , user_data ) {
3906
+ export function focus_handler ( metaWindow ) {
3898
3907
console . debug ( "focus:" , metaWindow ?. title ) ;
3899
3908
if ( Scratch . isScratchWindow ( metaWindow ) ) {
3900
3909
setAllWorkspacesInactive ( ) ;
@@ -3918,11 +3927,11 @@ export function focus_handler(metaWindow, user_data) {
3918
3927
else {
3919
3928
let needLayout = false ;
3920
3929
/**
3921
- * For non-topbar spaces, bring down fullscreen windows to mimic
3922
- * gnome behaviour with a topbar.
3930
+ * If has fullscreen window - when selected non-fullscreen window, do layout:
3931
+ * For non-topbar spaces, Bring down fullscreen windows to mimic gnome behaviour with a topbar,
3932
+ * Also ensures if columns group, then it's windows are correctly proportioned.
3923
3933
*/
3924
- if ( ! space . hasTopBar &&
3925
- space . hasFullScreenWindow ( ) ) {
3934
+ if ( space . hasFullScreenWindow ( ) ) {
3926
3935
needLayout = true ;
3927
3936
}
3928
3937
@@ -4488,10 +4497,16 @@ export function slurp(metaWindow) {
4488
4497
from = index ;
4489
4498
}
4490
4499
4500
+ // slurping fullscreen windows is trouble
4491
4501
if ( ! metaWindowToSlurp || space . length < 2 ) {
4492
4502
return ;
4493
4503
}
4494
4504
4505
+ // slurping fullscreen windows is trouble, unfullscreen when slurping
4506
+ if ( metaWindowToSlurp ?. fullscreen ) {
4507
+ metaWindowToSlurp . unmake_fullscreen ( ) ;
4508
+ }
4509
+
4495
4510
space [ to ] . push ( metaWindowToSlurp ) ;
4496
4511
4497
4512
{ // Remove the slurped window
@@ -4507,6 +4522,11 @@ export function slurp(metaWindow) {
4507
4522
} ) ;
4508
4523
}
4509
4524
4525
+ /**
4526
+ * Barfs the bottom window from a column.
4527
+ * @param {MetaWindow } metaWindow
4528
+ * @returns
4529
+ */
4510
4530
export function barf ( metaWindow ) {
4511
4531
if ( ! metaWindow )
4512
4532
return ;
@@ -4528,6 +4548,34 @@ export function barf(metaWindow) {
4528
4548
} ) ;
4529
4549
}
4530
4550
4551
+ /**
4552
+ * Barfs (expels) a specific window from a column.
4553
+ * @param {MetaWindow } metaWindow
4554
+ * @returns
4555
+ */
4556
+ export function barfThis ( metaWindow ) {
4557
+ if ( ! metaWindow )
4558
+ return ;
4559
+
4560
+ let space = spaces . spaceOfWindow ( metaWindow ) ;
4561
+ let index = space . indexOf ( metaWindow ) ;
4562
+ if ( index === - 1 )
4563
+ return ;
4564
+
4565
+ let column = space [ index ] ;
4566
+ if ( column . length < 2 )
4567
+ return ;
4568
+
4569
+ // remove metawindow from column
4570
+ const indexOfWindow = column . indexOf ( metaWindow ) ;
4571
+ column . splice ( indexOfWindow , 1 ) ;
4572
+ space . splice ( index + 1 , 0 , [ metaWindow ] ) ;
4573
+
4574
+ space . layout ( true , {
4575
+ customAllocators : { [ index ] : allocateEqualHeight , ensure : false } ,
4576
+ } ) ;
4577
+ }
4578
+
4531
4579
export function selectPreviousSpace ( mw , space ) {
4532
4580
spaces . selectStackSpace ( Meta . MotionDirection . DOWN ) ;
4533
4581
}
0 commit comments