24#ifndef __INTERACTIVE_H__
25#define __INTERACTIVE_H__
27#include <libbase/libbase.h>
29#define WLR_USE_UNSTABLE
30#include <wlr/types/wlr_buffer.h>
31#include <wlr/types/wlr_pointer.h>
32#include <wlr/types/wlr_scene.h>
33#undef WLR_USE_UNSTABLE
62 struct wlr_pointer_button_event *wlr_pointer_button_event_ptr);
108 struct wlr_scene_buffer *wlr_scene_buffer_ptr,
110 struct wlr_buffer *initial_wlr_buffer_ptr);
120 struct wlr_buffer *wlr_buffer_ptr);
133 double x,
double y) {
134 return (0 <= x && x < interactive_ptr->width &&
135 0 <= y && y < interactive_ptr->height);
145 if (!interactive_ptr->
focussed)
return;
146 interactive_ptr->
impl->
enter(interactive_ptr);
161 interactive_ptr->
focussed = focussed;
163 interactive_ptr->
impl->
focus(interactive_ptr);
174 interactive_ptr->
impl->
leave(interactive_ptr);
186 double x,
double y) {
187 if (!interactive_ptr->
focussed)
return;
188 interactive_ptr->
impl->
motion(interactive_ptr, x, y);
206 struct wlr_pointer_button_event *wlr_pointer_button_event_ptr) {
208 interactive_ptr, x, y, wlr_pointer_button_event_ptr);
220 const void *key_ptr);
237 bs_avltree_node_t *node_ptr);
static void wlmaker_interactive_focus(wlmaker_interactive_t *interactive_ptr, bool focussed)
Definition interactive.h:158
void wlmaker_interactive_init(wlmaker_interactive_t *interactive_ptr, const wlmaker_interactive_impl_t *impl_ptr, struct wlr_scene_buffer *wlr_scene_buffer_ptr, wlmaker_cursor_t *cursor_ptr, struct wlr_buffer *initial_wlr_buffer_ptr)
Definition interactive.c:30
wlmaker_interactive_t * wlmaker_interactive_from_avlnode(bs_avltree_node_t *node_ptr)
Definition interactive.c:87
int wlmaker_interactive_node_cmp(const bs_avltree_node_t *node_ptr, const void *key_ptr)
Definition interactive.c:64
static void wlmaker_interactive_motion(wlmaker_interactive_t *interactive_ptr, double x, double y)
Definition interactive.h:184
void(* wlmaker_interactive_callback_t)(wlmaker_interactive_t *interactive_ptr, void *data_ptr)
Definition interactive.h:68
static void wlmaker_interactive_button(wlmaker_interactive_t *interactive_ptr, double x, double y, struct wlr_pointer_button_event *wlr_pointer_button_event_ptr)
Definition interactive.h:203
void wlmaker_interactive_node_destroy(bs_avltree_node_t *node_ptr)
Definition interactive.c:80
static void wlmaker_interactive_leave(wlmaker_interactive_t *interactive_ptr)
Definition interactive.h:172
static void wlmaker_interactive_enter(wlmaker_interactive_t *interactive_ptr)
Definition interactive.h:143
static bool wlmaker_interactive_contains(const wlmaker_interactive_t *interactive_ptr, double x, double y)
Definition interactive.h:131
void wlmaker_interactive_set_texture(wlmaker_interactive_t *interactive_ptr, struct wlr_buffer *wlr_buffer_ptr)
Definition interactive.c:48
Definition interactive.h:73
wlmaker_cursor_t * cursor_ptr
Definition interactive.h:91
bool focussed
Definition interactive.h:81
const wlmaker_interactive_impl_t * impl
Definition interactive.h:75
struct wlr_scene_buffer * wlr_scene_buffer_ptr
Definition interactive.h:84
int height
Definition interactive.h:88
int width
Definition interactive.h:86
bs_avltree_node_t avlnode
Definition interactive.h:78
Definition interactive.h:45
void(* motion)(wlmaker_interactive_t *interactive_ptr, double x, double y)
Definition interactive.h:51
void(* leave)(wlmaker_interactive_t *interactive_ptr)
Definition interactive.h:49
void(* focus)(wlmaker_interactive_t *interactive_ptr)
Definition interactive.h:55
void(* button)(wlmaker_interactive_t *interactive_ptr, double x, double y, struct wlr_pointer_button_event *wlr_pointer_button_event_ptr)
Definition interactive.h:59
void(* enter)(wlmaker_interactive_t *interactive_ptr)
Definition interactive.h:47