1
0
Fork 0
forked from wry/wry

cursor-shape: implement v2

This commit is contained in:
Julian Orth 2024-10-21 17:31:19 +02:00
parent dbb55f10f0
commit aa207ffe14
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_color_manager_v1 | 1[^color_mng] | |
| wp_commit_timing_manager_v1 | 1 | | | wp_commit_timing_manager_v1 | 1 | |
| wp_content_type_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_drm_lease_device_v1 | 1 | |
| wp_fifo_manager_v1 | 1 | | | wp_fifo_manager_v1 | 1 | |
| wp_fractional_scale_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 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. observable. This should have no impact on performance in the common case.
- Implement color-management-v1. - Implement color-management-v1.
- Implement cursor-shape-v1 version 2.
# 1.9.1 (2025-02-13) # 1.9.1 (2025-02-13)

View file

@ -111,6 +111,8 @@ pub struct ServerCursors {
pub all_scroll: ServerCursorTemplate, pub all_scroll: ServerCursorTemplate,
pub zoom_in: ServerCursorTemplate, pub zoom_in: ServerCursorTemplate,
pub zoom_out: ServerCursorTemplate, pub zoom_out: ServerCursorTemplate,
pub dnd_ask: ServerCursorTemplate,
pub all_resize: ServerCursorTemplate,
} }
#[derive(Copy, Clone, Debug, Eq, PartialEq, FromPrimitive)] #[derive(Copy, Clone, Debug, Eq, PartialEq, FromPrimitive)]
@ -149,6 +151,8 @@ pub enum KnownCursor {
AllScroll, AllScroll,
ZoomIn, ZoomIn,
ZoomOut, ZoomOut,
DndAsk,
AllResize,
} }
impl ServerCursors { impl ServerCursors {
@ -201,6 +205,8 @@ impl ServerCursors {
all_scroll: load(&["all-scroll", "grabbing"])?, all_scroll: load(&["all-scroll", "grabbing"])?,
zoom_in: load(&["zoom-in"])?, zoom_in: load(&["zoom-in"])?,
zoom_out: load(&["zoom-out"])?, 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::AllScroll => &cursors.all_scroll,
KnownCursor::ZoomIn => &cursors.zoom_in, KnownCursor::ZoomIn => &cursors.zoom_in,
KnownCursor::ZoomOut => &cursors.zoom_out, KnownCursor::ZoomOut => &cursors.zoom_out,
KnownCursor::DndAsk => &cursors.dnd_ask,
KnownCursor::AllResize => &cursors.all_resize,
}; };
self.set_cursor2(Some( self.set_cursor2(Some(
tpl.instantiate(&self.group.state, self.group.size.get()), 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 ALL_SCROLL: u32 = 32;
const ZOOM_IN: u32 = 33; const ZOOM_IN: u32 = 33;
const ZOOM_OUT: u32 = 34; const ZOOM_OUT: u32 = 34;
const DND_ASK: u32 = 35;
const ALL_RESIZE: u32 = 36;
const V2: Version = Version(2);
pub enum CursorShapeCursorUser { pub enum CursorShapeCursorUser {
Seat(Rc<WlSeatGlobal>), Seat(Rc<WlSeatGlobal>),
@ -103,6 +107,8 @@ impl WpCursorShapeDeviceV1RequestHandler for WpCursorShapeDeviceV1 {
ALL_SCROLL => KnownCursor::AllScroll, ALL_SCROLL => KnownCursor::AllScroll,
ZOOM_IN => KnownCursor::ZoomIn, ZOOM_IN => KnownCursor::ZoomIn,
ZOOM_OUT => KnownCursor::ZoomOut, 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)), _ => return Err(WpCursorShapeDeviceV1Error::UnknownShape(req.shape)),
}; };
let tablet_tool; let tablet_tool;

View file

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