windows: remove DoubleClick from input enums

double clicks weren't registering correctly with the new selection
logic.  Tell windows that we're doing all our own click counting
and simplify the logic.
This commit is contained in:
Wez Furlong committed 2020-01-05 16:16:06 -08:00
1 parent 048495b651
commit bda0a3b5fe
3 files changed
+4 -13

No files matched your search

+3 -7
View File
@@ -270,7 +270,7 @@ impl WindowCallbacks for TermWindow {
}
}
WMEK::Press(ref press) | WMEK::DoubleClick(ref press) => {
WMEK::Press(ref press) => {
if let Some(focused) = self.focused.as_ref() {
if focused.elapsed() <= Duration::from_millis(200) {
log::trace!("discard mouse click because it focused the window");
@@ -2617,15 +2617,11 @@ impl TermWindow {
let mouse_event = term::MouseEvent {
kind: match event.kind {
WMEK::Move => TMEK::Move,
WMEK::VertWheel(_) | WMEK::HorzWheel(_) | WMEK::DoubleClick(_) | WMEK::Press(_) => {
TMEK::Press
}
WMEK::VertWheel(_) | WMEK::HorzWheel(_) | WMEK::Press(_) => TMEK::Press,
WMEK::Release(_) => TMEK::Release,
},
button: match event.kind {
WMEK::Release(ref press)
| WMEK::Press(ref press)
| WMEK::DoubleClick(ref press) => match press {
WMEK::Release(ref press) | WMEK::Press(ref press) => match press {
MousePress::Left => TMB::Left,
MousePress::Middle => TMB::Middle,
MousePress::Right => TMB::Right,
-2
View File
@@ -118,8 +118,6 @@ pub enum MouseEventKind {
Move,
Press(MousePress),
Release(MousePress),
/// Note: DoubleClick is never generated on X11!
DoubleClick(MousePress),
VertWheel(i16),
HorzWheel(i16),
}
+1 -4
View File
@@ -118,7 +118,7 @@ impl Window {
let class_name = wide_string(class_name);
let h_inst = unsafe { GetModuleHandleW(null()) };
let class = WNDCLASSW {
style: CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS,
style: CS_HREDRAW | CS_VREDRAW | CS_OWNDC,
lpfnWndProc: Some(wnd_proc),
cbClsExtra: 0,
cbWndExtra: 0,
@@ -732,9 +732,6 @@ unsafe fn mouse_button(hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM) ->
WM_RBUTTONUP => MouseEventKind::Release(MousePress::Right),
WM_MBUTTONDOWN => MouseEventKind::Press(MousePress::Middle),
WM_MBUTTONUP => MouseEventKind::Release(MousePress::Middle),
WM_LBUTTONDBLCLK => MouseEventKind::DoubleClick(MousePress::Left),
WM_RBUTTONDBLCLK => MouseEventKind::DoubleClick(MousePress::Right),
WM_MBUTTONDBLCLK => MouseEventKind::DoubleClick(MousePress::Middle),
_ => return None,
},
coords,