debug: Add profiler view
This commit is contained in:
parent
d2b049332c
commit
26743d6bdc
4 changed files with 140 additions and 4 deletions
|
|
@ -167,6 +167,10 @@ impl State {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "debug")]
|
||||
{
|
||||
self.common.egui.state.handle_device_added(&device);
|
||||
}
|
||||
}
|
||||
InputEvent::DeviceRemoved { device } => {
|
||||
for seat in &mut self.common.seats() {
|
||||
|
|
@ -182,6 +186,10 @@ impl State {
|
|||
break;
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "debug")]
|
||||
{
|
||||
self.common.egui.state.handle_device_removed(&device);
|
||||
}
|
||||
}
|
||||
InputEvent::Keyboard { event, .. } => {
|
||||
use smithay::backend::input::KeyboardKeyEvent;
|
||||
|
|
@ -227,6 +235,26 @@ impl State {
|
|||
return FilterResult::Intercept(None);
|
||||
}
|
||||
|
||||
#[cfg(feature = "debug")]
|
||||
{
|
||||
if data.common.seats().position(|x| x == seat).unwrap() == 0
|
||||
&& data.common.egui.active
|
||||
{
|
||||
if data.common.egui.state.wants_keyboard() {
|
||||
data.common.egui.state.handle_keyboard(
|
||||
&handle,
|
||||
state == KeyState::Pressed,
|
||||
modifiers.clone(),
|
||||
);
|
||||
userdata
|
||||
.get::<SupressedKeys>()
|
||||
.unwrap()
|
||||
.add(&handle);
|
||||
return FilterResult::Intercept(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if state == KeyState::Pressed
|
||||
&& (keysyms::KEY_XF86Switch_VT_1..=KEY_XF86Switch_VT_12)
|
||||
.contains(&handle.modified_sym())
|
||||
|
|
@ -356,6 +384,18 @@ impl State {
|
|||
utime: event.time(),
|
||||
},
|
||||
);
|
||||
#[cfg(feature = "debug")]
|
||||
if self.common.seats().position(|x| x == seat).unwrap() == 0 {
|
||||
let location = if let Some(output) = self.common.shell.outputs.first() {
|
||||
self.common
|
||||
.shell
|
||||
.map_global_to_space(position, output)
|
||||
.to_i32_round()
|
||||
} else {
|
||||
position.to_i32_round()
|
||||
};
|
||||
self.common.egui.state.handle_pointer_motion(location);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -406,6 +446,18 @@ impl State {
|
|||
time: event.time_msec(),
|
||||
},
|
||||
);
|
||||
#[cfg(feature = "debug")]
|
||||
if self.common.seats().position(|x| x == seat).unwrap() == 0 {
|
||||
let location = if let Some(output) = self.common.shell.outputs.first() {
|
||||
self.common
|
||||
.shell
|
||||
.map_global_to_space(position, output)
|
||||
.to_i32_round()
|
||||
} else {
|
||||
position.to_i32_round()
|
||||
};
|
||||
self.common.egui.state.handle_pointer_motion(location);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -419,6 +471,21 @@ impl State {
|
|||
let userdata = seat.user_data();
|
||||
let devices = userdata.get::<Devices>().unwrap();
|
||||
if devices.has_device(&device) {
|
||||
#[cfg(feature = "debug")]
|
||||
if self.common.seats().position(|x| x == seat).unwrap() == 0
|
||||
&& self.common.egui.active
|
||||
{
|
||||
if self.common.egui.state.wants_pointer() {
|
||||
if let Some(button) = event.button() {
|
||||
self.common.egui.state.handle_pointer_button(
|
||||
button,
|
||||
event.state() == ButtonState::Pressed,
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let serial = SERIAL_COUNTER.next_serial();
|
||||
let button = event.button_code();
|
||||
if event.state() == ButtonState::Pressed {
|
||||
|
|
@ -512,6 +579,25 @@ impl State {
|
|||
InputEvent::PointerAxis { event, .. } => {
|
||||
let device = event.device();
|
||||
for seat in self.common.seats().cloned().collect::<Vec<_>>().iter() {
|
||||
#[cfg(feature = "debug")]
|
||||
if self.common.seats().position(|x| x == seat).unwrap() == 0
|
||||
&& self.common.egui.active
|
||||
{
|
||||
if self.common.egui.state.wants_pointer() {
|
||||
self.common.egui.state.handle_pointer_axis(
|
||||
event
|
||||
.amount_discrete(Axis::Horizontal)
|
||||
.or_else(|| event.amount(Axis::Horizontal).map(|x| x * 3.0))
|
||||
.unwrap_or(0.0),
|
||||
event
|
||||
.amount_discrete(Axis::Vertical)
|
||||
.or_else(|| event.amount(Axis::Vertical).map(|x| x * 3.0))
|
||||
.unwrap_or(0.0),
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let userdata = seat.user_data();
|
||||
let devices = userdata.get::<Devices>().unwrap();
|
||||
if devices.has_device(&device) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue