File: layer.h

package info (click to toggle)
wlmaker 0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,884 kB
  • sloc: ansic: 54,832; xml: 1,424; python: 1,400; yacc: 118; lex: 70; sh: 16; makefile: 8
file content (132 lines) | stat: -rw-r--r-- 3,806 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/* ========================================================================= */
/**
 * @file layer.h
 *
 * @copyright
 * Copyright 2023 Google LLC
 *
 * 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.
 */
#ifndef __WLMTK_LAYER_H__
#define __WLMTK_LAYER_H__

#include <stdbool.h>
#include <libbase/libbase.h>

/** Forward declaration: Layer state. */
typedef struct _wlmtk_layer_t wlmtk_layer_t;
/** Forward declaration: Layer state. */
typedef struct _wlmtk_layer_output_t wlmtk_layer_output_t;

#include "element.h"
#include "panel.h"  // IWYU pragma: keep
#include "workspace.h"  // IWYU pragma: keep

/** Forward declaration: wlr output layout. */
struct wlr_output_layout;
/** Forward declaration: wlr output. */
struct wlr_output;


#ifdef __cplusplus
extern "C" {
#endif  // __cplusplus

/**
 * Creates a layer. Layers contain panels, such as layer shells.
 *
 * @param wlr_output_layout_ptr The output layout.
 *
 * @return Pointer to the layer handle or NULL on error.
 */
wlmtk_layer_t *wlmtk_layer_create(
    struct wlr_output_layout *wlr_output_layout_ptr);

/**
 * Destroys the layer.
 *
 * @param layer_ptr
 */
void wlmtk_layer_destroy(wlmtk_layer_t *layer_ptr);

/** @return Pointer to super @ref wlmtk_element_t of the layer. */
wlmtk_element_t *wlmtk_layer_element(wlmtk_layer_t *layer_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.
 *
 * @param layer_ptr
 * @param panel_ptr
 * @param wlr_output_ptr
 */
bool wlmtk_layer_add_panel(
    wlmtk_layer_t *layer_ptr,
    wlmtk_panel_t *panel_ptr,
    struct wlr_output *wlr_output_ptr);

/**
 * Removes the panel from the layer.
 *
 * @param layer_ptr
 * @param panel_ptr
 */
void wlmtk_layer_remove_panel(wlmtk_layer_t *layer_ptr,
                              wlmtk_panel_t *panel_ptr);

/**
 * Calls @ref 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).
 *
 * @param layer_ptr
 */
void wlmtk_layer_reconfigure(wlmtk_layer_t *layer_ptr);

/**
 * Calls @ref 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).
 *
 * @param layer_output_ptr
 */
void wlmtk_layer_output_reconfigure(wlmtk_layer_output_t *layer_output_ptr);

/**
 * Sets the parent workspace for the layer.
 *
 * Should only be called from @ref wlmtk_workspace_t methods.
 *
 * @param layer_ptr
 * @param workspace_ptr       NULL to clear the workspace reference.
 */
void wlmtk_layer_set_workspace(wlmtk_layer_t *layer_ptr,
                               wlmtk_workspace_t *workspace_ptr);


/** Layer unit test. */
extern const bs_test_case_t wlmtk_layer_test_cases[];

#ifdef __cplusplus
}  // extern "C"
#endif  // __cplusplus

#endif /* __WLMTK_LAYER_H__ */
/* == End of layer.h ======================================================= */