Compare commits
2 Commits
dc9d1fe248
...
e9834a5e35
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9834a5e35 | ||
|
|
fb99c9e472 |
@@ -23,7 +23,8 @@
|
||||
WM_CLIENT_MACHINE, \
|
||||
_NET_ACTIVE_WINDOW, \
|
||||
_COMPTON_SHADOW, \
|
||||
_NET_WM_WINDOW_TYPE
|
||||
_NET_WM_DESKTOP, \
|
||||
_NET_CURRENT_DESKTOP
|
||||
|
||||
#define ATOM_LIST2 \
|
||||
_NET_WM_WINDOW_TYPE_DESKTOP, \
|
||||
@@ -43,6 +44,7 @@
|
||||
_NET_WM_STATE, \
|
||||
_NET_WM_STATE_FULLSCREEN, \
|
||||
_NET_WM_BYPASS_COMPOSITOR, \
|
||||
_NET_WM_WINDOW_TYPE, \
|
||||
UTF8_STRING, \
|
||||
C_STRING
|
||||
// clang-format on
|
||||
|
||||
@@ -206,9 +206,6 @@ typedef struct session {
|
||||
/// Width of root window.
|
||||
int root_width;
|
||||
// Damage of root window.
|
||||
// Damage root_damage;
|
||||
int selmon_center_x;
|
||||
int selmon_center_y;
|
||||
/// X Composite overlay window.
|
||||
xcb_window_t overlay;
|
||||
/// The target window for debug mode
|
||||
@@ -294,6 +291,8 @@ typedef struct session {
|
||||
int size_expose;
|
||||
/// Index of the next free slot in <code>expose_rects</code>.
|
||||
int n_expose;
|
||||
/// Current desktop of display
|
||||
uint32_t cur_desktop;
|
||||
|
||||
// === Window related ===
|
||||
/// A hash table of all windows.
|
||||
|
||||
21
src/event.c
21
src/event.c
@@ -453,6 +453,27 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
|
||||
|
||||
if (ps->root == ev->window) {
|
||||
|
||||
if (ev->atom == ps->atoms->a_NET_CURRENT_DESKTOP) {
|
||||
auto prop = x_get_prop(ps->c, ps->root, ps->atoms->a_NET_CURRENT_DESKTOP,
|
||||
1L, XCB_ATOM_CARDINAL, 32);
|
||||
|
||||
if (prop.nitems) {
|
||||
if (ps->cur_desktop != *prop.c32) {
|
||||
win_stack_foreach_managed_safe(w, &ps->window_stack) {
|
||||
if (w->a.override_redirect) {
|
||||
continue;
|
||||
}
|
||||
if (w->cur_desktop & *prop.c32) {
|
||||
w->dwm_mask = ANIM_NEXT_TAG;
|
||||
} else if (w->cur_desktop & ps->cur_desktop) {
|
||||
w->dwm_mask = ANIM_PREV_TAG;
|
||||
}
|
||||
}
|
||||
ps->cur_desktop = *prop.c32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ps->o.use_ewmh_active_win && ps->atoms->a_NET_ACTIVE_WINDOW == ev->atom) {
|
||||
// to update focus
|
||||
ps->pending_updates = true;
|
||||
|
||||
@@ -1882,6 +1882,8 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
|
||||
.white_picture = XCB_NONE,
|
||||
.shadow_context = NULL,
|
||||
|
||||
.cur_desktop = 0,
|
||||
|
||||
#ifdef CONFIG_VSYNC_DRM
|
||||
.drm_fd = -1,
|
||||
#endif
|
||||
|
||||
31
src/win.c
31
src/win.c
@@ -445,6 +445,10 @@ static void win_update_properties(session_t *ps, struct managed_win *w) {
|
||||
}
|
||||
}
|
||||
|
||||
if (win_fetch_and_unset_property_stale(w, ps->atoms->a_NET_WM_DESKTOP)) {
|
||||
win_update_prop_desktop(ps, w);
|
||||
}
|
||||
|
||||
if (win_fetch_and_unset_property_stale(w, ps->atoms->aWM_CLASS)) {
|
||||
if (win_update_class(ps, w)) {
|
||||
win_set_flags(w, WIN_FLAGS_FACTOR_CHANGED);
|
||||
@@ -686,10 +690,10 @@ void win_process_update_flags(session_t *ps, struct managed_win *w) {
|
||||
// Determine if a window should animate
|
||||
if (win_should_animate(ps, w)) {
|
||||
win_update_bounding_shape(ps, w);
|
||||
if (w->pending_g.y < 0 && w->g.y > 0 && abs(w->pending_g.y - w->g.y) >= w->pending_g.height)
|
||||
w->dwm_mask = ANIM_PREV_TAG;
|
||||
else if (w->pending_g.y > 0 && w->g.y < 0 && abs(w->pending_g.y - w->g.y) >= w->pending_g.height)
|
||||
w->dwm_mask = ANIM_NEXT_TAG;
|
||||
// if (w->pending_g.y < 0 && w->g.y > 0 && abs(w->pending_g.y - w->g.y) >= w->pending_g.height)
|
||||
// w->dwm_mask = ANIM_PREV_TAG;
|
||||
// else if (w->pending_g.y > 0 && w->g.y < 0 && abs(w->pending_g.y - w->g.y) >= w->pending_g.height)
|
||||
// w->dwm_mask = ANIM_NEXT_TAG;
|
||||
|
||||
if (!was_visible || w->dwm_mask) {
|
||||
|
||||
@@ -707,7 +711,6 @@ void win_process_update_flags(session_t *ps, struct managed_win *w) {
|
||||
w->g.width = (uint16_t)round(w->animation_w);
|
||||
w->g.height = (uint16_t)round(w->animation_h);
|
||||
}
|
||||
|
||||
} else {
|
||||
w->animation_is_tag = ANIM_IN_TAG;
|
||||
w->animation_dest_center_x =
|
||||
@@ -1170,6 +1173,17 @@ void win_update_prop_shadow_raw(session_t *ps, struct managed_win *w) {
|
||||
free_winprop(&prop);
|
||||
}
|
||||
|
||||
void win_update_prop_desktop(session_t *ps, struct managed_win *w) {
|
||||
winprop_t prop = x_get_prop(ps->c, w->base.id, ps->atoms->a_NET_WM_DESKTOP, 1,
|
||||
XCB_ATOM_CARDINAL, 32);
|
||||
if (!prop.nitems) {
|
||||
w->cur_desktop = w->cur_desktop;
|
||||
} else {
|
||||
w->cur_desktop = *prop.c32;
|
||||
}
|
||||
free_winprop(&prop);
|
||||
}
|
||||
|
||||
static void win_set_shadow(session_t *ps, struct managed_win *w, bool shadow_new) {
|
||||
if (w->shadow == shadow_new) {
|
||||
return;
|
||||
@@ -1994,6 +2008,7 @@ struct win *fill_win(session_t *ps, struct win *w) {
|
||||
ps->atoms->a_NET_WM_NAME, ps->atoms->aWM_CLASS,
|
||||
ps->atoms->aWM_WINDOW_ROLE, ps->atoms->a_COMPTON_SHADOW,
|
||||
ps->atoms->aWM_CLIENT_LEADER, ps->atoms->aWM_TRANSIENT_FOR,
|
||||
ps->atoms->a_NET_WM_DESKTOP
|
||||
};
|
||||
win_set_properties_stale(new, init_stale_props, ARR_SIZE(init_stale_props));
|
||||
|
||||
@@ -2686,7 +2701,9 @@ void unmap_win_start(session_t *ps, struct managed_win *w) {
|
||||
w->opacity_target_old = fmax(w->opacity_target, w->opacity_target_old);
|
||||
w->opacity_target = win_calc_opacity_target(ps, w);
|
||||
|
||||
if (ps->o.animations && ps->o.animation_for_unmap_window != OPEN_WINDOW_ANIMATION_NONE && ps->o.wintype_option[w->window_type].animation) {
|
||||
if (ps->o.animations &&
|
||||
ps->o.animation_for_unmap_window != OPEN_WINDOW_ANIMATION_NONE &&
|
||||
ps->o.wintype_option[w->window_type].animation) {
|
||||
w->dwm_mask = ANIM_UNMAP;
|
||||
init_animation(ps, w);
|
||||
|
||||
@@ -2771,7 +2788,7 @@ void win_update_monitor(int nmons, region_t *mons, struct managed_win *mw) {
|
||||
auto e = pixman_region32_extents(&mons[i]);
|
||||
// if (e->x1 <= mw->g.x && e->y1 <= mw->g.y &&
|
||||
// e->x2 >= mw->g.x + mw->widthb && e->y2 >= mw->g.y + mw->heightb) {
|
||||
if (e->x1 <= mw->g.x && e->x2 >= mw->g.x + mw->widthb) {
|
||||
if (e->x1 <= mw->pending_g.x && e->x2 >= mw->pending_g.x + mw->widthb) {
|
||||
mw->randr_monitor = i;
|
||||
log_debug("Window %#010x (%s), %dx%d+%dx%d, is entirely on the "
|
||||
"monitor %d (%dx%d+%dx%d)",
|
||||
|
||||
@@ -125,6 +125,7 @@ struct managed_win {
|
||||
struct managed_win *prev_trans;
|
||||
/// Number of windows above this window
|
||||
int stacking_rank;
|
||||
uint32_t cur_desktop;
|
||||
// TODO(yshui) rethink reg_ignore
|
||||
|
||||
// Core members
|
||||
@@ -565,3 +566,5 @@ static inline bool attr_pure attr_unused win_has_frame(const struct managed_win
|
||||
return w->g.border_width || w->frame_extents.top || w->frame_extents.left ||
|
||||
w->frame_extents.right || w->frame_extents.bottom;
|
||||
}
|
||||
|
||||
void win_update_prop_desktop(session_t *ps, struct managed_win *w);
|
||||
|
||||
Reference in New Issue
Block a user