1
0
mirror of https://codeberg.org/vyivel/dulcepan/ synced 2025-12-23 02:06:48 +02:00

Rework mouse controls

This commit is contained in:
Kirill Primak
2024-06-21 14:55:30 +03:00
parent 164594603e
commit 8e8cdf1f32
3 changed files with 266 additions and 48 deletions

View File

@@ -86,13 +86,32 @@ struct dp_seat {
struct wl_list link;
};
enum dp_selection_action {
DP_SELECTION_ACTION_NONE,
DP_SELECTION_ACTION_RESIZING,
DP_SELECTION_ACTION_MOVING,
};
enum dp_resize_edges {
DP_EDGE_NONE = 0,
DP_EDGE_TOP = 1 << 0,
DP_EDGE_BOTTOM = 1 << 1,
DP_EDGE_LEFT = 1 << 2,
DP_EDGE_RIGHT = 1 << 3,
};
struct dp_selection {
struct dp_output *output; // May be NULL
int x, y, width, height;
struct dp_output *interactive_output; // NULL if not interactively selecting
int interactive_x, interactive_y;
bool interactive_moved;
enum dp_selection_action action;
bool action_active;
// Pointer offset to apply during movement
int ptr_off_x, ptr_off_y;
int resize_edges;
// Resize anchor
int resize_x, resize_y;
};
enum dp_file_format {
@@ -161,10 +180,13 @@ void dp_output_hide_surface(struct dp_output *output);
void dp_seat_create(struct dp_state *state, uint32_t name, struct wl_seat *wl_seat);
void dp_seat_destroy(struct dp_seat *seat);
void dp_select_interactive_start(
void dp_select_start_interactive(struct dp_selection *selection, struct dp_output *output, int x,
int y, bool modify_existing);
void dp_select_stop_interactive(struct dp_selection *selection);
void dp_select_notify_pointer_position(
struct dp_selection *selection, struct dp_output *output, int x, int y);
void dp_select_interactive_move(struct dp_selection *selection, int x, int y);
void dp_select_interactive_stop(struct dp_selection *selection);
void dp_select_whole(struct dp_selection *selection, struct dp_output *output);
void dp_save(struct dp_state *state);