Skip to content

Commit

Permalink
updating smithay
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhbooth committed Oct 22, 2024
1 parent 9d172e6 commit fceedda
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 42 deletions.
41 changes: 22 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions src/server/client_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl WprsServerState {
let serial = self.serial_map.insert(serial);
pointer.motion(
self,
Some((surface, (0, 0).into())),
Some((surface, (0 as f64, 0 as f64).into())),
&MotionEvent {
location: event.position.into(),
serial,
Expand Down Expand Up @@ -180,7 +180,7 @@ impl WprsServerState {
debug!("pointer moved to {:?}", event.position);
pointer.motion(
self,
Some((surface, (0, 0).into())),
Some((surface, (0 as f64, 0 as f64).into())),
&MotionEvent {
location: event.position.into(),
serial: 0.into(), // unused
Expand Down Expand Up @@ -257,7 +257,7 @@ impl WprsServerState {

keyboard.input::<(), _>(
self,
keycode,
keycode.into(),
state,
serial,
self.start_time.elapsed().as_millis() as u32,
Expand Down Expand Up @@ -723,7 +723,11 @@ impl WprsServerState {

let serial = self.serial_map.insert(drag_enter.serial);
let pointer = self.seat.get_pointer().location(loc!())?;
let grab = DndGrab::new(Some((surface, (0, 0).into())), 0, drag_enter.loc.into());
let grab = DndGrab::new(
Some((surface, (0 as f64, 0 as f64).into())),
0,
drag_enter.loc.into(),
);
pointer.set_grab(self, grab, serial, Focus::Keep);
let drag_start_data = pointer.grab_start_data();
debug!("DRAG GRAB: pointer.grab_start_data {:?}", drag_start_data);
Expand Down Expand Up @@ -767,7 +771,10 @@ impl WprsServerState {
if let Some(grab_start_data) = pointer.grab_start_data() {
pointer.motion(
self,
Some((grab_start_data.focus.location(loc!())?.0, (0, 0).into())),
Some((
grab_start_data.focus.location(loc!())?.0,
(0 as f64, 0 as f64).into(),
)),
&MotionEvent {
location: drag_motion.into(),
serial: 0.into(), // unused
Expand Down
23 changes: 14 additions & 9 deletions src/server/smithay_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,8 @@ pub fn get_child_positions(surface: &WlSurface) -> Vec<SubsurfacePosition> {
position: compositor::with_states(child, |surface_data| {
surface_data
.cached_state
.pending::<SubsurfaceCachedState>()
.get::<SubsurfaceCachedState>()
.pending()
.location
.into()
}),
Expand Down Expand Up @@ -656,7 +657,9 @@ pub fn set_transformation(
#[instrument(skip_all, level = "debug")]
pub fn set_xdg_surface_attributes(surface_data: &SurfaceData, surface_state: &mut SurfaceState) {
if surface_data.cached_state.has::<SurfaceCachedState>() {
let surface_cached_state = surface_data.cached_state.current::<SurfaceCachedState>();
let mut guard = surface_data.cached_state.get::<SurfaceCachedState>();
let surface_cached_state = guard.current();

let xdg_surface_state = XdgSurfaceState {
window_geometry: surface_cached_state
.geometry
Expand Down Expand Up @@ -744,7 +747,8 @@ pub fn commit_impl(
position: (0, 0).into(),
});

let mut surface_attributes = surface_data.cached_state.current::<SurfaceAttributes>();
let mut guard = surface_data.cached_state.get::<SurfaceAttributes>();
let surface_attributes = guard.current();
let mut frame_callbacks = mem::take(&mut surface_attributes.frame_callbacks);

if !frame_callbacks.is_empty() {
Expand Down Expand Up @@ -786,8 +790,8 @@ pub fn commit_impl(
.expect("timer registration should never fail");
}

set_regions(&surface_attributes, surface_state);
set_transformation(&surface_attributes, surface_state);
set_regions(surface_attributes, surface_state);
set_transformation(surface_attributes, surface_state);
set_xdg_surface_attributes(surface_data, surface_state);

match &mut surface_state.role {
Expand All @@ -796,7 +800,8 @@ pub fn commit_impl(
subsurface_state.sync = sync;
subsurface_state.location = surface_data
.cached_state
.pending::<SubsurfaceCachedState>()
.get::<SubsurfaceCachedState>()
.pending()
.location
.into();
},
Expand Down Expand Up @@ -1037,7 +1042,7 @@ impl DndGrab {
pub fn new(
focus: Option<(
<WprsServerState as SeatHandler>::PointerFocus,
Point<i32, Logical>,
Point<f64, Logical>,
)>,
button: u32,
location: (f64, f64),
Expand All @@ -1064,7 +1069,7 @@ impl PointerGrab<WprsServerState> for DndGrab {
_handle: &mut PointerInnerHandle<'_, WprsServerState>,
focus: Option<(
<WprsServerState as SeatHandler>::PointerFocus,
Point<i32, Logical>,
Point<f64, Logical>,
)>,
event: &MotionEvent,
) {
Expand All @@ -1077,7 +1082,7 @@ impl PointerGrab<WprsServerState> for DndGrab {
_handle: &mut PointerInnerHandle<'_, WprsServerState>,
focus: Option<(
<WprsServerState as SeatHandler>::PointerFocus,
Point<i32, Logical>,
Point<f64, Logical>,
)>,
event: &RelativeMotionEvent,
) {
Expand Down
7 changes: 4 additions & 3 deletions src/xwayland_xdg_shell/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ impl CompositorHandler for WprsState {
compositor::with_states(&wl_surface, |surface_data| {
for callback in surface_data
.cached_state
.current::<SurfaceAttributes>()
.get::<SurfaceAttributes>()
.current()
.frame_callbacks
.drain(..)
{
Expand Down Expand Up @@ -844,7 +845,7 @@ impl PointerHandler for WprsState {
let serial = self.compositor_state.serial_map.insert(serial);
compositor_pointer.motion(
self,
Some((x11_surface, (0, 0).into())),
Some((x11_surface, (0 as f64, 0 as f64).into())),
&MotionEvent {
location: event.position.into(),
serial,
Expand All @@ -867,7 +868,7 @@ impl PointerHandler for WprsState {
PointerEventKind::Motion { time } => {
compositor_pointer.motion(
self,
Some((x11_surface, (0, 0).into())),
Some((x11_surface, (0 as f64, 0 as f64).into())),
&MotionEvent {
location: event.position.into(),
serial: 0.into(), // unused
Expand Down
12 changes: 7 additions & 5 deletions src/xwayland_xdg_shell/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ use smithay::wayland::shm::ShmHandler;
use smithay::wayland::shm::ShmState;
use smithay::wayland::xwayland_shell::XWaylandShellHandler;
use smithay::wayland::xwayland_shell::XWaylandShellState;
use smithay::xwayland::xwm::XwmId;
use smithay::xwayland::X11Surface;
use smithay::xwayland::X11Wm;
use smithay::xwayland::XWayland;
Expand All @@ -73,7 +74,6 @@ use smithay_client_toolkit::reexports::csd_frame::DecorationsFrame;
use smithay_client_toolkit::reexports::protocols::xdg::shell::client::xdg_surface;
use smithay_client_toolkit::shell::xdg::XdgSurface;
use smithay_client_toolkit::shell::WaylandSurface;
use x11rb::protocol::xproto::Window;

use crate::compositor_utils;
use crate::fallible_entry::FallibleEntryExt;
Expand Down Expand Up @@ -328,11 +328,11 @@ impl XWaylandShellHandler for WprsState {
&mut self.compositor_state.xwayland_shell_state
}

fn surface_associated(&mut self, surface: WlSurface, window: Window) {
fn surface_associated(&mut self, _xwm: XwmId, wl_surface: WlSurface, surface: X11Surface) {
// TODO: we should implement this and get rid of the deferring commit logic below
debug!(
"X11 window {:?} associated with surface {:?}",
window, surface
surface, wl_surface
)
}
}
Expand Down Expand Up @@ -488,7 +488,9 @@ pub fn commit_inner(
surface_data: &SurfaceData,
state: &mut WprsState,
) -> Result<()> {
let mut surface_attributes = surface_data.cached_state.current::<SurfaceAttributes>();
let mut guard = surface_data.cached_state.get::<SurfaceAttributes>();
let surface_attributes = guard.current();

let x11_surface = state
.compositor_state
.x11_surfaces
Expand Down Expand Up @@ -624,7 +626,7 @@ pub fn commit_inner(
compositor_utils::send_frames(
surface,
&surface_data.data_map,
&mut surface_attributes,
surface_attributes,
state.compositor_state.start_time.elapsed(),
Duration::ZERO,
)
Expand Down
2 changes: 1 addition & 1 deletion src/xwayland_xdg_shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ impl WprsState {

keyboard.input::<(), _>(
self,
keycode,
keycode.into(),
state,
serial,
self.compositor_state.start_time.elapsed().as_millis() as u32,
Expand Down

0 comments on commit fceedda

Please sign in to comment.