diff options
Diffstat (limited to 'include')
29 files changed, 283 insertions, 58 deletions
diff --git a/include/gesture.h b/include/gesture.h new file mode 100644 index 00000000..9c6b0f91 --- /dev/null +++ b/include/gesture.h @@ -0,0 +1,104 @@ +#ifndef _SWAY_GESTURE_H +#define _SWAY_GESTURE_H + +#include <stdbool.h> +#include <stdint.h> + +/** + * A gesture type used in binding. + */ +enum gesture_type { + GESTURE_TYPE_NONE = 0, + GESTURE_TYPE_HOLD, + GESTURE_TYPE_PINCH, + GESTURE_TYPE_SWIPE, +}; + +// Turns single type enum value to constant string representation. +const char *gesture_type_string(enum gesture_type direction); + +// Value to use to accept any finger count +extern const uint8_t GESTURE_FINGERS_ANY; + +/** + * A gesture direction used in binding. + */ +enum gesture_direction { + GESTURE_DIRECTION_NONE = 0, + // Directions based on delta x and y + GESTURE_DIRECTION_UP = 1 << 0, + GESTURE_DIRECTION_DOWN = 1 << 1, + GESTURE_DIRECTION_LEFT = 1 << 2, + GESTURE_DIRECTION_RIGHT = 1 << 3, + // Directions based on scale + GESTURE_DIRECTION_INWARD = 1 << 4, + GESTURE_DIRECTION_OUTWARD = 1 << 5, + // Directions based on rotation + GESTURE_DIRECTION_CLOCKWISE = 1 << 6, + GESTURE_DIRECTION_COUNTERCLOCKWISE = 1 << 7, +}; + +// Turns single direction enum value to constant string representation. +const char *gesture_direction_string(enum gesture_direction direction); + +/** + * Struct representing a pointer gesture + */ +struct gesture { + enum gesture_type type; + uint8_t fingers; + uint32_t directions; +}; + +/** + * Parses gesture from <gesture>[:<fingers>][:<directions>] string. + * + * Return NULL on success, otherwise error message string + */ +char *gesture_parse(const char *input, struct gesture *output); + +// Turns gesture into string representation +char *gesture_to_string(struct gesture *gesture); + +// Check if gesture is of certain type and finger count. +bool gesture_check(struct gesture *target, + enum gesture_type type, uint8_t fingers); + +// Check if a gesture target/binding is match by other gesture/input +bool gesture_match(struct gesture *target, + struct gesture *to_match, bool exact); + +// Returns true if gesture are exactly the same +bool gesture_equal(struct gesture *a, struct gesture *b); + +// Compare distance between two matched target gestures. +int8_t gesture_compare(struct gesture *a, struct gesture *b); + +// Small helper struct to track gestures over time +struct gesture_tracker { + enum gesture_type type; + uint8_t fingers; + double dx, dy; + double scale; + double rotation; +}; + +// Begin gesture tracking +void gesture_tracker_begin(struct gesture_tracker *tracker, + enum gesture_type type, uint8_t fingers); + +// Check if the provides type is currently being tracked +bool gesture_tracker_check(struct gesture_tracker *tracker, + enum gesture_type type); + +// Update gesture track with new data point +void gesture_tracker_update(struct gesture_tracker *tracker, double dx, + double dy, double scale, double rotation); + +// Reset tracker +void gesture_tracker_cancel(struct gesture_tracker *tracker); + +// Reset tracker and return gesture tracked +struct gesture *gesture_tracker_end(struct gesture_tracker *tracker); + +#endif diff --git a/include/pango.h b/include/pango.h index 93affc23..1db113c2 100644 --- a/include/pango.h +++ b/include/pango.h @@ -13,12 +13,12 @@ * escaped string to dest if provided. */ size_t escape_markup_text(const char *src, char *dest); -PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, +PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc, const char *text, double scale, bool markup); -void get_text_size(cairo_t *cairo, const char *font, int *width, int *height, +void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height, int *baseline, double scale, bool markup, const char *fmt, ...); -void get_text_metrics(const char *font, int *height, int *baseline); -void render_text(cairo_t *cairo, const char *font, +void get_text_metrics(const PangoFontDescription *desc, int *height, int *baseline); +void render_text(cairo_t *cairo, PangoFontDescription *desc, double scale, bool markup, const char *fmt, ...); #endif diff --git a/include/stringop.h b/include/stringop.h index 8d7089e9..b29f59b2 100644 --- a/include/stringop.h +++ b/include/stringop.h @@ -2,6 +2,7 @@ #define _SWAY_STRINGOP_H #include <stdbool.h> +#include <stddef.h> #include "list.h" void strip_whitespace(char *str); diff --git a/include/sway/commands.h b/include/sway/commands.h index 86856fcf..98b232e1 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -106,6 +106,7 @@ sway_cmd cmd_exec_process; sway_cmd cmd_assign; sway_cmd cmd_bar; sway_cmd cmd_bindcode; +sway_cmd cmd_bindgesture; sway_cmd cmd_bindswitch; sway_cmd cmd_bindsym; sway_cmd cmd_border; @@ -196,6 +197,7 @@ sway_cmd cmd_titlebar_border_thickness; sway_cmd cmd_titlebar_padding; sway_cmd cmd_unbindcode; sway_cmd cmd_unbindswitch; +sway_cmd cmd_unbindgesture; sway_cmd cmd_unbindsym; sway_cmd cmd_unmark; sway_cmd cmd_urgent; @@ -255,6 +257,7 @@ sway_cmd input_cmd_click_method; sway_cmd input_cmd_drag; sway_cmd input_cmd_drag_lock; sway_cmd input_cmd_dwt; +sway_cmd input_cmd_dwtp; sway_cmd input_cmd_events; sway_cmd input_cmd_left_handed; sway_cmd input_cmd_map_from_region; @@ -290,12 +293,14 @@ sway_cmd output_cmd_max_render_time; sway_cmd output_cmd_mode; sway_cmd output_cmd_modeline; sway_cmd output_cmd_position; +sway_cmd output_cmd_power; sway_cmd output_cmd_render_bit_depth; sway_cmd output_cmd_scale; sway_cmd output_cmd_scale_filter; sway_cmd output_cmd_subpixel; sway_cmd output_cmd_toggle; sway_cmd output_cmd_transform; +sway_cmd output_cmd_unplug; sway_cmd seat_cmd_attach; sway_cmd seat_cmd_cursor; diff --git a/include/sway/config.h b/include/sway/config.h index 4ec035c2..55aa8fbe 100644 --- a/include/sway/config.h +++ b/include/sway/config.h @@ -10,12 +10,14 @@ #include <xkbcommon/xkbcommon.h> #include <xf86drmMode.h> #include "../include/config.h" +#include "gesture.h" #include "list.h" #include "swaynag.h" #include "tree/container.h" #include "sway/input/tablet.h" #include "sway/tree/root.h" #include "wlr-layer-shell-unstable-v1-protocol.h" +#include <pango/pangocairo.h> // TODO: Refactor this shit @@ -32,7 +34,8 @@ enum binding_input_type { BINDING_KEYSYM, BINDING_MOUSECODE, BINDING_MOUSESYM, - BINDING_SWITCH + BINDING_SWITCH, // dummy, only used to call seat_execute_command + BINDING_GESTURE // dummy, only used to call seat_execute_command }; enum binding_flags { @@ -45,10 +48,11 @@ enum binding_flags { BINDING_RELOAD = 1 << 6, // switch only; (re)trigger binding on reload BINDING_INHIBITED = 1 << 7, // keyboard only: ignore shortcut inhibitor BINDING_NOREPEAT = 1 << 8, // keyboard only; do not trigger when repeating a held key + BINDING_EXACT = 1 << 9, // gesture only; only trigger on exact match }; /** - * A key binding and an associated command. + * A key (or mouse) binding and an associated command. */ struct sway_binding { enum binding_input_type type; @@ -62,12 +66,10 @@ struct sway_binding { char *command; }; -/** - * A mouse binding and an associated command. - */ -struct sway_mouse_binding { - uint32_t button; - char *command; +enum sway_switch_trigger { + SWAY_SWITCH_TRIGGER_OFF, + SWAY_SWITCH_TRIGGER_ON, + SWAY_SWITCH_TRIGGER_TOGGLE, }; /** @@ -75,12 +77,22 @@ struct sway_mouse_binding { */ struct sway_switch_binding { enum wlr_switch_type type; - enum wlr_switch_state state; + enum sway_switch_trigger trigger; uint32_t flags; char *command; }; /** + * A gesture binding and an associated command. + */ +struct sway_gesture_binding { + char *input; + uint32_t flags; + struct gesture gesture; + char *command; +}; + +/** * Focus on window activation. */ enum sway_fowa { @@ -99,6 +111,7 @@ struct sway_mode { list_t *keycode_bindings; list_t *mouse_bindings; list_t *switch_bindings; + list_t *gesture_bindings; bool pango; }; @@ -137,6 +150,7 @@ struct input_config { int drag; int drag_lock; int dwt; + int dwtp; int left_handed; int middle_emulation; int natural_scroll; @@ -234,12 +248,6 @@ struct seat_config { } xcursor_theme; }; -enum config_dpms { - DPMS_IGNORE, - DPMS_ON, - DPMS_OFF, -}; - enum scale_filter_mode { SCALE_FILTER_DEFAULT, // the default is currently smart SCALE_FILTER_LINEAR, @@ -261,6 +269,7 @@ enum render_bit_depth { struct output_config { char *name; int enabled; + int power; int width, height; float refresh_rate; int custom_mode; @@ -277,7 +286,6 @@ struct output_config { char *background; char *background_option; char *background_fallback; - enum config_dpms dpms_state; }; /** @@ -501,7 +509,8 @@ struct sway_config { char *floating_scroll_right_cmd; enum sway_container_layout default_orientation; enum sway_container_layout default_layout; - char *font; + char *font; // Used for IPC. + PangoFontDescription *font_description; // Used internally for rendering and validating. int font_height; int font_baseline; bool pango_markup; @@ -700,6 +709,8 @@ void free_sway_binding(struct sway_binding *sb); void free_switch_binding(struct sway_switch_binding *binding); +void free_gesture_binding(struct sway_gesture_binding *binding); + void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding); void load_swaybar(struct bar_config *bar); diff --git a/include/sway/criteria.h b/include/sway/criteria.h index ad8610cd..59f57f94 100644 --- a/include/sway/criteria.h +++ b/include/sway/criteria.h @@ -1,7 +1,8 @@ #ifndef _SWAY_CRITERIA_H #define _SWAY_CRITERIA_H -#include <pcre.h> +#define PCRE2_CODE_UNIT_WIDTH 8 +#include <pcre2.h> #include "config.h" #include "list.h" #include "tree/view.h" @@ -15,13 +16,13 @@ enum criteria_type { }; enum pattern_type { - PATTERN_PCRE, + PATTERN_PCRE2, PATTERN_FOCUSED, }; struct pattern { enum pattern_type match_type; - pcre *regex; + pcre2_code *regex; }; struct criteria { diff --git a/include/sway/desktop.h b/include/sway/desktop.h index c969a76b..7f2f5b3e 100644 --- a/include/sway/desktop.h +++ b/include/sway/desktop.h @@ -1,4 +1,4 @@ -#include <wlr/types/wlr_surface.h> +#include <wlr/types/wlr_compositor.h> struct sway_container; struct sway_view; diff --git a/include/sway/desktop/launcher.h b/include/sway/desktop/launcher.h new file mode 100644 index 00000000..3b577f74 --- /dev/null +++ b/include/sway/desktop/launcher.h @@ -0,0 +1,32 @@ +#ifndef _SWAY_LAUNCHER_H +#define _SWAY_LAUNCHER_H + +#include <stdlib.h> + +struct launcher_ctx { + pid_t pid; + char *name; + struct wlr_xdg_activation_token_v1 *token; + struct wl_listener token_destroy; + + bool activated; + + struct sway_node *node; + struct wl_listener node_destroy; + + struct wl_list link; // sway_server::pending_launcher_ctxs +}; + +struct launcher_ctx *launcher_ctx_find_pid(pid_t pid); + +struct sway_workspace *launcher_ctx_get_workspace(struct launcher_ctx *ctx); + +void launcher_ctx_consume(struct launcher_ctx *ctx); + +void launcher_ctx_destroy(struct launcher_ctx *ctx); + +struct launcher_ctx *launcher_ctx_create(void); + +const char *launcher_ctx_get_token_name(struct launcher_ctx *ctx); + +#endif diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 7d66e699..8a2898dd 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h @@ -4,7 +4,7 @@ #include <stdint.h> #include <wlr/types/wlr_pointer_constraints_v1.h> #include <wlr/types/wlr_pointer_gestures_v1.h> -#include <wlr/types/wlr_surface.h> +#include <wlr/types/wlr_compositor.h> #include "sway/input/seat.h" #include "config.h" @@ -36,6 +36,8 @@ struct sway_cursor { bool active_confine_requires_warp; struct wlr_pointer_gestures_v1 *pointer_gestures; + struct wl_listener hold_begin; + struct wl_listener hold_end; struct wl_listener pinch_begin; struct wl_listener pinch_update; struct wl_listener pinch_end; @@ -110,7 +112,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, enum wlr_button_state state); void dispatch_cursor_axis(struct sway_cursor *cursor, - struct wlr_event_pointer_axis *event); + struct wlr_pointer_axis_event *event); void cursor_set_image(struct sway_cursor *cursor, const char *image, struct wl_client *client); diff --git a/include/sway/input/keyboard.h b/include/sway/input/keyboard.h index 2c61e5a7..571d9e6f 100644 --- a/include/sway/input/keyboard.h +++ b/include/sway/input/keyboard.h @@ -50,6 +50,7 @@ struct sway_shortcut_state { struct sway_keyboard { struct sway_seat_device *seat_device; + struct wlr_keyboard *wlr; struct xkb_keymap *keymap; xkb_layout_index_t effective_layout; diff --git a/include/sway/input/libinput.h b/include/sway/input/libinput.h index 890d632e..e4b1acc3 100644 --- a/include/sway/input/libinput.h +++ b/include/sway/input/libinput.h @@ -2,7 +2,7 @@ #define _SWAY_INPUT_LIBINPUT_H #include "sway/input/input-manager.h" -void sway_input_configure_libinput_device(struct sway_input_device *device); +bool sway_input_configure_libinput_device(struct sway_input_device *device); void sway_input_reset_libinput_device(struct sway_input_device *device); diff --git a/include/sway/input/seat.h b/include/sway/input/seat.h index 77c2278d..e3a46872 100644 --- a/include/sway/input/seat.h +++ b/include/sway/input/seat.h @@ -18,7 +18,23 @@ struct sway_seatop_impl { enum wlr_button_state state); void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec); void (*pointer_axis)(struct sway_seat *seat, - struct wlr_event_pointer_axis *event); + struct wlr_pointer_axis_event *event); + void (*hold_begin)(struct sway_seat *seat, + struct wlr_pointer_hold_begin_event *event); + void (*hold_end)(struct sway_seat *seat, + struct wlr_pointer_hold_end_event *event); + void (*pinch_begin)(struct sway_seat *seat, + struct wlr_pointer_pinch_begin_event *event); + void (*pinch_update)(struct sway_seat *seat, + struct wlr_pointer_pinch_update_event *event); + void (*pinch_end)(struct sway_seat *seat, + struct wlr_pointer_pinch_end_event *event); + void (*swipe_begin)(struct sway_seat *seat, + struct wlr_pointer_swipe_begin_event *event); + void (*swipe_update)(struct sway_seat *seat, + struct wlr_pointer_swipe_update_event *event); + void (*swipe_end)(struct sway_seat *seat, + struct wlr_pointer_swipe_end_event *event); void (*rebase)(struct sway_seat *seat, uint32_t time_msec); void (*tablet_tool_motion)(struct sway_seat *seat, struct sway_tablet_tool *tool, uint32_t time_msec); @@ -274,7 +290,7 @@ void seatop_button(struct sway_seat *seat, uint32_t time_msec, void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec); void seatop_pointer_axis(struct sway_seat *seat, - struct wlr_event_pointer_axis *event); + struct wlr_pointer_axis_event *event); void seatop_tablet_tool_tip(struct sway_seat *seat, struct sway_tablet_tool *tool, uint32_t time_msec, @@ -283,6 +299,25 @@ void seatop_tablet_tool_tip(struct sway_seat *seat, void seatop_tablet_tool_motion(struct sway_seat *seat, struct sway_tablet_tool *tool, uint32_t time_msec); +void seatop_hold_begin(struct sway_seat *seat, + struct wlr_pointer_hold_begin_event *event); +void seatop_hold_end(struct sway_seat *seat, + struct wlr_pointer_hold_end_event *event); + +void seatop_pinch_begin(struct sway_seat *seat, + struct wlr_pointer_pinch_begin_event *event); +void seatop_pinch_update(struct sway_seat *seat, + struct wlr_pointer_pinch_update_event *event); +void seatop_pinch_end(struct sway_seat *seat, + struct wlr_pointer_pinch_end_event *event); + +void seatop_swipe_begin(struct sway_seat *seat, + struct wlr_pointer_swipe_begin_event *event); +void seatop_swipe_update(struct sway_seat *seat, + struct wlr_pointer_swipe_update_event *event); +void seatop_swipe_end(struct sway_seat *seat, + struct wlr_pointer_swipe_end_event *event); + void seatop_rebase(struct sway_seat *seat, uint32_t time_msec); /** diff --git a/include/sway/input/switch.h b/include/sway/input/switch.h index 213b471d..de6787b7 100644 --- a/include/sway/input/switch.h +++ b/include/sway/input/switch.h @@ -5,6 +5,7 @@ struct sway_switch { struct sway_seat_device *seat_device; + struct wlr_switch *wlr; enum wlr_switch_state state; enum wlr_switch_type type; diff --git a/include/sway/input/tablet.h b/include/sway/input/tablet.h index d7e4c242..c0a5aff7 100644 --- a/include/sway/input/tablet.h +++ b/include/sway/input/tablet.h @@ -32,6 +32,7 @@ struct sway_tablet_pad { struct wl_list link; struct sway_seat_device *seat_device; struct sway_tablet *tablet; + struct wlr_tablet_pad *wlr; struct wlr_tablet_v2_tablet_pad *tablet_v2_pad; struct wl_listener attach; diff --git a/include/sway/input/text_input.h b/include/sway/input/text_input.h index 37744266..c70fd935 100644 --- a/include/sway/input/text_input.h +++ b/include/sway/input/text_input.h @@ -3,7 +3,7 @@ #include <wlr/types/wlr_text_input_v3.h> #include <wlr/types/wlr_input_method_v2.h> -#include <wlr/types/wlr_surface.h> +#include <wlr/types/wlr_compositor.h> #include "sway/input/seat.h" /** diff --git a/include/sway/ipc-json.h b/include/sway/ipc-json.h index 6f4ade1a..bc9f4985 100644 --- a/include/sway/ipc-json.h +++ b/include/sway/ipc-json.h @@ -1,6 +1,7 @@ #ifndef _SWAY_IPC_JSON_H #define _SWAY_IPC_JSON_H #include <json.h> +#include "sway/output.h" #include "sway/tree/container.h" #include "sway/input/input-manager.h" @@ -9,6 +10,7 @@ json_object *ipc_json_get_version(void); json_object *ipc_json_get_binding_mode(void); json_object *ipc_json_describe_disabled_output(struct sway_output *o); +json_object *ipc_json_describe_non_desktop_output(struct sway_output_non_desktop *o); json_object *ipc_json_describe_node(struct sway_node *node); json_object *ipc_json_describe_node_recursive(struct sway_node *node); json_object *ipc_json_describe_input(struct sway_input_device *device); diff --git a/include/sway/layers.h b/include/sway/layers.h index 14816861..f8508493 100644 --- a/include/sway/layers.h +++ b/include/sway/layers.h @@ -1,7 +1,7 @@ #ifndef _SWAY_LAYERS_H #define _SWAY_LAYERS_H #include <stdbool.h> -#include <wlr/types/wlr_surface.h> +#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_layer_shell_v1.h> enum layer_parent { diff --git a/include/sway/output.h b/include/sway/output.h index dc34686a..2d702741 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -3,6 +3,7 @@ #include <time.h> #include <unistd.h> #include <wayland-server-core.h> +#include <wlr/types/wlr_damage_ring.h> #include <wlr/types/wlr_output.h> #include "config.h" #include "sway/desktop/fx_renderer.h" @@ -27,13 +28,13 @@ struct sway_output { struct wlr_box usable_area; struct timespec last_frame; - struct wlr_output_damage *damage; + struct wlr_damage_ring damage_ring; int lx, ly; // layout coords int width, height; // transformed buffer size enum wl_output_subpixel detected_subpixel; enum scale_filter_mode scale_filter; - // last applied mode when the output is DPMS'ed + // last applied mode when the output is powered off struct wlr_output_mode *current_mode; bool enabling, enabled; @@ -45,8 +46,9 @@ struct sway_output { struct wl_listener commit; struct wl_listener mode; struct wl_listener present; - struct wl_listener damage_destroy; - struct wl_listener damage_frame; + struct wl_listener damage; + struct wl_listener frame; + struct wl_listener needs_frame; struct { struct wl_signal disable; @@ -58,6 +60,12 @@ struct sway_output { struct wl_event_source *repaint_timer; }; +struct sway_output_non_desktop { + struct wlr_output *wlr_output; + + struct wl_listener destroy; +}; + struct sway_output *output_create(struct wlr_output *wlr_output); void output_destroy(struct sway_output *output); @@ -184,4 +192,6 @@ void handle_output_manager_test(struct wl_listener *listener, void *data); void handle_output_power_manager_set_mode(struct wl_listener *listener, void *data); +struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output); + #endif diff --git a/include/sway/server.h b/include/sway/server.h index 4496c23f..0c2eccf3 100644 --- a/include/sway/server.h +++ b/include/sway/server.h @@ -16,6 +16,7 @@ #include <wlr/types/wlr_output_power_management_v1.h> #include <wlr/types/wlr_presentation_time.h> #include <wlr/types/wlr_relative_pointer_v1.h> +#include <wlr/types/wlr_session_lock_v1.h> #include <wlr/types/wlr_server_decoration.h> #include <wlr/types/wlr_text_input_v3.h> #include <wlr/types/wlr_xdg_shell.h> @@ -52,6 +53,7 @@ struct sway_server { struct wl_listener output_layout_change; struct wlr_idle *idle; + struct wlr_idle_notifier_v1 *idle_notifier_v1; struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1; struct wlr_layer_shell_v1 *layer_shell; @@ -90,6 +92,20 @@ struct sway_server { struct wl_listener output_manager_apply; struct wl_listener output_manager_test; + struct { + bool locked; + struct wlr_session_lock_manager_v1 *manager; + + struct wlr_session_lock_v1 *lock; + struct wlr_surface *focused; + struct wl_listener lock_new_surface; + struct wl_listener lock_unlock; + struct wl_listener lock_destroy; + + struct wl_listener new_lock; + struct wl_listener manager_destroy; + } session_lock; + struct wlr_output_power_manager_v1 *output_power_manager_v1; struct wl_listener output_power_manager_set_mode; struct wlr_input_method_manager_v2 *input_method; @@ -99,6 +115,8 @@ struct sway_server { struct wlr_xdg_activation_v1 *xdg_activation_v1; struct wl_listener xdg_activation_v1_request_activate; + struct wl_list pending_launcher_ctxs; // launcher_ctx::link + // The timeout for transactions, after which a transaction is applied // regardless of readiness. size_t txn_timeout_ms; @@ -135,8 +153,6 @@ struct sway_debug { extern struct sway_debug debug; -/* Prepares an unprivileged server_init by performing all privileged operations in advance */ -bool server_privileged_prepare(struct sway_server *server); bool server_init(struct sway_server *server); void server_fini(struct sway_server *server); bool server_start(struct sway_server *server); @@ -149,6 +165,7 @@ void handle_new_output(struct wl_listener *listener, void *data); void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data); void handle_layer_shell_surface(struct wl_listener *listener, void *data); +void sway_session_lock_init(void); void handle_xdg_shell_surface(struct wl_listener *listener, void *data); #if HAVE_XWAYLAND void handle_xwayland_surface(struct wl_listener *listener, void *data); @@ -159,4 +176,6 @@ void handle_pointer_constraint(struct wl_listener *listener, void *data); void xdg_activation_v1_handle_request_activate(struct wl_listener *listener, void *data); +void set_rr_scheduling(void); + #endif diff --git a/include/sway/surface.h b/include/sway/surface.h index 4da96c02..fb1cd775 100644 --- a/include/sway/surface.h +++ b/include/sway/surface.h @@ -1,6 +1,6 @@ #ifndef _SWAY_SURFACE_H #define _SWAY_SURFACE_H -#include <wlr/types/wlr_surface.h> +#include <wlr/types/wlr_compositor.h> struct sway_surface { struct wlr_surface *wlr_surface; diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index ebe9568c..75a8113a 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -2,7 +2,7 @@ #define _SWAY_CONTAINER_H #include <stdint.h> #include <sys/types.h> -#include <wlr/types/wlr_surface.h> +#include <wlr/types/wlr_compositor.h> #include "list.h" #include "sway/tree/node.h" @@ -368,7 +368,7 @@ bool container_is_sticky_or_child(struct sway_container *con); * This will destroy pairs of redundant H/V splits * e.g. H[V[H[app app]] app] -> H[app app app] * The middle "V[H[" are eliminated by a call to container_squash - * on the V[ con. It's grandchildren are added to it's parent. + * on the V[ con. It's grandchildren are added to its parent. * * This function is roughly equivalent to i3's tree_flatten here: * https://github.com/i3/i3/blob/1f0c628cde40cf87371481041b7197344e0417c6/src/tree.c#L651 diff --git a/include/sway/tree/root.h b/include/sway/tree/root.h index 5d4a2f2d..a2c088e7 100644 --- a/include/sway/tree/root.h +++ b/include/sway/tree/root.h @@ -28,6 +28,7 @@ struct sway_root { double width, height; list_t *outputs; // struct sway_output + list_t *non_desktop_outputs; // struct sway_output_non_desktop list_t *scratchpad; // struct sway_container // For when there's no connected outputs @@ -68,12 +69,6 @@ void root_scratchpad_show(struct sway_container *con); */ void root_scratchpad_hide(struct sway_container *con); -struct sway_workspace *root_workspace_for_pid(pid_t pid); - -void root_record_workspace_pid(pid_t pid); - -void root_remove_workspace_pid(pid_t pid); - void root_for_each_workspace(void (*f)(struct sway_workspace *ws, void *data), void *data); @@ -91,6 +86,4 @@ struct sway_container *root_find_container( void root_get_box(struct sway_root *root, struct wlr_box *box); -void root_rename_pid_workspaces(const char *old_name, const char *new_name); - #endif diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index ee34af48..684d13a0 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -1,7 +1,7 @@ #ifndef _SWAY_VIEW_H #define _SWAY_VIEW_H #include <wayland-server-core.h> -#include <wlr/types/wlr_surface.h> +#include <wlr/types/wlr_compositor.h> #include "config.h" #if HAVE_XWAYLAND #include <wlr/xwayland.h> @@ -74,6 +74,7 @@ struct sway_view { struct sway_xdg_decoration *xdg_decoration; pid_t pid; + struct launcher_ctx *ctx; // The size the view would want to be if it weren't tiled. // Used when changing a view from tiled to floating. @@ -109,7 +110,7 @@ struct sway_view { list_t *executed_criteria; // struct criteria * union { - struct wlr_xdg_surface *wlr_xdg_surface; + struct wlr_xdg_toplevel *wlr_xdg_toplevel; #if HAVE_XWAYLAND struct wlr_xwayland_surface *wlr_xwayland_surface; #endif @@ -132,6 +133,7 @@ struct sway_xdg_shell_view { struct wl_listener commit; struct wl_listener request_move; struct wl_listener request_resize; + struct wl_listener request_maximize; struct wl_listener request_fullscreen; struct wl_listener set_title; struct wl_listener set_app_id; @@ -155,6 +157,7 @@ struct sway_xwayland_view { struct wl_listener set_title; struct wl_listener set_class; struct wl_listener set_role; + struct wl_listener set_startup_id; struct wl_listener set_window_type; struct wl_listener set_hints; struct wl_listener set_decorations; @@ -170,6 +173,7 @@ struct sway_xwayland_unmanaged { int lx, ly; + struct wl_listener request_activate; struct wl_listener request_configure; struct wl_listener request_fullscreen; struct wl_listener commit; @@ -217,7 +221,7 @@ struct sway_subsurface { struct sway_xdg_popup { struct sway_view_child child; - struct wlr_xdg_surface *wlr_xdg_surface; + struct wlr_xdg_popup *wlr_xdg_popup; struct wl_listener new_popup; struct wl_listener destroy; @@ -371,4 +375,6 @@ void view_save_buffer(struct sway_view *view); bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor); +void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx); + #endif diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 545a66a8..3ad0bdf3 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h @@ -58,7 +58,6 @@ struct swaybar_output { struct zxdg_output_v1 *xdg_output; struct wl_surface *surface; struct zwlr_layer_surface_v1 *layer_surface; - struct wl_region *input_region; uint32_t wl_name; struct wl_list workspaces; // swaybar_workspace::link diff --git a/include/swaybar/config.h b/include/swaybar/config.h index 4cacd21a..361acd99 100644 --- a/include/swaybar/config.h +++ b/include/swaybar/config.h @@ -6,6 +6,7 @@ #include "../include/config.h" #include "list.h" #include "util.h" +#include <pango/pangocairo.h> struct box_colors { uint32_t border; @@ -28,7 +29,7 @@ struct swaybar_config { char *status_command; bool pango_markup; uint32_t position; // zwlr_layer_surface_v1_anchor - char *font; + PangoFontDescription *font_description; char *sep_symbol; char *mode; char *hidden_state; diff --git a/include/swaybar/i3bar.h b/include/swaybar/i3bar.h index 1aec6d6c..dced2a6c 100644 --- a/include/swaybar/i3bar.h +++ b/include/swaybar/i3bar.h @@ -30,6 +30,6 @@ void i3bar_block_unref(struct i3bar_block *block); bool i3bar_handle_readable(struct status_line *status); enum hotspot_event_handling i3bar_block_send_click(struct status_line *status, struct i3bar_block *block, double x, double y, double rx, double ry, - double w, double h, int scale, uint32_t button); + double w, double h, int scale, uint32_t button, bool released); #endif diff --git a/include/swaybar/input.h b/include/swaybar/input.h index e8735d88..8ea88a69 100644 --- a/include/swaybar/input.h +++ b/include/swaybar/input.h @@ -49,7 +49,7 @@ struct swaybar_hotspot { int x, y, width, height; enum hotspot_event_handling (*callback)(struct swaybar_output *output, struct swaybar_hotspot *hotspot, double x, double y, uint32_t button, - void *data); + bool released, void *data); void (*destroy)(void *data); void *data; }; diff --git a/include/swaynag/swaynag.h b/include/swaynag/swaynag.h index baa6ee8b..2d68b6c9 100644 --- a/include/swaynag/swaynag.h +++ b/include/swaynag/swaynag.h @@ -67,7 +67,7 @@ struct swaynag_details { int offset; int visible_lines; int total_lines; - struct swaynag_button *button_details; + struct swaynag_button button_details; struct swaynag_button button_up; struct swaynag_button button_down; }; diff --git a/include/swaynag/types.h b/include/swaynag/types.h index 3c3b2754..18f218e0 100644 --- a/include/swaynag/types.h +++ b/include/swaynag/types.h @@ -4,7 +4,8 @@ struct swaynag_type { char *name; - char *font; + char *font; // Used for debugging. + PangoFontDescription *font_description; char *output; uint32_t anchors; int32_t layer; // enum zwlr_layer_shell_v1_layer or -1 if unset |