add Tab::is_mouse_grabbed concept

refs: https://github.com/wez/wezterm/issues/106
This commit is contained in:
Wez Furlong committed 2020-01-05 14:37:17 -08:00
1 parent f1846ab0ae
commit 5ba0c70cdb
5 files changed
+23

No files matched your search

+4
View File
@@ -103,6 +103,10 @@ impl Tab for LocalTab {
let terminal = self.terminal.borrow();
Some(terminal.get_selection_text())
}
fn is_mouse_grabbed(&self) -> bool {
self.terminal.borrow().is_mouse_grabbed()
}
}
impl LocalTab {
+6
View File
@@ -62,6 +62,12 @@ pub trait Tab: Downcast {
fn palette(&self) -> ColorPalette;
fn domain_id(&self) -> DomainId;
/// Returns true if the terminal has grabbed the mouse and wants to
/// give the embedded application a chance to process events.
/// In practice this controls whether the gui will perform local
/// handling of clicks.
fn is_mouse_grabbed(&self) -> bool;
fn set_clipboard(&self, _clipboard: &Arc<dyn Clipboard>) {}
/// Returns the selection range adjusted to the viewport
+5
View File
@@ -332,6 +332,11 @@ impl Tab for ClientTab {
// FIXME: get selection from peer or the surface
None
}
fn is_mouse_grabbed(&self) -> bool {
// FIXME: get the real state from the remote
true
}
}
struct RenderableInner {
+4
View File
@@ -331,6 +331,10 @@ impl Tab for TermWizTerminalTab {
// FIXME: grab it from the surface
None
}
fn is_mouse_grabbed(&self) -> bool {
true
}
}
pub struct TermWizTerminal {
+4
View File
@@ -876,6 +876,10 @@ impl TerminalState {
}
}
pub fn is_mouse_grabbed(&self) -> bool {
self.sgr_mouse
}
pub fn bracketed_paste_enabled(&self) -> bool {
self.bracketed_paste
}