2013-05-03 18:51:22 +01:00
|
|
|
/*
|
|
|
|
* Wayland Support
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 Intel Corporation
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2014-04-22 18:09:38 -04:00
|
|
|
#ifndef META_WAYLAND_POINTER_H
|
|
|
|
#define META_WAYLAND_POINTER_H
|
2013-05-03 18:51:22 +01:00
|
|
|
|
2013-08-30 18:03:30 +02:00
|
|
|
#include <glib.h>
|
2018-07-10 10:36:24 +02:00
|
|
|
#include <wayland-server.h>
|
2013-08-30 18:03:30 +02:00
|
|
|
|
2018-07-10 10:36:24 +02:00
|
|
|
#include "meta/meta-cursor-tracker.h"
|
|
|
|
#include "wayland/meta-wayland-pointer-constraints.h"
|
2021-04-18 20:24:52 +02:00
|
|
|
#include "wayland/meta-wayland-pointer-gesture-hold.h"
|
2018-07-10 10:36:24 +02:00
|
|
|
#include "wayland/meta-wayland-pointer-gesture-pinch.h"
|
|
|
|
#include "wayland/meta-wayland-pointer-gesture-swipe.h"
|
|
|
|
#include "wayland/meta-wayland-seat.h"
|
|
|
|
#include "wayland/meta-wayland-surface.h"
|
|
|
|
#include "wayland/meta-wayland-types.h"
|
2014-04-17 16:54:30 -04:00
|
|
|
|
2016-04-01 16:39:30 +08:00
|
|
|
#define META_TYPE_WAYLAND_POINTER (meta_wayland_pointer_get_type ())
|
|
|
|
G_DECLARE_FINAL_TYPE (MetaWaylandPointer, meta_wayland_pointer,
|
2016-09-12 23:17:28 +08:00
|
|
|
META, WAYLAND_POINTER,
|
|
|
|
MetaWaylandInputDevice)
|
2016-04-01 16:39:30 +08:00
|
|
|
|
2013-08-30 18:03:30 +02:00
|
|
|
struct _MetaWaylandPointerGrabInterface
|
|
|
|
{
|
2013-09-11 14:06:05 +02:00
|
|
|
void (*focus) (MetaWaylandPointerGrab *grab,
|
2014-03-16 16:50:38 +01:00
|
|
|
MetaWaylandSurface *surface);
|
2013-09-11 14:06:05 +02:00
|
|
|
void (*motion) (MetaWaylandPointerGrab *grab,
|
|
|
|
const ClutterEvent *event);
|
|
|
|
void (*button) (MetaWaylandPointerGrab *grab,
|
|
|
|
const ClutterEvent *event);
|
2016-09-21 14:33:47 +08:00
|
|
|
void (*cancel) (MetaWaylandPointerGrab *grab);
|
2013-08-30 18:03:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _MetaWaylandPointerGrab
|
|
|
|
{
|
|
|
|
const MetaWaylandPointerGrabInterface *interface;
|
|
|
|
MetaWaylandPointer *pointer;
|
|
|
|
};
|
|
|
|
|
2015-08-09 21:24:16 +08:00
|
|
|
struct _MetaWaylandPointerClient
|
|
|
|
{
|
|
|
|
struct wl_list pointer_resources;
|
2015-07-22 16:43:25 +02:00
|
|
|
struct wl_list swipe_gesture_resources;
|
2015-07-22 16:46:55 +02:00
|
|
|
struct wl_list pinch_gesture_resources;
|
2021-04-18 20:24:52 +02:00
|
|
|
struct wl_list hold_gesture_resources;
|
2015-06-02 16:26:34 +08:00
|
|
|
struct wl_list relative_pointer_resources;
|
2015-08-09 21:24:16 +08:00
|
|
|
};
|
|
|
|
|
2013-08-30 18:03:30 +02:00
|
|
|
struct _MetaWaylandPointer
|
|
|
|
{
|
2016-09-12 23:17:28 +08:00
|
|
|
MetaWaylandInputDevice parent;
|
2016-04-01 16:39:30 +08:00
|
|
|
|
2015-08-09 21:24:16 +08:00
|
|
|
MetaWaylandPointerClient *focus_client;
|
|
|
|
GHashTable *pointer_clients;
|
2014-02-18 18:00:26 -05:00
|
|
|
|
|
|
|
MetaWaylandSurface *focus_surface;
|
2017-05-31 17:24:07 +08:00
|
|
|
gulong focus_surface_destroyed_handler_id;
|
2021-09-03 23:49:46 +02:00
|
|
|
gulong focus_surface_alive_notify_id;
|
2013-08-30 18:03:30 +02:00
|
|
|
guint32 focus_serial;
|
2013-09-10 15:53:31 +02:00
|
|
|
guint32 click_serial;
|
2013-08-30 18:03:30 +02:00
|
|
|
|
2014-04-18 10:15:40 -04:00
|
|
|
MetaWaylandSurface *cursor_surface;
|
2019-11-16 01:25:52 +01:00
|
|
|
gulong cursor_surface_destroy_id;
|
2014-04-18 10:15:40 -04:00
|
|
|
|
2013-08-30 18:03:30 +02:00
|
|
|
MetaWaylandPointerGrab *grab;
|
|
|
|
MetaWaylandPointerGrab default_grab;
|
|
|
|
guint32 grab_button;
|
|
|
|
guint32 grab_serial;
|
|
|
|
guint32 grab_time;
|
2014-04-18 10:27:48 -04:00
|
|
|
float grab_x, grab_y;
|
2013-08-30 18:03:30 +02:00
|
|
|
|
2014-04-18 10:27:48 -04:00
|
|
|
ClutterInputDevice *device;
|
2013-08-30 18:03:30 +02:00
|
|
|
MetaWaylandSurface *current;
|
2017-05-31 17:27:52 +08:00
|
|
|
gulong current_surface_destroyed_handler_id;
|
2013-08-30 18:03:30 +02:00
|
|
|
|
|
|
|
guint32 button_count;
|
|
|
|
};
|
2013-05-03 18:51:22 +01:00
|
|
|
|
2016-09-12 23:20:36 +08:00
|
|
|
void meta_wayland_pointer_enable (MetaWaylandPointer *pointer);
|
2013-05-03 18:51:22 +01:00
|
|
|
|
2016-04-01 16:39:30 +08:00
|
|
|
void meta_wayland_pointer_disable (MetaWaylandPointer *pointer);
|
2013-05-03 18:51:22 +01:00
|
|
|
|
2014-04-22 18:09:38 -04:00
|
|
|
void meta_wayland_pointer_update (MetaWaylandPointer *pointer,
|
|
|
|
const ClutterEvent *event);
|
2014-04-17 17:52:11 -04:00
|
|
|
|
2014-04-22 18:09:38 -04:00
|
|
|
gboolean meta_wayland_pointer_handle_event (MetaWaylandPointer *pointer,
|
|
|
|
const ClutterEvent *event);
|
2014-04-17 18:16:49 -04:00
|
|
|
|
2015-02-11 17:34:15 +08:00
|
|
|
void meta_wayland_pointer_send_motion (MetaWaylandPointer *pointer,
|
|
|
|
const ClutterEvent *event);
|
|
|
|
|
2015-06-17 12:10:52 +08:00
|
|
|
void meta_wayland_pointer_send_relative_motion (MetaWaylandPointer *pointer,
|
|
|
|
const ClutterEvent *event);
|
|
|
|
|
2015-02-11 17:34:15 +08:00
|
|
|
void meta_wayland_pointer_send_button (MetaWaylandPointer *pointer,
|
|
|
|
const ClutterEvent *event);
|
|
|
|
|
2016-09-06 12:45:01 +08:00
|
|
|
void meta_wayland_pointer_broadcast_frame (MetaWaylandPointer *pointer);
|
|
|
|
|
2014-04-22 18:09:38 -04:00
|
|
|
void meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
|
|
|
|
MetaWaylandSurface *surface);
|
2013-08-28 16:23:34 +02:00
|
|
|
|
2014-04-22 18:09:38 -04:00
|
|
|
void meta_wayland_pointer_start_grab (MetaWaylandPointer *pointer,
|
|
|
|
MetaWaylandPointerGrab *grab);
|
2013-05-03 18:51:22 +01:00
|
|
|
|
2014-04-22 18:09:38 -04:00
|
|
|
void meta_wayland_pointer_end_grab (MetaWaylandPointer *pointer);
|
2013-05-03 18:51:22 +01:00
|
|
|
|
2016-01-21 17:01:08 +08:00
|
|
|
MetaWaylandPopup *meta_wayland_pointer_start_popup_grab (MetaWaylandPointer *pointer,
|
|
|
|
MetaWaylandPopupSurface *popup_surface);
|
2013-09-10 15:53:31 +02:00
|
|
|
|
2015-02-11 17:34:15 +08:00
|
|
|
void meta_wayland_pointer_end_popup_grab (MetaWaylandPointer *pointer);
|
|
|
|
|
2014-04-22 18:09:38 -04:00
|
|
|
void meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
|
|
|
|
MetaWaylandSurface *surface,
|
|
|
|
wl_fixed_t *x,
|
|
|
|
wl_fixed_t *y);
|
2013-09-11 14:06:05 +02:00
|
|
|
|
2014-04-22 18:09:38 -04:00
|
|
|
void meta_wayland_pointer_create_new_resource (MetaWaylandPointer *pointer,
|
|
|
|
struct wl_client *client,
|
|
|
|
struct wl_resource *seat_resource,
|
|
|
|
uint32_t id);
|
2014-04-17 17:00:59 -04:00
|
|
|
|
2014-05-22 10:57:02 -04:00
|
|
|
gboolean meta_wayland_pointer_can_grab_surface (MetaWaylandPointer *pointer,
|
|
|
|
MetaWaylandSurface *surface,
|
|
|
|
uint32_t serial);
|
|
|
|
|
2015-02-10 21:11:17 +08:00
|
|
|
gboolean meta_wayland_pointer_can_popup (MetaWaylandPointer *pointer,
|
|
|
|
uint32_t serial);
|
|
|
|
|
2015-02-12 11:20:52 +08:00
|
|
|
MetaWaylandSurface *meta_wayland_pointer_get_top_popup (MetaWaylandPointer *pointer);
|
|
|
|
|
2015-08-09 21:24:16 +08:00
|
|
|
MetaWaylandPointerClient * meta_wayland_pointer_get_pointer_client (MetaWaylandPointer *pointer,
|
|
|
|
struct wl_client *client);
|
|
|
|
void meta_wayland_pointer_unbind_pointer_client_resource (struct wl_resource *resource);
|
|
|
|
|
2015-06-02 16:26:34 +08:00
|
|
|
void meta_wayland_relative_pointer_init (MetaWaylandCompositor *compositor);
|
|
|
|
|
2015-06-17 12:10:52 +08:00
|
|
|
MetaWaylandSeat *meta_wayland_pointer_get_seat (MetaWaylandPointer *pointer);
|
|
|
|
|
2015-10-21 16:36:44 +02:00
|
|
|
void meta_wayland_surface_cursor_update (MetaWaylandSurface *cursor_surface);
|
|
|
|
|
|
|
|
void meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer);
|
|
|
|
|
2014-04-22 18:09:38 -04:00
|
|
|
#endif /* META_WAYLAND_POINTER_H */
|