1
0
Fork 0
forked from wry/wry

Merge pull request #305 from mahkoh/jorth/cs2

cursor-shape: implement v2
This commit is contained in:
mahkoh 2025-03-03 09:27:47 +01:00 committed by GitHub
commit 0fadb43c15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 17 additions and 2 deletions

View file

@ -163,7 +163,7 @@ Jay supports the following wayland protocols:
| wp_color_manager_v1 | 1[^color_mng] | |
| wp_commit_timing_manager_v1 | 1 | |
| wp_content_type_manager_v1 | 1 | |
| wp_cursor_shape_manager_v1 | 1 | |
| wp_cursor_shape_manager_v1 | 2 | |
| wp_drm_lease_device_v1 | 1 | |
| wp_fifo_manager_v1 | 1 | |
| wp_fractional_scale_manager_v1 | 1 | |

View file

@ -10,6 +10,7 @@
yellow. The blend buffer is only used for those areas of the screen where blending is
observable. This should have no impact on performance in the common case.
- Implement color-management-v1.
- Implement cursor-shape-v1 version 2.
# 1.9.1 (2025-02-13)

View file

@ -111,6 +111,8 @@ pub struct ServerCursors {
pub all_scroll: ServerCursorTemplate,
pub zoom_in: ServerCursorTemplate,
pub zoom_out: ServerCursorTemplate,
pub dnd_ask: ServerCursorTemplate,
pub all_resize: ServerCursorTemplate,
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, FromPrimitive)]
@ -149,6 +151,8 @@ pub enum KnownCursor {
AllScroll,
ZoomIn,
ZoomOut,
DndAsk,
AllResize,
}
impl ServerCursors {
@ -201,6 +205,8 @@ impl ServerCursors {
all_scroll: load(&["all-scroll", "grabbing"])?,
zoom_in: load(&["zoom-in"])?,
zoom_out: load(&["zoom-out"])?,
dnd_ask: load(&["dnd-ask", "dnd-copy", "copy"])?,
all_resize: load(&["all-resize", "move"])?,
}))
}
}

View file

@ -328,6 +328,8 @@ impl CursorUser {
KnownCursor::AllScroll => &cursors.all_scroll,
KnownCursor::ZoomIn => &cursors.zoom_in,
KnownCursor::ZoomOut => &cursors.zoom_out,
KnownCursor::DndAsk => &cursors.dnd_ask,
KnownCursor::AllResize => &cursors.all_resize,
};
self.set_cursor2(Some(
tpl.instantiate(&self.group.state, self.group.size.get()),

View file

@ -45,6 +45,10 @@ const ROW_RESIZE: u32 = 31;
const ALL_SCROLL: u32 = 32;
const ZOOM_IN: u32 = 33;
const ZOOM_OUT: u32 = 34;
const DND_ASK: u32 = 35;
const ALL_RESIZE: u32 = 36;
const V2: Version = Version(2);
pub enum CursorShapeCursorUser {
Seat(Rc<WlSeatGlobal>),
@ -103,6 +107,8 @@ impl WpCursorShapeDeviceV1RequestHandler for WpCursorShapeDeviceV1 {
ALL_SCROLL => KnownCursor::AllScroll,
ZOOM_IN => KnownCursor::ZoomIn,
ZOOM_OUT => KnownCursor::ZoomOut,
DND_ASK if self.version >= V2 => KnownCursor::DndAsk,
ALL_RESIZE if self.version >= V2 => KnownCursor::AllResize,
_ => return Err(WpCursorShapeDeviceV1Error::UnknownShape(req.shape)),
};
let tablet_tool;

View file

@ -52,7 +52,7 @@ impl Global for WpCursorShapeManagerV1Global {
}
fn version(&self) -> u32 {
1
2
}
}