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,13 +1752,17 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// Present a context menu on a right click event.
|
// Present a context menu on a right click event.
|
||||||
if self.context_menu.is_some()
|
// Yoda: on_context must fire even without a widget-side
|
||||||
&& let Some(on_context) = self.on_context.as_ref()
|
// 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)
|
&& (right_button_released(event)
|
||||||
|| (touch_lifted(event) && fingers_pressed == 2))
|
|| (touch_lifted(event) && fingers_pressed == 2))
|
||||||
{
|
{
|
||||||
|
if self.context_menu.is_some() {
|
||||||
state.show_context = Some(key);
|
state.show_context = Some(key);
|
||||||
state.context_cursor = cursor_position.position().unwrap_or_default();
|
state.context_cursor =
|
||||||
|
cursor_position.position().unwrap_or_default();
|
||||||
|
|
||||||
state.menu_state.inner.with_data_mut(|data| {
|
state.menu_state.inner.with_data_mut(|data| {
|
||||||
// Clear stale MenuBounds from any previous context menu before opening a new one.
|
// Clear stale MenuBounds from any previous context menu before opening a new one.
|
||||||
|
|
@ -1766,6 +1770,7 @@ where
|
||||||
data.open = true;
|
data.open = true;
|
||||||
data.view_cursor = cursor_position;
|
data.view_cursor = cursor_position;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
shell.publish(on_context(key));
|
shell.publish(on_context(key));
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
|
|
@ -1776,10 +1781,12 @@ where
|
||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
feature = "surface-message"
|
feature = "surface-message"
|
||||||
))]
|
))]
|
||||||
if matches!(
|
if self.context_menu.is_some()
|
||||||
|
&& matches!(
|
||||||
crate::app::cosmic::WINDOWING_SYSTEM.get(),
|
crate::app::cosmic::WINDOWING_SYSTEM.get(),
|
||||||
Some(crate::app::cosmic::WindowingSystem::Wayland)
|
Some(crate::app::cosmic::WindowingSystem::Wayland)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
self.create_popup(
|
self.create_popup(
|
||||||
layout,
|
layout,
|
||||||
cursor_position,
|
cursor_position,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue