mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-19 08:56:27 -05:00
Implement pointer motion and buttons
This commit is contained in:
parent
5b92d4fecf
commit
eaf6c0ccf4
7 changed files with 107 additions and 40 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#define _POSIX_C_SOURCE 199309L
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <wlr/types/wlr_box.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/types/wlr_gamma_control.h>
|
||||
|
|
@ -16,6 +17,34 @@ void view_destroy(struct roots_view *view) {
|
|||
free(view);
|
||||
}
|
||||
|
||||
void view_get_input_bounds(struct roots_view *view, struct wlr_box *box) {
|
||||
if (view->get_input_bounds) {
|
||||
view->get_input_bounds(view, box);
|
||||
return;
|
||||
}
|
||||
box->x = box->y = 0;
|
||||
}
|
||||
|
||||
void view_activate(struct roots_view *view, bool activate) {
|
||||
if (view->activate) {
|
||||
view->activate(view, activate);
|
||||
}
|
||||
}
|
||||
|
||||
struct roots_view *view_at(struct roots_desktop *desktop, int x, int y) {
|
||||
struct roots_view *view;
|
||||
wl_list_for_each(view, &desktop->views, link) {
|
||||
struct wlr_box box;
|
||||
view_get_input_bounds(view, &box);
|
||||
box.x += view->x;
|
||||
box.y += view->y;
|
||||
if (wlr_box_contains_point(&box, x, y)) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct roots_desktop *desktop_create(struct roots_server *server,
|
||||
struct roots_config *config) {
|
||||
struct roots_desktop *desktop = calloc(1, sizeof(struct roots_desktop));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue