diff --git a/api/lua/test_config.lua b/api/lua/test_config.lua index 28a27ff..9255f1a 100644 --- a/api/lua/test_config.lua +++ b/api/lua/test_config.lua @@ -149,11 +149,11 @@ require("pinnacle").setup(function(pinnacle) -- local tags_table = { "Terminal", "Browser", "Code", "Email", "Potato" } -- op:add_tags(tags_table) - for _, t in pairs(tag.get_by_name("1")) do - if t:output() and t:output():focused() then - t:toggle() - end - end + -- for _, t in pairs(tag.get_by_name("1")) do + -- t:toggle() + -- end + + tag.toggle("1", op) end) ---@type Layout[] diff --git a/src/backend/udev.rs b/src/backend/udev.rs index fdfdc21..b7c01b1 100644 --- a/src/backend/udev.rs +++ b/src/backend/udev.rs @@ -241,6 +241,7 @@ pub fn run_udev() -> Result<(), Box> { */ let udev_backend = UdevBackend::new(state.seat.name())?; + // Create DrmNodes from already connected GPUs for (device_id, path) in udev_backend.device_list() { if let Err(err) = DrmNode::from_dev_id(device_id) .map_err(DeviceAddError::DrmNode) @@ -252,6 +253,7 @@ pub fn run_udev() -> Result<(), Box> { event_loop .handle() .insert_source(udev_backend, move |event, _, data| match event { + // GPU connected UdevEvent::Added { device_id, path } => { if let Err(err) = DrmNode::from_dev_id(device_id) .map_err(DeviceAddError::DrmNode) @@ -265,6 +267,7 @@ pub fn run_udev() -> Result<(), Box> { data.state.device_changed(node) } } + // GPU disconnected UdevEvent::Removed { device_id } => { if let Ok(node) = DrmNode::from_dev_id(device_id) { data.state.device_removed(node) @@ -462,7 +465,7 @@ pub fn run_udev() -> Result<(), Box> { } event_loop.run( - Some(Duration::from_millis(6)), + Some(Duration::from_millis(1)), &mut CalloopData { state, display }, |data| { data.state.space.refresh(); diff --git a/src/backend/winit.rs b/src/backend/winit.rs index e7acf8d..abdc8e5 100644 --- a/src/backend/winit.rs +++ b/src/backend/winit.rs @@ -20,7 +20,10 @@ use smithay::{ delegate_dmabuf, desktop::{ space, - utils::{surface_primary_scanout_output, update_surface_primary_scanout_output}, + utils::{ + send_frames_surface_tree, surface_primary_scanout_output, + update_surface_primary_scanout_output, + }, }, input::pointer::{CursorImageAttributes, CursorImageStatus}, output::{Output, Subpixel}, @@ -345,9 +348,22 @@ pub fn run_winit() -> Result<(), Box> { .set_cursor_visible(cursor_visible); let throttle = Some(Duration::from_secs(1)); + // let throttle = Some(Duration::ZERO); let time = state.clock.now(); + if let CursorImageStatus::Surface(surf) = &state.cursor_status { + if let Some(op) = state.focus_state.focused_output.as_ref() { + send_frames_surface_tree( + surf, + op, + time, + Some(Duration::ZERO), + |_, _| None, + ); + } + } + state.space.elements().for_each(|window| { window.with_surfaces(|surface, states_inner| { let primary_scanout_output = update_surface_primary_scanout_output( diff --git a/src/focus.rs b/src/focus.rs index 9521c80..7f733be 100644 --- a/src/focus.rs +++ b/src/focus.rs @@ -71,6 +71,7 @@ impl TryFrom for WlSurface { impl PointerTarget> for FocusTarget { fn enter(&self, seat: &Seat>, data: &mut State, event: &MotionEvent) { + // tracing::debug!("Pointer enter on {self:?}"); match self { FocusTarget::Window(window) => PointerTarget::enter(window, seat, data, event), FocusTarget::Popup(popup) => { @@ -137,6 +138,7 @@ impl PointerTarget> for FocusTarget { serial: smithay::utils::Serial, time: u32, ) { + // tracing::debug!("Pointer leave on {self:?}"); match self { FocusTarget::Window(window) => PointerTarget::leave(window, seat, data, serial, time), FocusTarget::Popup(popup) => { diff --git a/src/handlers/xwayland.rs b/src/handlers/xwayland.rs index b96cd3b..af78640 100644 --- a/src/handlers/xwayland.rs +++ b/src/handlers/xwayland.rs @@ -36,9 +36,6 @@ impl XwmHandler for CalloopData { tracing::debug!("window type is {win_type:?}"); // tracing::debug!("new x11 window from map_window_request"); // tracing::debug!("window popup is {}", window.is_popup()); - // - // TODO: TOMORROW: figure out why keyboard input isn't going to games (prolly you never - // | change keyboard focus) if window.is_override_redirect() { let loc = window.geometry().loc; diff --git a/src/input.rs b/src/input.rs index a478e1f..17a8105 100644 --- a/src/input.rs +++ b/src/input.rs @@ -15,7 +15,7 @@ use smithay::{ desktop::space::SpaceElement, input::{ keyboard::{keysyms, FilterResult}, - pointer::{AxisFrame, ButtonEvent, MotionEvent}, + pointer::{AxisFrame, ButtonEvent, MotionEvent, PointerTarget}, }, reexports::wayland_protocols::xdg::shell::server::xdg_toplevel::ResizeEdge, utils::{Logical, Point, SERIAL_COUNTER}, @@ -164,6 +164,10 @@ impl State { // NOTE: *Do not* set keyboard focus to an override redirect window. This leads // | to wonky things like right-click menus not correctly getting pointer // | clicks or showing up at all. + + // TODO: TOMORROW: Firefox needs 2 clicks to open up right-click menu, first + // | one immediately dissapears + if !matches!(&window, WindowElement::X11(surf) if surf.is_override_redirect()) { keyboard.set_focus(self, Some(FocusTarget::Window(window.clone())), serial); } @@ -400,14 +404,20 @@ impl State { .space .element_under(pointer_loc) .map(|(window, loc)| (FocusTarget::Window(window.clone()), loc)); - // .and_then(|(window, location)| { - // window - // .surface_under(pointer_loc - location.to_f64(), WindowSurfaceType::ALL) - // .map(|(_s, p)| (FocusTarget::Window(window.clone()), p + location)) - // }); // tracing::debug!("surface_under_pointer: {surface_under_pointer:?}"); // tracing::debug!("pointer focus: {:?}", pointer.current_focus()); + if let Some((focus, _point)) = &surface_under_pointer { + focus.motion( + &self.seat.clone(), + self, + &MotionEvent { + location: pointer_loc, + serial, + time: event.time_msec(), + }, + ); + } pointer.motion( self, surface_under_pointer,