mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
wayland: Add methods to update the position of different tools' cursors
This commit is contained in:
parent
4ce4f4eac9
commit
17f2b4ea43
@ -33,6 +33,7 @@
|
|||||||
#include "meta-wayland-private.h"
|
#include "meta-wayland-private.h"
|
||||||
#include "meta-wayland-tablet-manager.h"
|
#include "meta-wayland-tablet-manager.h"
|
||||||
#include "meta-wayland-tablet-seat.h"
|
#include "meta-wayland-tablet-seat.h"
|
||||||
|
#include "meta-wayland-tablet-tool.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unbind_resource (struct wl_resource *resource)
|
unbind_resource (struct wl_resource *resource)
|
||||||
@ -237,3 +238,30 @@ meta_wayland_tablet_manager_ensure_seat (MetaWaylandTabletManager *manager,
|
|||||||
|
|
||||||
return tablet_seat;
|
return tablet_seat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_wayland_tablet_manager_update_cursor_position (MetaWaylandTabletManager *manager,
|
||||||
|
const ClutterEvent *event)
|
||||||
|
{
|
||||||
|
MetaWaylandTabletSeat *tablet_seat = NULL;
|
||||||
|
MetaWaylandTabletTool *tool = NULL;
|
||||||
|
ClutterInputDeviceTool *device_tool;
|
||||||
|
ClutterInputDevice *device;
|
||||||
|
|
||||||
|
device = clutter_event_get_source_device (event);
|
||||||
|
device_tool = clutter_event_get_device_tool (event);
|
||||||
|
|
||||||
|
if (device)
|
||||||
|
tablet_seat = meta_wayland_tablet_manager_lookup_seat (manager, device);
|
||||||
|
|
||||||
|
if (tablet_seat && device_tool)
|
||||||
|
tool = meta_wayland_tablet_seat_lookup_tool (tablet_seat, device_tool);
|
||||||
|
|
||||||
|
if (tool)
|
||||||
|
{
|
||||||
|
gfloat new_x, new_y;
|
||||||
|
|
||||||
|
clutter_event_get_coords (event, &new_x, &new_y);
|
||||||
|
meta_wayland_tablet_tool_set_cursor_position (tool, new_x, new_y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -51,4 +51,7 @@ MetaWaylandTabletSeat *
|
|||||||
meta_wayland_tablet_manager_ensure_seat (MetaWaylandTabletManager *manager,
|
meta_wayland_tablet_manager_ensure_seat (MetaWaylandTabletManager *manager,
|
||||||
MetaWaylandSeat *seat);
|
MetaWaylandSeat *seat);
|
||||||
|
|
||||||
|
void meta_wayland_tablet_manager_update_cursor_position (MetaWaylandTabletManager *manager,
|
||||||
|
const ClutterEvent *event);
|
||||||
|
|
||||||
#endif /* META_WAYLAND_TABLET_MANAGER_H */
|
#endif /* META_WAYLAND_TABLET_MANAGER_H */
|
||||||
|
@ -879,3 +879,12 @@ meta_wayland_tablet_tool_handle_event (MetaWaylandTabletTool *tool,
|
|||||||
|
|
||||||
return CLUTTER_EVENT_STOP;
|
return CLUTTER_EVENT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_wayland_tablet_tool_set_cursor_position (MetaWaylandTabletTool *tool,
|
||||||
|
int new_x,
|
||||||
|
int new_y)
|
||||||
|
{
|
||||||
|
if (tool->cursor_renderer)
|
||||||
|
meta_cursor_renderer_set_position (tool->cursor_renderer, new_x, new_y);
|
||||||
|
}
|
||||||
|
@ -73,4 +73,9 @@ void meta_wayland_tablet_tool_update (MetaWaylandTabletTool *t
|
|||||||
gboolean meta_wayland_tablet_tool_handle_event (MetaWaylandTabletTool *tool,
|
gboolean meta_wayland_tablet_tool_handle_event (MetaWaylandTabletTool *tool,
|
||||||
const ClutterEvent *event);
|
const ClutterEvent *event);
|
||||||
|
|
||||||
|
void meta_wayland_tablet_tool_set_cursor_position (MetaWaylandTabletTool *tool,
|
||||||
|
int new_x,
|
||||||
|
int new_y);
|
||||||
|
|
||||||
|
|
||||||
#endif /* META_WAYLAND_TABLET_TOOL_H */
|
#endif /* META_WAYLAND_TABLET_TOOL_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user