~earboxer/suggpicker

1da3d9e8aa36d620cffab1861409f49b7e18cf94 — Zach DeCook 2 years ago d04f7e0
kbd: don't send time
3 files changed, 17 insertions(+), 17 deletions(-)

M keyboard.c
M keyboard.h
M main.c
M keyboard.c => keyboard.c +5 -5
@@ 65,7 65,7 @@ kbd_get_key(struct kbd *kb, uint32_t x, uint32_t y) {
}

void
kbd_unpress_key(struct kbd *kb, uint32_t time) {
kbd_unpress_key(struct kbd *kb) {
	if (kb->last_press) {
		kbd_draw_key(kb, kb->last_press, Unpress);
		kb->last_press = NULL;


@@ 73,8 73,8 @@ kbd_unpress_key(struct kbd *kb, uint32_t time) {
}

void
kbd_release_key(struct kbd *kb, uint32_t time) {
	kbd_unpress_key(kb, time);
kbd_release_key(struct kbd *kb) {
	kbd_unpress_key(kb);
	printf("\n");
	// Important so autocompleted words get typed in time
	fflush(stdout);


@@ 82,12 82,12 @@ kbd_release_key(struct kbd *kb, uint32_t time) {
}

void
kbd_motion_key(struct kbd *kb, uint32_t time, uint32_t x, uint32_t y) {
kbd_motion_key(struct kbd *kb, uint32_t x, uint32_t y) {

}

void
kbd_press_key(struct kbd *kb, struct key *k, uint32_t time) {
kbd_press_key(struct kbd *kb, struct key *k) {
	if (k->label) {
		kb->last_press = k;
		kbd_draw_key(kb, k, Press);

M keyboard.h => keyboard.h +4 -4
@@ 54,10 54,10 @@ void draw_over_inset(struct drwsurf *ds, uint32_t x, uint32_t y, uint32_t width,
void kbd_init(struct kbd *kb);
void kbd_init_suggs(struct key *suggs, uint32_t width, uint32_t height);
struct key *kbd_get_key(struct kbd *kb, uint32_t x, uint32_t y);
void kbd_unpress_key(struct kbd *kb, uint32_t time);
void kbd_release_key(struct kbd *kb, uint32_t time);
void kbd_motion_key(struct kbd *kb, uint32_t time, uint32_t x, uint32_t y);
void kbd_press_key(struct kbd *kb, struct key *k, uint32_t time);
void kbd_unpress_key(struct kbd *kb);
void kbd_release_key(struct kbd *kb);
void kbd_motion_key(struct kbd *kb, uint32_t x, uint32_t y);
void kbd_press_key(struct kbd *kb, struct key *k);
void kbd_draw_key(struct kbd *kb, struct key *k, enum key_draw_type);
void kbd_draw_layout(struct kbd *kb);
void kbd_resize(struct kbd *kb);

M main.c => main.c +8 -8
@@ 147,18 147,18 @@ wl_touch_down(void *data, struct wl_touch *wl_touch, uint32_t serial,
	touch_x = wl_fixed_to_int(x);
	touch_y = wl_fixed_to_int(y);

	kbd_unpress_key(&keyboard, time);
	kbd_unpress_key(&keyboard);

	next_key = kbd_get_key(&keyboard, touch_x, touch_y);
	if (next_key) {
		kbd_press_key(&keyboard, next_key, time);
		kbd_press_key(&keyboard, next_key);
	}
}

void
wl_touch_up(void *data, struct wl_touch *wl_touch, uint32_t serial,
            uint32_t time, int32_t id) {
	kbd_release_key(&keyboard, time);
	kbd_release_key(&keyboard);
}

void


@@ 169,7 169,7 @@ wl_touch_motion(void *data, struct wl_touch *wl_touch, uint32_t time,
	touch_x = wl_fixed_to_int(x);
	touch_y = wl_fixed_to_int(y);

	kbd_motion_key(&keyboard, time, touch_x, touch_y);
	kbd_motion_key(&keyboard, touch_x, touch_y);
}

void


@@ 204,7 204,7 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer, uint32_t time,
	cur_y = wl_fixed_to_int(surface_y);

	if (cur_press) {
		kbd_motion_key(&keyboard, time, cur_x, cur_y);
		kbd_motion_key(&keyboard, cur_x, cur_y);
	}
}



@@ 215,15 215,15 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, uint32_t serial,
	cur_press = state == WL_POINTER_BUTTON_STATE_PRESSED;

	if (cur_press) {
		kbd_unpress_key(&keyboard, time);
		kbd_unpress_key(&keyboard);
	} else {
		kbd_release_key(&keyboard, time);
		kbd_release_key(&keyboard);
	}

	if (cur_press && cur_x >= 0 && cur_y >= 0) {
		next_key = kbd_get_key(&keyboard, cur_x, cur_y);
		if (next_key) {
			kbd_press_key(&keyboard, next_key, time);
			kbd_press_key(&keyboard, next_key);
		}
	}
}