@@ -81,7 +81,7 @@ impl AppletIconData {
8181 let padding = applet. suggested_padding ( false ) ;
8282 let icon_spacing = 4.0 ;
8383
84- let ( dot_radius, bar_size) = match applet. size {
84+ let ( dot_radius, bar_size) : ( f32 , f32 ) = match applet. size {
8585 Size :: Hardcoded ( _) => ( 2.0 , 8.0 ) ,
8686 Size :: PanelSize ( ref s) => {
8787 let size = s. get_applet_icon_size_with_padding ( false ) ;
@@ -101,10 +101,30 @@ impl AppletIconData {
101101 let padding = padding as f32 ;
102102
103103 let padding = match applet. anchor {
104- PanelAnchor :: Top => [ padding - ( dot_radius * 2. + 1. ) , padding, padding, padding] ,
105- PanelAnchor :: Bottom => [ padding, padding, padding - ( dot_radius * 2. + 1. ) , padding] ,
106- PanelAnchor :: Left => [ padding, padding, padding, padding - ( dot_radius * 2. + 1. ) ] ,
107- PanelAnchor :: Right => [ padding, padding - ( dot_radius * 2. + 1. ) , padding, padding] ,
104+ PanelAnchor :: Top => [
105+ padding - dot_radius. mul_add ( 2. , 1. ) ,
106+ padding,
107+ padding,
108+ padding,
109+ ] ,
110+ PanelAnchor :: Bottom => [
111+ padding,
112+ padding,
113+ padding - dot_radius. mul_add ( 2. , 1. ) ,
114+ padding,
115+ ] ,
116+ PanelAnchor :: Left => [
117+ padding,
118+ padding,
119+ padding,
120+ padding - dot_radius. mul_add ( 2. , 1. ) ,
121+ ] ,
122+ PanelAnchor :: Right => [
123+ padding,
124+ padding - dot_radius. mul_add ( 2. , 1. ) ,
125+ padding,
126+ padding,
127+ ] ,
108128 } ;
109129 AppletIconData {
110130 icon_size,
@@ -211,32 +231,32 @@ impl DockItem {
211231 } ;
212232
213233 let icon_wrapper: Element < _ > = match applet. anchor {
214- PanelAnchor :: Left => row ( [
215- indicator. into ( ) ,
216- horizontal_space ( ) . width ( Length :: Fixed ( 1.0 ) ) . into ( ) ,
217- cosmic_icon. clone ( ) . into ( ) ,
218- ] )
234+ PanelAnchor :: Left => row ! [
235+ indicator,
236+ horizontal_space( ) . width( Length :: Fixed ( 1.0 ) ) ,
237+ cosmic_icon. clone( ) ,
238+ ]
219239 . align_y ( Alignment :: Center )
220240 . into ( ) ,
221- PanelAnchor :: Right => row ( [
222- cosmic_icon. clone ( ) . into ( ) ,
223- horizontal_space ( ) . width ( Length :: Fixed ( 1.0 ) ) . into ( ) ,
224- indicator. into ( ) ,
225- ] )
241+ PanelAnchor :: Right => row ! [
242+ cosmic_icon. clone( ) ,
243+ horizontal_space( ) . width( Length :: Fixed ( 1.0 ) ) ,
244+ indicator,
245+ ]
226246 . align_y ( Alignment :: Center )
227247 . into ( ) ,
228- PanelAnchor :: Top => column ( [
229- indicator. into ( ) ,
230- vertical_space ( ) . height ( Length :: Fixed ( 1.0 ) ) . into ( ) ,
231- cosmic_icon. clone ( ) . into ( ) ,
232- ] )
248+ PanelAnchor :: Top => column ! [
249+ indicator,
250+ vertical_space( ) . height( Length :: Fixed ( 1.0 ) ) ,
251+ cosmic_icon. clone( ) ,
252+ ]
233253 . align_x ( Alignment :: Center )
234254 . into ( ) ,
235- PanelAnchor :: Bottom => column ( [
236- cosmic_icon. clone ( ) . into ( ) ,
237- vertical_space ( ) . height ( Length :: Fixed ( 1.0 ) ) . into ( ) ,
238- indicator. into ( ) ,
239- ] )
255+ PanelAnchor :: Bottom => column ! [
256+ cosmic_icon. clone( ) ,
257+ vertical_space( ) . height( Length :: Fixed ( 1.0 ) ) ,
258+ indicator,
259+ ]
240260 . align_x ( Alignment :: Center )
241261 . into ( ) ,
242262 } ;
@@ -452,9 +472,7 @@ where
452472 column ! [
453473 container( if let Some ( img) = img {
454474 Element :: from( Image :: new( Handle :: from_rgba(
455- img. width,
456- img. height,
457- img. img. clone( ) ,
475+ img. width, img. height, img. img,
458476 ) ) )
459477 } else {
460478 Image :: new( Handle :: from_rgba( 1 , 1 , [ 0u8 , 0u8 , 0u8 , 255u8 ] . as_slice( ) ) ) . into( )
@@ -768,24 +786,24 @@ impl cosmic::Application for CosmicAppList {
768786 height : height as i32 ,
769787 } ;
770788 let max_windows = 7.0 ;
771- let window_spacing = 8.0 ;
789+ let window_spacing = 8.0_f32 ;
772790 popup_settings. positioner . size_limits = match self . core . applet . anchor {
773791 PanelAnchor :: Right | PanelAnchor :: Left => Limits :: NONE
774792 . min_width ( 100.0 )
775793 . min_height ( 30.0 )
776- . max_width ( window_spacing * 2.0 + TOPLEVEL_BUTTON_WIDTH )
794+ . max_width ( window_spacing. mul_add ( 2.0 , TOPLEVEL_BUTTON_WIDTH ) )
777795 . max_height (
778- TOPLEVEL_BUTTON_HEIGHT * max_windows
779- + window_spacing * ( max_windows + 1.0 ) ,
796+ TOPLEVEL_BUTTON_HEIGHT
797+ . mul_add ( max_windows , window_spacing * ( max_windows + 1.0 ) ) ,
780798 ) ,
781799 PanelAnchor :: Bottom | PanelAnchor :: Top => Limits :: NONE
782800 . min_width ( 30.0 )
783801 . min_height ( 100.0 )
784802 . max_width (
785- TOPLEVEL_BUTTON_WIDTH * max_windows
786- + window_spacing * ( max_windows + 1.0 ) ,
803+ TOPLEVEL_BUTTON_WIDTH
804+ . mul_add ( max_windows , window_spacing * ( max_windows + 1.0 ) ) ,
787805 )
788- . max_height ( window_spacing * 2.0 + TOPLEVEL_BUTTON_HEIGHT ) ,
806+ . max_height ( window_spacing. mul_add ( 2.0 , TOPLEVEL_BUTTON_HEIGHT ) ) ,
789807 } ;
790808
791809 return get_popup ( popup_settings) ;
@@ -882,8 +900,7 @@ impl cosmic::Application for CosmicAppList {
882900 } )
883901 {
884902 let icon_id = window:: Id :: unique ( ) ;
885- self . dnd_source =
886- Some ( ( icon_id, toplevel_group. clone ( ) , DndAction :: empty ( ) , pos) ) ;
903+ self . dnd_source = Some ( ( icon_id, toplevel_group, DndAction :: empty ( ) , pos) ) ;
887904 }
888905 }
889906 Message :: DragFinished => {
@@ -1140,7 +1157,7 @@ impl cosmic::Application for CosmicAppList {
11401157 updated_appid = true ;
11411158 }
11421159
1143- * t_info = info . clone ( ) ;
1160+ t_info. clone_from ( & info ) ;
11441161 break ' toplevel_loop;
11451162 }
11461163 }
@@ -1297,7 +1314,7 @@ impl cosmic::Application for CosmicAppList {
12971314 DockItem {
12981315 id : self . item_ctr ,
12991316 toplevels : Vec :: new ( ) ,
1300- desktop_info : de. clone ( ) ,
1317+ desktop_info : de,
13011318 original_app_id : original_id. clone ( ) ,
13021319 }
13031320 }
@@ -1356,8 +1373,8 @@ impl cosmic::Application for CosmicAppList {
13561373 self . active_list . len ( ) . saturating_sub (
13571374 ( active_popup_cutoff. unwrap_or_default ( ) ) . saturating_sub ( 1 ) ,
13581375 ) as f32 ;
1359- let popup_applet_size = applet_suggested_size as f32 * popup_applet_count
1360- + 4.0 * ( popup_applet_count - 1. ) ;
1376+ let popup_applet_size = ( applet_suggested_size as f32 )
1377+ . mul_add ( popup_applet_count , 4.0 * ( popup_applet_count - 1. ) ) ;
13611378 let ( max_width, max_height) = match self . core . applet . anchor {
13621379 PanelAnchor :: Top | PanelAnchor :: Bottom => {
13631380 ( popup_applet_size, applet_suggested_size. into ( ) )
@@ -1413,8 +1430,8 @@ impl cosmic::Application for CosmicAppList {
14131430 self . pinned_list . len ( ) . saturating_sub (
14141431 favorite_popup_cutoff. unwrap_or_default ( ) . saturating_sub ( 1 ) ,
14151432 ) as f32 ;
1416- let popup_applet_size = applet_suggested_size as f32 * popup_applet_count
1417- + 4.0 * ( popup_applet_count - 1. ) ;
1433+ let popup_applet_size = ( applet_suggested_size as f32 )
1434+ . mul_add ( popup_applet_count , 4.0 * ( popup_applet_count - 1. ) ) ;
14181435 let ( max_width, max_height) = match self . core . applet . anchor {
14191436 PanelAnchor :: Top | PanelAnchor :: Bottom => {
14201437 ( popup_applet_size, applet_suggested_size as f32 )
@@ -1664,11 +1681,11 @@ impl cosmic::Application for CosmicAppList {
16641681 Length :: Shrink ,
16651682 Length :: Shrink ,
16661683 DndDestination :: for_data :: < DndPathBuf > (
1667- row ( favorites) . spacing ( app_icon. icon_spacing ) ,
1684+ Row :: from_vec ( favorites) . spacing ( app_icon. icon_spacing ) ,
16681685 |_, _| Message :: DndDropFinished ,
16691686 )
16701687 . drag_id ( DND_FAVORITES ) ,
1671- row ( active) . spacing ( app_icon. icon_spacing ) . into ( ) ,
1688+ Row :: from_vec ( active) . spacing ( app_icon. icon_spacing ) . into ( ) ,
16721689 container ( vertical_rule ( 1 ) )
16731690 . height ( Length :: Fill )
16741691 . padding ( [ divider_padding, 0 ] )
@@ -1679,11 +1696,13 @@ impl cosmic::Application for CosmicAppList {
16791696 Length :: Shrink ,
16801697 Length :: Shrink ,
16811698 DndDestination :: for_data (
1682- column ( favorites) . spacing ( app_icon. icon_spacing ) ,
1699+ Column :: from_vec ( favorites) . spacing ( app_icon. icon_spacing ) ,
16831700 |_data : Option < DndPathBuf > , _| Message :: DndDropFinished ,
16841701 )
16851702 . drag_id ( DND_FAVORITES ) ,
1686- column ( active) . spacing ( app_icon. icon_spacing ) . into ( ) ,
1703+ Column :: from_vec ( active)
1704+ . spacing ( app_icon. icon_spacing )
1705+ . into ( ) ,
16871706 container ( divider:: horizontal:: default ( ) )
16881707 . width ( Length :: Fill )
16891708 . padding ( [ 0 , divider_padding] )
@@ -1846,7 +1865,7 @@ impl cosmic::Application for CosmicAppList {
18461865 }
18471866
18481867 if !toplevels. is_empty ( ) {
1849- let mut list_col = column ! [ ] ;
1868+ let mut list_col = Column :: with_capacity ( toplevels . len ( ) ) ;
18501869 for ( info, _) in toplevels {
18511870 let title = if info. title . len ( ) > 34 {
18521871 format ! ( "{:.32}..." , & info. title)
@@ -1936,8 +1955,10 @@ impl cosmic::Application for CosmicAppList {
19361955 }
19371956 PopupType :: TopLevelList => match self . core . applet . anchor {
19381957 PanelAnchor :: Left | PanelAnchor :: Right => {
1939- let mut content =
1940- column ! [ ] . padding ( 8 ) . align_x ( Alignment :: Center ) . spacing ( 8 ) ;
1958+ let mut content = Column :: with_capacity ( toplevels. len ( ) )
1959+ . padding ( 8 )
1960+ . align_x ( Alignment :: Center )
1961+ . spacing ( 8 ) ;
19411962 for ( info, img) in toplevels {
19421963 let title = if info. title . len ( ) > 18 {
19431964 format ! ( "{:.16}..." , & info. title)
@@ -1959,7 +1980,10 @@ impl cosmic::Application for CosmicAppList {
19591980 . into ( )
19601981 }
19611982 PanelAnchor :: Bottom | PanelAnchor :: Top => {
1962- let mut content = row ! [ ] . padding ( 8 ) . align_y ( Alignment :: Center ) . spacing ( 8 ) ;
1983+ let mut content = Row :: with_capacity ( toplevels. len ( ) )
1984+ . padding ( 8 )
1985+ . align_y ( Alignment :: Center )
1986+ . spacing ( 8 ) ;
19631987 for ( info, img) in toplevels {
19641988 let title = if info. title . len ( ) > 18 {
19651989 format ! ( "{:.16}..." , & info. title)
@@ -2170,9 +2194,9 @@ impl cosmic::Application for CosmicAppList {
21702194 . into ( )
21712195 } else {
21722196 let suggested = self . core . applet . suggested_size ( false ) ;
2173- iced :: widget :: row! ( )
2174- . width ( Length :: Fixed ( suggested. 0 as f32 ) )
2175- . height ( Length :: Fixed ( suggested. 1 as f32 ) )
2197+ Row :: new ( )
2198+ . width ( Length :: Fixed ( suggested. 0 . into ( ) ) )
2199+ . height ( Length :: Fixed ( suggested. 1 . into ( ) ) )
21762200 . into ( )
21772201 }
21782202 }
@@ -2352,7 +2376,7 @@ impl CosmicAppList {
23522376 continue ;
23532377 }
23542378
2355- fallback_entry = entry . clone ( ) ;
2379+ fallback_entry. clone_from ( entry ) ;
23562380 break ;
23572381 }
23582382 }
0 commit comments