mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 17:31:28 +00:00
We somewhat more wlc_point now
Apparently I missed some cc @Cloudef
This commit is contained in:
parent
95442dac8d
commit
cd161aa985
|
@ -295,8 +295,8 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier
|
||||||
return EVENT_PASSTHROUGH;
|
return EVENT_PASSTHROUGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct wlc_origin *origin) {
|
static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct wlc_point *origin) {
|
||||||
struct wlc_origin new_origin = *origin;
|
struct wlc_point new_origin = *origin;
|
||||||
// Switch to adjacent output if touching output edge.
|
// Switch to adjacent output if touching output edge.
|
||||||
//
|
//
|
||||||
// Since this doesn't currently support moving windows between outputs we
|
// Since this doesn't currently support moving windows between outputs we
|
||||||
|
@ -338,7 +338,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct
|
||||||
|
|
||||||
|
|
||||||
static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers,
|
static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers,
|
||||||
uint32_t button, enum wlc_button_state state, const struct wlc_origin *origin) {
|
uint32_t button, enum wlc_button_state state, const struct wlc_point *origin) {
|
||||||
|
|
||||||
// Update view pointer is on
|
// Update view pointer is on
|
||||||
pointer_state.view = container_under_pointer();
|
pointer_state.view = container_under_pointer();
|
||||||
|
|
|
@ -162,9 +162,9 @@ static void reset_initial_sibling(void) {
|
||||||
pointer_state.mode = 0;
|
pointer_state.mode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pointer_position_set(struct wlc_origin *new_origin, bool force_focus) {
|
void pointer_position_set(struct wlc_point *new_origin, bool force_focus) {
|
||||||
struct wlc_origin origin;
|
struct wlc_point origin;
|
||||||
wlc_pointer_get_origin(&origin);
|
wlc_pointer_get_position(&origin);
|
||||||
pointer_state.delta.x = new_origin->x - origin.x;
|
pointer_state.delta.x = new_origin->x - origin.x;
|
||||||
pointer_state.delta.y = new_origin->y - origin.y;
|
pointer_state.delta.y = new_origin->y - origin.y;
|
||||||
|
|
||||||
|
@ -182,11 +182,11 @@ void pointer_position_set(struct wlc_origin *new_origin, bool force_focus) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlc_pointer_set_origin(new_origin);
|
wlc_pointer_set_position(new_origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void center_pointer_on(swayc_t *view) {
|
void center_pointer_on(swayc_t *view) {
|
||||||
struct wlc_origin new_origin;
|
struct wlc_point new_origin;
|
||||||
new_origin.x = view->x + view->width/2;
|
new_origin.x = view->x + view->width/2;
|
||||||
new_origin.y = view->y + view->height/2;
|
new_origin.y = view->y + view->height/2;
|
||||||
pointer_position_set(&new_origin, true);
|
pointer_position_set(&new_origin, true);
|
||||||
|
@ -214,8 +214,8 @@ static void pointer_mode_set_right(void) {
|
||||||
int midway_x = initial.ptr->x + initial.ptr->width/2;
|
int midway_x = initial.ptr->x + initial.ptr->width/2;
|
||||||
int midway_y = initial.ptr->y + initial.ptr->height/2;
|
int midway_y = initial.ptr->y + initial.ptr->height/2;
|
||||||
|
|
||||||
struct wlc_origin origin;
|
struct wlc_point origin;
|
||||||
wlc_pointer_get_origin(&origin);
|
wlc_pointer_get_position(&origin);
|
||||||
lock.left = origin.x > midway_x;
|
lock.left = origin.x > midway_x;
|
||||||
lock.top = origin.y > midway_y;
|
lock.top = origin.y > midway_y;
|
||||||
|
|
||||||
|
@ -279,8 +279,8 @@ void pointer_mode_update(void) {
|
||||||
pointer_state.mode = 0;
|
pointer_state.mode = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct wlc_origin origin;
|
struct wlc_point origin;
|
||||||
wlc_pointer_get_origin(&origin);
|
wlc_pointer_get_position(&origin);
|
||||||
int dx = origin.x;
|
int dx = origin.x;
|
||||||
int dy = origin.y;
|
int dy = origin.y;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue