mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-13 08:55:58 +01:00
xwayland: add pid support
This commit is contained in:
parent
97346e7a1b
commit
b78ae54158
3 changed files with 18 additions and 4 deletions
|
@ -45,6 +45,7 @@ struct wlr_xwayland_surface {
|
|||
char *instance;
|
||||
struct wlr_xwayland_surface *parent;
|
||||
list_t *state; // list of xcb_atom_t
|
||||
pid_t pid;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
|
|
|
@ -15,6 +15,7 @@ const char *atom_map[ATOM_LAST] = {
|
|||
"WM_S0",
|
||||
"_NET_SUPPORTED",
|
||||
"_NET_WM_S0",
|
||||
"_NET_WM_PID",
|
||||
"_NET_WM_NAME",
|
||||
"_NET_WM_STATE",
|
||||
"WM_TAKE_FOCUS",
|
||||
|
@ -199,13 +200,22 @@ static void handle_surface_state(struct wlr_xwm *xwm,
|
|||
|
||||
static void read_surface_state(struct wlr_xwm *xwm,
|
||||
struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) {
|
||||
if (reply->type != XCB_ATOM_ATOM) { // TODO: check that
|
||||
return;
|
||||
}
|
||||
// reply->type == XCB_ATOM_ANY
|
||||
handle_surface_state(xwm, surface, xcb_get_property_value(reply),
|
||||
reply->value_len, NET_WM_STATE_ADD);
|
||||
}
|
||||
|
||||
static void read_surface_pid(struct wlr_xwm *xwm,
|
||||
struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) {
|
||||
if (reply->type != XCB_ATOM_CARDINAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
pid_t *pid = (pid_t *)xcb_get_property_value(reply);
|
||||
surface->pid = *pid;
|
||||
wlr_log(L_DEBUG, "NET_WM_PID %d", surface->pid);
|
||||
}
|
||||
|
||||
static void read_surface_property(struct wlr_xwm *xwm,
|
||||
struct wlr_xwayland_surface *surface, xcb_atom_t property) {
|
||||
xcb_get_property_cookie_t cookie = xcb_get_property(xwm->xcb_conn, 0,
|
||||
|
@ -223,6 +233,8 @@ static void read_surface_property(struct wlr_xwm *xwm,
|
|||
read_surface_title(xwm, surface, reply);
|
||||
} else if (property == XCB_ATOM_WM_TRANSIENT_FOR) {
|
||||
read_surface_parent(xwm, surface, reply);
|
||||
} else if (property == xwm->atoms[NET_WM_PID]) {
|
||||
read_surface_pid(xwm, surface, reply);
|
||||
} else if (property == xwm->atoms[NET_WM_STATE]) {
|
||||
read_surface_state(xwm, surface, reply);
|
||||
} else {
|
||||
|
@ -248,7 +260,7 @@ static void map_shell_surface(struct wlr_xwm *xwm,
|
|||
xwm->atoms[NET_WM_STATE],
|
||||
//xwm->atoms[NET_WM_WINDOW_TYPE],
|
||||
xwm->atoms[NET_WM_NAME],
|
||||
//xwm->atoms[NET_WM_PID],
|
||||
xwm->atoms[NET_WM_PID],
|
||||
//xwm->atoms[MOTIF_WM_HINTS],
|
||||
};
|
||||
for (size_t i = 0; i < sizeof(props)/sizeof(xcb_atom_t); i++) {
|
||||
|
|
|
@ -52,6 +52,7 @@ enum atom_name {
|
|||
WM_S0,
|
||||
NET_SUPPORTED,
|
||||
NET_WM_S0,
|
||||
NET_WM_PID,
|
||||
NET_WM_NAME,
|
||||
NET_WM_STATE,
|
||||
WM_TAKE_FOCUS,
|
||||
|
|
Loading…
Reference in a new issue