changing workspaces */
static SLIST_HEAD(ignore_head, Ignore_Event) ignore_events;
-void add_ignore_event(const int sequence) {
+void add_ignore_event(const int sequence, const int response_type) {
struct Ignore_Event *event = smalloc(sizeof(struct Ignore_Event));
event->sequence = sequence;
+ event->response_type = response_type;
event->added = time(NULL);
SLIST_INSERT_HEAD(&ignore_events, event, ignore_events);
* Checks if the given sequence is ignored and returns true if so.
*
*/
-static bool event_is_ignored(const int sequence) {
+static bool event_is_ignored(const int sequence, const int response_type) {
struct Ignore_Event *event;
time_t now = time(NULL);
for (event = SLIST_FIRST(&ignore_events); event != SLIST_END(&ignore_events);) {
if (event->sequence != sequence)
continue;
+ if (event->response_type != 0 &&
+ event->response_type != response_type)
+ continue;
+
/* instead of removing a sequence number we better wait until it gets
* garbage collected. it may generate multiple events (there are multiple
* enter_notifies for one configure_request, for example). */
}
/* Some events are not interesting, because they were not generated
* actively by the user, but by reconfiguration of windows */
- if (event_is_ignored(event->sequence))
+ if (event_is_ignored(event->sequence, XCB_ENTER_NOTIFY)) {
+ DLOG("Event ignored\n");
return 1;
+ }
bool enter_child = false;
/* Get container by frame or by child window */
cookie = xcb_get_window_attributes_unchecked(conn, event->window);
DLOG("window = 0x%08x, serial is %d.\n", event->window, event->sequence);
- add_ignore_event(event->sequence);
+ add_ignore_event(event->sequence, 0);
manage_window(event->window, cookie, false);
x_push_changes(croot);
*
*/
static int handle_unmap_notify_event(xcb_unmap_notify_event_t *event) {
-
- /* FIXME: we cannot ignore this sequence because more UnmapNotifys with the same sequence
- * numbers but different window IDs may follow */
/* we need to ignore EnterNotify events which will be generated because a
* different window is visible now */
- //add_ignore_event(event->sequence);
+ add_ignore_event(event->sequence, XCB_ENTER_NOTIFY);
DLOG("UnmapNotify for 0x%08x (received from 0x%08x), serial %d\n", event->window, event->event, event->sequence);
Con *con = con_by_window_id(event->window);
cookie = xcb_map_window(conn, con->window->id);
DLOG("mapping child window (serial %d)\n", cookie.sequence);
/* Ignore enter_notifies which are generated when mapping */
- add_ignore_event(cookie.sequence);
+ add_ignore_event(cookie.sequence, 0);
state->child_mapped = true;
}
cookie = xcb_map_window(conn, con->frame);
DLOG("mapping container (serial %d)\n", cookie.sequence);
/* Ignore enter_notifies which are generated when mapping */
- add_ignore_event(cookie.sequence);
+ add_ignore_event(cookie.sequence, 0);
state->mapped = con->mapped;
}
DLOG("ignore_unmap for con %p (frame 0x%08x) now %d\n", con, con->frame, con->ignore_unmap);
}
/* Ignore enter_notifies which are generated when unmapping */
- add_ignore_event(cookie.sequence);
+ add_ignore_event(cookie.sequence, 0);
state->mapped = con->mapped;
}