mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 23:21:08 +03:00
window: implement window movement by dragging on Wayland
This commit is contained in:
parent
bd9b964106
commit
94ede1e8f1
@ -321,6 +321,7 @@ impl super::TermWindow {
|
||||
TabBarItem::None => {
|
||||
// Potentially starting a drag by the tab bar
|
||||
self.window_drag_position.replace(event.clone());
|
||||
context.request_drag_move();
|
||||
}
|
||||
},
|
||||
WMEK::Press(MousePress::Middle) => match self.tab_bar.hit_test(x) {
|
||||
|
@ -220,9 +220,18 @@ pub trait WindowOps {
|
||||
/// Resize the inner or client area of the window
|
||||
fn set_inner_size(&self, width: usize, height: usize);
|
||||
|
||||
/// Requests the windowing system to start a window drag.
|
||||
///
|
||||
/// This is only implemented on backends that handle
|
||||
/// window movement on the server side (Wayland).
|
||||
fn request_drag_move(&self) {}
|
||||
|
||||
/// Changes the location of the window on the screen.
|
||||
/// The coordinates are of the top left pixel of the
|
||||
/// client area.
|
||||
///
|
||||
/// This is only implemented on backends that allow
|
||||
/// windows to move themselves (not Wayland).
|
||||
fn set_window_position(&self, _coords: ScreenPoint) {}
|
||||
|
||||
/// inform the windowing system of the current textual
|
||||
|
@ -10,7 +10,7 @@ use wayland_client::Attached;
|
||||
#[derive(Default)]
|
||||
pub struct CopyAndPaste {
|
||||
data_offer: Option<WlDataOffer>,
|
||||
last_serial: u32,
|
||||
pub(crate) last_serial: u32,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for CopyAndPaste {
|
||||
|
@ -94,6 +94,7 @@ pub struct PointerDispatcher {
|
||||
auto_pointer: ThemedPointer,
|
||||
#[allow(dead_code)]
|
||||
themer: ThemeManager,
|
||||
pub(crate) seat: WlSeat,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@ -237,6 +238,7 @@ impl PointerDispatcher {
|
||||
data_device,
|
||||
themer,
|
||||
auto_pointer,
|
||||
seat: seat.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -793,9 +793,9 @@ impl WindowOps for WaylandWindow {
|
||||
});
|
||||
}
|
||||
|
||||
fn set_window_position(&self, coords: ScreenPoint) {
|
||||
fn request_drag_move(&self) {
|
||||
WaylandConnection::with_window_inner(self.0, move |inner| {
|
||||
inner.set_window_position(coords);
|
||||
inner.request_drag_move();
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
@ -1000,7 +1000,13 @@ impl WaylandWindowInner {
|
||||
}
|
||||
}
|
||||
|
||||
fn set_window_position(&self, _coords: ScreenPoint) {}
|
||||
fn request_drag_move(&self) {
|
||||
if let Some(window) = self.window.as_ref() {
|
||||
let serial = self.copy_and_paste.lock().unwrap().last_serial;
|
||||
let conn = Connection::get().unwrap().wayland();
|
||||
window.start_interactive_move(&conn.pointer.seat, serial);
|
||||
}
|
||||
}
|
||||
|
||||
/// Change the title for the window manager
|
||||
fn set_title(&mut self, title: &str) {
|
||||
|
@ -285,6 +285,14 @@ impl WindowOps for Window {
|
||||
}
|
||||
}
|
||||
|
||||
fn request_drag_move(&self) {
|
||||
match self {
|
||||
Self::X11(x) => x.request_drag_move(),
|
||||
#[cfg(feature = "wayland")]
|
||||
Self::Wayland(w) => w.request_drag_move(),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_window_position(&self, coords: ScreenPoint) {
|
||||
match self {
|
||||
Self::X11(x) => x.set_window_position(coords),
|
||||
|
Loading…
Reference in New Issue
Block a user