fix(segmented_button): publish on_context without widget context_menu
Upstream's popup refactor gated the on_context callback behind context_menu.is_some(), silencing consumers that provide their own dialog (cosmic-term tab rename). Publish the message unconditionally; keep menu state + popup creation gated on an actual context_menu. Leyoda 2026 – GPLv3
This commit is contained in:
parent
2fe2d35286
commit
3e4ab4576d
1 changed files with 21 additions and 14 deletions
|
|
@ -1752,20 +1752,25 @@ where
|
|||
}
|
||||
|
||||
// Present a context menu on a right click event.
|
||||
if self.context_menu.is_some()
|
||||
&& let Some(on_context) = self.on_context.as_ref()
|
||||
// Yoda: on_context must fire even without a widget-side
|
||||
// context_menu — consumers (cosmic-term tab rename) rely
|
||||
// on the message alone and provide their own dialog.
|
||||
if let Some(on_context) = self.on_context.as_ref()
|
||||
&& (right_button_released(event)
|
||||
|| (touch_lifted(event) && fingers_pressed == 2))
|
||||
{
|
||||
state.show_context = Some(key);
|
||||
state.context_cursor = cursor_position.position().unwrap_or_default();
|
||||
if self.context_menu.is_some() {
|
||||
state.show_context = Some(key);
|
||||
state.context_cursor =
|
||||
cursor_position.position().unwrap_or_default();
|
||||
|
||||
state.menu_state.inner.with_data_mut(|data| {
|
||||
// Clear stale MenuBounds from any previous context menu before opening a new one.
|
||||
data.reset();
|
||||
data.open = true;
|
||||
data.view_cursor = cursor_position;
|
||||
});
|
||||
state.menu_state.inner.with_data_mut(|data| {
|
||||
// Clear stale MenuBounds from any previous context menu before opening a new one.
|
||||
data.reset();
|
||||
data.open = true;
|
||||
data.view_cursor = cursor_position;
|
||||
});
|
||||
}
|
||||
|
||||
shell.publish(on_context(key));
|
||||
shell.capture_event();
|
||||
|
|
@ -1776,10 +1781,12 @@ where
|
|||
target_os = "linux",
|
||||
feature = "surface-message"
|
||||
))]
|
||||
if matches!(
|
||||
crate::app::cosmic::WINDOWING_SYSTEM.get(),
|
||||
Some(crate::app::cosmic::WindowingSystem::Wayland)
|
||||
) {
|
||||
if self.context_menu.is_some()
|
||||
&& matches!(
|
||||
crate::app::cosmic::WINDOWING_SYSTEM.get(),
|
||||
Some(crate::app::cosmic::WindowingSystem::Wayland)
|
||||
)
|
||||
{
|
||||
self.create_popup(
|
||||
layout,
|
||||
cursor_position,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue