wlmaker
Loading...
Searching...
No Matches
Macros | Functions | Variables
content.c File Reference
#include "content.h"
#include "surface.h"
#include <wlr/types/wlr_compositor.h>
Include dependency graph for content.c:

Functions

static void _wlmtk_content_element_get_dimensions (wlmtk_element_t *element_ptr, int *left_ptr, int *top_ptr, int *right_ptr, int *bottom_ptr)
 
bool wlmtk_content_init (wlmtk_content_t *content_ptr, wlmtk_surface_t *surface_ptr, wlmtk_env_t *env_ptr)
 
void wlmtk_content_fini (wlmtk_content_t *content_ptr)
 
void wlmtk_content_set_surface (wlmtk_content_t *content_ptr, wlmtk_surface_t *surface_ptr)
 
wlmtk_content_vmt_t wlmtk_content_extend (wlmtk_content_t *content_ptr, const wlmtk_content_vmt_t *content_vmt_ptr)
 
void wlmtk_content_get_size (wlmtk_content_t *content_ptr, int *width_ptr, int *height_ptr)
 
void wlmtk_content_commit (wlmtk_content_t *content_ptr, int width, int height, uint32_t serial)
 
void wlmtk_content_set_window (wlmtk_content_t *content_ptr, wlmtk_window_t *window_ptr)
 
wlmtk_element_twlmtk_content_element (wlmtk_content_t *content_ptr)
 
void wlmtk_content_add_popup (wlmtk_content_t *content_ptr, wlmtk_content_t *popup_content_ptr)
 
void wlmtk_content_remove_popup (wlmtk_content_t *content_ptr, wlmtk_content_t *popup_content_ptr)
 
wlmtk_content_twlmtk_content_get_parent_content (wlmtk_content_t *content_ptr)
 
static void _wlmtk_fake_content_request_close (wlmtk_content_t *content_ptr)
 
static uint32_t _wlmtk_fake_content_request_size (wlmtk_content_t *content_ptr, int width, int height)
 
static void _wlmtk_fake_content_set_activated (wlmtk_content_t *content_ptr, bool activated)
 
wlmtk_fake_content_twlmtk_fake_content_create (wlmtk_fake_surface_t *fake_surface_ptr)
 
void wlmtk_fake_content_destroy (wlmtk_fake_content_t *fake_content_ptr)
 
void wlmtk_fake_content_commit (wlmtk_fake_content_t *fake_content_ptr)
 
static void test_init_fini (bs_test_t *test_ptr)
 
static void test_set_clear_surface (bs_test_t *test_ptr)
 
static void test_add_remove_popup (bs_test_t *test_ptr)
 

Variables

static const wlmtk_element_vmt_t _wlmtk_content_element_vmt
 
static wlmtk_content_vmt_t _wlmtk_fake_content_vmt
 
const bs_test_case_t wlmtk_content_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_content_element_get_dimensions()

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

Returns the content's dimension: Considers only the surface, and leaves out pop-ups, in order to draw margins and decorations for just the main surface.

Parameters
element_ptr
left_ptr
top_ptr
right_ptr
bottom_ptr

◆ _wlmtk_fake_content_request_close()

void _wlmtk_fake_content_request_close ( wlmtk_content_t * content_ptr)
static

Test implementation of wlmtk_content_vmt_t::request_close.

◆ _wlmtk_fake_content_request_size()

uint32_t _wlmtk_fake_content_request_size ( wlmtk_content_t * content_ptr,
int width,
int height )
static

Test implementation of wlmtk_content_vmt_t::request_size.

◆ _wlmtk_fake_content_set_activated()

void _wlmtk_fake_content_set_activated ( wlmtk_content_t * content_ptr,
bool activated )
static

Test implementation of wlmtk_content_vmt_t::set_activated.

◆ test_add_remove_popup()

void test_add_remove_popup ( bs_test_t * test_ptr)
static

Tests adding and removing popups.

◆ test_init_fini()

void test_init_fini ( bs_test_t * test_ptr)
static

Tests setup and teardown.

◆ test_set_clear_surface()

void test_set_clear_surface ( bs_test_t * test_ptr)
static

Tests setting and clearing the surface.

◆ wlmtk_content_add_popup()

void wlmtk_content_add_popup ( wlmtk_content_t * content_ptr,
wlmtk_content_t * popup_content_ptr )

Adds a popup to the content.

Parameters
content_ptr
popup_content_ptr

◆ wlmtk_content_commit()

void wlmtk_content_commit ( wlmtk_content_t * content_ptr,
int width,
int height,
uint32_t serial )

Commits size and serial: Calls into wlmtk_window_serial.

◆ wlmtk_content_element()

wlmtk_element_t * wlmtk_content_element ( wlmtk_content_t * content_ptr)

Returns the superclass' instance of wlmtk_element_t.

◆ wlmtk_content_extend()

wlmtk_content_vmt_t wlmtk_content_extend ( wlmtk_content_t * content_ptr,
const wlmtk_content_vmt_t * content_vmt_ptr )

Extends the content by specifying virtual methods.

Parameters
content_ptr
content_vmt_ptr
Returns
The original virtual method table.

◆ wlmtk_content_fini()

void wlmtk_content_fini ( wlmtk_content_t * content_ptr)

Un-initializes the content.

Parameters
content_ptr

◆ wlmtk_content_get_parent_content()

wlmtk_content_t * wlmtk_content_get_parent_content ( wlmtk_content_t * content_ptr)
Returns
A pointer to the parent content, or NULL if none.

◆ wlmtk_content_get_size()

void wlmtk_content_get_size ( wlmtk_content_t * content_ptr,
int * width_ptr,
int * height_ptr )

Gets size: Forwards to wlmtk_surface_get_size.

◆ wlmtk_content_init()

bool wlmtk_content_init ( wlmtk_content_t * content_ptr,
wlmtk_surface_t * surface_ptr,
wlmtk_env_t * env_ptr )

Initializes the content with the given surface.

Parameters
content_ptr
surface_ptr
env_ptr
Returns
true on success.

◆ wlmtk_content_remove_popup()

void wlmtk_content_remove_popup ( wlmtk_content_t * content_ptr,
wlmtk_content_t * popup_content_ptr )

Removes a popup from the content.

popup_content_ptr must have previously been added to content_ptr.

Parameters
content_ptr
popup_content_ptr

◆ wlmtk_content_set_surface()

void wlmtk_content_set_surface ( wlmtk_content_t * content_ptr,
wlmtk_surface_t * surface_ptr )

Sets or clears the content's surface.

Parameters
content_ptr
surface_ptrSurface to set for the content, or NULL.

◆ wlmtk_content_set_window()

void wlmtk_content_set_window ( wlmtk_content_t * content_ptr,
wlmtk_window_t * window_ptr )

Sets the window for the content.

Private: Should only be called by Window ctor (a friend).

Parameters
content_ptr
window_ptr

◆ wlmtk_fake_content_commit()

void wlmtk_fake_content_commit ( wlmtk_fake_content_t * fake_content_ptr)

Commits the state of last wlmtk_content_request_size call.

◆ wlmtk_fake_content_create()

wlmtk_fake_content_t * wlmtk_fake_content_create ( wlmtk_fake_surface_t * fake_surface_ptr)

Creates a fake content, for tests.

◆ wlmtk_fake_content_destroy()

void wlmtk_fake_content_destroy ( wlmtk_fake_content_t * fake_content_ptr)

Destroys the fake content.

Variable Documentation

◆ _wlmtk_content_element_vmt

const wlmtk_element_vmt_t _wlmtk_content_element_vmt
static
Initial value:
= {
}
static void _wlmtk_content_element_get_dimensions(wlmtk_element_t *element_ptr, int *left_ptr, int *top_ptr, int *right_ptr, int *bottom_ptr)
Definition content.c:241

Virtual method table for the content's superclass wlmtk_element_t.

◆ _wlmtk_fake_content_vmt

wlmtk_content_vmt_t _wlmtk_fake_content_vmt
static
Initial value:
= {
}
static void _wlmtk_fake_content_request_close(wlmtk_content_t *content_ptr)
Definition content.c:332
static void _wlmtk_fake_content_set_activated(wlmtk_content_t *content_ptr, bool activated)
Definition content.c:341
static uint32_t _wlmtk_fake_content_request_size(wlmtk_content_t *content_ptr, int width, int height)
Definition content.c:318

Virtual method table for the fake content.

◆ wlmtk_content_test_cases

const bs_test_case_t wlmtk_content_test_cases[]
Initial value:
= {
{ 1, "init_fini", test_init_fini },
{ 1, "set_clear_surface", test_set_clear_surface },
{ 1, "add_remove_popup", test_add_remove_popup },
{ 0, NULL, NULL }
}
static void test_add_remove_popup(bs_test_t *test_ptr)
Definition content.c:430
static void test_init_fini(bs_test_t *test_ptr)
Definition content.c:365
static void test_set_clear_surface(bs_test_t *test_ptr)
Definition content.c:409

Content's unit tests.