pass mouse grabbed state over remote tabs
This allows local double click selection to work outside vim and for mouse reporting to work inside vim.
This commit is contained in:
1 parent
c5a8531a91
commit
0a1a44eef0
3 files changed
+7
-2
No files matched your search
@@ -413,6 +413,7 @@ pub struct GetTabRenderChangesResponse {
|
||||
pub tab_id: TabId,
|
||||
pub sequence_no: SequenceNo,
|
||||
pub changes: Vec<Change>,
|
||||
pub mouse_grabbed: bool,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -388,6 +388,7 @@ fn maybe_push_tab_changes(
|
||||
sender: PollableSender<DecodedPdu>,
|
||||
) -> anyhow::Result<()> {
|
||||
let tab_id = tab.tab_id();
|
||||
let mouse_grabbed = tab.is_mouse_grabbed();
|
||||
let mut surfaces = surfaces.lock().unwrap();
|
||||
let dims = tab.renderer().get_dimensions();
|
||||
let surface = surfaces
|
||||
@@ -402,6 +403,7 @@ fn maybe_push_tab_changes(
|
||||
tab_id,
|
||||
sequence_no: surface.last_seq,
|
||||
changes,
|
||||
mouse_grabbed,
|
||||
}),
|
||||
serial: 0,
|
||||
})?;
|
||||
|
||||
+4
-2
@@ -137,6 +137,7 @@ pub struct ClientTab {
|
||||
reader: Pipe,
|
||||
mouse: Arc<Mutex<MouseState>>,
|
||||
clipboard: RefCell<Option<Arc<dyn Clipboard>>>,
|
||||
mouse_grabbed: RefCell<bool>,
|
||||
}
|
||||
|
||||
impl ClientTab {
|
||||
@@ -187,6 +188,7 @@ impl ClientTab {
|
||||
writer: RefCell::new(writer),
|
||||
reader,
|
||||
clipboard: RefCell::new(None),
|
||||
mouse_grabbed: RefCell::new(false),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,6 +196,7 @@ impl ClientTab {
|
||||
match pdu {
|
||||
Pdu::GetTabRenderChangesResponse(delta) => {
|
||||
log::trace!("new delta {}", delta.sequence_no);
|
||||
*self.mouse_grabbed.borrow_mut() = delta.mouse_grabbed;
|
||||
self.renderable
|
||||
.borrow()
|
||||
.inner
|
||||
@@ -318,8 +321,7 @@ impl Tab for ClientTab {
|
||||
}
|
||||
|
||||
fn is_mouse_grabbed(&self) -> bool {
|
||||
// FIXME: get the real state from the remote
|
||||
true
|
||||
*self.mouse_grabbed.borrow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user