Replace all X11 mouse events with XI2 equivalents (#11235)
This PR replaces all pointer events on X11 with their XI2 equivalents, which fixes problems with scroll events not being reported when a mouse button is down. Additionally it closes #11206 by resetting the tracked global scroll valulator position with `None` on a leave event to prevent a large scroll delta if scrolling is done outside the window. Lastly, it resolves the bad window issue kvark was having. Release Notes: - Fixed X11 Scroll snapping (#11206 ). --------- Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
5486c3dc93
commit
9a60c0a059
3 changed files with 45 additions and 60 deletions
|
@ -16,11 +16,11 @@ use x11rb::{
|
|||
connection::{Connection as _, RequestConnection as _},
|
||||
protocol::{
|
||||
render::{self, ConnectionExt as _},
|
||||
xinput,
|
||||
xproto::{self, ConnectionExt as _},
|
||||
xinput::{self, ConnectionExt as _},
|
||||
xproto::{self, ConnectionExt as _, CreateWindowAux},
|
||||
},
|
||||
resource_manager::Database,
|
||||
wrapper::ConnectionExt,
|
||||
wrapper::ConnectionExt as _,
|
||||
xcb_ffi::XCBConnection,
|
||||
};
|
||||
|
||||
|
@ -262,14 +262,7 @@ impl X11WindowState {
|
|||
| xproto::EventMask::LEAVE_WINDOW
|
||||
| xproto::EventMask::FOCUS_CHANGE
|
||||
| xproto::EventMask::KEY_PRESS
|
||||
| xproto::EventMask::KEY_RELEASE
|
||||
| xproto::EventMask::BUTTON_PRESS
|
||||
| xproto::EventMask::BUTTON_RELEASE
|
||||
| xproto::EventMask::POINTER_MOTION
|
||||
| xproto::EventMask::BUTTON1_MOTION
|
||||
| xproto::EventMask::BUTTON2_MOTION
|
||||
| xproto::EventMask::BUTTON3_MOTION
|
||||
| xproto::EventMask::BUTTON_MOTION,
|
||||
| xproto::EventMask::KEY_RELEASE,
|
||||
);
|
||||
|
||||
xcb_connection
|
||||
|
@ -290,18 +283,6 @@ impl X11WindowState {
|
|||
.check()
|
||||
.unwrap();
|
||||
|
||||
xinput::ConnectionExt::xinput_xi_select_events(
|
||||
&xcb_connection,
|
||||
x_window,
|
||||
&[xinput::EventMask {
|
||||
deviceid: 1,
|
||||
mask: vec![xinput::XIEventMask::MOTION],
|
||||
}],
|
||||
)
|
||||
.unwrap()
|
||||
.check()
|
||||
.unwrap();
|
||||
|
||||
if let Some(titlebar) = params.titlebar {
|
||||
if let Some(title) = titlebar.title {
|
||||
xcb_connection
|
||||
|
@ -326,6 +307,21 @@ impl X11WindowState {
|
|||
)
|
||||
.unwrap();
|
||||
|
||||
xcb_connection
|
||||
.xinput_xi_select_events(
|
||||
x_window,
|
||||
&[xinput::EventMask {
|
||||
deviceid: 1,
|
||||
mask: vec![
|
||||
xinput::XIEventMask::MOTION
|
||||
| xinput::XIEventMask::BUTTON_PRESS
|
||||
| xinput::XIEventMask::BUTTON_RELEASE
|
||||
| xinput::XIEventMask::LEAVE,
|
||||
],
|
||||
}],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
xcb_connection.map_window(x_window).unwrap();
|
||||
xcb_connection.flush().unwrap();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue