wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
xdg_decoration.c File Reference
#include "xdg_decoration.h"
#include <libbase/libbase.h>
#include <libbase/plist.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <wayland-server-core.h>
#include <wayland-util.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_xdg_decoration_v1.h>
#include "config.h"
#include "toolkit/toolkit.h"
#include "xdg_shell.h"
#include "xdg_toplevel.h"
Include dependency graph for xdg_decoration.c:

Classes

struct  _wlmaker_xdg_decoration_manager_t
 
struct  wlmaker_xdg_decoration_t
 
struct  _xdg_decoration_test_arg
 

Functions

static void handle_new_toplevel_decoration (struct wl_listener *listener_ptr, void *data_ptr)
 
static void handle_destroy (struct wl_listener *listener_ptr, void *data_ptr)
 
static wlmaker_xdg_decoration_twlmaker_xdg_decoration_create (wlmaker_xdg_decoration_manager_t *decoration_manager_ptr, struct wlr_xdg_toplevel_decoration_v1 *wlr_xdg_toplevel_decoration_v1_ptr)
 
static void wlmaker_xdg_decoration_destroy (wlmaker_xdg_decoration_t *decoration_ptr)
 
static void handle_decoration_request_mode (struct wl_listener *listener_ptr, void *data_ptr)
 
static void handle_decoration_destroy (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _xdg_decoration_handle_surface_commit (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _xdg_decoration_handle_surface_destroy (struct wl_listener *listener_ptr, void *data_ptr)
 
wlmaker_xdg_decoration_manager_twlmaker_xdg_decoration_manager_create (struct wl_display *wl_display_ptr, bspl_dict_t *config_dict_ptr)
 
void wlmaker_xdg_decoration_manager_destroy (wlmaker_xdg_decoration_manager_t *decoration_manager_ptr)
 
static void test_manager (bs_test_t *test_ptr)
 
static void test_decoration_initialized (bs_test_t *test_ptr)
 
static void test_decoration_uninitialized (bs_test_t *test_ptr)
 
static uint32_t _xdg_decoration_fake_set_mode (struct wlr_xdg_toplevel_decoration_v1 *decoration_ptr, enum wlr_xdg_toplevel_decoration_v1_mode mode)
 

Variables

static const bspl_enum_desc_t _wlmaker_config_decoration_desc []
 
static const bspl_desc_t _wlmaker_xdg_decoration_config_desc []
 
static const char * _wlmaker_xdg_decoration_dict_name = "Decoration"
 
static const bs_test_case_t wlmaker_xdg_decoration_test_cases []
 
const bs_test_set_t wlmaker_xdg_decoration_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

◆ _xdg_decoration_fake_set_mode()

static uint32_t _xdg_decoration_fake_set_mode ( struct wlr_xdg_toplevel_decoration_v1 *  decoration_ptr,
enum wlr_xdg_toplevel_decoration_v1_mode  mode 
)
static

Injected method, for wlr_xdg_toplevel_decoration_v1_set_mode().

◆ _xdg_decoration_handle_surface_commit()

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

Handles surface commit: If initialized, set_mode and unsubscribe.

Parameters
listener_ptr
data_ptr

◆ _xdg_decoration_handle_surface_destroy()

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

Handles surface destroy: Unsubscribe surface listeners.

Parameters
listener_ptr
data_ptr

◆ handle_decoration_destroy()

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

Handler for the destroy signal of wlr_xdg_toplevel_decoration_v1.

Parameters
listener_ptr
data_ptr

◆ handle_decoration_request_mode()

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

Handler for the request_mode signal of wlr_xdg_toplevel_decoration_v1.

Parameters
listener_ptr
data_ptr

◆ handle_destroy()

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

Handler for the destroy signal of wlr_xdg_decoration_manager_v1.

Parameters
listener_ptr
data_ptr

◆ handle_new_toplevel_decoration()

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

Handler for the new_toplevel_decoration signal of wlr_xdg_decoration_manager_v1.

Parameters
listener_ptr
data_ptrPoints to wlr_xdg_toplevel_decoration_v1.

◆ test_decoration_initialized()

void test_decoration_initialized ( bs_test_t *  test_ptr)
static

Test decoration for an initialized surface.

◆ test_decoration_uninitialized()

void test_decoration_uninitialized ( bs_test_t *  test_ptr)
static

Test decoration for an uninitialized surface.

◆ test_manager()

void test_manager ( bs_test_t *  test_ptr)
static

Setup and teardown of XDG decoration manager.

◆ wlmaker_xdg_decoration_create()

wlmaker_xdg_decoration_t * wlmaker_xdg_decoration_create ( wlmaker_xdg_decoration_manager_t decoration_manager_ptr,
struct wlr_xdg_toplevel_decoration_v1 *  wlr_xdg_toplevel_decoration_v1_ptr 
)
static

Creates a decoration handle.

Parameters
decoration_manager_ptr
wlr_xdg_toplevel_decoration_v1_ptr
Returns
The decoration handle or NULL on error.

◆ wlmaker_xdg_decoration_destroy()

void wlmaker_xdg_decoration_destroy ( wlmaker_xdg_decoration_t decoration_ptr)
static

Destroys the decoration handle.

Parameters
decoration_ptr

◆ wlmaker_xdg_decoration_manager_create()

wlmaker_xdg_decoration_manager_t * wlmaker_xdg_decoration_manager_create ( struct wl_display *  wl_display_ptr,
bspl_dict_t *  config_dict_ptr 
)

Creates a new XDG decoration manager.

Parameters
wl_display_ptr
config_dict_ptr
Returns
A decoration manager handle or NULL on error.

◆ wlmaker_xdg_decoration_manager_destroy()

void wlmaker_xdg_decoration_manager_destroy ( wlmaker_xdg_decoration_manager_t decoration_manager_ptr)

Destroys the XDG decoration manager.

Parameters
decoration_manager_ptr

Variable Documentation

◆ _wlmaker_config_decoration_desc

const bspl_enum_desc_t _wlmaker_config_decoration_desc[]
static
Initial value:
= {
BSPL_ENUM("SuggestClient", WLMAKER_CONFIG_DECORATION_SUGGEST_CLIENT),
BSPL_ENUM("SuggestServer", WLMAKER_CONFIG_DECORATION_SUGGEST_SERVER),
BSPL_ENUM("EnforceClient", WLMAKER_CONFIG_DECORATION_ENFORCE_CLIENT),
BSPL_ENUM("EnforceServer", WLMAKER_CONFIG_DECORATION_ENFORCE_SERVER),
}
@ WLMAKER_CONFIG_DECORATION_SUGGEST_CLIENT
Definition config.h:38
@ WLMAKER_CONFIG_DECORATION_SUGGEST_SERVER
Definition config.h:40
@ WLMAKER_CONFIG_DECORATION_ENFORCE_CLIENT
Definition config.h:42
@ WLMAKER_CONFIG_DECORATION_ENFORCE_SERVER
Definition config.h:44

Plist descriptor of decoration mode.

See also
wlmaker_config_decoration_t.

◆ _wlmaker_xdg_decoration_config_desc

const bspl_desc_t _wlmaker_xdg_decoration_config_desc[]
static
Initial value:
= {
BSPL_DESC_ENUM("Mode", true, wlmaker_xdg_decoration_manager_t, mode, mode,
}
Definition xdg_decoration.c:43
static const bspl_enum_desc_t _wlmaker_config_decoration_desc[]
Definition xdg_decoration.c:107

Plist descriptor of the 'Decoration' dict contents.

◆ _wlmaker_xdg_decoration_dict_name

const char* _wlmaker_xdg_decoration_dict_name = "Decoration"
static

Name of the top-level dict holding the decoration manager's config.

◆ wlmaker_xdg_decoration_test_cases

const bs_test_case_t wlmaker_xdg_decoration_test_cases[]
static
Initial value:
= {
{ true, "manager", test_manager },
{ true, "decoration_initialized", test_decoration_initialized },
{ true, "decoration_uninitialized", test_decoration_uninitialized },
}
static void test_decoration_uninitialized(bs_test_t *test_ptr)
Definition xdg_decoration.c:550
static void test_decoration_initialized(bs_test_t *test_ptr)
Definition xdg_decoration.c:494
static void test_manager(bs_test_t *test_ptr)
Definition xdg_decoration.c:473

Unit test cases.

◆ wlmaker_xdg_decoration_test_set

const bs_test_set_t wlmaker_xdg_decoration_test_set
Initial value:
= BS_TEST_SET(
true, "xdg_decoration", wlmaker_xdg_decoration_test_cases)
static const bs_test_case_t wlmaker_xdg_decoration_test_cases[]
Definition xdg_decoration.c:438

Unit test set.