Introduce kiwmi_strata
With the migration to wlr_scene, some objects (desktop, output etc) will no longer have any reason to care about individual shells and similar; handling each one on its own would introduce code that is, from their perspective, over-complicated. Strata (sg. stratum; this name was chosen to avoid confusion with the over-used 'layer') represent logical layers of surfaces on the desktop, such as every layer shell layer, one for xdg shell, another for popups.
This commit is contained in:
parent
7c98b5e5dc
commit
8c191d2d41
4 changed files with 68 additions and 1 deletions
|
@ -19,7 +19,7 @@
|
||||||
struct kiwmi_layer {
|
struct kiwmi_layer {
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
struct wlr_layer_surface_v1 *layer_surface;
|
struct wlr_layer_surface_v1 *layer_surface;
|
||||||
uint32_t layer;
|
uint32_t layer; // enum zwlr_layer_shell_v1_layer
|
||||||
|
|
||||||
struct kiwmi_output *output;
|
struct kiwmi_output *output;
|
||||||
|
|
||||||
|
|
33
include/desktop/stratum.h
Normal file
33
include/desktop/stratum.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/* Copyright (c), Niclas Meyer <niclas@countingsort.com>
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KIWMI_DESKTOP_STRATUM_H
|
||||||
|
#define KIWMI_DESKTOP_STRATUM_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A stratum is a layer in the scene-graph (the name was chosen to avoid
|
||||||
|
* confusion with layer-shell). The root node contains a scene_tree for each
|
||||||
|
* stratum, which itself contains a scene_tree per output.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// There are some assumptions made about the values, don't mindlessly change.
|
||||||
|
enum kiwmi_stratum {
|
||||||
|
KIWMI_STRATUM_LS_BACKGROUND, // LS == layer_shell
|
||||||
|
KIWMI_STRATUM_LS_BOTTOM,
|
||||||
|
KIWMI_STRATUM_NORMAL,
|
||||||
|
KIWMI_STRATUM_LS_TOP,
|
||||||
|
KIWMI_STRATUM_LS_OVERLAY,
|
||||||
|
KIWMI_STRATUM_POPUPS,
|
||||||
|
KIWMI_STRATA_COUNT,
|
||||||
|
KIWMI_STRATUM_NONE = KIWMI_STRATA_COUNT,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum kiwmi_stratum stratum_from_layer_shell_layer(uint32_t layer);
|
||||||
|
|
||||||
|
#endif /* KIWMI_DESKTOP_STRATUM_H */
|
33
kiwmi/desktop/stratum.c
Normal file
33
kiwmi/desktop/stratum.c
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/* Copyright (c), Niclas Meyer <niclas@countingsort.com>
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <wlr/util/log.h>
|
||||||
|
|
||||||
|
#include "desktop/stratum.h"
|
||||||
|
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
||||||
|
|
||||||
|
enum kiwmi_stratum
|
||||||
|
stratum_from_layer_shell_layer(uint32_t layer)
|
||||||
|
{
|
||||||
|
switch (layer) {
|
||||||
|
case ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND:
|
||||||
|
return KIWMI_STRATUM_LS_BACKGROUND;
|
||||||
|
case ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM:
|
||||||
|
return KIWMI_STRATUM_LS_BOTTOM;
|
||||||
|
case ZWLR_LAYER_SHELL_V1_LAYER_TOP:
|
||||||
|
return KIWMI_STRATUM_LS_TOP;
|
||||||
|
case ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY:
|
||||||
|
return KIWMI_STRATUM_LS_OVERLAY;
|
||||||
|
default:
|
||||||
|
// We should update our codebase to support the layer
|
||||||
|
wlr_log(
|
||||||
|
WLR_ERROR, "No matching stratum for layer_shell layer %d", layer);
|
||||||
|
return KIWMI_STRATUM_NONE;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ kiwmi_sources = files(
|
||||||
'desktop/desktop.c',
|
'desktop/desktop.c',
|
||||||
'desktop/layer_shell.c',
|
'desktop/layer_shell.c',
|
||||||
'desktop/output.c',
|
'desktop/output.c',
|
||||||
|
'desktop/stratum.c',
|
||||||
'desktop/view.c',
|
'desktop/view.c',
|
||||||
'desktop/xdg_shell.c',
|
'desktop/xdg_shell.c',
|
||||||
'input/cursor.c',
|
'input/cursor.c',
|
||||||
|
|
Loading…
Reference in a new issue