feat(backend/X11): 添加从 _NET_WM_STATE 中获取 urgent 属性的功能
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include "core/event.h"
|
#include "core/event.h"
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xcb_event.h>
|
#include <xcb/xcb_event.h>
|
||||||
@@ -71,6 +72,18 @@ static window_geometry_mode_t geometry_mode_from_states(
|
|||||||
return ZDWM_GEOMETRY_NORMAL;
|
return ZDWM_GEOMETRY_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool urgent_from_states(
|
||||||
|
const atoms_t *atoms,
|
||||||
|
const xcb_atom_t *state_atoms,
|
||||||
|
uint32_t state_count
|
||||||
|
) {
|
||||||
|
for (uint32_t i = 0; i < state_count; ++i) {
|
||||||
|
if (state_atoms[i] == atoms->_NET_WM_STATE_DEMANDS_ATTENTION) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool handle_map_request(
|
static bool handle_map_request(
|
||||||
backend_t *backend,
|
backend_t *backend,
|
||||||
event_t *event,
|
event_t *event,
|
||||||
@@ -127,6 +140,9 @@ static bool handle_map_request(
|
|||||||
state_count,
|
state_count,
|
||||||
&ev->props.state_count
|
&ev->props.state_count
|
||||||
);
|
);
|
||||||
|
if (!ev->urgent) {
|
||||||
|
ev->urgent = urgent_from_states(atoms, state_atoms, state_count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p_delete(&state_atoms);
|
p_delete(&state_atoms);
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
X(_NET_WM_STATE_MAXIMIZED_VERT) \
|
X(_NET_WM_STATE_MAXIMIZED_VERT) \
|
||||||
X(_NET_WM_STATE_MAXIMIZED_HORZ) \
|
X(_NET_WM_STATE_MAXIMIZED_HORZ) \
|
||||||
\
|
\
|
||||||
|
X(_NET_WM_STATE_DEMANDS_ATTENTION) \
|
||||||
|
\
|
||||||
X(_NET_WM_WINDOW_TYPE) \
|
X(_NET_WM_WINDOW_TYPE) \
|
||||||
X(_NET_WM_WINDOW_TYPE_NORMAL) \
|
X(_NET_WM_WINDOW_TYPE_NORMAL) \
|
||||||
X(_NET_WM_WINDOW_TYPE_DESKTOP) \
|
X(_NET_WM_WINDOW_TYPE_DESKTOP) \
|
||||||
|
|||||||
Reference in New Issue
Block a user