wlmaker
Loading...
Searching...
No Matches
Macros | Functions | Variables
buffer.c File Reference
#include "buffer.h"
#include <string.h>
#include <wayland-util.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_scene.h>
#include "gfxbuf.h"
#include "input.h"
#include "libbase/libbase.h"
#include "util.h"
Include dependency graph for buffer.c:

Functions

static struct wlr_scene_node * _wlmtk_buffer_element_create_scene_node (wlmtk_element_t *element_ptr, struct wlr_scene_tree *wlr_scene_tree_ptr)
 
static void _wlmtk_buffer_element_get_dimensions (wlmtk_element_t *element_ptr, int *left_ptr, int *top_ptr, int *right_ptr, int *bottom_ptr)
 
static bool _wlmtk_buffer_element_pointer_accepts_motion (wlmtk_element_t *element_ptr, wlmtk_pointer_motion_event_t *motion_event_ptr)
 
static void _wlmtk_buffer_handle_wlr_scene_buffer_node_destroy (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmtk_buffer_handle_element_pointer_enter (struct wl_listener *listener_ptr, void *data_ptr)
 
bool wlmtk_buffer_init (wlmtk_buffer_t *buffer_ptr)
 
void wlmtk_buffer_fini (wlmtk_buffer_t *buffer_ptr)
 
void wlmtk_buffer_set (wlmtk_buffer_t *buffer_ptr, struct wlr_buffer *wlr_buffer_ptr)
 
wlmtk_element_twlmtk_buffer_element (wlmtk_buffer_t *buffer_ptr)
 
static void test_pointer_motion (bs_test_t *test_ptr)
 

Variables

static const wlmtk_element_vmt_t buffer_element_vmt
 
const bs_test_case_t wlmtk_buffer_test_cases []
 

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.

Function Documentation

◆ _wlmtk_buffer_element_create_scene_node()

struct wlr_scene_node * _wlmtk_buffer_element_create_scene_node ( wlmtk_element_t element_ptr,
struct wlr_scene_tree *  wlr_scene_tree_ptr 
)
static

Implementation of the superclass wlmtk_element_t::create_scene_node method.

Creates a struct wlr_scene_buffer attached to wlr_scene_tree_ptr.

Parameters
element_ptr
wlr_scene_tree_ptr

◆ _wlmtk_buffer_element_get_dimensions()

void _wlmtk_buffer_element_get_dimensions ( wlmtk_element_t element_ptr,
int *  left_ptr,
int *  top_ptr,
int *  right_ptr,
int *  bottom_ptr 
)
static

Implementation of the element's get_dimensions method: Return dimensions.

Parameters
element_ptr
left_ptrLeftmost position. May be NULL.
top_ptrTopmost position. May be NULL.
right_ptrRightmost position. Ma be NULL.
bottom_ptrBottommost position. May be NULL.

◆ _wlmtk_buffer_element_pointer_accepts_motion()

bool _wlmtk_buffer_element_pointer_accepts_motion ( wlmtk_element_t element_ptr,
wlmtk_pointer_motion_event_t motion_event_ptr 
)
static

Returns true if a buffer is provided, and the motion happens within the buffer's dimensions.

Parameters
element_ptr
motion_event_ptr
Returns
true if (x, y) is within the buffer's dimensions.

◆ _wlmtk_buffer_handle_element_pointer_enter()

void _wlmtk_buffer_handle_element_pointer_enter ( struct wl_listener *  listener_ptr,
void *  data_ptr 
)
static

Handles when pointer enters the area: Sets the configured cursor.

◆ _wlmtk_buffer_handle_wlr_scene_buffer_node_destroy()

void _wlmtk_buffer_handle_wlr_scene_buffer_node_destroy ( struct wl_listener *  listener_ptr,
void *  data_ptr 
)
static

Handles the 'destroy' callback of wlr_scene_buffer_ptr->node.

Will reset the wlr_scene_buffer_ptr value. Destruction of the node had been triggered (hence the callback).

Parameters
listener_ptr
data_ptr

◆ test_pointer_motion()

void test_pointer_motion ( bs_test_t *  test_ptr)
static

◆ wlmtk_buffer_element()

wlmtk_element_t * wlmtk_buffer_element ( wlmtk_buffer_t buffer_ptr)
Returns
the superclass' wlmtk_element_t of buffer_ptr.

◆ wlmtk_buffer_fini()

void wlmtk_buffer_fini ( wlmtk_buffer_t buffer_ptr)

Cleans up the buffer.

Parameters
buffer_ptr

◆ wlmtk_buffer_init()

bool wlmtk_buffer_init ( wlmtk_buffer_t buffer_ptr)

Initializes the buffer.

Parameters
buffer_ptr
Returns
true on success.

◆ wlmtk_buffer_set()

void wlmtk_buffer_set ( wlmtk_buffer_t buffer_ptr,
struct wlr_buffer *  wlr_buffer_ptr 
)

Sets (or updates) buffer contents.

Parameters
buffer_ptr
wlr_buffer_ptrA WLR buffer to use for the update. That buffer will get locked by wlmtk_buffer_t for the duration of it's use.

Variable Documentation

◆ buffer_element_vmt

const wlmtk_element_vmt_t buffer_element_vmt
static
Initial value:
= {
}
static struct wlr_scene_node * _wlmtk_buffer_element_create_scene_node(wlmtk_element_t *element_ptr, struct wlr_scene_tree *wlr_scene_tree_ptr)
Definition buffer.c:144
static void _wlmtk_buffer_element_get_dimensions(wlmtk_element_t *element_ptr, int *left_ptr, int *top_ptr, int *right_ptr, int *bottom_ptr)
Definition buffer.c:174
static bool _wlmtk_buffer_element_pointer_accepts_motion(wlmtk_element_t *element_ptr, wlmtk_pointer_motion_event_t *motion_event_ptr)
Definition buffer.c:207

Method table for the buffer's virtual methods.

◆ wlmtk_buffer_test_cases

const bs_test_case_t wlmtk_buffer_test_cases[]
Initial value:
= {
{ 1, "pointer_motion", test_pointer_motion },
{ 0, NULL, NULL },
}
static void test_pointer_motion(bs_test_t *test_ptr)
Definition buffer.c:264

Unit test cases.