Implement hide_cursor <timeout> command

Allows the cursor to be hidden after a specified timeout in
milliseconds
This commit is contained in:
Brian Ashworth 2018-12-17 15:37:15 -05:00 committed by emersion
parent a223030b70
commit 5fca74a1f1
9 changed files with 91 additions and 7 deletions

View file

@ -133,6 +133,7 @@ sway_cmd cmd_force_display_urgency_hint;
sway_cmd cmd_force_focus_wrapping;
sway_cmd cmd_fullscreen;
sway_cmd cmd_gaps;
sway_cmd cmd_hide_cursor;
sway_cmd cmd_hide_edge_borders;
sway_cmd cmd_include;
sway_cmd cmd_input;

View file

@ -436,6 +436,8 @@ struct sway_config {
enum edge_border_types hide_edge_borders;
enum edge_border_types saved_edge_borders;
int hide_cursor_timeout;
// border colors
struct {
struct border_colors focused;

View file

@ -1,6 +1,8 @@
#ifndef _SWAY_INPUT_CURSOR_H
#define _SWAY_INPUT_CURSOR_H
#include <stdbool.h>
#include <stdint.h>
#include <wlr/types/wlr_surface.h>
#include "sway/input/seat.h"
#define SWAY_CURSOR_PRESSED_BUTTONS_CAP 32
@ -21,6 +23,8 @@ struct sway_cursor {
const char *image;
struct wl_client *image_client;
struct wlr_surface *image_surface;
int hotspot_x, hotspot_y;
struct wl_listener motion;
struct wl_listener motion_absolute;
@ -38,6 +42,9 @@ struct sway_cursor {
struct wl_listener request_set_cursor;
struct wl_event_source *hide_source;
bool hidden;
// Mouse binding state
uint32_t pressed_buttons[SWAY_CURSOR_PRESSED_BUTTONS_CAP];
size_t pressed_button_count;