core: 添加窗口所属层级判定
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "base/array.h"
|
#include "base/array.h"
|
||||||
#include "base/memory.h"
|
#include "base/memory.h"
|
||||||
#include "core/types.h"
|
#include "core/types.h"
|
||||||
|
#include "core/window.h"
|
||||||
|
|
||||||
void layer_stack_cleanup(layer_stack_t *layer) {
|
void layer_stack_cleanup(layer_stack_t *layer) {
|
||||||
p_delete(&layer->order);
|
p_delete(&layer->order);
|
||||||
@@ -86,3 +87,17 @@ bool layer_stack_lower(layer_stack_t *layer, window_id_t window) {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
layer_type_t layer_classify(const window_props_t *props) {
|
||||||
|
for (size_t i = 0; i < props->type_count; ++i) {
|
||||||
|
window_type_t type = props->types[i];
|
||||||
|
if (type == ZDWM_WINDOW_TYPE_NOTIFICATION) return ZDWM_WINDOW_LAYER_OVERLAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < props->state_count; ++i) {
|
||||||
|
window_state_t state = props->states[i];
|
||||||
|
if (state == ZDWM_WINDOW_STATE_ABOVE) return ZDWM_WINDOW_LAYER_TOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ZDWM_WINDOW_LAYER_NORMAL;
|
||||||
|
}
|
||||||
|
|||||||
10
src/core/policy.c
Normal file
10
src/core/policy.c
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "core/policy.h"
|
||||||
|
|
||||||
|
#include "base/macros.h"
|
||||||
|
#include "core/state.h"
|
||||||
|
|
||||||
|
layer_type_t policy_adjust_window_layer_from_transient(
|
||||||
|
const state_t *state, window_id_t transient_for, layer_type_t base_layer) {
|
||||||
|
const window_t *window = state_window_get(state, transient_for);
|
||||||
|
return MAX(window->layer, base_layer);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user