2019-03-17 09:44:26 -04:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Copyright (c) 2019, Yuxuan Shui <yshuiv7@gmail.com>
|
|
|
|
|
2019-08-09 19:56:04 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2019-03-17 09:44:26 -04:00
|
|
|
#include <X11/Xlibint.h>
|
2019-03-17 09:56:12 -04:00
|
|
|
#include <X11/extensions/sync.h>
|
2019-08-09 19:56:04 -04:00
|
|
|
#include <xcb/damage.h>
|
2019-09-16 18:27:59 -04:00
|
|
|
#include <xcb/randr.h>
|
2019-03-17 09:44:26 -04:00
|
|
|
|
2019-05-05 19:34:08 -04:00
|
|
|
#include "atom.h"
|
2019-03-17 09:44:26 -04:00
|
|
|
#include "common.h"
|
2019-03-30 05:07:21 -04:00
|
|
|
#include "compiler.h"
|
2019-09-16 18:27:59 -04:00
|
|
|
#include "config.h"
|
2019-03-17 09:44:26 -04:00
|
|
|
#include "event.h"
|
2019-09-16 18:27:59 -04:00
|
|
|
#include "log.h"
|
2020-04-04 10:55:30 -04:00
|
|
|
#include "picom.h"
|
2019-08-09 19:56:04 -04:00
|
|
|
#include "region.h"
|
2019-09-16 18:27:59 -04:00
|
|
|
#include "utils.h"
|
2019-08-09 19:56:04 -04:00
|
|
|
#include "win.h"
|
2019-09-16 18:27:59 -04:00
|
|
|
#include "x.h"
|
2019-03-17 09:44:26 -04:00
|
|
|
|
|
|
|
/// Event handling with X is complicated. Handling events with other events possibly
|
|
|
|
/// in-flight is no good. Because your internal state won't be up to date. Also, querying
|
|
|
|
/// the server while events are in-flight is not good. Because events later in the queue
|
|
|
|
/// might container information you are querying. Thus those events will cause you to do
|
|
|
|
/// unnecessary updates even when you already have the latest information (remember, you
|
|
|
|
/// made the query when those events were already in the queue. so the reply you got is
|
|
|
|
/// more up-to-date than the events). Also, handling events when other client are making
|
|
|
|
/// concurrent requests is not good. Because the server states are changing without you
|
|
|
|
/// knowning them. This is super racy, and can cause lots of potential problems.
|
|
|
|
///
|
|
|
|
/// All of above mandates we do these things:
|
|
|
|
/// 1. Grab server when handling events
|
|
|
|
/// 2. Make sure the event queue is empty before we make any query to the server
|
|
|
|
///
|
|
|
|
/// Notice (2) has a dependency circle. To handle events, you sometimes need to make
|
|
|
|
/// queries. But to make queries you have to first handle events.
|
|
|
|
///
|
|
|
|
/// To break that circle, we split all event handling into top and bottom halves. The
|
|
|
|
/// bottom half will just look at the event itself, update as much state as they can
|
|
|
|
/// without making queries, then queue up necessary works need to be done by the top half.
|
|
|
|
/// The top half will do all the other necessary updates. Before entering the top half, we
|
|
|
|
/// grab the server and make sure the event queue is empty.
|
|
|
|
///
|
|
|
|
/// When top half finished, we enter the render stage, where no server state should be
|
|
|
|
/// queried. All rendering should be done with our internal knowledge of the server state.
|
|
|
|
///
|
2020-08-30 10:25:58 -04:00
|
|
|
|
|
|
|
// TODO(yshui) the things described above
|
2019-03-17 09:44:26 -04:00
|
|
|
|
2019-03-17 09:56:12 -04:00
|
|
|
/**
|
|
|
|
* Get a window's name from window ID.
|
|
|
|
*/
|
2019-03-17 10:15:17 -04:00
|
|
|
static inline const char *ev_window_name(session_t *ps, xcb_window_t wid) {
|
|
|
|
char *name = "";
|
2019-03-17 09:56:12 -04:00
|
|
|
if (wid) {
|
2019-03-17 10:15:17 -04:00
|
|
|
name = "(Failed to get title)";
|
|
|
|
if (ps->root == wid) {
|
|
|
|
name = "(Root window)";
|
|
|
|
} else if (ps->overlay == wid) {
|
|
|
|
name = "(Overlay)";
|
|
|
|
} else {
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_managed_win(ps, wid);
|
2019-03-17 10:15:17 -04:00
|
|
|
if (!w) {
|
2019-03-17 09:56:12 -04:00
|
|
|
w = find_toplevel(ps, wid);
|
2019-03-17 10:15:17 -04:00
|
|
|
}
|
2019-03-17 09:56:12 -04:00
|
|
|
|
2019-09-23 16:05:13 -04:00
|
|
|
if (w && w->name) {
|
|
|
|
name = w->name;
|
2019-03-17 10:15:17 -04:00
|
|
|
}
|
2019-03-17 09:56:12 -04:00
|
|
|
}
|
|
|
|
}
|
2019-03-17 10:15:17 -04:00
|
|
|
return name;
|
2019-03-17 09:56:12 -04:00
|
|
|
}
|
|
|
|
|
2019-03-17 10:15:17 -04:00
|
|
|
static inline xcb_window_t attr_pure ev_window(session_t *ps, xcb_generic_event_t *ev) {
|
2019-03-17 09:56:12 -04:00
|
|
|
switch (ev->response_type) {
|
|
|
|
case FocusIn:
|
|
|
|
case FocusOut: return ((xcb_focus_in_event_t *)ev)->event;
|
|
|
|
case CreateNotify: return ((xcb_create_notify_event_t *)ev)->window;
|
|
|
|
case ConfigureNotify: return ((xcb_configure_notify_event_t *)ev)->window;
|
|
|
|
case DestroyNotify: return ((xcb_destroy_notify_event_t *)ev)->window;
|
|
|
|
case MapNotify: return ((xcb_map_notify_event_t *)ev)->window;
|
|
|
|
case UnmapNotify: return ((xcb_unmap_notify_event_t *)ev)->window;
|
|
|
|
case ReparentNotify: return ((xcb_reparent_notify_event_t *)ev)->window;
|
|
|
|
case CirculateNotify: return ((xcb_circulate_notify_event_t *)ev)->window;
|
|
|
|
case Expose: return ((xcb_expose_event_t *)ev)->window;
|
|
|
|
case PropertyNotify: return ((xcb_property_notify_event_t *)ev)->window;
|
|
|
|
case ClientMessage: return ((xcb_client_message_event_t *)ev)->window;
|
|
|
|
default:
|
|
|
|
if (ps->damage_event + XCB_DAMAGE_NOTIFY == ev->response_type) {
|
|
|
|
return ((xcb_damage_notify_event_t *)ev)->drawable;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps->shape_exists && ev->response_type == ps->shape_event) {
|
|
|
|
return ((xcb_shape_notify_event_t *)ev)->affected_window;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-31 00:46:28 -04:00
|
|
|
#define CASESTRRET(s) \
|
|
|
|
case s: return #s;
|
|
|
|
|
2019-03-30 05:07:21 -04:00
|
|
|
static inline const char *ev_name(session_t *ps, xcb_generic_event_t *ev) {
|
2019-03-17 09:56:12 -04:00
|
|
|
static char buf[128];
|
|
|
|
switch (ev->response_type & 0x7f) {
|
|
|
|
CASESTRRET(FocusIn);
|
|
|
|
CASESTRRET(FocusOut);
|
|
|
|
CASESTRRET(CreateNotify);
|
|
|
|
CASESTRRET(ConfigureNotify);
|
|
|
|
CASESTRRET(DestroyNotify);
|
|
|
|
CASESTRRET(MapNotify);
|
|
|
|
CASESTRRET(UnmapNotify);
|
|
|
|
CASESTRRET(ReparentNotify);
|
|
|
|
CASESTRRET(CirculateNotify);
|
|
|
|
CASESTRRET(Expose);
|
|
|
|
CASESTRRET(PropertyNotify);
|
|
|
|
CASESTRRET(ClientMessage);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps->damage_event + XCB_DAMAGE_NOTIFY == ev->response_type)
|
|
|
|
return "Damage";
|
|
|
|
|
|
|
|
if (ps->shape_exists && ev->response_type == ps->shape_event)
|
|
|
|
return "ShapeNotify";
|
|
|
|
|
|
|
|
if (ps->xsync_exists) {
|
|
|
|
int o = ev->response_type - ps->xsync_event;
|
|
|
|
switch (o) {
|
|
|
|
CASESTRRET(XSyncCounterNotify);
|
|
|
|
CASESTRRET(XSyncAlarmNotify);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(buf, "Event %d", ev->response_type);
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2019-03-17 10:15:17 -04:00
|
|
|
static inline const char *attr_pure ev_focus_mode_name(xcb_focus_in_event_t *ev) {
|
2019-03-17 09:44:26 -04:00
|
|
|
switch (ev->mode) {
|
|
|
|
CASESTRRET(NotifyNormal);
|
|
|
|
CASESTRRET(NotifyWhileGrabbed);
|
|
|
|
CASESTRRET(NotifyGrab);
|
|
|
|
CASESTRRET(NotifyUngrab);
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
2019-03-17 10:15:17 -04:00
|
|
|
static inline const char *attr_pure ev_focus_detail_name(xcb_focus_in_event_t *ev) {
|
2019-03-17 09:44:26 -04:00
|
|
|
switch (ev->detail) {
|
|
|
|
CASESTRRET(NotifyAncestor);
|
|
|
|
CASESTRRET(NotifyVirtual);
|
|
|
|
CASESTRRET(NotifyInferior);
|
|
|
|
CASESTRRET(NotifyNonlinear);
|
|
|
|
CASESTRRET(NotifyNonlinearVirtual);
|
|
|
|
CASESTRRET(NotifyPointer);
|
|
|
|
CASESTRRET(NotifyPointerRoot);
|
|
|
|
CASESTRRET(NotifyDetailNone);
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
|
2020-03-31 00:46:28 -04:00
|
|
|
#undef CASESTRRET
|
|
|
|
|
2019-03-17 10:15:17 -04:00
|
|
|
static inline void ev_focus_in(session_t *ps, xcb_focus_in_event_t *ev) {
|
2019-04-19 16:15:00 -04:00
|
|
|
log_debug("{ mode: %s, detail: %s }\n", ev_focus_mode_name(ev),
|
2019-03-17 09:44:26 -04:00
|
|
|
ev_focus_detail_name(ev));
|
2019-05-24 19:06:41 -04:00
|
|
|
ps->pending_updates = true;
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ev_focus_out(session_t *ps, xcb_focus_out_event_t *ev) {
|
2019-04-19 16:15:00 -04:00
|
|
|
log_debug("{ mode: %s, detail: %s }\n", ev_focus_mode_name(ev),
|
2019-03-17 10:15:17 -04:00
|
|
|
ev_focus_detail_name(ev));
|
2019-05-24 19:06:41 -04:00
|
|
|
ps->pending_updates = true;
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ev_create_notify(session_t *ps, xcb_create_notify_event_t *ev) {
|
2020-04-09 22:26:13 -04:00
|
|
|
if (ev->parent == ps->root) {
|
|
|
|
add_win_top(ps, ev->window);
|
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
2019-04-27 08:36:42 -04:00
|
|
|
/// Handle configure event of a regular window
|
|
|
|
static void configure_win(session_t *ps, xcb_configure_notify_event_t *ce) {
|
|
|
|
auto w = find_win(ps, ce->window);
|
|
|
|
|
|
|
|
if (!w) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!w->managed) {
|
|
|
|
restack_above(ps, w, ce->above_sibling);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto mw = (struct managed_win *)w;
|
|
|
|
|
|
|
|
if (mw->state == WSTATE_UNMAPPED || mw->state == WSTATE_UNMAPPING ||
|
|
|
|
mw->state == WSTATE_DESTROYING) {
|
|
|
|
// Only restack the window to make sure we can handle future restack
|
|
|
|
// notification correctly
|
|
|
|
restack_above(ps, w, ce->above_sibling);
|
|
|
|
} else {
|
|
|
|
restack_above(ps, w, ce->above_sibling);
|
|
|
|
|
|
|
|
// If window geometry change, free old extents
|
|
|
|
if (mw->g.x != ce->x || mw->g.y != ce->y || mw->g.width != ce->width ||
|
|
|
|
mw->g.height != ce->height || mw->g.border_width != ce->border_width) {
|
2020-10-22 23:11:52 -04:00
|
|
|
// We don't mark the old region as damaged if we have stale
|
|
|
|
// shape/size/position information. The old region should have
|
|
|
|
// already been add to damage when the information became stale.
|
|
|
|
if (!win_check_flags_any(
|
|
|
|
mw, WIN_FLAGS_SIZE_STALE | WIN_FLAGS_POSITION_STALE)) {
|
|
|
|
// Mark the old extents as damaged.
|
|
|
|
// The new extents will be marked damaged when processing
|
|
|
|
// window flags.
|
|
|
|
region_t damage;
|
|
|
|
pixman_region32_init(&damage);
|
|
|
|
win_extents(mw, &damage);
|
|
|
|
add_damage(ps, &damage);
|
|
|
|
pixman_region32_fini(&damage);
|
|
|
|
}
|
2020-10-22 20:27:55 -04:00
|
|
|
|
|
|
|
// Queue pending updates
|
|
|
|
win_set_flags(mw, WIN_FLAGS_FACTOR_CHANGED);
|
|
|
|
ps->pending_updates = true;
|
|
|
|
|
2020-10-22 23:11:52 -04:00
|
|
|
// At least one of the following if's is true
|
|
|
|
if (mw->g.x != ce->x || mw->g.y != ce->y) {
|
|
|
|
log_trace("Window position changed, %dx%d -> %dx%d",
|
|
|
|
mw->g.x, mw->g.y, ce->x, ce->y);
|
|
|
|
mw->g.x = ce->x;
|
|
|
|
mw->g.y = ce->y;
|
|
|
|
win_set_flags(mw, WIN_FLAGS_POSITION_STALE);
|
|
|
|
}
|
2020-10-22 20:27:55 -04:00
|
|
|
|
|
|
|
if (mw->g.width != ce->width || mw->g.height != ce->height ||
|
|
|
|
mw->g.border_width != ce->border_width) {
|
|
|
|
log_trace("Window size changed, %dx%d -> %dx%d",
|
|
|
|
mw->g.width, mw->g.height, ce->width, ce->height);
|
|
|
|
mw->g.width = ce->width;
|
|
|
|
mw->g.height = ce->height;
|
|
|
|
mw->g.border_width = ce->border_width;
|
|
|
|
win_set_flags(mw, WIN_FLAGS_SIZE_STALE);
|
|
|
|
}
|
2019-04-27 08:36:42 -04:00
|
|
|
|
2020-10-22 20:27:55 -04:00
|
|
|
// Recalculate which screen this window is on
|
|
|
|
win_update_screen(ps->xinerama_nscrs, ps->xinerama_scr_regs, mw);
|
2019-04-27 08:36:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// override_redirect flag cannot be changed after window creation, as far
|
|
|
|
// as I know, so there's no point to re-match windows here.
|
|
|
|
mw->a.override_redirect = ce->override_redirect;
|
|
|
|
}
|
|
|
|
|
2019-03-17 09:44:26 -04:00
|
|
|
static inline void ev_configure_notify(session_t *ps, xcb_configure_notify_event_t *ev) {
|
2019-04-19 16:15:00 -04:00
|
|
|
log_debug("{ send_event: %d, id: %#010x, above: %#010x, override_redirect: %d }",
|
2019-03-17 09:44:26 -04:00
|
|
|
ev->event, ev->window, ev->above_sibling, ev->override_redirect);
|
|
|
|
if (ev->window == ps->root) {
|
core: delayed handling of root ConfigureNotify
Previously, root ConfigureNotify is handled immediately, by resetting
the backend, which in turn releases all the window images. This puts all
the windows into a state where they don't have images attached, which
they really should be in when the screen is redirected.
(To expand a little, a window without images should only exist if:
* It's an unmanaged window.
* Screen is unredirected.)
Normally, this kind of window could be fine, as the next render phase
will re-acquire images for them. However, if a window in this state is
destroyed with fading enabled, then the render phase won't try to
acquire images for it, causing it to go into the main rendering function
without images attached, and trigger an assertion.
This commit delays the handling of root ConfigureNotify until the render
phase. This way, the images will be immediately re-acquired after they
are released, thus prevent this problem from happening.
Also adds a testcase for this.
Fixes #357
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-31 00:01:14 -04:00
|
|
|
set_root_flags(ps, ROOT_FLAGS_CONFIGURED);
|
2019-03-17 09:44:26 -04:00
|
|
|
} else {
|
|
|
|
configure_win(ps, ev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ev_destroy_notify(session_t *ps, xcb_destroy_notify_event_t *ev) {
|
2019-04-18 21:15:31 -04:00
|
|
|
auto w = find_win(ps, ev->window);
|
2020-04-09 22:26:13 -04:00
|
|
|
auto mw = find_toplevel(ps, ev->window);
|
|
|
|
if (mw && mw->client_win == mw->base.id) {
|
|
|
|
// We only want _real_ frame window
|
|
|
|
assert(&mw->base == w);
|
|
|
|
mw = NULL;
|
|
|
|
}
|
|
|
|
assert(w == NULL || mw == NULL);
|
|
|
|
|
|
|
|
if (w != NULL) {
|
2019-09-19 20:41:56 -04:00
|
|
|
auto _ attr_unused = destroy_win_start(ps, w);
|
2020-04-09 22:26:13 -04:00
|
|
|
} else if (mw != NULL) {
|
2020-04-10 21:35:21 -04:00
|
|
|
win_unmark_client(ps, mw);
|
|
|
|
win_set_flags(mw, WIN_FLAGS_CLIENT_STALE);
|
2020-04-10 21:53:37 -04:00
|
|
|
ps->pending_updates = true;
|
2020-04-09 22:26:13 -04:00
|
|
|
} else {
|
|
|
|
log_debug("Received a destroy notify from an unknown window, %#010x",
|
|
|
|
ev->window);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ev_map_notify(session_t *ps, xcb_map_notify_event_t *ev) {
|
2019-09-19 12:26:09 -04:00
|
|
|
// Unmap overlay window if it got mapped but we are currently not
|
|
|
|
// in redirected state.
|
|
|
|
if (ps->overlay && ev->window == ps->overlay && !ps->redirected) {
|
|
|
|
log_debug("Overlay is mapped while we are not redirected");
|
|
|
|
auto e = xcb_request_check(ps->c, xcb_unmap_window(ps->c, ps->overlay));
|
|
|
|
if (e) {
|
|
|
|
log_error("Failed to unmap the overlay window");
|
|
|
|
free(e);
|
|
|
|
}
|
|
|
|
// We don't track the overlay window, so we can return
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto w = find_managed_win(ps, ev->window);
|
|
|
|
if (!w) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-04-06 15:52:32 -04:00
|
|
|
win_set_flags(w, WIN_FLAGS_MAPPED);
|
2019-09-19 12:26:09 -04:00
|
|
|
|
2019-03-17 09:44:26 -04:00
|
|
|
// FocusIn/Out may be ignored when the window is unmapped, so we must
|
|
|
|
// recheck focus here
|
2019-09-16 18:27:59 -04:00
|
|
|
ps->pending_updates = true; // to update focus
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ev_unmap_notify(session_t *ps, xcb_unmap_notify_event_t *ev) {
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_managed_win(ps, ev->window);
|
2019-03-17 09:44:26 -04:00
|
|
|
if (w) {
|
2019-09-19 20:41:56 -04:00
|
|
|
unmap_win_start(ps, w);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ev_reparent_notify(session_t *ps, xcb_reparent_notify_event_t *ev) {
|
2020-04-05 15:45:26 -04:00
|
|
|
log_debug("Window %#010x has new parent: %#010x, override_redirect: %d",
|
|
|
|
ev->window, ev->parent, ev->override_redirect);
|
2020-04-05 16:07:59 -04:00
|
|
|
auto w_top = find_toplevel(ps, ev->window);
|
|
|
|
if (w_top) {
|
2020-04-10 21:16:33 -04:00
|
|
|
win_unmark_client(ps, w_top);
|
2020-04-10 20:05:52 -04:00
|
|
|
win_set_flags(w_top, WIN_FLAGS_CLIENT_STALE);
|
|
|
|
ps->pending_updates = true;
|
2020-04-05 16:07:59 -04:00
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
|
|
|
|
if (ev->parent == ps->root) {
|
2019-04-27 08:36:42 -04:00
|
|
|
// X will generate reparent notifiy even if the parent didn't actually
|
|
|
|
// change (i.e. reparent again to current parent). So we check if that's
|
|
|
|
// the case
|
|
|
|
auto w = find_win(ps, ev->window);
|
|
|
|
if (w) {
|
|
|
|
// This window has already been reparented to root before,
|
|
|
|
// so we don't need to create a new window for it, we just need to
|
|
|
|
// move it to the top
|
|
|
|
restack_top(ps, w);
|
|
|
|
} else {
|
|
|
|
add_win_top(ps, ev->window);
|
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
} else {
|
|
|
|
// otherwise, find and destroy the window first
|
2019-09-19 20:23:44 -04:00
|
|
|
{
|
|
|
|
auto w = find_win(ps, ev->window);
|
|
|
|
if (w) {
|
2020-04-10 21:23:58 -04:00
|
|
|
auto ret = destroy_win_start(ps, w);
|
|
|
|
if (!ret && w->managed) {
|
|
|
|
auto mw = (struct managed_win *)w;
|
|
|
|
CHECK(win_skip_fading(ps, mw));
|
|
|
|
}
|
2019-04-18 21:15:31 -04:00
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Reset event mask in case something wrong happens
|
|
|
|
xcb_change_window_attributes(
|
|
|
|
ps->c, ev->window, XCB_CW_EVENT_MASK,
|
|
|
|
(const uint32_t[]){determine_evmask(ps, ev->window, WIN_EVMODE_UNKNOWN)});
|
|
|
|
|
2020-04-09 20:44:33 -04:00
|
|
|
if (!wid_has_prop(ps, ev->window, ps->atoms->aWM_STATE)) {
|
|
|
|
log_debug("Window %#010x doesn't have WM_STATE property, it is "
|
|
|
|
"probably not a client window. But we will listen for "
|
|
|
|
"property change in case it gains one.",
|
|
|
|
ev->window);
|
|
|
|
xcb_change_window_attributes(
|
|
|
|
ps->c, ev->window, XCB_CW_EVENT_MASK,
|
|
|
|
(const uint32_t[]){determine_evmask(ps, ev->window, WIN_EVMODE_UNKNOWN) |
|
|
|
|
XCB_EVENT_MASK_PROPERTY_CHANGE});
|
|
|
|
} else {
|
2020-04-06 15:22:54 -04:00
|
|
|
auto w_real_top = find_managed_window_or_parent(ps, ev->parent);
|
2020-04-09 20:44:33 -04:00
|
|
|
if (w_real_top && w_real_top->state != WSTATE_UNMAPPED &&
|
|
|
|
w_real_top->state != WSTATE_UNMAPPING) {
|
|
|
|
log_debug("Mark window %#010x (%s) as having a stale "
|
|
|
|
"client",
|
|
|
|
w_real_top->base.id, w_real_top->name);
|
|
|
|
win_set_flags(w_real_top, WIN_FLAGS_CLIENT_STALE);
|
|
|
|
ps->pending_updates = true;
|
|
|
|
} else {
|
|
|
|
if (!w_real_top)
|
|
|
|
log_debug("parent %#010x not found", ev->parent);
|
2019-03-17 09:44:26 -04:00
|
|
|
else {
|
2020-04-09 20:44:33 -04:00
|
|
|
// Window is not currently mapped, unmark its
|
|
|
|
// client to trigger a client recheck when it is
|
|
|
|
// mapped later.
|
|
|
|
win_unmark_client(ps, w_real_top);
|
|
|
|
log_debug("parent %#010x (%s) is in state %d",
|
|
|
|
w_real_top->base.id, w_real_top->name,
|
|
|
|
w_real_top->state);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ev_circulate_notify(session_t *ps, xcb_circulate_notify_event_t *ev) {
|
2019-04-27 08:36:42 -04:00
|
|
|
auto w = find_win(ps, ev->window);
|
|
|
|
|
|
|
|
if (!w)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (ev->place == PlaceOnTop) {
|
|
|
|
restack_top(ps, w);
|
|
|
|
} else {
|
|
|
|
restack_bottom(ps, w);
|
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void expose_root(session_t *ps, const rect_t *rects, int nrects) {
|
|
|
|
region_t region;
|
|
|
|
pixman_region32_init_rects(®ion, rects, nrects);
|
|
|
|
add_damage(ps, ®ion);
|
2020-09-05 11:42:24 -04:00
|
|
|
pixman_region32_fini(®ion);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ev_expose(session_t *ps, xcb_expose_event_t *ev) {
|
|
|
|
if (ev->window == ps->root || (ps->overlay && ev->window == ps->overlay)) {
|
|
|
|
int more = ev->count + 1;
|
|
|
|
if (ps->n_expose == ps->size_expose) {
|
|
|
|
if (ps->expose_rects) {
|
|
|
|
ps->expose_rects =
|
|
|
|
crealloc(ps->expose_rects, ps->size_expose + more);
|
|
|
|
ps->size_expose += more;
|
|
|
|
} else {
|
|
|
|
ps->expose_rects = ccalloc(more, rect_t);
|
|
|
|
ps->size_expose = more;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ps->expose_rects[ps->n_expose].x1 = ev->x;
|
|
|
|
ps->expose_rects[ps->n_expose].y1 = ev->y;
|
|
|
|
ps->expose_rects[ps->n_expose].x2 = ev->x + ev->width;
|
|
|
|
ps->expose_rects[ps->n_expose].y2 = ev->y + ev->height;
|
|
|
|
ps->n_expose++;
|
|
|
|
|
|
|
|
if (ev->count == 0) {
|
|
|
|
expose_root(ps, ps->expose_rects, ps->n_expose);
|
|
|
|
ps->n_expose = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t *ev) {
|
2019-03-17 10:15:17 -04:00
|
|
|
if (unlikely(log_get_level_tls() <= LOG_LEVEL_TRACE)) {
|
2019-03-17 09:44:26 -04:00
|
|
|
// Print out changed atom
|
|
|
|
xcb_get_atom_name_reply_t *reply =
|
|
|
|
xcb_get_atom_name_reply(ps->c, xcb_get_atom_name(ps->c, ev->atom), NULL);
|
|
|
|
const char *name = "?";
|
|
|
|
int name_len = 1;
|
|
|
|
if (reply) {
|
|
|
|
name = xcb_get_atom_name_name(reply);
|
|
|
|
name_len = xcb_get_atom_name_name_length(reply);
|
|
|
|
}
|
|
|
|
|
2019-04-19 16:15:00 -04:00
|
|
|
log_debug("{ atom = %.*s }", name_len, name);
|
2019-03-17 09:44:26 -04:00
|
|
|
free(reply);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps->root == ev->window) {
|
2019-09-16 18:27:59 -04:00
|
|
|
if (ps->o.use_ewmh_active_win && ps->atoms->a_NET_ACTIVE_WINDOW == ev->atom) {
|
2019-05-24 19:06:41 -04:00
|
|
|
// to update focus
|
|
|
|
ps->pending_updates = true;
|
2019-03-17 09:44:26 -04:00
|
|
|
} else {
|
|
|
|
// Destroy the root "image" if the wallpaper probably changed
|
|
|
|
if (x_is_root_back_pixmap_atom(ps, ev->atom)) {
|
|
|
|
root_damaged(ps);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unconcerned about any other proprties on root window
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-22 10:48:11 -04:00
|
|
|
ps->pending_updates = true;
|
2019-03-17 09:44:26 -04:00
|
|
|
// If WM_STATE changes
|
2019-05-05 19:34:08 -04:00
|
|
|
if (ev->atom == ps->atoms->aWM_STATE) {
|
2019-03-17 09:44:26 -04:00
|
|
|
// Check whether it could be a client window
|
|
|
|
if (!find_toplevel(ps, ev->window)) {
|
|
|
|
// Reset event mask anyway
|
|
|
|
xcb_change_window_attributes(ps->c, ev->window, XCB_CW_EVENT_MASK,
|
|
|
|
(const uint32_t[]){determine_evmask(
|
|
|
|
ps, ev->window, WIN_EVMODE_UNKNOWN)});
|
|
|
|
|
2020-04-05 16:20:58 -04:00
|
|
|
auto w_top = find_managed_window_or_parent(ps, ev->window);
|
2020-04-09 20:44:33 -04:00
|
|
|
// ev->window might have not been managed yet, in that case w_top
|
|
|
|
// would be NULL.
|
|
|
|
if (w_top) {
|
|
|
|
win_set_flags(w_top, WIN_FLAGS_CLIENT_STALE);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
}
|
2020-10-22 10:48:11 -04:00
|
|
|
return;
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// If _NET_WM_WINDOW_TYPE changes... God knows why this would happen, but
|
|
|
|
// there are always some stupid applications. (#144)
|
2019-05-05 19:34:08 -04:00
|
|
|
if (ev->atom == ps->atoms->a_NET_WM_WINDOW_TYPE) {
|
2019-04-17 18:14:45 -04:00
|
|
|
struct managed_win *w = NULL;
|
2020-10-22 10:48:11 -04:00
|
|
|
if ((w = find_toplevel(ps, ev->window))) {
|
|
|
|
win_set_property_stale(w, ev->atom);
|
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
2020-01-18 13:00:35 -05:00
|
|
|
if (ev->atom == ps->atoms->a_NET_WM_BYPASS_COMPOSITOR) {
|
|
|
|
// Unnecessay until we remove the queue_redraw in ev_handle
|
|
|
|
queue_redraw(ps);
|
|
|
|
}
|
|
|
|
|
2019-03-17 09:44:26 -04:00
|
|
|
// If _NET_WM_OPACITY changes
|
2019-05-05 19:34:08 -04:00
|
|
|
if (ev->atom == ps->atoms->a_NET_WM_WINDOW_OPACITY) {
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_managed_win(ps, ev->window) ?: find_toplevel(ps, ev->window);
|
2020-10-25 07:33:59 -04:00
|
|
|
if (w) {
|
|
|
|
win_set_property_stale(w, ev->atom);
|
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// If frame extents property changes
|
2019-05-05 19:34:08 -04:00
|
|
|
if (ps->o.frame_opacity > 0 && ev->atom == ps->atoms->a_NET_FRAME_EXTENTS) {
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_toplevel(ps, ev->window);
|
2019-03-17 09:44:26 -04:00
|
|
|
if (w) {
|
2020-10-22 10:48:11 -04:00
|
|
|
win_set_property_stale(w, ev->atom);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If name changes
|
2020-03-29 14:15:07 -04:00
|
|
|
if (ps->atoms->aWM_NAME == ev->atom || ps->atoms->a_NET_WM_NAME == ev->atom) {
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_toplevel(ps, ev->window);
|
2020-10-22 10:48:11 -04:00
|
|
|
if (w) {
|
|
|
|
win_set_property_stale(w, ev->atom);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If class changes
|
2020-03-29 14:15:07 -04:00
|
|
|
if (ps->atoms->aWM_CLASS == ev->atom) {
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_toplevel(ps, ev->window);
|
2019-03-17 09:44:26 -04:00
|
|
|
if (w) {
|
2020-10-22 10:48:11 -04:00
|
|
|
win_set_property_stale(w, ev->atom);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If role changes
|
2020-03-29 14:15:07 -04:00
|
|
|
if (ps->atoms->aWM_WINDOW_ROLE == ev->atom) {
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_toplevel(ps, ev->window);
|
2020-10-22 10:48:11 -04:00
|
|
|
if (w) {
|
|
|
|
win_set_property_stale(w, ev->atom);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If _COMPTON_SHADOW changes
|
2019-10-22 15:44:59 -04:00
|
|
|
if (ps->atoms->a_COMPTON_SHADOW == ev->atom) {
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_managed_win(ps, ev->window);
|
|
|
|
if (w) {
|
2020-10-22 10:48:11 -04:00
|
|
|
win_set_property_stale(w, ev->atom);
|
2019-04-17 18:14:45 -04:00
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// If a leader property changes
|
2019-05-05 19:34:08 -04:00
|
|
|
if ((ps->o.detect_transient && ps->atoms->aWM_TRANSIENT_FOR == ev->atom) ||
|
|
|
|
(ps->o.detect_client_leader && ps->atoms->aWM_CLIENT_LEADER == ev->atom)) {
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_toplevel(ps, ev->window);
|
2019-03-17 09:44:26 -04:00
|
|
|
if (w) {
|
2020-10-22 10:48:11 -04:00
|
|
|
win_set_property_stale(w, ev->atom);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check for other atoms we are tracking
|
|
|
|
for (latom_t *platom = ps->track_atom_lst; platom; platom = platom->next) {
|
|
|
|
if (platom->atom == ev->atom) {
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_managed_win(ps, ev->window);
|
2020-10-22 10:48:11 -04:00
|
|
|
if (!w) {
|
2019-03-17 09:44:26 -04:00
|
|
|
w = find_toplevel(ps, ev->window);
|
2020-10-22 10:48:11 -04:00
|
|
|
}
|
|
|
|
if (w) {
|
2020-10-22 20:51:28 -04:00
|
|
|
// Set FACTOR_CHANGED so rules based on properties will be
|
|
|
|
// re-evaluated.
|
|
|
|
// Don't need to set property stale here, since that only
|
|
|
|
// concerns properties we explicitly check.
|
|
|
|
win_set_flags(w, WIN_FLAGS_FACTOR_CHANGED);
|
2020-10-22 10:48:11 -04:00
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-17 18:14:45 -04:00
|
|
|
static inline void repair_win(session_t *ps, struct managed_win *w) {
|
2019-09-19 20:59:25 -04:00
|
|
|
// Only mapped window can receive damages
|
|
|
|
assert(win_is_mapped_in_x(w));
|
2019-03-17 09:44:26 -04:00
|
|
|
|
|
|
|
region_t parts;
|
|
|
|
pixman_region32_init(&parts);
|
|
|
|
|
|
|
|
if (!w->ever_damaged) {
|
|
|
|
win_extents(w, &parts);
|
|
|
|
set_ignore_cookie(
|
|
|
|
ps, xcb_damage_subtract(ps->c, w->damage, XCB_NONE, XCB_NONE));
|
|
|
|
} else {
|
2020-08-30 04:11:45 -04:00
|
|
|
set_ignore_cookie(
|
|
|
|
ps, xcb_damage_subtract(ps->c, w->damage, XCB_NONE, ps->damaged_region));
|
|
|
|
x_fetch_region(ps->c, ps->damaged_region, &parts);
|
2019-03-30 05:07:21 -04:00
|
|
|
pixman_region32_translate(&parts, w->g.x + w->g.border_width,
|
|
|
|
w->g.y + w->g.border_width);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
w->ever_damaged = true;
|
|
|
|
w->pixmap_damaged = true;
|
|
|
|
|
|
|
|
// Why care about damage when screen is unredirected?
|
|
|
|
// We will force full-screen repaint on redirection.
|
|
|
|
if (!ps->redirected) {
|
|
|
|
pixman_region32_fini(&parts);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove the part in the damage area that could be ignored
|
2020-10-22 23:11:52 -04:00
|
|
|
if (w->reg_ignore && win_is_region_ignore_valid(ps, w)) {
|
2019-03-17 09:44:26 -04:00
|
|
|
pixman_region32_subtract(&parts, &parts, w->reg_ignore);
|
2020-10-22 23:11:52 -04:00
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
|
|
|
|
add_damage(ps, &parts);
|
|
|
|
pixman_region32_fini(&parts);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ev_damage_notify(session_t *ps, xcb_damage_notify_event_t *de) {
|
|
|
|
/*
|
|
|
|
if (ps->root == de->drawable) {
|
|
|
|
root_damaged();
|
|
|
|
return;
|
|
|
|
} */
|
|
|
|
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_managed_win(ps, de->drawable);
|
2019-03-17 09:44:26 -04:00
|
|
|
|
2019-04-17 18:14:45 -04:00
|
|
|
if (!w) {
|
2019-03-17 09:44:26 -04:00
|
|
|
return;
|
2019-04-17 18:14:45 -04:00
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
|
|
|
|
repair_win(ps, w);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void ev_shape_notify(session_t *ps, xcb_shape_notify_event_t *ev) {
|
2019-04-17 18:14:45 -04:00
|
|
|
auto w = find_managed_win(ps, ev->affected_window);
|
|
|
|
if (!w || w->a.map_state == XCB_MAP_STATE_UNMAPPED) {
|
2019-03-17 09:44:26 -04:00
|
|
|
return;
|
2019-04-17 18:14:45 -04:00
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Empty bounding_shape may indicated an
|
|
|
|
* unmapped/destroyed window, in which case
|
|
|
|
* seemingly BadRegion errors would be triggered
|
|
|
|
* if we attempt to rebuild border_size
|
|
|
|
*/
|
2020-10-22 23:34:05 -04:00
|
|
|
// Mark the old bounding shape as damaged
|
|
|
|
if (!win_check_flags_any(w, WIN_FLAGS_SIZE_STALE | WIN_FLAGS_POSITION_STALE)) {
|
|
|
|
region_t tmp = win_get_bounding_shape_global_by_val(w);
|
|
|
|
add_damage(ps, &tmp);
|
|
|
|
pixman_region32_fini(&tmp);
|
|
|
|
}
|
2019-03-17 09:44:26 -04:00
|
|
|
w->reg_ignore_valid = false;
|
2020-10-22 23:34:05 -04:00
|
|
|
|
|
|
|
win_set_flags(w, WIN_FLAGS_SIZE_STALE);
|
|
|
|
ps->pending_updates = true;
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
ev_selection_clear(session_t *ps, xcb_selection_clear_event_t attr_unused *ev) {
|
|
|
|
// The only selection we own is the _NET_WM_CM_Sn selection.
|
|
|
|
// If we lose that one, we should exit.
|
|
|
|
log_fatal("Another composite manager started and took the _NET_WM_CM_Sn "
|
|
|
|
"selection.");
|
2019-10-23 14:27:30 -04:00
|
|
|
quit(ps);
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ev_handle(session_t *ps, xcb_generic_event_t *ev) {
|
|
|
|
if ((ev->response_type & 0x7f) != KeymapNotify) {
|
|
|
|
discard_ignore(ps, ev->full_sequence);
|
|
|
|
}
|
|
|
|
|
2019-04-19 16:15:00 -04:00
|
|
|
xcb_window_t wid = ev_window(ps, ev);
|
2019-03-17 09:44:26 -04:00
|
|
|
if (ev->response_type != ps->damage_event + XCB_DAMAGE_NOTIFY) {
|
2019-04-19 16:15:00 -04:00
|
|
|
log_debug("event %10.10s serial %#010x window %#010x \"%s\"",
|
|
|
|
ev_name(ps, ev), ev->full_sequence, wid, ev_window_name(ps, wid));
|
|
|
|
} else {
|
2019-03-17 10:15:17 -04:00
|
|
|
log_trace("event %10.10s serial %#010x window %#010x \"%s\"",
|
|
|
|
ev_name(ps, ev), ev->full_sequence, wid, ev_window_name(ps, wid));
|
2019-03-17 09:44:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check if a custom XEvent constructor was registered in xlib for this event
|
|
|
|
// type, and call it discarding the constructed XEvent if any. XESetWireToEvent
|
|
|
|
// might be used by libraries to intercept messages from the X server e.g. the
|
|
|
|
// OpenGL lib waiting for DRI2 events.
|
|
|
|
|
|
|
|
// XXX This exists to workaround compton issue #33, #34, #47
|
|
|
|
// For even more details, see:
|
|
|
|
// https://bugs.freedesktop.org/show_bug.cgi?id=35945
|
|
|
|
// https://lists.freedesktop.org/archives/xcb/2011-November/007337.html
|
|
|
|
auto proc = XESetWireToEvent(ps->dpy, ev->response_type, 0);
|
|
|
|
if (proc) {
|
|
|
|
XESetWireToEvent(ps->dpy, ev->response_type, proc);
|
|
|
|
XEvent dummy;
|
|
|
|
|
|
|
|
// Stop Xlib from complaining about lost sequence numbers.
|
|
|
|
// proc might also just be Xlib internal event processing functions, and
|
|
|
|
// because they probably won't see all X replies, they will complain about
|
|
|
|
// missing sequence numbers.
|
|
|
|
//
|
|
|
|
// We only need the low 16 bits
|
|
|
|
ev->sequence = (uint16_t)(LastKnownRequestProcessed(ps->dpy) & 0xffff);
|
|
|
|
proc(ps->dpy, &dummy, (xEvent *)ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
// XXX redraw needs to be more fine grained
|
|
|
|
queue_redraw(ps);
|
|
|
|
|
|
|
|
switch (ev->response_type) {
|
|
|
|
case FocusIn: ev_focus_in(ps, (xcb_focus_in_event_t *)ev); break;
|
|
|
|
case FocusOut: ev_focus_out(ps, (xcb_focus_out_event_t *)ev); break;
|
|
|
|
case CreateNotify: ev_create_notify(ps, (xcb_create_notify_event_t *)ev); break;
|
|
|
|
case ConfigureNotify:
|
|
|
|
ev_configure_notify(ps, (xcb_configure_notify_event_t *)ev);
|
|
|
|
break;
|
|
|
|
case DestroyNotify:
|
|
|
|
ev_destroy_notify(ps, (xcb_destroy_notify_event_t *)ev);
|
|
|
|
break;
|
|
|
|
case MapNotify: ev_map_notify(ps, (xcb_map_notify_event_t *)ev); break;
|
|
|
|
case UnmapNotify: ev_unmap_notify(ps, (xcb_unmap_notify_event_t *)ev); break;
|
|
|
|
case ReparentNotify:
|
|
|
|
ev_reparent_notify(ps, (xcb_reparent_notify_event_t *)ev);
|
|
|
|
break;
|
|
|
|
case CirculateNotify:
|
|
|
|
ev_circulate_notify(ps, (xcb_circulate_notify_event_t *)ev);
|
|
|
|
break;
|
|
|
|
case Expose: ev_expose(ps, (xcb_expose_event_t *)ev); break;
|
|
|
|
case PropertyNotify:
|
|
|
|
ev_property_notify(ps, (xcb_property_notify_event_t *)ev);
|
|
|
|
break;
|
|
|
|
case SelectionClear:
|
|
|
|
ev_selection_clear(ps, (xcb_selection_clear_event_t *)ev);
|
|
|
|
break;
|
|
|
|
case 0: ev_xcb_error(ps, (xcb_generic_error_t *)ev); break;
|
|
|
|
default:
|
|
|
|
if (ps->shape_exists && ev->response_type == ps->shape_event) {
|
|
|
|
ev_shape_notify(ps, (xcb_shape_notify_event_t *)ev);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (ps->randr_exists &&
|
|
|
|
ev->response_type == (ps->randr_event + XCB_RANDR_SCREEN_CHANGE_NOTIFY)) {
|
2019-03-17 11:17:48 -04:00
|
|
|
set_root_flags(ps, ROOT_FLAGS_SCREEN_CHANGE);
|
2019-03-17 09:44:26 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (ps->damage_event + XCB_DAMAGE_NOTIFY == ev->response_type) {
|
|
|
|
ev_damage_notify(ps, (xcb_damage_notify_event_t *)ev);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|