mirror of
https://github.com/labwc/labwc.git
synced 2026-06-13 14:33:18 -04:00
Add swaymsg-compatible IPC interface with labmsg client
This commit is contained in:
parent
bce14a5ad7
commit
8328c05041
20 changed files with 2291 additions and 11 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
76
include/ipc.h
Normal file
76
include/ipc.h
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/* 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_shutdown(void);
|
||||
|
||||
#endif /* LABWC_IPC_H */
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef LABWC_H
|
||||
#define LABWC_H
|
||||
#include "config.h"
|
||||
#include <wlr/util/box.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "common/set.h"
|
||||
#include "config.h"
|
||||
#include "cycle.h"
|
||||
#include "input/cursor.h"
|
||||
#include "overlay.h"
|
||||
|
|
@ -65,9 +65,9 @@ struct seat {
|
|||
struct input_method_relay *input_method_relay;
|
||||
|
||||
/**
|
||||
* Cursor context saved when a mouse button is pressed on a view/surface.
|
||||
* It is used to send cursor motion events to a surface even though
|
||||
* the cursor has left the surface in the meantime.
|
||||
* Cursor context saved when a mouse button is pressed on a
|
||||
* view/surface. It is used to send cursor motion events to a surface
|
||||
* even though the cursor has left the surface in the meantime.
|
||||
*
|
||||
* This allows to keep dragging a scrollbar or selecting text even
|
||||
* when moving outside of the window.
|
||||
|
|
@ -245,7 +245,8 @@ struct server {
|
|||
*/
|
||||
struct wlr_scene_tree *xdg_popup_tree;
|
||||
#if HAVE_XWAYLAND
|
||||
/* Tree for unmanaged xsurfaces without initialized view (usually popups) */
|
||||
/* Tree for unmanaged xsurfaces without initialized view (usually
|
||||
* popups) */
|
||||
struct wlr_scene_tree *unmanaged_tree;
|
||||
#endif
|
||||
struct wlr_scene_tree *cycle_preview_tree;
|
||||
|
|
@ -254,7 +255,7 @@ struct server {
|
|||
|
||||
/* Workspaces */
|
||||
struct {
|
||||
struct wl_list all; /* struct workspace.link */
|
||||
struct wl_list all; /* struct workspace.link */
|
||||
struct workspace *current;
|
||||
struct workspace *last;
|
||||
struct wlr_ext_workspace_manager_v1 *ext_manager;
|
||||
|
|
@ -324,6 +325,8 @@ struct server {
|
|||
pid_t primary_client_pid;
|
||||
|
||||
char *title_fmt;
|
||||
|
||||
struct wl_list ipc_clients;
|
||||
};
|
||||
|
||||
/* defined in main.c */
|
||||
|
|
@ -406,7 +409,8 @@ void seat_pointer_end_grab(struct seat *seat, struct wlr_surface *surface);
|
|||
*/
|
||||
void seat_focus_lock_surface(struct seat *seat, struct wlr_surface *surface);
|
||||
|
||||
void seat_set_focus_layer(struct seat *seat, struct wlr_layer_surface_v1 *layer);
|
||||
void seat_set_focus_layer(struct seat *seat,
|
||||
struct wlr_layer_surface_v1 *layer);
|
||||
void seat_output_layout_changed(struct seat *seat);
|
||||
|
||||
/*
|
||||
|
|
@ -457,7 +461,6 @@ void server_start(void);
|
|||
void server_finish(void);
|
||||
|
||||
void create_constraint(struct wl_listener *listener, void *data);
|
||||
void constrain_cursor(struct wlr_pointer_constraint_v1
|
||||
*constraint);
|
||||
void constrain_cursor(struct wlr_pointer_constraint_v1 *constraint);
|
||||
|
||||
#endif /* LABWC_H */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue