mirror of
https://github.com/labwc/labwc.git
synced 2026-02-15 04:27:53 -05:00
window-rules: implement type filter
Co-Authored-By: Grigory Kirillov <txgk@bk.ru>
This commit is contained in:
parent
9be18f3009
commit
858e1c65cf
9 changed files with 157 additions and 79 deletions
|
|
@ -67,6 +67,26 @@ enum view_wants_focus {
|
|||
VIEW_WANTS_FOCUS_OFFER,
|
||||
};
|
||||
|
||||
enum window_type {
|
||||
/* https://specifications.freedesktop.org/wm-spec/wm-spec-1.4.html#idm45649101374512 */
|
||||
NET_WM_WINDOW_TYPE_DESKTOP = 0,
|
||||
NET_WM_WINDOW_TYPE_DOCK,
|
||||
NET_WM_WINDOW_TYPE_TOOLBAR,
|
||||
NET_WM_WINDOW_TYPE_MENU,
|
||||
NET_WM_WINDOW_TYPE_UTILITY,
|
||||
NET_WM_WINDOW_TYPE_SPLASH,
|
||||
NET_WM_WINDOW_TYPE_DIALOG,
|
||||
NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
|
||||
NET_WM_WINDOW_TYPE_POPUP_MENU,
|
||||
NET_WM_WINDOW_TYPE_TOOLTIP,
|
||||
NET_WM_WINDOW_TYPE_NOTIFICATION,
|
||||
NET_WM_WINDOW_TYPE_COMBO,
|
||||
NET_WM_WINDOW_TYPE_DND,
|
||||
NET_WM_WINDOW_TYPE_NORMAL,
|
||||
|
||||
WINDOW_TYPE_LEN
|
||||
};
|
||||
|
||||
struct view;
|
||||
struct wlr_surface;
|
||||
|
||||
|
|
@ -113,6 +133,8 @@ struct view_impl {
|
|||
enum view_wants_focus (*wants_focus)(struct view *self);
|
||||
/* returns true if view reserves space at screen edge */
|
||||
bool (*has_strut_partial)(struct view *self);
|
||||
/* returns true if view declared itself a window type */
|
||||
bool (*contains_window_type)(struct view *view, int32_t window_type);
|
||||
};
|
||||
|
||||
struct view {
|
||||
|
|
@ -358,6 +380,7 @@ void view_array_append(struct server *server, struct wl_array *views,
|
|||
enum lab_view_criteria criteria);
|
||||
|
||||
enum view_wants_focus view_wants_focus(struct view *view);
|
||||
bool view_contains_window_type(struct view *view, enum window_type window_type);
|
||||
|
||||
/**
|
||||
* view_edge_invert() - select the opposite of a provided edge
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ enum property {
|
|||
struct window_rule {
|
||||
char *identifier;
|
||||
char *title;
|
||||
int window_type;
|
||||
bool match_once;
|
||||
|
||||
enum window_rule_event event;
|
||||
|
|
|
|||
|
|
@ -14,26 +14,6 @@ struct wlr_compositor;
|
|||
struct wlr_output;
|
||||
struct wlr_output_layout;
|
||||
|
||||
enum atom {
|
||||
/* https://specifications.freedesktop.org/wm-spec/wm-spec-1.4.html#idm45649101374512 */
|
||||
NET_WM_WINDOW_TYPE_DESKTOP = 0,
|
||||
NET_WM_WINDOW_TYPE_DOCK,
|
||||
NET_WM_WINDOW_TYPE_TOOLBAR,
|
||||
NET_WM_WINDOW_TYPE_MENU,
|
||||
NET_WM_WINDOW_TYPE_UTILITY,
|
||||
NET_WM_WINDOW_TYPE_SPLASH,
|
||||
NET_WM_WINDOW_TYPE_DIALOG,
|
||||
NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
|
||||
NET_WM_WINDOW_TYPE_POPUP_MENU,
|
||||
NET_WM_WINDOW_TYPE_TOOLTIP,
|
||||
NET_WM_WINDOW_TYPE_NOTIFICATION,
|
||||
NET_WM_WINDOW_TYPE_COMBO,
|
||||
NET_WM_WINDOW_TYPE_DND,
|
||||
NET_WM_WINDOW_TYPE_NORMAL,
|
||||
|
||||
ATOM_LEN
|
||||
};
|
||||
|
||||
static const char * const atom_names[] = {
|
||||
"_NET_WM_WINDOW_TYPE_DESKTOP",
|
||||
"_NET_WM_WINDOW_TYPE_DOCK",
|
||||
|
|
@ -52,10 +32,10 @@ static const char * const atom_names[] = {
|
|||
};
|
||||
|
||||
static_assert(
|
||||
ARRAY_SIZE(atom_names) == ATOM_LEN,
|
||||
ARRAY_SIZE(atom_names) == WINDOW_TYPE_LEN,
|
||||
"Xwayland atoms out of sync");
|
||||
|
||||
extern xcb_atom_t atoms[ATOM_LEN];
|
||||
extern xcb_atom_t atoms[WINDOW_TYPE_LEN];
|
||||
|
||||
struct xwayland_unmanaged {
|
||||
struct server *server;
|
||||
|
|
@ -105,9 +85,6 @@ void xwayland_adjust_stacking_order(struct server *server);
|
|||
|
||||
struct wlr_xwayland_surface *xwayland_surface_from_view(struct view *view);
|
||||
|
||||
bool xwayland_surface_contains_window_type(
|
||||
struct wlr_xwayland_surface *surface, enum atom window_type);
|
||||
|
||||
void xwayland_server_init(struct server *server,
|
||||
struct wlr_compositor *compositor);
|
||||
void xwayland_server_finish(struct server *server);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue