cagebreak/input_manager.h
project-repo 6dbcb7eda9 Release 2.0.0
This is a major release and includes BREAKING changes!

Breaking Changes:
  * More intuitive switch of focus, next, prev and exchange (#20, 40 in Bugs.md)
    Cagebreak will probably still feel broadly the same though.
  * Remove -r flag - This is replaced by output configuration.
  * Socket disabled by default - The socket is enabled by invoking Cagebreak with the -e flag.
  * Socket permissions restricted to the user of the Cagebreak process (700)
    This may require modification of scripts interacting with the socket with
    different UIDs than the UID of the Cagebreak process.
  * Rename "Current frame" indicator to "Current tile"

Changelog:
  * Move to wlr_scene
  * Add events displaying change over the socket
    * this enables scripting tools
  * Add support for scaling outputs (thanks to Oliver Friedmann)
  * Remove -r flag
  * Add rotation to output configuration
  * Add cursor enable|disable flag
  * Add input keyboard configuration
  * Custom path flag for configuration file
  * Restrict socket permissions to the user running cagebreak (700)
  * Fix Issue #31 (resolve some terminology) 38 in Bugs.md
  * Fix Issue #30 - 39 in Bugs.md
  * Fix Issue #20 - 40 in Bugs.md
  * Fix Issue #12 - 41 in Bugs.md (dump + events over socket)
  * Fix Bugs found via scan-build static analysis (42 - 45 in Bugs.md)
  * Fix Issue #33 - 46 in Bugs.md
  * Fix Issue #32 - 47 in Bugs.md
  * Fix Issue #16 - 48 in Bugs.md
  * Fix Issue #3 - 49 in Bugs.md (disabling keybinding interpretation for specific keyboards is now possible)
  * Fix Issue #26 - 50 in Bugs.md
  * Fix Issue #7 - 51 in Bugs.md (Change cursor to square while Cagebreak is waiting for a key)
  * Fix config bug for some commands - 52 in Bugs.md
  * Fix Issue #35 - 53 in Bugs.md (update to wlroots 0.16.1)
  * Improve FAQ.md (related to some Issues)
  * Disable outputs when unable to set any mode (crashed previously)
  * Add Code of Conduct
  * Print version number on startup
2023-01-08 22:09:15 +01:00

127 lines
2.7 KiB
C

// Copyright 2020 - 2023, project-repo and the cagebreak contributors
// SPDX -License-Identifier: MIT
#ifndef CG_INPUT_MANAGER_H
#define CG_INPUT_MANAGER_H
#include "seat.h"
#include "server.h"
#include <wayland-server-core.h>
#include <wlr/util/box.h>
struct cg_input_manager *
input_manager_create(struct cg_server *server);
void
input_manager_handle_device_destroy(struct wl_listener *listener, void *data);
uint32_t
input_manager_get_mouse_button(const char *name, char **error);
struct cg_input_config *
input_manager_create_empty_input_config();
struct cg_input_config *
input_manager_merge_input_configs(struct cg_input_config *cfg1,
struct cg_input_config *cfg2);
void
cg_input_manager_configure(struct cg_server *server);
void
cg_input_manager_configure_keyboard_group(struct cg_keyboard_group *group);
struct cg_input_manager {
struct wl_list devices;
struct cg_server *server;
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
struct wl_listener new_input;
struct wl_listener virtual_keyboard_new;
struct wl_listener virtual_pointer_new;
};
struct cg_input_config_mapped_from_region {
double x1, y1;
double x2, y2;
bool mm;
};
struct calibration_matrix {
bool configured;
float matrix[6];
};
enum cg_input_config_mapped_to {
MAPPED_TO_DEFAULT,
MAPPED_TO_OUTPUT,
MAPPED_TO_REGION,
};
/**
* options for input devices
*/
struct cg_input_config {
char *identifier;
/* Libinput devices */
int accel_profile;
struct calibration_matrix calibration_matrix;
int click_method;
int drag;
int drag_lock;
int dwt;
int left_handed;
int middle_emulation;
int natural_scroll;
float pointer_accel;
float scroll_factor;
/*int repeat_delay;
int repeat_rate;*/
int scroll_button;
int scroll_method;
int send_events;
int tap;
int tap_button_map;
/*char *xkb_layout;
char *xkb_model;
char *xkb_options;
char *xkb_rules;
char *xkb_variant;
char *xkb_file;
bool xkb_file_is_set;
int xkb_numlock;
int xkb_capslock;*/
struct wl_list link;
struct cg_input_config_mapped_from_region *mapped_from_region;
enum cg_input_config_mapped_to mapped_to;
char *mapped_to_output;
/*struct wlr_box *mapped_to_region;*/
/*struct wl_list tools;*/
bool capturable;
struct wlr_box region;
/* Keyboards */
int enable_keybindings;
int repeat_delay;
int repeat_rate;
};
struct cg_input_device {
char *identifier;
struct cg_server *server;
struct wlr_input_device *wlr_device;
struct wl_list link; // input_manager::devices
struct wl_listener device_destroy;
bool is_virtual;
/* Only one of the following is non-NULL depending on the type of the input
* device */
struct cg_pointer *pointer;
struct cg_touch *touch;
};
#endif