This commit is contained in:
st0rm-shad0w 2026-06-10 11:40:39 +09:00 committed by GitHub
commit 81666b458d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 2674 additions and 3 deletions

View file

@ -29,6 +29,7 @@ bool action_is_valid(struct action *action);
bool action_is_show_menu(struct action *action);
void action_arg_add_str(struct action *action, const char *key, const char *value);
void action_arg_add_int(struct action *action, const char *key, int value);
void action_arg_add_actionlist(struct action *action, const char *key);
void action_arg_add_querylist(struct action *action, const char *key);

View file

@ -73,6 +73,7 @@ struct rcxml {
char *config_dir;
char *config_file;
bool merge_config;
char *loaded_config_file;
/* core */
bool xdg_shell_server_side_deco;

View file

@ -9,5 +9,6 @@ struct foreign_toplevel *foreign_toplevel_create(struct view *view);
void foreign_toplevel_set_parent(struct foreign_toplevel *toplevel,
struct foreign_toplevel *parent);
void foreign_toplevel_destroy(struct foreign_toplevel *toplevel);
const char *foreign_toplevel_get_identifier(struct foreign_toplevel *toplevel);
#endif /* LABWC_FOREIGN_TOPLEVEL_H */

77
include/ipc.h Normal file
View file

@ -0,0 +1,77 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_IPC_H
#define LABWC_IPC_H
#include <stdbool.h>
#include <stdint.h>
#include <wayland-util.h>
struct view;
struct workspace;
/* Wire protocol */
#define IPC_MAGIC "labwc-ipc"
#define IPC_MAGIC_LEN 9
#define IPC_HEADER_SIZE (IPC_MAGIC_LEN + 4 + 4) /* 17 bytes */
/* Message types (same numbering as sway/i3) */
enum ipc_msg_type {
IPC_RUN_COMMAND = 0,
IPC_GET_WORKSPACES = 1,
IPC_SUBSCRIBE = 2,
IPC_GET_OUTPUTS = 3,
IPC_GET_TREE = 4,
IPC_GET_MARKS = 5,
IPC_GET_BAR_CONFIG = 6,
IPC_GET_VERSION = 7,
IPC_GET_BINDING_MODES = 8,
IPC_GET_CONFIG = 9,
IPC_SEND_TICK = 10,
IPC_SYNC = 11,
IPC_GET_BINDING_STATE = 12,
IPC_GET_INPUTS = 100,
IPC_GET_SEATS = 101,
};
/* Event types (bit 31 set) */
#define IPC_EVENT_FLAG 0x80000000
enum ipc_event_type {
IPC_EVENT_WORKSPACE = (IPC_EVENT_FLAG | 0),
IPC_EVENT_OUTPUT = (IPC_EVENT_FLAG | 1),
IPC_EVENT_WINDOW = (IPC_EVENT_FLAG | 3),
IPC_EVENT_SHUTDOWN = (IPC_EVENT_FLAG | 6),
IPC_EVENT_TICK = (IPC_EVENT_FLAG | 7),
};
/* Subscription bitmask */
#define IPC_SUB_WORKSPACE (1 << 0)
#define IPC_SUB_OUTPUT (1 << 1)
#define IPC_SUB_WINDOW (1 << 3)
#define IPC_SUB_SHUTDOWN (1 << 6)
#define IPC_SUB_TICK (1 << 7)
struct ipc_client {
struct wl_list link; /* server.ipc_clients */
int fd;
struct wl_event_source *readable;
struct wl_event_source *writable;
uint32_t subscriptions;
/* Write buffer for partial writes */
char *write_buf;
size_t write_buf_len;
size_t write_buf_cap;
};
/* Server lifecycle */
void ipc_init(void);
void ipc_finish(void);
/* Event emitters (called from compositor hooks) */
void ipc_event_workspace(const char *change, struct workspace *current,
struct workspace *old);
void ipc_event_output(const char *change);
void ipc_event_window(const char *change, struct view *view);
void ipc_event_window_geometry(struct view *view, struct wlr_box *new_geo);
void ipc_event_shutdown(void);
#endif /* LABWC_IPC_H */

View file

@ -324,6 +324,8 @@ struct server {
pid_t primary_client_pid;
char *title_fmt;
struct wl_list ipc_clients;
};
/* defined in main.c */

View file

@ -242,6 +242,12 @@ struct view {
/* Set temporarily when moving view due to layout change */
bool adjusting_for_layout_change;
/*
* Last geometry reported to IPC subscribers. Used to detect
* actual position/size changes and emit move/resize events.
*/
struct wlr_box ipc_last_geo;
/* used by xdg-shell views */
uint32_t pending_configure_serial;
struct wl_event_source *pending_configure_timeout;