wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
backend.c File Reference
#include "backend.h"
#include <libbase/libbase.h>
#include <libbase/plist.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <toolkit/toolkit.h>
#include <wayland-server-core.h>
#include <wayland-util.h>
#include <wlr/backend.h>
#include <wlr/backend/session.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_screencopy_v1.h>
#include <wlr/types/wlr_subcompositor.h>
#include <wlr/version.h>
#include "output.h"
#include "output_config.h"
#include "output_manager.h"
Include dependency graph for backend.c:

Classes

struct  _wlmbe_backend_t
 

Functions

static void _wlmbe_backend_handle_new_output (struct wl_listener *listener_ptr, void *data_ptr)
 
static bool _wlmbe_backend_decode_item (bspl_object_t *obj_ptr, size_t i, void *dest_ptr)
 
static void _wlmbe_backend_decode_fini (void *dest_ptr)
 
static void _wlmbe_backend_config_dlnode_destroy (bs_dllist_node_t *dlnode_ptr, void *ud_ptr)
 
wlmbe_backend_twlmbe_backend_create (struct wl_display *wl_display_ptr, struct wlr_scene *wlr_scene_ptr, struct wlr_output_layout *wlr_output_layout_ptr, int width, int height, bspl_dict_t *config_dict_ptr)
 
void wlmbe_backend_destroy (wlmbe_backend_t *backend_ptr)
 
void wlmbe_backend_switch_to_vt (wlmbe_backend_t *backend_ptr, unsigned vt_num)
 
struct wlr_backend * wlmbe_backend_wlr (wlmbe_backend_t *backend_ptr)
 
struct wlr_compositor * wlmbe_backend_compositor (wlmbe_backend_t *backend_ptr)
 
struct wlr_output * wlmbe_primary_output (struct wlr_output_layout *wlr_output_layout_ptr)
 
size_t wlmbe_num_outputs (struct wlr_output_layout *wlr_output_layout_ptr)
 
bool _wlmbe_backend_add_output (wlmbe_backend_t *backend_ptr, wlmbe_output_t *output_ptr)
 
static void _wlmbe_backend_test_find (bs_test_t *test_ptr)
 

Variables

static const bspl_desc_t _wlmbe_output_configs_desc []
 
static const bspl_desc_t _wlmbe_outputs_state_desc []
 
const bs_test_case_t wlmbe_backend_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

◆ _wlmbe_backend_add_output()

bool _wlmbe_backend_add_output ( wlmbe_backend_t backend_ptr,
wlmbe_output_t output_ptr 
)

Adds the output to the backend.

Parameters
backend_ptr
output_ptr
Returns
true on success.

◆ _wlmbe_backend_config_dlnode_destroy()

void _wlmbe_backend_config_dlnode_destroy ( bs_dllist_node_t *  dlnode_ptr,
void *  ud_ptr 
)
static

Iterator callback: Destroys a wlmbe_output_config_t.

Parameters
dlnode_ptrTo wlmbe_output_config_t::dlnode, and identifies the config node to destroy.
ud_ptrunused.

◆ _wlmbe_backend_decode_fini()

void _wlmbe_backend_decode_fini ( void *  dest_ptr)
static

Frees all resources of the wlmbe_output_config_t in the list.

◆ _wlmbe_backend_decode_item()

bool _wlmbe_backend_decode_item ( bspl_object_t *  obj_ptr,
size_t  i,
void *  dest_ptr 
)
static

Decodes an item of Outputs.

◆ _wlmbe_backend_handle_new_output()

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

Handles new output events: Creates wlmbe_output_t and adds them.

◆ _wlmbe_backend_test_find()

void _wlmbe_backend_test_find ( bs_test_t *  test_ptr)
static

Tests that output configurations are found as desired.

◆ wlmbe_backend_compositor()

struct wlr_compositor * wlmbe_backend_compositor ( wlmbe_backend_t backend_ptr)

Accessor. TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Eliminate.

◆ wlmbe_backend_create()

wlmbe_backend_t * wlmbe_backend_create ( struct wl_display *  wl_display_ptr,
struct wlr_scene *  wlr_scene_ptr,
struct wlr_output_layout *  wlr_output_layout_ptr,
int  width,
int  height,
bspl_dict_t *  config_dict_ptr 
)

Creates the backend drivers.

Parameters
wl_display_ptr
wlr_scene_ptr
wlr_output_layout_ptr
width
height
config_dict_ptr
Returns
the server backend state, or NULL on error.

◆ wlmbe_backend_destroy()

void wlmbe_backend_destroy ( wlmbe_backend_t backend_ptr)

Destroys the server backend.

Parameters
backend_ptr

◆ wlmbe_backend_switch_to_vt()

void wlmbe_backend_switch_to_vt ( wlmbe_backend_t backend_ptr,
unsigned  vt_num 
)

Switches to the given virtual terminal, if a wlroots session is available.

Logs if wlr_session_change_vt() fails, but ignores the errors.

Parameters
backend_ptr
vt_num

◆ wlmbe_backend_wlr()

struct wlr_backend * wlmbe_backend_wlr ( wlmbe_backend_t backend_ptr)

Accessor. TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Eliminate.

◆ wlmbe_num_outputs()

size_t wlmbe_num_outputs ( struct wlr_output_layout *  wlr_output_layout_ptr)

Returns the number of outputs active in the output layout.

Parameters
wlr_output_layout_ptr
Returns
Number of outputs.

◆ wlmbe_primary_output()

struct wlr_output * wlmbe_primary_output ( struct wlr_output_layout *  wlr_output_layout_ptr)

Returns the primary output. Currently that is the first output found in the output layout.

Parameters
wlr_output_layout_ptr
Returns
A pointer to the struct wlr_output for the primary output.

Variable Documentation

◆ _wlmbe_output_configs_desc

const bspl_desc_t _wlmbe_output_configs_desc[]
static
Initial value:
= {
BSPL_DESC_ARRAY("Outputs", true, wlmbe_backend_t, output_configs,
output_configs,
NULL,
BSPL_DESC_SENTINEL(),
}
static bool _wlmbe_backend_decode_item(bspl_object_t *obj_ptr, size_t i, void *dest_ptr)
Definition backend.c:459
static void _wlmbe_backend_decode_fini(void *dest_ptr)
Definition backend.c:485
Definition backend.c:52

Descriptor for the output configuration.

◆ _wlmbe_outputs_state_desc

const bspl_desc_t _wlmbe_outputs_state_desc[]
static
Initial value:
= {
BSPL_DESC_ARRAY("Outputs", true, wlmbe_backend_t, ephemeral_output_configs,
ephemeral_output_configs,
NULL,
BSPL_DESC_SENTINEL(),
}

Descriptor for the output state, stored as plist.

◆ wlmbe_backend_test_cases

const bs_test_case_t wlmbe_backend_test_cases[]
Initial value:
= {
{ 1, "find", _wlmbe_backend_test_find },
{ 0, NULL, NULL }
}
static void _wlmbe_backend_test_find(bs_test_t *test_ptr)
Definition backend.c:519

Unit test cases.