revert keyboard focus back to working code
This commit is contained in:
parent
c523905c49
commit
fdd3706768
2 changed files with 31 additions and 12 deletions
|
|
@ -72,12 +72,27 @@ pub fn run_winit() -> Result<(), Box<dyn std::error::Error>> {
|
|||
};
|
||||
|
||||
if event.state() == ButtonState::Pressed {
|
||||
if let Some((surface, _)) = state.surface_under(state.pointer_location) {
|
||||
keyboard.set_focus(
|
||||
&mut state,
|
||||
Some(surface),
|
||||
SERIAL_COUNTER.next_serial(),
|
||||
);
|
||||
if let Some(surface) = state.focused_surface() {
|
||||
{
|
||||
if let Some(ref surface) = surface.surface {
|
||||
keyboard.set_focus(
|
||||
&mut state,
|
||||
Some(surface.wl_surface().clone()),
|
||||
SERIAL_COUNTER.next_serial(),
|
||||
);
|
||||
}
|
||||
if let Some(ref surface) = surface.xsurface {
|
||||
keyboard.set_focus(
|
||||
&mut state,
|
||||
surface.wl_surface(),
|
||||
SERIAL_COUNTER.next_serial(),
|
||||
);
|
||||
}
|
||||
}
|
||||
{
|
||||
let mut space = state.space.lock();
|
||||
space.raise_element(&surface, true);
|
||||
}
|
||||
} else {
|
||||
keyboard.set_focus(&mut state, None, SERIAL_COUNTER.next_serial());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,6 +226,12 @@ impl State {
|
|||
// None
|
||||
// }
|
||||
|
||||
pub fn button_event(&mut self, ev: ButtonEvent) {
|
||||
let pointer = self.pointer.clone();
|
||||
pointer.button(self, &ev);
|
||||
pointer.frame(self);
|
||||
}
|
||||
|
||||
pub fn surface_under(
|
||||
&self,
|
||||
pos: Point<f64, Logical>,
|
||||
|
|
@ -241,12 +247,6 @@ impl State {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn button_event(&mut self, ev: ButtonEvent) {
|
||||
let pointer = self.pointer.clone();
|
||||
pointer.button(self, &ev);
|
||||
pointer.frame(self);
|
||||
}
|
||||
|
||||
pub fn focused_surface(&mut self) -> Option<AppWrapper> {
|
||||
let space = self.space.lock();
|
||||
// let mut surfaces = vec![];
|
||||
|
|
@ -259,6 +259,10 @@ impl State {
|
|||
}
|
||||
|
||||
None
|
||||
// self.space
|
||||
// .lock()
|
||||
// .element_under(self.pointer_location)
|
||||
// .and_then(|(window, _location)| Some(window.clone()))
|
||||
}
|
||||
|
||||
pub fn motion_event(&mut self, ev: MotionEvent, locationrel: Point<f64, Logical>) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue