From 12a5804fa7a8f106d60107031260657b9e9f9054 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sun, 10 Dec 2023 16:30:53 +0000 Subject: [PATCH 1/5] remove redundant clones (clippy::redundant_clone) --- examples/config/src/main.rs | 2 +- examples/cosmic/src/window.rs | 7 +++---- examples/multi-window/src/window.rs | 2 +- src/app/mod.rs | 6 ++---- src/widget/context_drawer/overlay.rs | 2 +- src/widget/menu/menu_inner.rs | 4 ++-- src/widget/text_input/input.rs | 8 ++++---- 7 files changed, 14 insertions(+), 17 deletions(-) diff --git a/examples/config/src/main.rs b/examples/config/src/main.rs index f606e15c4e..f6fb5c0dfd 100644 --- a/examples/config/src/main.rs +++ b/examples/config/src/main.rs @@ -4,7 +4,7 @@ use cosmic_config::{Config, ConfigGet, ConfigSet}; fn test_config(config: Config) { - let watcher = config + let _watcher = config .watch(|config, keys| { println!("Changed: {:?}", keys); for key in keys.iter() { diff --git a/examples/cosmic/src/window.rs b/examples/cosmic/src/window.rs index 8f621c1952..b4016ea9a7 100644 --- a/examples/cosmic/src/window.rs +++ b/examples/cosmic/src/window.rs @@ -8,7 +8,6 @@ use cosmic::{ font::load_fonts, iced::{self, Application, Command, Length, Subscription}, iced::{ - subscription, widget::{self, column, container, horizontal_space, row, text}, window::{self, close, drag, minimize, toggle_maximize}, }, @@ -306,10 +305,10 @@ impl Window { ]).into() } - fn view_unimplemented_sub_page<'a, Message: Clone + From + 'static>( - &'a self, + fn view_unimplemented_sub_page + 'static>( + &self, sub_page: impl SubPage, - ) -> Element<'a, Message> { + ) -> Element<'_, Message> { settings::view_column(vec![ self.parent_page_button(sub_page), text("We haven't created that panel yet, and/or it is using a similar idea as current Pop! designs.").into(), diff --git a/examples/multi-window/src/window.rs b/examples/multi-window/src/window.rs index 4c9b14076e..0b269cf75b 100644 --- a/examples/multi-window/src/window.rs +++ b/examples/multi-window/src/window.rs @@ -5,7 +5,7 @@ use cosmic::{ iced::{self, event, window}, iced_core::{id, Alignment, Length, Point}, iced_widget::{column, container, scrollable, text, text_input}, - widget::{button, cosmic_container}, + widget::button, Command, }; diff --git a/src/app/mod.rs b/src/app/mod.rs index 17d37dbff8..ab42dd5ddc 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -101,7 +101,7 @@ pub(crate) fn iced_settings( autosize: settings.autosize, client_decorations: settings.client_decorations, resizable: settings.resizable, - size: (settings.size.width as u32, settings.size.height as u32).into(), + size: (settings.size.width as u32, settings.size.height as u32), size_limits: settings.size_limits, title: None, transparent: settings.transparent, @@ -567,9 +567,7 @@ impl ApplicationExt for App { #[cfg(not(feature = "multi-window"))] fn set_window_title(&mut self, title: String) -> iced::Command> { - self.core_mut() - .title - .insert(window::Id::MAIN, title.clone()); + self.core_mut().title.insert(window::Id::MAIN, title); iced::Command::none() } diff --git a/src/widget/context_drawer/overlay.rs b/src/widget/context_drawer/overlay.rs index a66f390099..1096c89dd9 100644 --- a/src/widget/context_drawer/overlay.rs +++ b/src/widget/context_drawer/overlay.rs @@ -34,7 +34,7 @@ where let mut node = self .content .as_widget() - .layout(&mut self.tree, renderer, &limits); + .layout(self.tree, renderer, &limits); let node_size = node.size(); node.move_to(Point { diff --git a/src/widget/menu/menu_inner.rs b/src/widget/menu/menu_inner.rs index a0f3439c43..a731c98d96 100644 --- a/src/widget/menu/menu_inner.rs +++ b/src/widget/menu/menu_inner.rs @@ -484,8 +484,8 @@ where (root, Vec::new()), |(menu_root, mut nodes), (_i, ms)| { let slice = ms.slice(bounds, overlay_offset, self.item_height); - let start_index = slice.start_index; - let end_index = slice.end_index; + let _start_index = slice.start_index; + let _end_index = slice.end_index; let children_node = ms.layout( overlay_offset, slice, diff --git a/src/widget/text_input/input.rs b/src/widget/text_input/input.rs index 02386a0363..043718ed3c 100644 --- a/src/widget/text_input/input.rs +++ b/src/widget/text_input/input.rs @@ -640,7 +640,7 @@ where if cursor_position.is_over(leading_icon_layout.bounds()) { return leading_icon.as_widget_mut().on_event( tree, - event.clone(), + event, leading_icon_layout, cursor_position, renderer, @@ -678,7 +678,7 @@ where if cursor_position.is_over(trailing_icon_layout.bounds()) { return trailing_icon.as_widget_mut().on_event( tree, - event.clone(), + event, trailing_icon_layout, cursor_position, renderer, @@ -1579,7 +1579,7 @@ where } }))); let target = x as f32 - text_layout.bounds().x; - state.dnd_offer = DndOfferState::HandlingOffer(mime_types.clone(), DndAction::None); + state.dnd_offer = DndOfferState::HandlingOffer(mime_types, DndAction::None); // existing logic for setting the selection let position = if target > 0.0 { let value = if is_secure { @@ -1646,7 +1646,7 @@ where accepted: DndAction::Move.union(DndAction::Copy), } }))); - state.dnd_offer = DndOfferState::HandlingOffer(mime_types.clone(), action); + state.dnd_offer = DndOfferState::HandlingOffer(mime_types, action); } }; let target = x as f32 - text_layout.bounds().x; From 1ffd464c210805c66cecf0507386bc1940243e2b Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sun, 10 Dec 2023 16:32:17 +0000 Subject: [PATCH 2/5] use 'Self' keyword to refer to own type (clippy::use_self) --- examples/application/src/main.rs | 10 +++++----- examples/cosmic/src/window.rs | 10 +++++----- examples/cosmic/src/window/demo.rs | 18 +++++++++--------- examples/cosmic/src/window/desktop.rs | 4 ++-- examples/multi-window/src/window.rs | 2 +- examples/open-dialog/src/main.rs | 2 +- src/widget/text_input/value.rs | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/application/src/main.rs b/examples/application/src/main.rs index a84eca1c7f..57b1347d2f 100644 --- a/examples/application/src/main.rs +++ b/examples/application/src/main.rs @@ -19,10 +19,10 @@ pub enum Page { impl Page { const fn as_str(self) -> &'static str { match self { - Page::Page1 => "Page 1", - Page::Page2 => "Page 2", - Page::Page3 => "Page 3", - Page::Page4 => "Page 4", + Self::Page1 => "Page 1", + Self::Page2 => "Page 2", + Self::Page3 => "Page 3", + Self::Page4 => "Page 4", } } } @@ -94,7 +94,7 @@ impl cosmic::Application for App { nav_model.activate_position(0); - let mut app = App { core, nav_model }; + let mut app = Self { core, nav_model }; let command = app.update_title(); diff --git a/examples/cosmic/src/window.rs b/examples/cosmic/src/window.rs index b4016ea9a7..168bf683c8 100644 --- a/examples/cosmic/src/window.rs +++ b/examples/cosmic/src/window.rs @@ -135,9 +135,9 @@ impl Page { } impl Default for Page { - fn default() -> Page { + fn default() -> Self { //TODO: what should the default page be? - Page::Desktop(None) + Self::Desktop(None) } } @@ -214,8 +214,8 @@ pub enum Message { } impl From for Message { - fn from(page: Page) -> Message { - Message::Page(page) + fn from(page: Page) -> Self { + Self::Page(page) } } @@ -323,7 +323,7 @@ impl Application for Window { type Theme = Theme; fn new(_flags: ()) -> (Self, Command) { - let mut window = Window::default() + let mut window = Self::default() .nav_bar_toggled(true) .show_maximize(true) .show_minimize(true); diff --git a/examples/cosmic/src/window/demo.rs b/examples/cosmic/src/window/demo.rs index 6329dd3140..f3f417c564 100644 --- a/examples/cosmic/src/window/demo.rs +++ b/examples/cosmic/src/window/demo.rs @@ -35,19 +35,19 @@ pub enum ThemeVariant { impl From<&ThemeType> for ThemeVariant { fn from(theme: &ThemeType) -> Self { match theme { - ThemeType::Light => ThemeVariant::Light, - ThemeType::Dark => ThemeVariant::Dark, - ThemeType::HighContrastDark => ThemeVariant::HighContrastDark, - ThemeType::HighContrastLight => ThemeVariant::HighContrastLight, - ThemeType::Custom(_) => ThemeVariant::Custom, - ThemeType::System(_) => ThemeVariant::System, + ThemeType::Light => Self::Light, + ThemeType::Dark => Self::Dark, + ThemeType::HighContrastDark => Self::HighContrastDark, + ThemeType::HighContrastLight => Self::HighContrastLight, + ThemeType::Custom(_) => Self::Custom, + ThemeType::System(_) => Self::System, } } } impl From for ThemeVariant { fn from(theme: ThemeType) -> Self { - ThemeVariant::from(&theme) + Self::from(&theme) } } @@ -118,8 +118,8 @@ pub struct State { } impl Default for State { - fn default() -> State { - State { + fn default() -> Self { + Self { checkbox_value: false, dropdown_selected: Some(0), dropdown_options: vec!["Option 1", "Option 2", "Option 3", "Option 4"], diff --git a/examples/cosmic/src/window/desktop.rs b/examples/cosmic/src/window/desktop.rs index 3b3858da23..99cbe2dba3 100644 --- a/examples/cosmic/src/window/desktop.rs +++ b/examples/cosmic/src/window/desktop.rs @@ -42,8 +42,8 @@ pub enum Message { } impl From for Message { - fn from(page: Page) -> Message { - Message::Page(page) + fn from(page: Page) -> Self { + Self::Page(page) } } diff --git a/examples/multi-window/src/window.rs b/examples/multi-window/src/window.rs index 0b269cf75b..e50dd5b57c 100644 --- a/examples/multi-window/src/window.rs +++ b/examples/multi-window/src/window.rs @@ -43,7 +43,7 @@ impl cosmic::Application for MultiWindow { } fn init(core: Core, _input: Self::Flags) -> (Self, cosmic::app::Command) { - let windows = MultiWindow { + let windows = Self { windows: HashMap::from([( window::Id::MAIN, Window { diff --git a/examples/open-dialog/src/main.rs b/examples/open-dialog/src/main.rs index f14379fcf1..bf639197aa 100644 --- a/examples/open-dialog/src/main.rs +++ b/examples/open-dialog/src/main.rs @@ -68,7 +68,7 @@ impl cosmic::Application for App { /// Creates the application, and optionally emits command on initialize. fn init(core: Core, _input: Self::Flags) -> (Self, Command) { - let mut app = App { + let mut app = Self { core, open_sender: None, file_contents: String::new(), diff --git a/src/widget/text_input/value.rs b/src/widget/text_input/value.rs index b18ea2ca1b..a53ec97eba 100644 --- a/src/widget/text_input/value.rs +++ b/src/widget/text_input/value.rs @@ -100,7 +100,7 @@ impl Value { } /// Inserts a bunch of graphemes at the given grapheme `index`. - pub fn insert_many(&mut self, index: usize, mut value: Value) { + pub fn insert_many(&mut self, index: usize, mut value: Self) { let _ = self .graphemes .splice(index..index, value.graphemes.drain(..)); From 550f6c8284de6544bfc7564a94640de34986b52d Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sun, 10 Dec 2023 16:34:42 +0000 Subject: [PATCH 3/5] use inline format args (clippy::uninlined_format_args) --- examples/config/src/main.rs | 2 +- examples/cosmic/src/window.rs | 2 +- examples/cosmic/src/window/demo.rs | 2 +- examples/multi-window/src/window.rs | 2 +- src/app/mod.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/config/src/main.rs b/examples/config/src/main.rs index f6fb5c0dfd..a63fc1090d 100644 --- a/examples/config/src/main.rs +++ b/examples/config/src/main.rs @@ -6,7 +6,7 @@ use cosmic_config::{Config, ConfigGet, ConfigSet}; fn test_config(config: Config) { let _watcher = config .watch(|config, keys| { - println!("Changed: {:?}", keys); + println!("Changed: {keys:?}"); for key in keys.iter() { println!(" - {} = {:?}", key, config.get::(key)); } diff --git a/examples/cosmic/src/window.rs b/examples/cosmic/src/window.rs index 168bf683c8..bf56e0f7f5 100644 --- a/examples/cosmic/src/window.rs +++ b/examples/cosmic/src/window.rs @@ -263,7 +263,7 @@ impl Window { fn set_scale_factor(&mut self, factor: f32) { self.scale_factor = factor as f64; - self.scale_factor_string = format!("{:.2}", factor); + self.scale_factor_string = format!("{factor:.2}"); } fn sub_page_button + 'static>( diff --git a/examples/cosmic/src/window/demo.rs b/examples/cosmic/src/window/demo.rs index f3f417c564..708d5a6ab5 100644 --- a/examples/cosmic/src/window/demo.rs +++ b/examples/cosmic/src/window/demo.rs @@ -229,7 +229,7 @@ impl State { column![].spacing(10).align_items(Alignment::Center), |row, theme| { row.push(radio( - format!("{:?}", theme), + format!("{theme:?}"), theme, if ThemeVariant::from(&window.theme.theme_type) == theme { Some(theme) diff --git a/examples/multi-window/src/window.rs b/examples/multi-window/src/window.rs index e50dd5b57c..5b8435f1d2 100644 --- a/examples/multi-window/src/window.rs +++ b/examples/multi-window/src/window.rs @@ -103,7 +103,7 @@ impl cosmic::Application for MultiWindow { self.windows.insert( id, Window { - input_id: id::Id::new(format!("window_{}", count)), + input_id: id::Id::new(format!("window_{count}")), input_value: String::new(), }, ); diff --git a/src/app/mod.rs b/src/app/mod.rs index ab42dd5ddc..82649381f4 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -469,7 +469,7 @@ where /// Constructs views for other windows. fn view_window(&self, id: window::Id) -> Element { - panic!("no view for window {:?}", id); + panic!("no view for window {id:?}"); } /// Overrides the default style for applications From 87edb6320238fbaeb438b9ae79867b6969312b84 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sun, 10 Dec 2023 16:39:18 +0000 Subject: [PATCH 4/5] remove needless lifetimes (clippy::needless_lifetimes) --- cosmic-config/src/lib.rs | 2 +- cosmic-theme/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cosmic-config/src/lib.rs b/cosmic-config/src/lib.rs index 8ff3d8db17..502a71a6b0 100644 --- a/cosmic-config/src/lib.rs +++ b/cosmic-config/src/lib.rs @@ -169,7 +169,7 @@ impl Config { } // Start a transaction (to set multiple configs at the same time) - pub fn transaction<'a>(&'a self) -> ConfigTransaction<'a> { + pub fn transaction(&self) -> ConfigTransaction<'_> { ConfigTransaction { config: self, updates: Mutex::new(Vec::new()), diff --git a/cosmic-theme/src/lib.rs b/cosmic-theme/src/lib.rs index 782d15f1e0..e50f267453 100644 --- a/cosmic-theme/src/lib.rs +++ b/cosmic-theme/src/lib.rs @@ -20,6 +20,6 @@ pub mod steps; pub mod util; /// name of cosmic theme -pub const NAME: &'static str = "com.system76.CosmicTheme"; +pub const NAME: &str = "com.system76.CosmicTheme"; pub use palette; From f8c7985545795a876ef58146d82a6fe927d9e541 Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Sun, 10 Dec 2023 16:47:36 +0000 Subject: [PATCH 5/5] don't clone types which implement 'Copy' (clippy::clone_on_copy) --- cosmic-theme/src/lib.rs | 1 - cosmic-theme/src/model/derivation.rs | 14 ++--- cosmic-theme/src/model/theme.rs | 76 ++++++++++++++-------------- 3 files changed, 45 insertions(+), 46 deletions(-) diff --git a/cosmic-theme/src/lib.rs b/cosmic-theme/src/lib.rs index e50f267453..9e191faf40 100644 --- a/cosmic-theme/src/lib.rs +++ b/cosmic-theme/src/lib.rs @@ -7,7 +7,6 @@ //! pub use model::*; -pub use output::*; mod model; mod output; diff --git a/cosmic-theme/src/model/derivation.rs b/cosmic-theme/src/model/derivation.rs index 1fd4fb8d30..ce52bb70ad 100644 --- a/cosmic-theme/src/model/derivation.rs +++ b/cosmic-theme/src/model/derivation.rs @@ -35,7 +35,7 @@ where let mut divider_c: Srgba = on_bg.clone().into(); divider_c.alpha = 0.2; - let divider = over(divider_c.clone(), bg.clone()); + let divider = over(divider_c, bg.clone()); Self { base: bg, component, @@ -121,7 +121,7 @@ where /// helper for producing a component from a base color a neutral and an accent pub fn colored_component(base: C, neutral: C, accent: C, hovered: C, pressed: C) -> Self { let base: Srgba = base.into(); - let mut base_50 = base.clone(); + let mut base_50 = base; base_50.alpha *= 0.5; let on_20 = neutral.clone(); @@ -129,7 +129,7 @@ where on_50.alpha = 0.5; Component { - base: base.clone().into(), + base: base.into(), hover: over(hovered.clone(), base).into(), pressed: over(pressed, base).into(), selected: over(hovered, base).into(), @@ -174,11 +174,11 @@ where border: C, ) -> Self { let base = base.into(); - let mut base_50 = base.clone(); + let mut base_50 = base; base_50.alpha *= 0.5; let mut on_20 = on_component.clone().into(); - let mut on_50 = on_20.clone(); + let mut on_50 = on_20; on_20.alpha = 0.2; on_50.alpha = 0.5; @@ -188,7 +188,7 @@ where disabled_border.alpha *= 0.5; Component { - base: base.clone().into(), + base: base.into(), hover: if base.alpha < 0.001 { hovered.clone() } else { @@ -207,7 +207,7 @@ where selected_text: accent.clone(), focus: accent.clone(), divider: if is_high_contrast { - on_50.clone().into() + on_50.into() } else { on_20.into() }, diff --git a/cosmic-theme/src/model/theme.rs b/cosmic-theme/src/model/theme.rs index f0be9d6bc9..77637296a1 100644 --- a/cosmic-theme/src/model/theme.rs +++ b/cosmic-theme/src/model/theme.rs @@ -291,142 +291,142 @@ impl Theme { // TODO convenient getter functions for each named color variable /// get @accent_color pub fn accent_color(&self) -> Srgba { - self.accent.base.clone() + self.accent.base } /// get @success_color pub fn success_color(&self) -> Srgba { - self.success.base.clone() + self.success.base } /// get @destructive_color pub fn destructive_color(&self) -> Srgba { - self.destructive.base.clone() + self.destructive.base } /// get @warning_color pub fn warning_color(&self) -> Srgba { - self.warning.base.clone() + self.warning.base } // Containers /// get @bg_color pub fn bg_color(&self) -> Srgba { - self.background.base.clone() + self.background.base } /// get @bg_component_color pub fn bg_component_color(&self) -> Srgba { - self.background.component.base.clone() + self.background.component.base } /// get @primary_container_color pub fn primary_container_color(&self) -> Srgba { - self.primary.base.clone() + self.primary.base } /// get @primary_component_color pub fn primary_component_color(&self) -> Srgba { - self.primary.component.base.clone() + self.primary.component.base } /// get @secondary_container_color pub fn secondary_container_color(&self) -> Srgba { - self.secondary.base.clone() + self.secondary.base } /// get @secondary_component_color pub fn secondary_component_color(&self) -> Srgba { - self.secondary.component.base.clone() + self.secondary.component.base } /// get @button_bg_color pub fn button_bg_color(&self) -> Srgba { - self.button.base.clone() + self.button.base } // Text /// get @on_bg_color pub fn on_bg_color(&self) -> Srgba { - self.background.on.clone() + self.background.on } /// get @on_bg_component_color pub fn on_bg_component_color(&self) -> Srgba { - self.background.component.on.clone() + self.background.component.on } /// get @on_primary_color pub fn on_primary_container_color(&self) -> Srgba { - self.primary.on.clone() + self.primary.on } /// get @on_primary_component_color pub fn on_primary_component_color(&self) -> Srgba { - self.primary.component.on.clone() + self.primary.component.on } /// get @on_secondary_color pub fn on_secondary_container_color(&self) -> Srgba { - self.secondary.on.clone() + self.secondary.on } /// get @on_secondary_component_color pub fn on_secondary_component_color(&self) -> Srgba { - self.secondary.component.on.clone() + self.secondary.component.on } /// get @accent_text_color pub fn accent_text_color(&self) -> Srgba { - self.accent.base.clone() + self.accent.base } /// get @success_text_color pub fn success_text_color(&self) -> Srgba { - self.success.base.clone() + self.success.base } /// get @warning_text_color pub fn warning_text_color(&self) -> Srgba { - self.warning.base.clone() + self.warning.base } /// get @destructive_text_color pub fn destructive_text_color(&self) -> Srgba { - self.destructive.base.clone() + self.destructive.base } /// get @on_accent_color pub fn on_accent_color(&self) -> Srgba { - self.accent.on.clone() + self.accent.on } /// get @on_success_color pub fn on_success_color(&self) -> Srgba { - self.success.on.clone() + self.success.on } /// get @oon_warning_color pub fn on_warning_color(&self) -> Srgba { - self.warning.on.clone() + self.warning.on } /// get @on_destructive_color pub fn on_destructive_color(&self) -> Srgba { - self.destructive.on.clone() + self.destructive.on } /// get @button_color pub fn button_color(&self) -> Srgba { - self.button.on.clone() + self.button.on } // Borders and Dividers /// get @bg_divider pub fn bg_divider(&self) -> Srgba { - self.background.divider.clone() + self.background.divider } /// get @bg_component_divider pub fn bg_component_divider(&self) -> Srgba { - self.background.component.divider.clone() + self.background.component.divider } /// get @primary_container_divider pub fn primary_container_divider(&self) -> Srgba { - self.primary.divider.clone() + self.primary.divider } /// get @primary_component_divider pub fn primary_component_divider(&self) -> Srgba { - self.primary.component.divider.clone() + self.primary.component.divider } /// get @secondary_container_divider pub fn secondary_container_divider(&self) -> Srgba { - self.secondary.divider.clone() + self.secondary.divider } /// get @button_divider pub fn button_divider(&self) -> Srgba { - self.button.divider.clone() + self.button.divider } /// get @window_header_bg pub fn window_header_bg(&self) -> Srgba { - self.background.base.clone() + self.background.base } /// get @space_none @@ -765,7 +765,7 @@ impl ThemeBuilder { let bg = if let Some(bg_color) = bg_color { bg_color } else { - p_ref.gray_1.clone() + p_ref.gray_1 }; let step_array = steps(bg, NonZeroUsize::new(100).unwrap()); @@ -792,10 +792,10 @@ impl ThemeBuilder { text_steps_array.as_ref(), ); - let mut component_hovered_overlay = p_ref.neutral_0.clone(); + let mut component_hovered_overlay = p_ref.neutral_0; component_hovered_overlay.alpha = 0.1; - let mut component_pressed_overlay = p_ref.neutral_0.clone(); + let mut component_pressed_overlay = p_ref.neutral_0; component_pressed_overlay.alpha = 0.2; let bg_component = Component::component( @@ -851,7 +851,7 @@ impl ThemeBuilder { // Standard button background is neutral 7 with 25% opacity let button_bg = { - let mut color = neutral_7.clone(); + let mut color = neutral_7; color.alpha = 0.25; color }; @@ -955,7 +955,7 @@ impl ThemeBuilder { p_ref.neutral_8, ); - let mut on_50 = component.on.clone(); + let mut on_50 = component.on; on_50.alpha = 0.5; component.on_disabled = over(on_50, component.base);