#include <xcb/randr.h>
+/**
+ * Adds the sequence number of an event to the ignored events.
+ * Useful to ignore for example the enter notify caused by a pointer warp of
+ * i3.
+ *
+ */
+void add_ignore_event(const int sequence);
+
/**
* There was a key press. We compare this key code with our bindings table and
* pass the bound action to parse_command().
#include "workspace.h"
#include "config.h"
#include "log.h"
+#include "handlers.h"
/*
* Removes the given client from the container, either because it will be inserted into another
void client_warp_pointer_into(xcb_connection_t *conn, Client *client) {
int mid_x = client->rect.width / 2,
mid_y = client->rect.height / 2;
- xcb_warp_pointer(conn, XCB_NONE, client->child, 0, 0, 0, 0, mid_x, mid_y);
+ xcb_void_cookie_t cookie;
+ cookie = xcb_warp_pointer(conn, XCB_NONE, client->child, 0, 0, 0, 0, mid_x, mid_y);
+ /* We need to add this event twice because we get one enter_notify for
+ * the child and one for the frame */
+ add_ignore_event(cookie.sequence);
+ add_ignore_event(cookie.sequence);
}
/*
changing workspaces */
static SLIST_HEAD(ignore_head, Ignore_Event) ignore_events;
-static void add_ignore_event(const int sequence) {
+/*
+ * Adds the sequence number of an event to the ignored events.
+ * Useful to ignore for example the enter notify caused by a pointer warp of
+ * i3.
+ *
+ */
+void add_ignore_event(const int sequence) {
struct Ignore_Event *event = smalloc(sizeof(struct Ignore_Event));
event->sequence = sequence;
#include "log.h"
#include "ewmh.h"
#include "ipc.h"
+#include "handlers.h"
/*
* Returns a pointer to the workspace with the given number (starting at 0),
need_warp = true;
else {
Rect *dims = &(c_ws->output->rect);
- xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0,
+ xcb_void_cookie_t cookie;
+ cookie = xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0,
dims->x + (dims->width / 2), dims->y + (dims->height / 2));
+ add_ignore_event(cookie.sequence);
}
/* Re-decorate the old client, it’s not focused anymore */