2019-10-27 13:06:39 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
2019-10-27 18:46:36 +01:00
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
2019-10-27 15:57:23 +01:00
|
|
|
#include <wayland-client.h>
|
2019-10-27 17:07:44 +01:00
|
|
|
#include <xkbcommon/xkbcommon.h>
|
2019-10-27 15:57:23 +01:00
|
|
|
|
2019-12-31 15:39:40 +01:00
|
|
|
#include <primary-selection-unstable-v1.h>
|
|
|
|
|
#include <presentation-time.h>
|
|
|
|
|
|
2019-12-01 13:43:51 +01:00
|
|
|
#include <tllist.h>
|
|
|
|
|
|
2019-10-27 19:08:48 +01:00
|
|
|
#include "fdm.h"
|
2019-10-27 13:06:39 +01:00
|
|
|
|
2020-12-02 18:52:50 +01:00
|
|
|
/* Forward declarations */
|
|
|
|
|
struct terminal;
|
|
|
|
|
|
2020-03-18 15:30:14 +01:00
|
|
|
enum bind_action_normal {
|
2020-03-12 10:46:27 +01:00
|
|
|
BIND_ACTION_NONE,
|
2020-09-10 18:17:47 +02:00
|
|
|
BIND_ACTION_SCROLLBACK_UP_PAGE,
|
|
|
|
|
BIND_ACTION_SCROLLBACK_UP_HALF_PAGE,
|
|
|
|
|
BIND_ACTION_SCROLLBACK_UP_LINE,
|
|
|
|
|
BIND_ACTION_SCROLLBACK_DOWN_PAGE,
|
|
|
|
|
BIND_ACTION_SCROLLBACK_DOWN_HALF_PAGE,
|
|
|
|
|
BIND_ACTION_SCROLLBACK_DOWN_LINE,
|
2020-03-08 12:08:46 +01:00
|
|
|
BIND_ACTION_CLIPBOARD_COPY,
|
|
|
|
|
BIND_ACTION_CLIPBOARD_PASTE,
|
|
|
|
|
BIND_ACTION_PRIMARY_PASTE,
|
|
|
|
|
BIND_ACTION_SEARCH_START,
|
2020-03-08 15:17:29 +01:00
|
|
|
BIND_ACTION_FONT_SIZE_UP,
|
|
|
|
|
BIND_ACTION_FONT_SIZE_DOWN,
|
|
|
|
|
BIND_ACTION_FONT_SIZE_RESET,
|
|
|
|
|
BIND_ACTION_SPAWN_TERMINAL,
|
2020-03-12 09:34:09 +01:00
|
|
|
BIND_ACTION_MINIMIZE,
|
|
|
|
|
BIND_ACTION_MAXIMIZE,
|
|
|
|
|
BIND_ACTION_FULLSCREEN,
|
2020-07-15 09:46:13 +02:00
|
|
|
BIND_ACTION_PIPE_SCROLLBACK,
|
|
|
|
|
BIND_ACTION_PIPE_VIEW,
|
2020-07-31 17:02:53 +02:00
|
|
|
BIND_ACTION_PIPE_SELECTED,
|
2021-02-04 20:55:08 +01:00
|
|
|
BIND_ACTION_SHOW_URLS_COPY,
|
2021-02-04 20:39:13 +01:00
|
|
|
BIND_ACTION_SHOW_URLS_LAUNCH,
|
2020-08-11 09:55:33 +02:00
|
|
|
|
|
|
|
|
/* Mouse specific actions - i.e. they require a mouse coordinate */
|
|
|
|
|
BIND_ACTION_SELECT_BEGIN,
|
2020-08-11 10:17:19 +02:00
|
|
|
BIND_ACTION_SELECT_BEGIN_BLOCK,
|
|
|
|
|
BIND_ACTION_SELECT_EXTEND,
|
2021-01-06 11:11:46 +01:00
|
|
|
BIND_ACTION_SELECT_EXTEND_CHAR_WISE,
|
2020-08-11 09:55:33 +02:00
|
|
|
BIND_ACTION_SELECT_WORD,
|
|
|
|
|
BIND_ACTION_SELECT_WORD_WS,
|
2020-08-11 10:17:19 +02:00
|
|
|
BIND_ACTION_SELECT_ROW,
|
2020-08-11 09:55:33 +02:00
|
|
|
|
2021-02-04 20:39:13 +01:00
|
|
|
BIND_ACTION_KEY_COUNT = BIND_ACTION_SHOW_URLS_LAUNCH + 1,
|
2020-09-08 19:08:26 +02:00
|
|
|
BIND_ACTION_COUNT = BIND_ACTION_SELECT_ROW + 1,
|
2020-03-08 12:08:46 +01:00
|
|
|
};
|
|
|
|
|
|
2020-03-18 15:30:14 +01:00
|
|
|
enum bind_action_search {
|
|
|
|
|
BIND_ACTION_SEARCH_NONE,
|
|
|
|
|
BIND_ACTION_SEARCH_CANCEL,
|
|
|
|
|
BIND_ACTION_SEARCH_COMMIT,
|
|
|
|
|
BIND_ACTION_SEARCH_FIND_PREV,
|
|
|
|
|
BIND_ACTION_SEARCH_FIND_NEXT,
|
|
|
|
|
BIND_ACTION_SEARCH_EDIT_LEFT,
|
|
|
|
|
BIND_ACTION_SEARCH_EDIT_LEFT_WORD,
|
|
|
|
|
BIND_ACTION_SEARCH_EDIT_RIGHT,
|
|
|
|
|
BIND_ACTION_SEARCH_EDIT_RIGHT_WORD,
|
|
|
|
|
BIND_ACTION_SEARCH_EDIT_HOME,
|
|
|
|
|
BIND_ACTION_SEARCH_EDIT_END,
|
|
|
|
|
BIND_ACTION_SEARCH_DELETE_PREV,
|
|
|
|
|
BIND_ACTION_SEARCH_DELETE_PREV_WORD,
|
|
|
|
|
BIND_ACTION_SEARCH_DELETE_NEXT,
|
|
|
|
|
BIND_ACTION_SEARCH_DELETE_NEXT_WORD,
|
|
|
|
|
BIND_ACTION_SEARCH_EXTEND_WORD,
|
|
|
|
|
BIND_ACTION_SEARCH_EXTEND_WORD_WS,
|
2020-11-01 12:39:57 +01:00
|
|
|
BIND_ACTION_SEARCH_CLIPBOARD_PASTE,
|
|
|
|
|
BIND_ACTION_SEARCH_PRIMARY_PASTE,
|
2020-03-18 15:30:14 +01:00
|
|
|
BIND_ACTION_SEARCH_COUNT,
|
|
|
|
|
};
|
|
|
|
|
|
2021-01-30 12:43:59 +01:00
|
|
|
enum bind_action_url {
|
|
|
|
|
BIND_ACTION_URL_NONE,
|
|
|
|
|
BIND_ACTION_URL_CANCEL,
|
2021-02-14 14:18:11 +01:00
|
|
|
BIND_ACTION_URL_TOGGLE_URL_ON_JUMP_LABEL,
|
2021-01-30 12:43:59 +01:00
|
|
|
BIND_ACTION_URL_COUNT,
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-07 14:46:29 +01:00
|
|
|
typedef tll(xkb_keycode_t) xkb_keycode_list_t;
|
|
|
|
|
|
|
|
|
|
struct key_binding {
|
|
|
|
|
xkb_mod_mask_t mods;
|
|
|
|
|
xkb_keysym_t sym;
|
|
|
|
|
xkb_keycode_list_t key_codes;
|
|
|
|
|
|
|
|
|
|
int action; /* enum bind_action_* */
|
|
|
|
|
char **pipe_argv;
|
2021-01-30 12:43:59 +01:00
|
|
|
};
|
2021-02-07 14:46:29 +01:00
|
|
|
typedef tll(struct key_binding) key_binding_list_t;
|
|
|
|
|
|
|
|
|
|
struct mouse_binding {
|
|
|
|
|
enum bind_action_normal action;
|
|
|
|
|
xkb_mod_mask_t mods;
|
|
|
|
|
uint32_t button;
|
|
|
|
|
int count;
|
|
|
|
|
char **pipe_argv;
|
|
|
|
|
};
|
|
|
|
|
typedef tll(struct mouse_binding) mouse_binding_list_t;
|
2021-01-30 12:43:59 +01:00
|
|
|
|
2020-10-28 19:16:04 +01:00
|
|
|
/* Mime-types we support when dealing with data offers (e.g. copy-paste, or DnD) */
|
|
|
|
|
enum data_offer_mime_type {
|
|
|
|
|
DATA_OFFER_MIME_UNSET,
|
|
|
|
|
DATA_OFFER_MIME_TEXT_PLAIN,
|
|
|
|
|
DATA_OFFER_MIME_TEXT_UTF8,
|
|
|
|
|
DATA_OFFER_MIME_URI_LIST,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct wl_window;
|
2019-10-27 16:15:32 +01:00
|
|
|
struct wl_clipboard {
|
2020-10-28 19:16:04 +01:00
|
|
|
struct wl_window *window; /* For DnD */
|
2019-10-27 16:15:32 +01:00
|
|
|
struct wl_data_source *data_source;
|
|
|
|
|
struct wl_data_offer *data_offer;
|
2020-10-28 19:16:04 +01:00
|
|
|
enum data_offer_mime_type mime_type;
|
2019-10-27 16:15:32 +01:00
|
|
|
char *text;
|
|
|
|
|
uint32_t serial;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct wl_primary {
|
|
|
|
|
struct zwp_primary_selection_source_v1 *data_source;
|
|
|
|
|
struct zwp_primary_selection_offer_v1 *data_offer;
|
2020-10-28 19:16:04 +01:00
|
|
|
enum data_offer_mime_type mime_type;
|
2019-10-27 16:15:32 +01:00
|
|
|
char *text;
|
|
|
|
|
uint32_t serial;
|
|
|
|
|
};
|
|
|
|
|
|
2020-12-12 19:05:24 +01:00
|
|
|
/* Maps a mouse button to its "owning" surface */
|
|
|
|
|
struct button_tracker {
|
|
|
|
|
int button;
|
|
|
|
|
int surf_kind; /* TODO: this is really an "enum term_surface" */
|
|
|
|
|
bool send_to_client; /* Only valid when surface is the main grid surface */
|
|
|
|
|
};
|
|
|
|
|
|
2020-12-20 15:01:21 -07:00
|
|
|
struct rect {
|
|
|
|
|
int x;
|
|
|
|
|
int y;
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-08 16:45:26 +02:00
|
|
|
struct seat {
|
|
|
|
|
struct wayland *wayl;
|
|
|
|
|
struct wl_seat *wl_seat;
|
|
|
|
|
uint32_t wl_name;
|
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
|
|
/* Focused terminals */
|
|
|
|
|
struct terminal *kbd_focus;
|
|
|
|
|
struct terminal *mouse_focus;
|
|
|
|
|
|
|
|
|
|
/* Keyboard state */
|
|
|
|
|
struct wl_keyboard *wl_keyboard;
|
|
|
|
|
struct {
|
2020-07-09 11:20:46 +02:00
|
|
|
uint32_t serial;
|
|
|
|
|
|
2020-07-08 16:45:26 +02:00
|
|
|
struct xkb_context *xkb;
|
|
|
|
|
struct xkb_keymap *xkb_keymap;
|
|
|
|
|
struct xkb_state *xkb_state;
|
|
|
|
|
struct xkb_compose_table *xkb_compose_table;
|
|
|
|
|
struct xkb_compose_state *xkb_compose_state;
|
|
|
|
|
struct {
|
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
|
|
bool dont_re_repeat;
|
|
|
|
|
int32_t delay;
|
|
|
|
|
int32_t rate;
|
|
|
|
|
uint32_t key;
|
|
|
|
|
} repeat;
|
|
|
|
|
|
|
|
|
|
xkb_mod_index_t mod_shift;
|
|
|
|
|
xkb_mod_index_t mod_alt;
|
|
|
|
|
xkb_mod_index_t mod_ctrl;
|
|
|
|
|
xkb_mod_index_t mod_meta;
|
|
|
|
|
|
2020-09-15 18:44:54 +02:00
|
|
|
xkb_keycode_t key_arrow_up;
|
|
|
|
|
xkb_keycode_t key_arrow_down;
|
|
|
|
|
|
2020-07-08 16:45:26 +02:00
|
|
|
/* Enabled modifiers */
|
|
|
|
|
bool shift;
|
|
|
|
|
bool alt;
|
|
|
|
|
bool ctrl;
|
|
|
|
|
bool meta;
|
|
|
|
|
|
|
|
|
|
struct {
|
2021-02-07 14:46:29 +01:00
|
|
|
key_binding_list_t key;
|
|
|
|
|
key_binding_list_t search;
|
|
|
|
|
key_binding_list_t url;
|
2020-07-08 16:45:26 +02:00
|
|
|
} bindings;
|
|
|
|
|
} kbd;
|
|
|
|
|
|
|
|
|
|
/* Pointer state */
|
|
|
|
|
struct wl_pointer *wl_pointer;
|
|
|
|
|
struct {
|
|
|
|
|
uint32_t serial;
|
|
|
|
|
|
|
|
|
|
struct wl_surface *surface;
|
|
|
|
|
struct wl_cursor_theme *theme;
|
|
|
|
|
struct wl_cursor *cursor;
|
2020-07-08 19:52:17 +02:00
|
|
|
int scale;
|
2020-07-31 17:09:06 +02:00
|
|
|
bool hidden;
|
2020-07-08 16:45:26 +02:00
|
|
|
|
2020-07-09 09:52:11 +02:00
|
|
|
const char *xcursor;
|
2020-07-08 16:45:26 +02:00
|
|
|
struct wl_callback *xcursor_callback;
|
2020-07-09 09:52:11 +02:00
|
|
|
bool xcursor_pending;
|
2020-07-08 16:45:26 +02:00
|
|
|
} pointer;
|
|
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
int x;
|
|
|
|
|
int y;
|
|
|
|
|
int col;
|
|
|
|
|
int row;
|
|
|
|
|
|
2020-12-12 19:05:24 +01:00
|
|
|
/* Mouse buttons currently being pressed, and their "owning" surfaces */
|
|
|
|
|
tll(struct button_tracker) buttons;
|
|
|
|
|
|
|
|
|
|
/* Double- and triple click state */
|
2020-07-08 16:45:26 +02:00
|
|
|
int count;
|
2020-12-12 19:05:24 +01:00
|
|
|
int last_released_button;
|
2020-07-08 16:45:26 +02:00
|
|
|
struct timeval last_time;
|
|
|
|
|
|
|
|
|
|
/* We used a discrete axis event in the current pointer frame */
|
|
|
|
|
double axis_aggregated;
|
|
|
|
|
bool have_discrete;
|
2020-08-09 22:40:53 +02:00
|
|
|
|
|
|
|
|
mouse_binding_list_t bindings;
|
2020-07-08 16:45:26 +02:00
|
|
|
} mouse;
|
|
|
|
|
|
|
|
|
|
/* Clipboard */
|
|
|
|
|
struct wl_data_device *data_device;
|
|
|
|
|
struct zwp_primary_selection_device_v1 *primary_selection_device;
|
|
|
|
|
|
|
|
|
|
struct wl_clipboard clipboard;
|
|
|
|
|
struct wl_primary primary;
|
2020-10-10 22:14:35 +02:00
|
|
|
|
2020-12-03 18:36:56 +01:00
|
|
|
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
2020-10-10 22:14:35 +02:00
|
|
|
/* Input Method Editor */
|
|
|
|
|
struct zwp_text_input_v3 *wl_text_input;
|
2020-12-01 19:31:49 +01:00
|
|
|
struct {
|
2020-12-20 15:01:21 -07:00
|
|
|
struct {
|
|
|
|
|
struct rect pending;
|
|
|
|
|
struct rect sent;
|
|
|
|
|
} cursor_rect;
|
|
|
|
|
|
2020-12-01 19:31:49 +01:00
|
|
|
struct {
|
2020-12-02 18:52:50 +01:00
|
|
|
struct {
|
|
|
|
|
char *text;
|
|
|
|
|
int32_t cursor_begin;
|
|
|
|
|
int32_t cursor_end;
|
|
|
|
|
} pending;
|
2021-03-23 13:03:07 +01:00
|
|
|
|
|
|
|
|
wchar_t *text;
|
|
|
|
|
struct cell *cells;
|
|
|
|
|
int count;
|
|
|
|
|
struct {
|
|
|
|
|
bool hidden;
|
|
|
|
|
int start; /* Cell index, inclusive */
|
|
|
|
|
int end; /* Cell index, exclusive */
|
|
|
|
|
} cursor;
|
2020-12-01 19:31:49 +01:00
|
|
|
} preedit;
|
|
|
|
|
|
|
|
|
|
struct {
|
2020-12-02 18:52:50 +01:00
|
|
|
struct {
|
|
|
|
|
char *text;
|
|
|
|
|
} pending;
|
2020-12-01 19:31:49 +01:00
|
|
|
} commit;
|
|
|
|
|
|
|
|
|
|
struct {
|
2020-12-02 18:52:50 +01:00
|
|
|
struct {
|
|
|
|
|
uint32_t before_length;
|
|
|
|
|
uint32_t after_length;
|
|
|
|
|
} pending;
|
2020-12-01 19:31:49 +01:00
|
|
|
} surrounding;
|
|
|
|
|
|
2021-03-02 09:01:40 +01:00
|
|
|
bool focused;
|
2020-12-01 19:31:49 +01:00
|
|
|
uint32_t serial;
|
|
|
|
|
} ime;
|
2020-12-03 18:36:56 +01:00
|
|
|
#endif
|
2020-07-08 16:45:26 +02:00
|
|
|
};
|
|
|
|
|
|
2020-02-29 18:02:38 +01:00
|
|
|
enum csd_surface {
|
|
|
|
|
CSD_SURF_TITLE,
|
|
|
|
|
CSD_SURF_LEFT,
|
|
|
|
|
CSD_SURF_RIGHT,
|
|
|
|
|
CSD_SURF_TOP,
|
|
|
|
|
CSD_SURF_BOTTOM,
|
2020-03-02 20:29:28 +01:00
|
|
|
CSD_SURF_MINIMIZE,
|
|
|
|
|
CSD_SURF_MAXIMIZE,
|
|
|
|
|
CSD_SURF_CLOSE,
|
2020-02-29 18:02:38 +01:00
|
|
|
CSD_SURF_COUNT,
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-08 16:45:26 +02:00
|
|
|
struct monitor {
|
|
|
|
|
struct wayland *wayl;
|
|
|
|
|
struct wl_output *output;
|
|
|
|
|
struct zxdg_output_v1 *xdg;
|
|
|
|
|
uint32_t wl_name;
|
|
|
|
|
|
|
|
|
|
int x;
|
|
|
|
|
int y;
|
|
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
/* Physical size, in mm */
|
|
|
|
|
struct {
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
} mm;
|
|
|
|
|
|
|
|
|
|
/* Physical size, in pixels */
|
|
|
|
|
struct {
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
} px_real;
|
|
|
|
|
|
|
|
|
|
/* Scaled size, in pixels */
|
|
|
|
|
struct {
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
} px_scaled;
|
|
|
|
|
} dim;
|
|
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
/* PPI, based on physical size */
|
|
|
|
|
struct {
|
|
|
|
|
int x;
|
|
|
|
|
int y;
|
|
|
|
|
} real;
|
|
|
|
|
|
|
|
|
|
/* PPI, logical, based on scaled size */
|
|
|
|
|
struct {
|
|
|
|
|
int x;
|
|
|
|
|
int y;
|
|
|
|
|
} scaled;
|
|
|
|
|
} ppi;
|
|
|
|
|
|
2020-07-26 07:41:57 +02:00
|
|
|
float dpi;
|
|
|
|
|
|
2020-07-08 16:45:26 +02:00
|
|
|
int scale;
|
|
|
|
|
float refresh;
|
|
|
|
|
enum wl_output_subpixel subpixel;
|
2021-01-11 17:53:27 +01:00
|
|
|
enum wl_output_transform transform;
|
2020-07-08 16:45:26 +02:00
|
|
|
|
|
|
|
|
/* From wl_output */
|
|
|
|
|
char *make;
|
|
|
|
|
char *model;
|
|
|
|
|
|
|
|
|
|
/* From xdg_output */
|
|
|
|
|
char *name;
|
|
|
|
|
char *description;
|
|
|
|
|
|
|
|
|
|
float inch; /* e.g. 24" */
|
2020-11-24 00:00:43 +01:00
|
|
|
|
|
|
|
|
bool use_output_release;
|
2020-07-08 16:45:26 +02:00
|
|
|
};
|
|
|
|
|
|
2021-02-12 11:29:36 +01:00
|
|
|
struct wl_surf_subsurf {
|
|
|
|
|
struct wl_surface *surf;
|
|
|
|
|
struct wl_subsurface *sub;
|
|
|
|
|
};
|
|
|
|
|
|
2021-01-31 11:12:07 +01:00
|
|
|
struct wl_url {
|
|
|
|
|
const struct url *url;
|
2021-02-12 11:31:31 +01:00
|
|
|
struct wl_surf_subsurf surf;
|
2021-01-31 11:12:07 +01:00
|
|
|
};
|
|
|
|
|
|
2019-11-01 20:19:53 +01:00
|
|
|
struct wayland;
|
2019-10-27 13:06:39 +01:00
|
|
|
struct wl_window {
|
2020-01-03 13:37:03 +01:00
|
|
|
struct terminal *term;
|
2019-10-27 13:06:39 +01:00
|
|
|
struct wl_surface *surface;
|
|
|
|
|
struct xdg_surface *xdg_surface;
|
|
|
|
|
struct xdg_toplevel *xdg_toplevel;
|
|
|
|
|
|
|
|
|
|
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;
|
|
|
|
|
|
2020-02-26 12:17:58 +01:00
|
|
|
enum {CSD_UNKNOWN, CSD_NO, CSD_YES } use_csd;
|
2020-02-23 14:17:48 +01:00
|
|
|
|
|
|
|
|
struct {
|
2021-02-12 11:39:25 +01:00
|
|
|
struct wl_surf_subsurf surface[CSD_SURF_COUNT];
|
2020-02-29 12:52:55 +01:00
|
|
|
int move_timeout_fd;
|
|
|
|
|
uint32_t serial;
|
2020-02-23 14:17:48 +01:00
|
|
|
} csd;
|
|
|
|
|
|
2021-02-12 12:00:40 +01:00
|
|
|
struct wl_surf_subsurf search;
|
|
|
|
|
struct wl_surf_subsurf scrollback_indicator;
|
|
|
|
|
struct wl_surf_subsurf render_timer;
|
2020-08-13 18:35:17 +02:00
|
|
|
|
2019-10-27 16:01:03 +01:00
|
|
|
struct wl_callback *frame_callback;
|
|
|
|
|
|
2019-10-27 13:06:39 +01:00
|
|
|
tll(const struct monitor *) on_outputs; /* Outputs we're mapped on */
|
2021-01-31 11:12:07 +01:00
|
|
|
tll(struct wl_url) urls;
|
2020-01-03 13:54:44 +01:00
|
|
|
|
2020-01-03 18:55:13 +01:00
|
|
|
bool is_configured;
|
2020-02-26 12:39:17 +01:00
|
|
|
bool is_fullscreen;
|
2020-02-26 13:23:00 +01:00
|
|
|
bool is_maximized;
|
2021-01-10 15:40:11 +01:00
|
|
|
bool is_resizing;
|
2020-10-20 20:58:03 +02:00
|
|
|
bool is_tiled_top;
|
|
|
|
|
bool is_tiled_bottom;
|
|
|
|
|
bool is_tiled_left;
|
|
|
|
|
bool is_tiled_right;
|
|
|
|
|
bool is_tiled; /* At least one of is_tiled_{top,bottom,left,right} is true */
|
2020-01-03 13:54:44 +01:00
|
|
|
struct {
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
2021-01-11 18:45:12 +01:00
|
|
|
bool is_activated:1;
|
|
|
|
|
bool is_fullscreen:1;
|
|
|
|
|
bool is_maximized:1;
|
|
|
|
|
bool is_resizing:1;
|
|
|
|
|
bool is_tiled_top:1;
|
|
|
|
|
bool is_tiled_bottom:1;
|
|
|
|
|
bool is_tiled_left:1;
|
|
|
|
|
bool is_tiled_right:1;
|
2020-01-03 13:54:44 +01:00
|
|
|
} configure;
|
2021-01-17 16:12:54 +01:00
|
|
|
|
|
|
|
|
int resize_timeout_fd;
|
2019-10-27 13:06:39 +01:00
|
|
|
};
|
|
|
|
|
|
2019-12-31 16:12:48 +01:00
|
|
|
struct config;
|
2019-10-27 17:13:29 +01:00
|
|
|
struct terminal;
|
2019-10-27 13:06:39 +01:00
|
|
|
struct wayland {
|
2019-12-31 16:12:48 +01:00
|
|
|
const struct config *conf;
|
2019-10-27 19:08:48 +01:00
|
|
|
struct fdm *fdm;
|
2020-03-15 13:36:35 +01:00
|
|
|
|
|
|
|
|
int fd;
|
|
|
|
|
|
2019-10-27 13:06:39 +01:00
|
|
|
struct wl_display *display;
|
|
|
|
|
struct wl_registry *registry;
|
|
|
|
|
struct wl_compositor *compositor;
|
|
|
|
|
struct wl_subcompositor *sub_compositor;
|
|
|
|
|
struct wl_shm *shm;
|
|
|
|
|
|
|
|
|
|
struct zxdg_output_manager_v1 *xdg_output_manager;
|
|
|
|
|
|
2019-10-27 18:43:07 +01:00
|
|
|
struct xdg_wm_base *shell;
|
|
|
|
|
struct zxdg_decoration_manager_v1 *xdg_decoration_manager;
|
|
|
|
|
|
2019-10-27 13:06:39 +01:00
|
|
|
struct wl_data_device_manager *data_device_manager;
|
|
|
|
|
struct zwp_primary_selection_device_manager_v1 *primary_selection_device_manager;
|
2019-10-27 17:07:44 +01:00
|
|
|
|
2020-07-08 16:45:26 +02:00
|
|
|
struct wp_presentation *presentation;
|
|
|
|
|
uint32_t presentation_clock_id;
|
2019-10-27 18:43:07 +01:00
|
|
|
|
2020-12-03 18:36:56 +01:00
|
|
|
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
2020-10-10 22:14:35 +02:00
|
|
|
struct zwp_text_input_manager_v3 *text_input_manager;
|
2020-12-03 18:36:56 +01:00
|
|
|
#endif
|
2020-10-10 22:14:35 +02:00
|
|
|
|
2019-10-27 13:06:39 +01:00
|
|
|
bool have_argb8888;
|
|
|
|
|
tll(struct monitor) monitors; /* All available outputs */
|
2020-07-08 16:45:26 +02:00
|
|
|
tll(struct seat) seats;
|
2019-10-27 17:13:29 +01:00
|
|
|
|
2019-10-30 20:02:06 +01:00
|
|
|
tll(struct terminal *) terms;
|
2019-10-27 13:06:39 +01:00
|
|
|
};
|
2019-10-27 15:57:23 +01:00
|
|
|
|
2019-12-31 16:12:48 +01:00
|
|
|
struct wayland *wayl_init(const struct config *conf, struct fdm *fdm);
|
2019-10-27 15:57:23 +01:00
|
|
|
void wayl_destroy(struct wayland *wayl);
|
2019-10-27 16:01:03 +01:00
|
|
|
|
2021-02-12 11:29:36 +01:00
|
|
|
bool wayl_reload_xcursor_theme(struct seat *seat, int new_scale);
|
|
|
|
|
|
wayland: wl_display_flush() never blocks
Since it doesn't block, we need to detect EAGAIN failures and ensure
we actually flush everything.
If we don't, we sooner or later end up in a wayland client library
call that aborts due to the socket buffer being full.
Ideally, we'd simply enable POLLOUT in the FDM. However, we cannot
write *anything* to the wayland socket until we've actually managed to
send everything. This means enabling POLLOUT in the FDM wont work
since we may (*will*) end up trying to write more data to it before
we've flushed it.
So, add a wrapper function, wayl_flush(), that acts as a blocking
variant of wl_display_flush(), by detecting EAGAIN failiures and
calling poll() itself, on the wayland socket only, until all data has
been sent.
2020-01-04 21:10:08 +01:00
|
|
|
void wayl_flush(struct wayland *wayl);
|
2020-01-03 21:02:12 +01:00
|
|
|
void wayl_roundtrip(struct wayland *wayl);
|
|
|
|
|
|
2020-01-03 13:37:03 +01:00
|
|
|
struct wl_window *wayl_win_init(struct terminal *term);
|
2019-10-27 16:01:03 +01:00
|
|
|
void wayl_win_destroy(struct wl_window *win);
|
2020-07-08 19:52:17 +02:00
|
|
|
|
2021-02-12 11:29:36 +01:00
|
|
|
bool wayl_win_subsurface_new(
|
|
|
|
|
struct wl_window *win, struct wl_surf_subsurf *surf);
|
|
|
|
|
bool wayl_win_subsurface_new_with_custom_parent(
|
|
|
|
|
struct wl_window *win, struct wl_surface *parent,
|
|
|
|
|
struct wl_surf_subsurf *surf);
|
|
|
|
|
void wayl_win_subsurface_destroy(struct wl_surf_subsurf *surf);
|