wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
layer.c File Reference
#include "layer.h"
#include <libbase/libbase.h>
#include <stdlib.h>
#include <wayland-server-core.h>
#include <wayland-util.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/util/edges.h>
#include "container.h"
#include "panel.h"
#include "test.h"
#include "tile.h"
#include "util.h"
#include "workspace.h"
Include dependency graph for layer.c:

Classes

struct  _wlmtk_layer_t
 
struct  _wlmtk_layer_output_t
 
struct  wlmtk_layer_output_update_arg_t
 

Functions

static wlmtk_layer_output_t_wlmtk_layer_output_create (struct wlr_output *wlr_output_ptr)
 
static void _wlmtk_layer_output_tree_node_destroy (bs_avltree_node_t *avlnode_ptr)
 
static int _wlmtk_layer_output_tree_node_cmp (const bs_avltree_node_t *avlnode_ptr, const void *key_ptr)
 
static void _wlmtk_layer_output_remove_dlnode_panel (bs_dllist_node_t *dlnode_ptr, void *ud_ptr)
 
static bool _wlmtk_layer_output_update (struct wl_list *link_ptr, void *ud_ptr)
 
static void _wlmtk_layer_output_add_panel (wlmtk_layer_output_t *layer_output_ptr, wlmtk_panel_t *panel_ptr)
 
static void _wlmtk_layer_output_remove_panel (wlmtk_layer_output_t *layer_output_ptr, wlmtk_panel_t *panel_ptr)
 
static void _wlmtk_layer_handle_output_layout_change (struct wl_listener *listener_ptr, void *data_ptr)
 
wlmtk_layer_twlmtk_layer_create (struct wlr_output_layout *wlr_output_layout_ptr)
 
void wlmtk_layer_destroy (wlmtk_layer_t *layer_ptr)
 
wlmtk_element_twlmtk_layer_element (wlmtk_layer_t *layer_ptr)
 
bool wlmtk_layer_add_panel (wlmtk_layer_t *layer_ptr, wlmtk_panel_t *panel_ptr, struct wlr_output *wlr_output_ptr)
 
void wlmtk_layer_remove_panel (wlmtk_layer_t *layer_ptr, wlmtk_panel_t *panel_ptr)
 
void wlmtk_layer_output_reconfigure (wlmtk_layer_output_t *layer_output_ptr)
 
void wlmtk_layer_set_workspace (wlmtk_layer_t *layer_ptr, wlmtk_workspace_t *workspace_ptr)
 
static void test_multi_output (bs_test_t *test_ptr)
 
static void test_layout (bs_test_t *test_ptr)
 

Variables

const bs_test_case_t wlmtk_layer_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_layer_handle_output_layout_change()

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

Handles output changes: Updates own extents, updates layers.

◆ _wlmtk_layer_output_add_panel()

void _wlmtk_layer_output_add_panel ( wlmtk_layer_output_t layer_output_ptr,
wlmtk_panel_t panel_ptr 
)
static

Adds the panel to the output.

◆ _wlmtk_layer_output_create()

wlmtk_layer_output_t * _wlmtk_layer_output_create ( struct wlr_output *  wlr_output_ptr)
static

Creates a layer output for wlr_output_ptr.

◆ _wlmtk_layer_output_remove_dlnode_panel()

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

Removes dlnode_ptr's panel from the layer output and destroys it.

◆ _wlmtk_layer_output_remove_panel()

void _wlmtk_layer_output_remove_panel ( wlmtk_layer_output_t layer_output_ptr,
wlmtk_panel_t panel_ptr 
)
static

Removes the panel from the output.

◆ _wlmtk_layer_output_tree_node_cmp()

int _wlmtk_layer_output_tree_node_cmp ( const bs_avltree_node_t *  avlnode_ptr,
const void *  key_ptr 
)
static

◆ _wlmtk_layer_output_tree_node_destroy()

void _wlmtk_layer_output_tree_node_destroy ( bs_avltree_node_t *  avlnode_ptr)
static

Destroys the layer output.

◆ _wlmtk_layer_output_update()

bool _wlmtk_layer_output_update ( struct wl_list *  link_ptr,
void *  ud_ptr 
)
static

Updates the given output in wlmtk_layer_t::output_tree_ptr.

If the output already exists in wlmtk_layer_output_update_arg_t::former_output_tree_ptr, it will be moved over into wlmtk_layer_t::output_tree_ptr. Otherwise, a new output is created there. If the output's extents (position and/or size) have changed, the layer's panel positions will be reconfigured.

Parameters
link_ptrstruct wlr_output_layout_output::link.
ud_ptrThe wlmtk_layer_output_update_arg_t.
Returns
true on success, or false on error.

◆ test_layout()

void test_layout ( bs_test_t *  test_ptr)
static

Tests panel layout with multiple panels.

◆ test_multi_output()

void test_multi_output ( bs_test_t *  test_ptr)
static

Tests adding + removing outputs, and updates to panel positions.

◆ wlmtk_layer_add_panel()

bool wlmtk_layer_add_panel ( wlmtk_layer_t layer_ptr,
wlmtk_panel_t panel_ptr,
struct wlr_output *  wlr_output_ptr 
)

Adds the panel to the output within the specified layer. This will trigger an update to the layer's layout, and a call to request_size of each panel of that output.

Parameters
layer_ptr
panel_ptr
wlr_output_ptr

◆ wlmtk_layer_create()

wlmtk_layer_t * wlmtk_layer_create ( struct wlr_output_layout *  wlr_output_layout_ptr)

Creates a layer. Layers contain panels, such as layer shells.

Parameters
wlr_output_layout_ptrThe output layout.
Returns
Pointer to the layer handle or NULL on error.

◆ wlmtk_layer_destroy()

void wlmtk_layer_destroy ( wlmtk_layer_t layer_ptr)

Destroys the layer.

Parameters
layer_ptr

◆ wlmtk_layer_element()

wlmtk_element_t * wlmtk_layer_element ( wlmtk_layer_t layer_ptr)
Returns
Pointer to super wlmtk_element_t of the layer.

◆ wlmtk_layer_output_reconfigure()

void wlmtk_layer_output_reconfigure ( wlmtk_layer_output_t layer_output_ptr)

Calls wlmtk_panel_compute_dimensions for each contained panel.

The Wayland protocol spells it is 'undefined' how panels (layer shells) are stacked and configured within a layer. For wlmaker, we'll configure the panels in sequence as they were added (found in the container, back to front).

Parameters
layer_output_ptr

◆ wlmtk_layer_remove_panel()

void wlmtk_layer_remove_panel ( wlmtk_layer_t layer_ptr,
wlmtk_panel_t panel_ptr 
)

Removes the panel from the layer.

Parameters
layer_ptr
panel_ptr

◆ wlmtk_layer_set_workspace()

void wlmtk_layer_set_workspace ( wlmtk_layer_t layer_ptr,
wlmtk_workspace_t workspace_ptr 
)

Sets the parent workspace for the layer.

Should only be called from wlmtk_workspace_t methods.

Parameters
layer_ptr
workspace_ptrNULL to clear the workspace reference.

Variable Documentation

◆ wlmtk_layer_test_cases

const bs_test_case_t wlmtk_layer_test_cases[]
Initial value:
= {
{ 1, "multi_output", test_multi_output },
{ 1, "layout", test_layout },
{ 0, NULL, NULL }
}
static void test_layout(bs_test_t *test_ptr)
Definition layer.c:505
static void test_multi_output(bs_test_t *test_ptr)
Definition layer.c:421

Layer unit test.