Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize cursor position #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ static Window last_avoided = None;
/* Forward declarations */
static void event_init_x_loop(void);
static void event_init_timer(void);
static void event_init_cursor_pos(void);
static void x_cb(EV_P_ ev_io *w, int revents);
static void x_check_cb(EV_P_ ev_check *w, int revents);
static void idle_cb(EV_P_ ev_timer *w, int revents);
static void event_select_xi(void);

void event_init(void) {
event_select_xi();
event_init_cursor_pos();

loop = EV_DEFAULT;
event_init_x_loop();

if (config.timeout >= 0.0) {
event_init_timer();
}
Expand All @@ -46,6 +48,16 @@ static void event_init_timer(void) {
ev_timer_start(loop, idle_watcher);
}

static void event_init_cursor_pos(void) {
Window child;
int root_x, root_y;

cursor_find(&child, &root_x, &root_y);

last_cursor_pos.x = root_x;
last_cursor_pos.y = root_y;
}

static void x_cb(EV_P_ ev_io *w, int revents) {
/* Deliberately empty. */
}
Expand Down