wlmaker
Loading...
Searching...
No Matches
interactive.h File Reference
#include <libbase/libbase.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_pointer.h>
#include <wlr/types/wlr_scene.h>
#include "cursor.h"
Include dependency graph for interactive.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wlmaker_interactive_impl_t
 
struct  _wlmaker_interactive_t
 

Typedefs

typedef struct _wlmaker_interactive_t wlmaker_interactive_t
 
typedef void(* wlmaker_interactive_callback_t) (wlmaker_interactive_t *interactive_ptr, void *data_ptr)
 

Functions

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)
 
void wlmaker_interactive_set_texture (wlmaker_interactive_t *interactive_ptr, struct wlr_buffer *wlr_buffer_ptr)
 
static bool wlmaker_interactive_contains (const wlmaker_interactive_t *interactive_ptr, double x, double y)
 
static void wlmaker_interactive_enter (wlmaker_interactive_t *interactive_ptr)
 
static void wlmaker_interactive_focus (wlmaker_interactive_t *interactive_ptr, bool focussed)
 
static void wlmaker_interactive_leave (wlmaker_interactive_t *interactive_ptr)
 
static void wlmaker_interactive_motion (wlmaker_interactive_t *interactive_ptr, double x, double y)
 
static void wlmaker_interactive_button (wlmaker_interactive_t *interactive_ptr, double x, double y, struct wlr_pointer_button_event *wlr_pointer_button_event_ptr)
 
int wlmaker_interactive_node_cmp (const bs_avltree_node_t *node_ptr, const void *key_ptr)
 
void wlmaker_interactive_node_destroy (bs_avltree_node_t *node_ptr)
 
wlmaker_interactive_twlmaker_interactive_from_avlnode (bs_avltree_node_t *node_ptr)
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Abstract interface for interactive elements used in wlmaker: Buttons, title bar and resize bar elements. It is used as a common interface to pass along cursor motion and button events.

Typedef Documentation

◆ wlmaker_interactive_callback_t

typedef void(* wlmaker_interactive_callback_t) (wlmaker_interactive_t *interactive_ptr, void *data_ptr)

Callback for when an interactive element needs to trigger an action.

◆ wlmaker_interactive_t

Handle for the interactive.

Function Documentation

◆ wlmaker_interactive_button()

static void wlmaker_interactive_button ( wlmaker_interactive_t * interactive_ptr,
double x,
double y,
struct wlr_pointer_button_event * wlr_pointer_button_event_ptr )
inlinestatic

Call when there is a button event for the interactive.

Called when a button is pressed while over the interactive. But also for any button release event (of the entire server), in order to wrap up state of clickable actions.

Parameters
interactive_ptr
xNew cursor x pos, relative to the interactive.
yNew cursor y pos, relative to the interactive.
wlr_pointer_button_event_ptr

◆ wlmaker_interactive_contains()

static bool wlmaker_interactive_contains ( const wlmaker_interactive_t * interactive_ptr,
double x,
double y )
inlinestatic

Returns whether the interactive contains |x|, |y| in relative coordinates.

Parameters
interactive_ptr
x
y
Returns
True if |x|, |y| is within [0, |width|), [0, |height|).

◆ wlmaker_interactive_enter()

static void wlmaker_interactive_enter ( wlmaker_interactive_t * interactive_ptr)
inlinestatic

Call when the cursor enters the interactive area.

Parameters
interactive_ptr

◆ wlmaker_interactive_focus()

static void wlmaker_interactive_focus ( wlmaker_interactive_t * interactive_ptr,
bool focussed )
inlinestatic

Call to specify whether the view containing the interactive is focussed.

This is used to adjust eg. the decoration style to focussed or blurred windows.

Parameters
interactive_ptr
focussed

◆ wlmaker_interactive_from_avlnode()

wlmaker_interactive_t * wlmaker_interactive_from_avlnode ( bs_avltree_node_t * node_ptr)

Cast the AVL tree node to the wlmaker_interactive_t.

Parameters
node_ptr
Returns
The interactive of this node.

◆ wlmaker_interactive_init()

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 )

Initializes the interactive.

Parameters
interactive_ptr
impl_ptr
wlr_scene_buffer_ptrBuffer scene node to contain the button. Must outlive the interactive, not taking ownership.
cursor_ptr
initial_wlr_buffer_ptrTexture WLR buffer to initialize |wlr_scene_buffer_ptr| from.

◆ wlmaker_interactive_leave()

static void wlmaker_interactive_leave ( wlmaker_interactive_t * interactive_ptr)
inlinestatic

Call when the cursor leaves the interactive area.

Parameters
interactive_ptr

◆ wlmaker_interactive_motion()

static void wlmaker_interactive_motion ( wlmaker_interactive_t * interactive_ptr,
double x,
double y )
inlinestatic

Call when the cursor moves in the interactive area.

Parameters
interactive_ptr
xNew cursor x pos, relative to the interactive.
yNew cursor y pos, relative to the interactive.

◆ wlmaker_interactive_node_cmp()

int wlmaker_interactive_node_cmp ( const bs_avltree_node_t * node_ptr,
const void * key_ptr )

AVL tree comparator: Compares the wlr_scene_buffer.node pointers.

Parameters
node_ptr
key_ptr
Returns
-1 if less, 0 if equal, 1 if larger.

◆ wlmaker_interactive_node_destroy()

void wlmaker_interactive_node_destroy ( bs_avltree_node_t * node_ptr)

Destroy the avl tree node, ie. the interactive at this node.

Parameters
node_ptr

◆ wlmaker_interactive_set_texture()

void wlmaker_interactive_set_texture ( wlmaker_interactive_t * interactive_ptr,
struct wlr_buffer * wlr_buffer_ptr )

Sets this interactive's texture. Also updates dimensions accordingly.

Parameters
interactive_ptr
wlr_buffer_ptr