Merge branch 'pop-os:master' into master
This commit is contained in:
commit
5c96696f9c
3 changed files with 43 additions and 26 deletions
|
|
@ -86,27 +86,6 @@ fn watcher_stream<T: CosmicConfigEntry + Send + Sync + Default + 'static + Clone
|
|||
unreachable!();
|
||||
};
|
||||
|
||||
let mut config = match T::get_entry(&cosmic_config) {
|
||||
Ok(config) => config,
|
||||
Err((errors, default)) => {
|
||||
if !errors.is_empty() {
|
||||
eprintln!("Error getting config: {config_id} {errors:?}");
|
||||
}
|
||||
default
|
||||
}
|
||||
};
|
||||
|
||||
if let Err(err) = tx
|
||||
.send(Update {
|
||||
errors: Vec::new(),
|
||||
keys: Vec::new(),
|
||||
config: config.clone(),
|
||||
})
|
||||
.await
|
||||
{
|
||||
eprintln!("Failed to send config: {err}");
|
||||
}
|
||||
|
||||
let mut attempts = 0;
|
||||
|
||||
loop {
|
||||
|
|
@ -168,6 +147,29 @@ fn watcher_stream<T: CosmicConfigEntry + Send + Sync + Default + 'static + Clone
|
|||
let mut owner_changed = owner_changed
|
||||
.map(|c| Change::OwnerChanged(c.is_some()))
|
||||
.fuse();
|
||||
|
||||
// update now, just in case we missed changes while setting up stream
|
||||
let mut config = match T::get_entry(&cosmic_config) {
|
||||
Ok(config) => config,
|
||||
Err((errors, default)) => {
|
||||
if !errors.is_empty() {
|
||||
eprintln!("Error getting config: {config_id} {errors:?}");
|
||||
}
|
||||
default
|
||||
}
|
||||
};
|
||||
|
||||
if let Err(err) = tx
|
||||
.send(Update {
|
||||
errors: Vec::new(),
|
||||
keys: Vec::new(),
|
||||
config: config.clone(),
|
||||
})
|
||||
.await
|
||||
{
|
||||
eprintln!("Failed to send config: {err}");
|
||||
}
|
||||
|
||||
loop {
|
||||
let change: Changed = futures::select! {
|
||||
c = changes.next() => {
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ where
|
|||
.merge(menu_status)
|
||||
}
|
||||
|
||||
Mouse(ButtonReleased(Left)) | Touch(FingerLifted { .. }) => {
|
||||
Mouse(ButtonReleased(_)) | Touch(FingerLifted { .. }) => {
|
||||
let state = self.tree.state.downcast_mut::<MenuBarState>();
|
||||
state.pressed = false;
|
||||
|
||||
|
|
@ -596,7 +596,13 @@ where
|
|||
.iter()
|
||||
.any(|ms| ms.menu_bounds.check_bounds.contains(overlay_cursor));
|
||||
|
||||
if self.close_condition.click_inside && is_inside {
|
||||
if self.close_condition.click_inside
|
||||
&& is_inside
|
||||
&& matches!(
|
||||
event,
|
||||
Mouse(ButtonReleased(Left)) | Touch(FingerLifted { .. })
|
||||
)
|
||||
{
|
||||
state.reset();
|
||||
return Captured;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -910,6 +910,13 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
if let Event::Mouse(mouse::Event::ButtonReleased(_))
|
||||
| Event::Touch(touch::Event::FingerLifted { .. }) = event
|
||||
{
|
||||
state.focused = false;
|
||||
state.focused_item = Item::None;
|
||||
}
|
||||
|
||||
if let Some(on_activate) = self.on_activate.as_ref() {
|
||||
if let Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
|
||||
| Event::Touch(touch::Event::FingerLifted { .. }) = event
|
||||
|
|
@ -928,8 +935,6 @@ where
|
|||
state.show_context = Some(key);
|
||||
state.context_cursor =
|
||||
cursor_position.position().unwrap_or_default();
|
||||
state.focused = true;
|
||||
state.focused_item = Item::Tab(key);
|
||||
|
||||
let menu_state =
|
||||
tree.children[0].state.downcast_mut::<MenuBarState>();
|
||||
|
|
@ -1321,13 +1326,17 @@ where
|
|||
|
||||
let center_y = bounds.center_y();
|
||||
|
||||
let menu_open = !tree.children.is_empty()
|
||||
&& tree.children[0].state.downcast_ref::<MenuBarState>().open;
|
||||
|
||||
let key_is_active = self.model.is_active(key);
|
||||
let key_is_hovered = self.button_is_hovered(state, key);
|
||||
let key_has_context_menu_open = menu_open && state.show_context == Some(key);
|
||||
let status_appearance = if self.button_is_focused(state, key) {
|
||||
appearance.focus
|
||||
} else if key_is_active {
|
||||
appearance.active
|
||||
} else if key_is_hovered {
|
||||
} else if key_is_hovered || key_has_context_menu_open {
|
||||
appearance.hover
|
||||
} else {
|
||||
appearance.inactive
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue