@@ -29,7 +29,7 @@ const THUMBNAIL_FADE_TIME = 0.1; // seconds
2929const PREVIEW_DELAY_TIMEOUT = 0 ; // milliseconds
3030var PREVIEW_SWITCHER_FADEOUT_TIME = 0.2 ; // seconds
3131
32- const iconSizes = [ 96 , 64 , 48 , 32 , 22 ] ;
32+ const iconSizes = [ 96 , 64 , 48 ] ;
3333
3434function mod ( a , b ) {
3535 return ( a + b ) % b ;
@@ -124,16 +124,14 @@ ClassicSwitcher.prototype = {
124124 let thumbnailCenter = posX + icon . width / 2 ;
125125 let [ childMinWidth , childNaturalWidth ] = this . _thumbnails . actor . get_preferred_width ( - 1 ) ;
126126 childBox . x1 = Math . max ( monitor . x + leftPadding , Math . floor ( thumbnailCenter - childNaturalWidth / 2 ) ) ;
127- if ( childBox . x1 + childNaturalWidth > monitor . x + monitor . width - hPadding ) {
128- let offset = childBox . x1 + childNaturalWidth - monitor . width + hPadding ;
129- childBox . x1 = Math . max ( monitor . x + leftPadding , childBox . x1 - offset - hPadding ) ;
127+ if ( childBox . x1 + childNaturalWidth > monitor . x + monitor . width - rightPadding ) {
128+ let offset = ( childBox . x1 + childNaturalWidth ) - ( monitor . x + monitor . width - rightPadding ) ;
129+ childBox . x1 -= offset ;
130130 }
131131
132132 let spacing = this . actor . get_theme_node ( ) . get_length ( 'spacing' ) ;
133133
134134 childBox . x2 = childBox . x1 + childNaturalWidth ;
135- if ( childBox . x2 > monitor . x + monitor . width - rightPadding )
136- childBox . x2 = monitor . x + monitor . width - rightPadding ;
137135 childBox . y1 = this . _appList . actor . allocation . y2 + spacing ;
138136 this . _thumbnails . addClones ( monitor . y + monitor . height - bottomPadding - childBox . y1 ) ;
139137 let [ childMinHeight , childNaturalHeight ] = this . _thumbnails . actor . get_preferred_height ( - 1 ) ;
@@ -479,8 +477,9 @@ SwitcherList.prototype = {
479477
480478 // Here we use a GenericContainer so that we can force all the
481479 // children except the separator to have the same width.
480+ // TODO: Separator is gone, we could use an St.ScrollView now.
482481 this . _list = new Cinnamon . GenericContainer ( { style_class : 'switcher-list-item-container' } ) ;
483- this . _list . spacing = 0 ;
482+ this . _list . spacing = - 1 ;
484483 this . _list . connect ( 'style-changed' , Lang . bind ( this , function ( ) {
485484 this . _list . spacing = this . _list . get_theme_node ( ) . get_length ( 'spacing' ) ;
486485 } ) ) ;
@@ -513,7 +512,6 @@ SwitcherList.prototype = {
513512
514513 this . _items = [ ] ;
515514 this . _highlighted = - 1 ;
516- this . _separator = null ;
517515 this . _squareItems = squareItems ;
518516 this . _minSize = 0 ;
519517 this . _scrollableRight = true ;
@@ -522,6 +520,10 @@ SwitcherList.prototype = {
522520 } ,
523521
524522 _allocateTop : function ( actor , box , flags ) {
523+ if ( this . _list . spacing === - 1 ) {
524+ this . _list . spacing = this . _list . get_theme_node ( ) . get_length ( 'spacing' ) ;
525+ }
526+
525527 let leftPadding = this . actor . get_theme_node ( ) . get_padding ( St . Side . LEFT ) ;
526528 let rightPadding = this . actor . get_theme_node ( ) . get_padding ( St . Side . RIGHT ) ;
527529
@@ -587,12 +589,6 @@ SwitcherList.prototype = {
587589 this . _itemEntered ( index ) ;
588590 } ,
589591
590- addSeparator : function ( ) {
591- let box = new St . Bin ( { style_class : 'separator' } ) ;
592- this . _separator = box ;
593- this . _list . add_actor ( box ) ;
594- } ,
595-
596592 highlight : function ( index , justOutline ) {
597593 if ( this . _highlighted != - 1 ) {
598594 this . _items [ this . _highlighted ] . remove_style_pseudo_class ( 'outlined' ) ;
@@ -659,36 +655,22 @@ SwitcherList.prototype = {
659655 this . emit ( 'item-entered' , n ) ;
660656 } ,
661657
662- _maxChildWidth : function ( forHeight ) {
658+ _maxChildWidth : function ( ) {
663659 let maxChildMin = 0 ;
664660 let maxChildNat = 0 ;
665661
666- for ( let i = 0 ; i < this . _items . length ; i ++ ) {
667- let [ childMin , childNat ] = this . _items [ i ] . get_preferred_width ( forHeight ) ;
668- maxChildMin = Math . max ( childMin , maxChildMin ) ;
669- maxChildNat = Math . max ( childNat , maxChildNat ) ;
670-
671- if ( this . _squareItems ) {
672- let [ childMin , childNat ] = this . _items [ i ] . get_preferred_height ( - 1 ) ;
673- maxChildMin = Math . max ( childMin , maxChildMin ) ;
674- maxChildNat = Math . max ( childNat , maxChildNat ) ;
675- }
662+ if ( this . _items . length > 0 ) {
663+ return this . _items [ 0 ] . get_preferred_width ( - 1 ) ;
676664 }
677665
678- return [ maxChildMin , maxChildNat ] ;
666+ return [ 0 , 0 ]
679667 } ,
680668
681669 _getPreferredWidth : function ( actor , forHeight , alloc ) {
682- let [ maxChildMin , maxChildNat ] = this . _maxChildWidth ( forHeight ) ;
683-
684- let separatorWidth = 0 ;
685- if ( this . _separator ) {
686- let [ sepMin , sepNat ] = this . _separator . get_preferred_width ( forHeight ) ;
687- separatorWidth = sepNat + this . _list . spacing ;
688- }
670+ let [ maxChildMin , maxChildNat ] = this . _maxChildWidth ( ) ;
689671
690672 let totalSpacing = this . _list . spacing * Math . max ( 1 , ( this . _items . length - 1 ) ) ;
691- alloc . min_size = this . _items . length * maxChildMin + separatorWidth + totalSpacing ;
673+ alloc . min_size = this . _items . length * maxChildMin + totalSpacing ;
692674 alloc . natural_size = alloc . min_size ;
693675 this . _minSize = alloc . min_size ;
694676 } ,
@@ -704,7 +686,7 @@ SwitcherList.prototype = {
704686 }
705687
706688 if ( this . _squareItems ) {
707- let [ childMin , childNat ] = this . _maxChildWidth ( - 1 ) ;
689+ let [ childMin , childNat ] = this . _maxChildWidth ( ) ;
708690 maxChildMin = Math . max ( childMin , maxChildMin ) ;
709691 maxChildNat = maxChildMin ;
710692 }
@@ -716,17 +698,10 @@ SwitcherList.prototype = {
716698 _allocate : function ( actor , box , flags ) {
717699 let childHeight = box . y2 - box . y1 ;
718700
719- let [ maxChildMin , maxChildNat ] = this . _maxChildWidth ( childHeight ) ;
701+ let [ maxChildMin , maxChildNat ] = this . _maxChildWidth ( ) ;
720702 let totalSpacing = this . _list . spacing * ( this . _items . length - 1 ) ;
721703
722- let separatorWidth = 0 ;
723- if ( this . _separator ) {
724- let [ sepMin , sepNat ] = this . _separator . get_preferred_width ( childHeight ) ;
725- separatorWidth = sepNat ;
726- totalSpacing += this . _list . spacing ;
727- }
728-
729- let childWidth = Math . floor ( Math . max ( 0 , box . x2 - box . x1 - totalSpacing - separatorWidth ) / this . _items . length ) ;
704+ let childWidth = Math . floor ( Math . max ( 0 , box . x2 - box . x1 - totalSpacing ) / this . _items . length ) ;
730705
731706 let x = 0 ;
732707 let children = this . _list . get_children ( ) ;
@@ -754,14 +729,6 @@ SwitcherList.prototype = {
754729 children [ i ] . allocate ( childBox , flags ) ;
755730
756731 x += this . _list . spacing + childWidth ;
757- } else if ( children [ i ] == this . _separator ) {
758- // We want the separator to be more compact than the rest.
759- childBox . x1 = x ;
760- childBox . y1 = 0 ;
761- childBox . x2 = x + separatorWidth ;
762- childBox . y2 = childHeight ;
763- children [ i ] . allocate ( childBox , flags ) ;
764- x += this . _list . spacing + separatorWidth ;
765732 } else {
766733 // Something else, eg, AppList's arrows;
767734 // we don't allocate it.
@@ -830,8 +797,6 @@ AppList.prototype = {
830797 let [ iconMinHeight , iconNaturalHeight ] = this . icons [ j ] . label . get_preferred_height ( - 1 ) ;
831798 let iconSpacing = iconNaturalHeight + iconPadding + iconBorder ;
832799 let totalSpacing = this . _list . spacing * ( this . _items . length - 1 ) ;
833- if ( this . _separator )
834- totalSpacing += this . _separator . width + this . _list . spacing ;
835800
836801 // We just assume the whole screen here due to weirdness happing with the passed width
837802 let parentPadding = this . actor . get_parent ( ) . get_theme_node ( ) . get_horizontal_padding ( ) ;
@@ -845,7 +810,6 @@ AppList.prototype = {
845810 if ( w <= availWidth )
846811 break ;
847812 }
848-
849813 if ( this . _items . length == 1 ) {
850814 this . _iconSize = iconSizes [ 0 ] ;
851815 height = ( iconSizes [ 0 ] * global . ui_scale ) + iconSpacing ;
@@ -937,22 +901,12 @@ ThumbnailList.prototype = {
937901
938902 let activeWorkspace = global . screen . get_active_workspace ( ) ;
939903
940- // We fake the value of 'separatorAdded' when the app has no window
941- // on the current workspace, to avoid displaying a useless separator in
942- // that case.
943- let separatorAdded = windows . length == 0 || windows [ 0 ] . get_workspace ( ) != activeWorkspace ;
944-
945904 this . _labels = new Array ( ) ;
946905 this . _thumbnailBins = new Array ( ) ;
947906 this . _clones = new Array ( ) ;
948907 this . _windows = windows ;
949908
950909 for ( let i = 0 ; i < windows . length ; i ++ ) {
951- if ( ! separatorAdded && windows [ i ] . get_workspace ( ) != activeWorkspace ) {
952- this . addSeparator ( ) ;
953- separatorAdded = true ;
954- }
955-
956910 let box = new St . BoxLayout ( { style_class : 'thumbnail-box' ,
957911 vertical : true } ) ;
958912
0 commit comments