Each source file that had grown beyond a single concern is replaced by an identically-named directory containing focused submodules. `src/event_loop/mod.rs` (878 lines) becomes a directory with clipboard, context_menu, cursor_shape, drag, focus, handlers, invalidation, overlays_reconcile, repeat, run, surface, text_editing, and tooltip. Every widget, input handler, and theme component follows the same split. Public interfaces are unchanged — only the internal file layout moves. image bumped from 0.25.2 to 0.25.9.
44 lines
1.3 KiB
Rust
44 lines
1.3 KiB
Rust
// SPDX-License-Identifier: LGPL-2.1-only
|
|
// Copyright (C) 2026 Liberux Labs, S. L. <info@liberux.net>
|
|
|
|
use smithay_client_toolkit::seat::pointer::{ PointerEvent, PointerEventKind };
|
|
use smithay_client_toolkit::reexports::client::
|
|
{
|
|
protocol::wl_pointer::WlPointer,
|
|
Connection, QueueHandle,
|
|
};
|
|
|
|
use crate::app::App;
|
|
use crate::event_loop::{ AppData, SurfaceFocus };
|
|
|
|
impl<A: App> AppData<A>
|
|
{
|
|
pub( super ) fn on_pointer_enter(
|
|
&mut self,
|
|
_conn: &Connection,
|
|
_qh: &QueueHandle<Self>,
|
|
_pointer: &WlPointer,
|
|
event: &PointerEvent,
|
|
)
|
|
{
|
|
let focus = self.focus_for_surface( &event.surface )
|
|
.unwrap_or( SurfaceFocus::Main );
|
|
if let PointerEventKind::Enter { serial } = event.kind
|
|
{
|
|
// Pointer just entered our surface — capture the
|
|
// serial that wp_cursor_shape_device_v1::set_shape
|
|
// requires, then push the initial cursor shape
|
|
// *unconditionally*. Resetting `current_cursor_shape`
|
|
// to `None` is what forces the dispatch: the
|
|
// compositor was showing whatever the previous
|
|
// client asked for (e.g. a text I-beam from a
|
|
// terminal under our window), and we must claim
|
|
// the cursor for our surface even when the target
|
|
// equals what we last pushed.
|
|
self.last_pointer_enter_serial = serial;
|
|
self.current_cursor_shape = None;
|
|
self.dispatch_cursor_shape( focus );
|
|
}
|
|
}
|
|
}
|