Merge branch 'master' into master

This commit is contained in:
Jack Zeal 2026-05-27 03:36:48 +00:00 committed by GitHub
commit 6885d5b887
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
70 changed files with 1979 additions and 321 deletions

View file

@ -4,6 +4,7 @@
#include <cairo.h>
#include <pango/pango-font.h>
#include <stdbool.h>
struct lab_data_buffer;
@ -43,10 +44,11 @@ void font_get_buffer_size(int max_width, const char *text, struct font *font,
* @font: font description
* @color: foreground color in rgba format
* @bg_pattern: background pattern
* @use_markup: flag to render pango markup
*/
void font_buffer_create(struct lab_data_buffer **buffer, int max_width,
int height, const char *text, struct font *font, const float *color,
cairo_pattern_t *bg_pattern, double scale);
cairo_pattern_t *bg_pattern, double scale, bool use_markup);
/**
* font_finish - free some font related resources

View file

@ -62,8 +62,12 @@
#define BOUNDED_INT(a) ((a) < INT_MAX && (a) > INT_MIN)
#endif
#define LAB_WLR_VERSION_AT_LEAST(major, minor, micro) \
(WLR_VERSION_NUM >= (((major) << 16) | ((minor) << 8) | (micro)))
#define _LAB_CALC_WLR_VERSION_NUM(major, minor, micro) (((major) << 16) | ((minor) << 8) | (micro))
#define LAB_WLR_VERSION_AT_LEAST(major, minor, micro) ( \
server.wlr_version >= _LAB_CALC_WLR_VERSION_NUM(major, minor, micro))
#define LAB_WLR_VERSION_LOWER(major, minor, micro) (!LAB_WLR_VERSION_AT_LEAST(major, minor, micro))
/**
* PIXEL () - calculate pixel offset in an array

View file

@ -16,6 +16,12 @@ pid_t spawn_primary_client(const char *command);
*/
void spawn_async_no_shell(char const *command);
/**
* spawn_sync_no_shell - execute synchronously
* @command: command to be executed
*/
void spawn_sync_no_shell(char const *command);
/**
* spawn_piped - execute asynchronously
* @command: command to be executed

View file

@ -28,6 +28,9 @@ static struct key_combos {
}, {
.binding = "W-a",
.action = "ToggleMaximize",
}, {
.binding = "W-d",
.action = "ToggleShowDesktop",
}, {
.binding = "W-Left",
.action = "SnapToEdge",
@ -84,35 +87,35 @@ static struct key_combos {
.value = "no",
},
}, {
.binding = "XF86_AudioLowerVolume",
.binding = "XF86AudioLowerVolume",
.action = "Execute",
.attributes[0] = {
.name = "command",
.value = "amixer sset Master 5%-",
.value = "pactl set-sink-volume @DEFAULT_SINK@ -5%",
},
}, {
.binding = "XF86_AudioRaiseVolume",
.binding = "XF86AudioRaiseVolume",
.action = "Execute",
.attributes[0] = {
.name = "command",
.value = "amixer sset Master 5%+",
.value = "pactl set-sink-volume @DEFAULT_SINK@ +5%",
},
}, {
.binding = "XF86_AudioMute",
.binding = "XF86AudioMute",
.action = "Execute",
.attributes[0] = {
.name = "command",
.value = "amixer sset Master toggle",
.value = "pactl set-sink-mute @DEFAULT_SINK@ toggle",
},
}, {
.binding = "XF86_MonBrightnessUp",
.binding = "XF86MonBrightnessUp",
.action = "Execute",
.attributes[0] = {
.name = "command",
.value = "brightnessctl set +10%",
},
}, {
.binding = "XF86_MonBrightnessDown",
.binding = "XF86MonBrightnessDown",
.action = "Execute",
.attributes[0] = {
.name = "command",
@ -141,14 +144,14 @@ static struct key_combos {
* <mouse>
* <context name="Maximize">
* <mousebind button="Left" action="Click">
* <action name="Focus"/>
* <action name="Raise"/>
* <action name="ToggleMaximize"/>
* <action name="Focus" />
* <action name="Raise" />
* <action name="ToggleMaximize" />
* </mousebind>
* </context>
* <context name="Root">
* <mousebind direction="Up" action="Scroll">
* <action name="GoToDesktop" to="left" wrap="yes"/>
* <action name="GoToDesktop" to="left" wrap="yes" />
* </mousebind>
* </context>
* </mouse>

View file

@ -23,6 +23,7 @@ struct keybind {
struct wl_list actions; /* struct action.link */
struct wl_list link; /* struct rcxml.keybinds */
bool on_release;
bool override_inhibition;
};
/**

View file

@ -31,6 +31,7 @@ struct libinput_category {
int dwt; /* -1 or libinput_config_dwt_state */
int click_method; /* -1 or libinput_config_click_method */
int scroll_method; /* -1 or libinput_config_scroll_method */
int scroll_button; /* -1 or a button from linux/input_event_codes.h */
int send_events_mode; /* -1 or libinput_config_send_events_mode */
bool have_calibration_matrix;
double scroll_factor;

View file

@ -36,6 +36,12 @@ enum tearing_mode {
LAB_TEARING_FULLSCREEN_FORCED,
};
enum render_bit_depth {
LAB_RENDER_BIT_DEPTH_DEFAULT = 0,
LAB_RENDER_BIT_DEPTH_8,
LAB_RENDER_BIT_DEPTH_10,
};
enum tiling_events_mode {
LAB_TILING_EVENTS_NEVER = 0,
LAB_TILING_EVENTS_REGION = 1 << 0,
@ -74,8 +80,10 @@ struct rcxml {
int gap;
enum adaptive_sync_mode adaptive_sync;
enum tearing_mode allow_tearing;
enum render_bit_depth target_render_depth;
bool auto_enable_outputs;
bool reuse_output_mode;
uint32_t allowed_interfaces;
bool xwayland_persistence;
bool primary_selection;
char *prompt_command;
@ -89,6 +97,7 @@ struct rcxml {
bool focus_follow_mouse;
bool focus_follow_mouse_requires_movement;
bool raise_on_focus;
uint32_t raise_on_focus_delay_ms;
/* theme */
char *theme_name;
@ -225,4 +234,6 @@ void rcxml_finish(void);
*/
void append_parsed_actions(xmlNode *node, struct wl_list *list);
uint32_t parse_privileged_interface(const char *name);
#endif /* LABWC_RCXML_H */

View file

@ -103,6 +103,10 @@ void cycle_finish(bool switch_focus);
/* Re-initialize the window switcher */
void cycle_reinitialize(void);
/* Immediately cycle to next/previous window */
void cycle_immediate(enum lab_cycle_dir direction,
struct cycle_filter filter);
/* Focus the clicked window and close OSD */
void cycle_on_cursor_release(struct wlr_scene_node *node);

View file

@ -5,12 +5,17 @@
#include <stdbool.h>
#include <stdint.h>
struct seat;
/*
* All keycodes in these functions are (Linux) libinput evdev scancodes which is
* what 'wlr_keyboard' uses (e.g. 'seat->keyboard_group->keyboard->keycodes').
* Note: These keycodes are different to XKB scancodes by a value of 8.
*/
void key_state_indicator_update(struct seat *seat);
void key_state_indicator_toggle(void);
/**
* key_state_pressed_sent_keycodes - generate array of pressed+sent keys
* Note: The array is generated by subtracting any bound keys from _all_ pressed

View file

@ -148,8 +148,15 @@ struct seat {
};
struct server {
uint32_t wlr_version;
struct wl_display *wl_display;
struct wl_event_loop *wl_event_loop; /* Can be used for timer events */
/* Pending auto-raise timer (used when rc.raise_on_focus_delay_ms > 0) */
struct view *pending_auto_raise_view;
struct wl_event_source *pending_auto_raise_timer;
struct wlr_renderer *renderer;
struct wlr_allocator *allocator;
struct wlr_backend *backend;
@ -187,6 +194,13 @@ struct server {
struct wlr_xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager;
struct wl_listener xdg_toplevel_icon_set_icon;
struct {
struct wlr_ext_foreign_toplevel_image_capture_source_manager_v1 *manager;
struct {
struct wl_listener new_request;
} on;
} toplevel_capture;
/* front to back order */
struct wl_list views;
uint64_t next_view_creation_id;
@ -308,6 +322,8 @@ struct server {
struct sfdo *sfdo;
pid_t primary_client_pid;
char *title_fmt;
};
/* defined in main.c */
@ -343,6 +359,13 @@ void xdg_shell_finish(void);
*/
void desktop_focus_view(struct view *view, bool raise);
/**
* desktop_cancel_pending_auto_raise() - cancel any pending delayed auto-raise
* (from raiseOnFocusDelay). Called when a view is being destroyed, on config
* reload, or when a new focus change with raise=false supersedes the pending.
*/
void desktop_cancel_pending_auto_raise(void);
/**
* desktop_focus_view_or_surface() - like desktop_focus_view() but can
* also focus other (e.g. xwayland-unmanaged) surfaces

View file

@ -23,9 +23,11 @@ struct menuitem {
char *text;
char *icon_name;
const char *arrow;
uint32_t accelerator;
struct menu *parent;
struct menu *submenu;
bool selectable;
bool use_markup;
enum menuitem_type type;
int native_width;
struct wlr_scene_tree *tree;
@ -66,6 +68,19 @@ struct menu {
/* For keyboard support */
void menu_item_select_next(void);
void menu_item_select_previous(void);
/**
* menu_item_select_by_accelerator - selects the next menu item with
* a matching accelerator, starting after the current selection
*
* @accelerator a shortcut to quickly select/open an item, defined in menu.xml
* with an underscore in the item label before the target letter.
*
* Return: a boolean value that represents whether the newly selected item
* needs to be executed.
*/
bool menu_item_select_by_accelerator(uint32_t accelerator);
void menu_submenu_enter(void);
void menu_submenu_leave(void);
bool menu_call_selected_actions(void);
@ -100,7 +115,7 @@ void menu_open_root(struct menu *menu, int x, int y);
void menu_process_cursor_motion(struct wlr_scene_node *node);
/**
* menu_close_root- close root menu
* menu_close_root - close root menu
*
* This function will close server.menu_current and set it to NULL.
* Asserts that server.input_mode is set to LAB_INPUT_STATE_MENU.

View file

@ -71,6 +71,9 @@ struct wlr_box output_usable_area_in_layout_coords(struct output *output);
void handle_output_power_manager_set_mode(struct wl_listener *listener,
void *data);
void output_enable_adaptive_sync(struct output *output, bool enabled);
void output_enable_hdr(struct output *output, struct wlr_output_state *os,
bool enabled, bool silent);
void output_state_setup_hdr(struct output *output, bool silent);
/**
* Notifies whether a fullscreen view is displayed on the given output.

View file

@ -130,7 +130,7 @@ void scaled_buffer_request_update(struct scaled_buffer *self,
/**
* scaled_buffer_invalidate_sharing - clear the list of entire cached
* scaled_buffers used to share visually dupliated buffers. This should
* scaled_buffers used to share visually duplicated buffers. This should
* be called on Reconfigure to force updates of newly created
* scaled_buffers rather than reusing ones created before Reconfigure.
*/

View file

@ -15,6 +15,7 @@ struct scaled_font_buffer {
/* Private */
char *text;
bool use_markup;
int max_width;
float color[4];
float bg_color[4];
@ -69,8 +70,18 @@ scaled_font_buffer_create_for_titlebar(struct wlr_scene_tree *parent,
* bg_color is ignored for font buffers created with
* scaled_font_buffer_create_for_titlebar().
*/
void scaled_font_buffer_update(struct scaled_font_buffer *self, const char *text,
int max_width, struct font *font, const float *color,
void scaled_font_buffer_update(struct scaled_font_buffer *self,
const char *text, int max_width, struct font *font, const float *color,
const float *bg_color);
/**
* Update an existing auto scaling font buffer allowing the use of pango markup.
*
* Behaves identically to scaled_font_buffer_update(), but allows customization
* of the `use_markup` field of the @self struct via @use_markup.
*/
void scaled_font_buffer_update_markup(struct scaled_font_buffer *self,
const char *text, int max_width, struct font *font, const float *color,
const float *bg_color, bool use_markup);
#endif /* LABWC_SCALED_FONT_BUFFER_H */

8
include/show-desktop.h Normal file
View file

@ -0,0 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_SHOW_DESKTOP_H
#define LABWC_SHOW_DESKTOP_H
void show_desktop_toggle(void);
void show_desktop_reset(void);
#endif /* LABWC_SHOW_DESKTOP_H */

View file

@ -177,6 +177,12 @@ struct view {
char *title;
char *app_id; /* WM_CLASS for xwayland windows */
struct {
struct wlr_scene *scene;
struct wlr_ext_image_capture_source_v1 *source;
struct wl_listener on_capture_source_destroy;
} capture;
bool mapped;
bool been_mapped;
uint64_t creation_id;
@ -184,6 +190,7 @@ struct view {
enum ssd_preference ssd_preference;
bool shaded;
bool minimized;
bool was_minimized_by_show_desktop_action;
enum view_axis maximized;
bool fullscreen;
bool tearing_hint;
@ -319,6 +326,7 @@ struct xdg_toplevel_view {
/* Events unique to xdg-toplevel views */
struct wl_listener set_app_id;
struct wl_listener request_show_window_menu;
struct wl_listener set_parent;
struct wl_listener new_popup;
};
@ -630,4 +638,6 @@ enum lab_placement_policy view_placement_parse(const char *policy);
/* xdg.c */
struct wlr_xdg_surface *xdg_surface_from_view(struct view *view);
bool view_matches_criteria(struct view *view, enum lab_view_criteria criteria);
#endif /* LABWC_VIEW_H */