2019-03-07 18:25:38 +00:00
|
|
|
/* Copyright (c), Charlotte Meyer <dev@buffet.sh>
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KIWMI_INPUT_CURSOR_H
|
|
|
|
#define KIWMI_INPUT_CURSOR_H
|
|
|
|
|
2019-03-21 21:12:54 +00:00
|
|
|
#include <wayland-server.h>
|
2019-03-07 18:25:38 +00:00
|
|
|
#include <wlr/types/wlr_output_layout.h>
|
|
|
|
|
2020-01-17 19:51:56 +00:00
|
|
|
#include "desktop/view.h"
|
|
|
|
|
|
|
|
enum kiwmi_cursor_mode {
|
|
|
|
KIWMI_CURSOR_PASSTHROUGH,
|
|
|
|
KIWMI_CURSOR_MOVE,
|
|
|
|
KIWMI_CURSOR_RESIZE,
|
|
|
|
};
|
|
|
|
|
2019-03-07 18:25:38 +00:00
|
|
|
struct kiwmi_cursor {
|
2019-12-26 20:55:10 +00:00
|
|
|
struct kiwmi_server *server;
|
2019-03-07 18:25:38 +00:00
|
|
|
struct wlr_cursor *cursor;
|
|
|
|
struct wlr_xcursor_manager *xcursor_manager;
|
2020-01-07 14:48:55 +00:00
|
|
|
|
2020-01-17 19:51:56 +00:00
|
|
|
enum kiwmi_cursor_mode cursor_mode;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
struct kiwmi_view *view;
|
|
|
|
int orig_x;
|
|
|
|
int orig_y;
|
|
|
|
struct wlr_box orig_geom;
|
|
|
|
uint32_t resize_edges;
|
|
|
|
} grabbed;
|
|
|
|
|
2019-03-07 18:25:38 +00:00
|
|
|
struct wl_listener cursor_motion;
|
|
|
|
struct wl_listener cursor_motion_absolute;
|
2019-12-26 20:55:10 +00:00
|
|
|
struct wl_listener cursor_button;
|
2019-12-29 11:10:51 +00:00
|
|
|
struct wl_listener cursor_axis;
|
|
|
|
struct wl_listener cursor_frame;
|
2020-01-07 14:48:55 +00:00
|
|
|
|
|
|
|
struct {
|
|
|
|
struct wl_signal button_down;
|
|
|
|
struct wl_signal button_up;
|
|
|
|
struct wl_signal motion;
|
2021-08-14 18:39:04 +00:00
|
|
|
struct wl_signal scroll;
|
2020-01-07 14:48:55 +00:00
|
|
|
} events;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct kiwmi_cursor_button_event {
|
|
|
|
struct wlr_event_pointer_button *wlr_event;
|
|
|
|
bool handled;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct kiwmi_cursor_motion_event {
|
|
|
|
double oldx;
|
|
|
|
double oldy;
|
|
|
|
double newx;
|
|
|
|
double newy;
|
2019-03-07 18:25:38 +00:00
|
|
|
};
|
|
|
|
|
2021-08-14 18:39:04 +00:00
|
|
|
struct kiwmi_cursor_scroll_event {
|
|
|
|
const char *device_name;
|
|
|
|
bool is_vertical;
|
|
|
|
double length;
|
|
|
|
bool handled;
|
|
|
|
};
|
|
|
|
|
2021-09-05 09:20:52 +00:00
|
|
|
void cursor_refresh_focus(
|
|
|
|
struct kiwmi_cursor *cursor,
|
|
|
|
struct wlr_surface **new_surface,
|
|
|
|
double *cursor_sx,
|
|
|
|
double *cursor_sy);
|
|
|
|
|
2019-12-26 20:55:10 +00:00
|
|
|
struct kiwmi_cursor *cursor_create(
|
|
|
|
struct kiwmi_server *server,
|
|
|
|
struct wlr_output_layout *output_layout);
|
2020-01-15 20:52:26 +00:00
|
|
|
void cursor_destroy(struct kiwmi_cursor *cursor);
|
2019-03-07 18:25:38 +00:00
|
|
|
|
|
|
|
#endif /* KIWMI_INPUT_CURSOR_H */
|