wlmaker
Loading...
Searching...
No Matches
Functions | Variables
panel.c File Reference
#include "panel.h"
#include <libbase/libbase.h>
#include <stdlib.h>
#include <string.h>
#include <wlr/util/edges.h>
#include "test.h"
Include dependency graph for panel.c:

Functions

bool wlmtk_panel_init (wlmtk_panel_t *panel_ptr, const wlmtk_panel_positioning_t *positioning_ptr)
 
void wlmtk_panel_fini (wlmtk_panel_t *panel_ptr)
 
wlmtk_panel_vmt_t wlmtk_panel_extend (wlmtk_panel_t *panel_ptr, const wlmtk_panel_vmt_t *panel_vmt_ptr)
 
wlmtk_element_twlmtk_panel_element (wlmtk_panel_t *panel_ptr)
 
bs_dllist_node_t * wlmtk_dlnode_from_panel (wlmtk_panel_t *panel_ptr)
 
wlmtk_panel_twlmtk_panel_from_dlnode (bs_dllist_node_t *dlnode_ptr)
 
void wlmtk_panel_set_layer (wlmtk_panel_t *panel_ptr, wlmtk_layer_t *layer_ptr)
 
wlmtk_layer_twlmtk_panel_get_layer (wlmtk_panel_t *panel_ptr)
 
void wlmtk_panel_set_layer_output (wlmtk_panel_t *panel_ptr, wlmtk_layer_output_t *layer_output_ptr)
 
wlmtk_layer_output_twlmtk_panel_get_layer_output (wlmtk_panel_t *panel_ptr)
 
void wlmtk_panel_commit (wlmtk_panel_t *panel_ptr, uint32_t serial, const wlmtk_panel_positioning_t *positioning_ptr)
 
struct wlr_box wlmtk_panel_compute_dimensions (const wlmtk_panel_t *panel_ptr, const struct wlr_box *full_area_ptr, struct wlr_box *usable_area_ptr)
 
static void _wlmtk_fake_panel_element_destroy (wlmtk_element_t *element_ptr)
 
static uint32_t _wlmtk_fake_panel_request_size (wlmtk_panel_t *panel_ptr, int width, int height)
 
wlmtk_fake_panel_twlmtk_fake_panel_create (const wlmtk_panel_positioning_t *positioning_ptr)
 
void wlmtk_fake_panel_destroy (wlmtk_fake_panel_t *fake_panel_ptr)
 
static void test_init_fini (bs_test_t *test_ptr)
 
static void test_compute_dimensions (bs_test_t *test_ptr)
 
static void test_compute_dimensions_exclusive (bs_test_t *test_ptr)
 

Variables

static const wlmtk_element_vmt_t _wlmtk_fake_panel_element_vmt
 
static const wlmtk_panel_vmt_t _wlmtk_fake_panel_vmt
 
const bs_test_case_t wlmtk_panel_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_fake_panel_element_destroy()

void _wlmtk_fake_panel_element_destroy ( wlmtk_element_t element_ptr)
static

Implements wlmtk_element_vmt_t::destroy for the fake panel.

◆ _wlmtk_fake_panel_request_size()

uint32_t _wlmtk_fake_panel_request_size ( wlmtk_panel_t panel_ptr,
int  width,
int  height 
)
static

Fake implementation of wlmtk_panel_vmt_t::request_size.

◆ test_compute_dimensions()

void test_compute_dimensions ( bs_test_t *  test_ptr)
static

Verifies wlmtk_panel_compute_dimensions.

◆ test_compute_dimensions_exclusive()

void test_compute_dimensions_exclusive ( bs_test_t *  test_ptr)
static

Verifies dimension computation with an exclusive_zone.

◆ test_init_fini()

void test_init_fini ( bs_test_t *  test_ptr)
static

Tests setup, teardown and some accessors.

◆ wlmtk_dlnode_from_panel()

bs_dllist_node_t * wlmtk_dlnode_from_panel ( wlmtk_panel_t panel_ptr)
Returns
Pointer to wlmtk_panel_t::dlnode.

◆ wlmtk_fake_panel_create()

wlmtk_fake_panel_t * wlmtk_fake_panel_create ( const wlmtk_panel_positioning_t positioning_ptr)

Creates a fake panel, for tests.

◆ wlmtk_fake_panel_destroy()

void wlmtk_fake_panel_destroy ( wlmtk_fake_panel_t fake_panel_ptr)

Destroys the fake panel.

◆ wlmtk_panel_commit()

void wlmtk_panel_commit ( wlmtk_panel_t panel_ptr,
uint32_t  serial,
const wlmtk_panel_positioning_t positioning_ptr 
)

Reports a commit for the given serial, and updates positioning.

Parameters
panel_ptr
serial
positioning_ptr

◆ wlmtk_panel_compute_dimensions()

struct wlr_box wlmtk_panel_compute_dimensions ( const wlmtk_panel_t panel_ptr,
const struct wlr_box *  full_area_ptr,
struct wlr_box *  usable_area_ptr 
)

Computes the requested dimension for the panel.

Parameters
panel_ptr
full_area_ptr
usable_area_ptrAre that remains usable from the output and layer after factoring in other panels. *usable_area_ptr will be updated with this panel's exclusive area (if any) subtracted.
Returns
A wlr_box with the requested position and size for this panel. The caller is advised to issue a call to wlmtk_panel_request_size call and update the panel element's position with the box' information.

◆ wlmtk_panel_element()

wlmtk_element_t * wlmtk_panel_element ( wlmtk_panel_t panel_ptr)
Returns
pointer to the super wlmtk_element_t of the panel.

◆ wlmtk_panel_extend()

wlmtk_panel_vmt_t wlmtk_panel_extend ( wlmtk_panel_t panel_ptr,
const wlmtk_panel_vmt_t panel_vmt_ptr 
)

Extends the panel by the specified virtual methods.

Parameters
panel_ptr
panel_vmt_ptr
Returns
The original virtual method table.

◆ wlmtk_panel_fini()

void wlmtk_panel_fini ( wlmtk_panel_t panel_ptr)

Un-initializes the panel.

Parameters
panel_ptr

◆ wlmtk_panel_from_dlnode()

wlmtk_panel_t * wlmtk_panel_from_dlnode ( bs_dllist_node_t *  dlnode_ptr)
Returns
Pointer to wlmtk_panel_t for the given dlnode.

◆ wlmtk_panel_get_layer()

wlmtk_layer_t * wlmtk_panel_get_layer ( wlmtk_panel_t panel_ptr)
Returns
the wlmtk_layer_t this panel belongs to. Or NULL, if unmapped.

◆ wlmtk_panel_get_layer_output()

wlmtk_layer_output_t * wlmtk_panel_get_layer_output ( wlmtk_panel_t panel_ptr)
Returns
the wlmtk_layer_output_t the panel belongs to. NULL if unmapped.

◆ wlmtk_panel_init()

bool wlmtk_panel_init ( wlmtk_panel_t panel_ptr,
const wlmtk_panel_positioning_t positioning_ptr 
)

Initializes the panel.

Parameters
panel_ptr
positioning_ptr
Returns
true on success.

◆ wlmtk_panel_set_layer()

void wlmtk_panel_set_layer ( wlmtk_panel_t panel_ptr,
wlmtk_layer_t layer_ptr 
)

Sets the layer for the panel_ptr.

This method must only be called from wlmtk_layer_t.

Parameters
panel_ptr
layer_ptr

◆ wlmtk_panel_set_layer_output()

void wlmtk_panel_set_layer_output ( wlmtk_panel_t panel_ptr,
wlmtk_layer_output_t layer_output_ptr 
)

Sets the layer output for the panel_ptr.

This method must only be called from wlmtk_layer_output_t.

Parameters
panel_ptr
layer_output_ptr

Variable Documentation

◆ _wlmtk_fake_panel_element_vmt

const wlmtk_element_vmt_t _wlmtk_fake_panel_element_vmt
static
Initial value:
= {
}
static void _wlmtk_fake_panel_element_destroy(wlmtk_element_t *element_ptr)
Definition panel.c:287

Virtual methods of the fake panel's element superclass.

◆ _wlmtk_fake_panel_vmt

const wlmtk_panel_vmt_t _wlmtk_fake_panel_vmt
static
Initial value:
= {
}
static uint32_t _wlmtk_fake_panel_request_size(wlmtk_panel_t *panel_ptr, int width, int height)
Definition panel.c:296

Virtual methods of the fake panel.

◆ wlmtk_panel_test_cases

const bs_test_case_t wlmtk_panel_test_cases[]
Initial value:
= {
{ 1, "init_fini", test_init_fini },
{ 1, "compute_dimensions", test_compute_dimensions },
{ 1, "compute_dimensions_exclusive", test_compute_dimensions_exclusive },
{ 0, NULL, NULL }
}
static void test_compute_dimensions(bs_test_t *test_ptr)
Definition panel.c:340
static void test_compute_dimensions_exclusive(bs_test_t *test_ptr)
Definition panel.c:406
static void test_init_fini(bs_test_t *test_ptr)
Definition panel.c:324

Unit test cases of panel.