wlmaker
Loading...
Searching...
No Matches
Functions | Variables
tile.c File Reference
#include "tile.h"
#include <cairo.h>
#include <inttypes.h>
#include <libbase/libbase.h>
#include <libbase/plist.h>
#include <string.h>
#include "gfxbuf.h"
#include "primitives.h"
#include "style.h"
Include dependency graph for tile.c:

Functions

static struct wlr_buffer * _wlmtk_tile_create_buffer (const struct wlmtk_tile_style *style_ptr)
 
static void _wlmtk_tile_align_content (wlmtk_tile_t *tile_ptr)
 
bool wlmtk_tile_init (wlmtk_tile_t *tile_ptr, const struct wlmtk_tile_style *style_ptr)
 
wlmtk_tile_vmt_t wlmtk_tile_extend (wlmtk_tile_t *tile_ptr, const wlmtk_tile_vmt_t *tile_vmt_ptr)
 
void wlmtk_tile_fini (wlmtk_tile_t *tile_ptr)
 
bool wlmtk_tile_set_style (wlmtk_tile_t *tile_ptr, const struct wlmtk_tile_style *style_ptr)
 
bool wlmtk_tile_set_background_buffer (wlmtk_tile_t *tile_ptr, struct wlr_buffer *wlr_buffer_ptr)
 
void wlmtk_tile_set_content (wlmtk_tile_t *tile_ptr, wlmtk_element_t *element_ptr)
 
void wlmtk_tile_set_overlay (wlmtk_tile_t *tile_ptr, wlmtk_element_t *element_ptr)
 
wlmtk_element_twlmtk_tile_element (wlmtk_tile_t *tile_ptr)
 
wlmtk_tile_twlmtk_tile_from_dlnode (bs_dllist_node_t *dlnode_ptr)
 
bs_dllist_node_t * wlmtk_dlnode_from_tile (wlmtk_tile_t *tile_ptr)
 
static void test_init_fini (bs_test_t *test_ptr)
 

Variables

const bspl_desc_t wlmtk_tile_style_desc []
 
static const bs_test_case_t _wlmtk_tile_test_cases []
 
const bs_test_set_t wlmtk_tile_test_set
 

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_tile_align_content()

void _wlmtk_tile_align_content ( wlmtk_tile_t tile_ptr)
static

(re)centers the content element.

◆ _wlmtk_tile_create_buffer()

struct wlr_buffer * _wlmtk_tile_create_buffer ( const struct wlmtk_tile_style style_ptr)
static

Crates a wlr_buffer with background, as described in style_ptr.

◆ test_init_fini()

static void test_init_fini ( bs_test_t *  test_ptr)
static

Exercises setup and teardown.

◆ wlmtk_dlnode_from_tile()

bs_dllist_node_t * wlmtk_dlnode_from_tile ( wlmtk_tile_t tile_ptr)
Returns
wlmtk_tile_t::dlnode from tile_ptr.

◆ wlmtk_tile_element()

wlmtk_element_t * wlmtk_tile_element ( wlmtk_tile_t tile_ptr)
Returns
the superclass' wlmtk_element_t of tile_ptr.

◆ wlmtk_tile_extend()

wlmtk_tile_vmt_t wlmtk_tile_extend ( wlmtk_tile_t tile_ptr,
const wlmtk_tile_vmt_t tile_vmt_ptr 
)

Extends the tile's virtual methods.

Parameters
tile_ptr
tile_vmt_ptr
Returns
The previous virtual method table.

◆ wlmtk_tile_fini()

void wlmtk_tile_fini ( wlmtk_tile_t tile_ptr)

Un-initializes the tile.

Parameters
tile_ptr

◆ wlmtk_tile_from_dlnode()

wlmtk_tile_t * wlmtk_tile_from_dlnode ( bs_dllist_node_t *  dlnode_ptr)
Returns
The wlmtk_tile_t for dlnode_ptr.

◆ wlmtk_tile_init()

bool wlmtk_tile_init ( wlmtk_tile_t tile_ptr,
const struct wlmtk_tile_style style_ptr 
)

Initializes the tile.

Parameters
tile_ptr
style_ptr
Returns
true on success.

◆ wlmtk_tile_set_background_buffer()

bool wlmtk_tile_set_background_buffer ( wlmtk_tile_t tile_ptr,
struct wlr_buffer *  wlr_buffer_ptr 
)

Sets (overwrites) the default tile's background buffer.

This permits specific tiles, eg. a Dock Clip to include active elements in the background, or change the bezel or texture.

Parameters
tile_ptr
wlr_buffer_ptrPoints to a struct wlr_buffer. The tile will add a buffer lock, so the caller may safely drop or unlock the buffer. The buffer must match the tile's size.
Returns
false if the buffer did not match the tile size.

◆ wlmtk_tile_set_content()

void wlmtk_tile_set_content ( wlmtk_tile_t tile_ptr,
wlmtk_element_t element_ptr 
)

Sets element_ptr as the content of tile_ptr.

TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Flesh out the behaviour – permit only 1 content? Does the tile claim ownerwhip? How to reset the content?

Parameters
tile_ptr
element_ptr

◆ wlmtk_tile_set_overlay()

void wlmtk_tile_set_overlay ( wlmtk_tile_t tile_ptr,
wlmtk_element_t element_ptr 
)

Sets element_ptr as the overlay of tile_ptr.

TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Flesh out the behaviour – permit only 1 overlay? Does the tile claim ownerwhip? How to reset the overlay?

Parameters
tile_ptr
element_ptr

◆ wlmtk_tile_set_style()

bool wlmtk_tile_set_style ( wlmtk_tile_t tile_ptr,
const struct wlmtk_tile_style style_ptr 
)

Updates the style for the tile.

Parameters
tile_ptr
style_ptr
Returns
true on success.

Variable Documentation

◆ _wlmtk_tile_test_cases

const bs_test_case_t _wlmtk_tile_test_cases[]
static
Initial value:
= {
{ 1, "init_fini", test_init_fini },
}
static void test_init_fini(bs_test_t *test_ptr)
Definition tile.c:295

Test cases

◆ wlmtk_tile_style_desc

const bspl_desc_t wlmtk_tile_style_desc[]
Initial value:
= {
BSPL_DESC_UINT64(
"Size", true, struct wlmtk_tile_style, size, size, 64),
BSPL_DESC_UINT64(
"ContentSize", true, struct wlmtk_tile_style,
content_size, content_size, 48),
BSPL_DESC_UINT64(
"BezelWidth", true, struct wlmtk_tile_style,
bezel_width, bezel_width, 2),
BSPL_DESC_CUSTOM(
"Fill", true, struct wlmtk_tile_style, fill, fill,
wlmtk_style_decode_fill, NULL, NULL, NULL),
}
Definition tile.h:44
bool wlmtk_style_decode_fill(bspl_object_t *object_ptr, const union bspl_desc_value *desc_value_ptr, void *value_ptr)
Definition style.c:107

Plist decoding descriptor of a tile style.

◆ wlmtk_tile_test_set

const bs_test_set_t wlmtk_tile_test_set
Initial value:
= BS_TEST_SET(
true, "tile", _wlmtk_tile_test_cases)
static const bs_test_case_t _wlmtk_tile_test_cases[]
Definition tile.c:285

Unit test cases for wlmtk_tile_t.