Add view_resize

This commit is contained in:
emersion 2017-09-30 11:57:39 +02:00
parent 97679b8e12
commit 33a97576ca
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
5 changed files with 30 additions and 8 deletions

View file

@ -30,10 +30,12 @@ void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor,
}
void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,
struct roots_view *view) {
struct roots_view *view, uint32_t edges) {
input->mode = ROOTS_CURSOR_RESIZE;
input->offs_x = cursor->x - view->x;
input->offs_y = cursor->y - view->y;
wlr_log(L_DEBUG, "begin resize");
input->offs_x = cursor->x - (double)view->wlr_surface->current.width - view->x;
input->offs_y = cursor->y - (double)view->wlr_surface->current.height - view->y;
input->resize_edges = edges;
wlr_seat_pointer_clear_focus(input->wl_seat);
}
@ -61,9 +63,11 @@ void cursor_update_position(struct roots_input *input, uint32_t time) {
}
break;
case ROOTS_CURSOR_RESIZE:
// TODO: this is just for testing
if (input->active_view && input->active_view->type == ROOTS_XDG_SHELL_V6_VIEW) {
wlr_xdg_toplevel_v6_set_size(input->active_view->xdg_surface_v6, input->cursor->x - input->offs_x, input->cursor->y - input->offs_y);
if (input->active_view) {
// TODO: edges
uint32_t width = input->cursor->x - input->offs_x;
uint32_t height = input->cursor->y - input->offs_y;
view_resize(input->active_view, width, height);
}
break;
case ROOTS_CURSOR_ROTATE: