add overview based on kwin's placement algorithm

kwin/src/plugins/private/expolayout.cpp

kwin's overview placement algorithm first sorts by window height(2nd key center_y),

turning it into a one-dimensional row partitioning problem.

(limit binary search iteration to guarantee termination)

Then it sorts within the rows based on window center_x.

(first sort fallback rev creation_id
for stablility)
This commit is contained in:
yuiiio 2026-04-15 08:35:26 +09:00
parent 6df6a092ba
commit 41ff854483
11 changed files with 909 additions and 1 deletions

View file

@ -48,6 +48,7 @@ enum lab_node_type {
LAB_NODE_ROOT,
LAB_NODE_MENUITEM,
LAB_NODE_CYCLE_OSD_ITEM,
LAB_NODE_OVERVIEW_ITEM,
LAB_NODE_LAYER_SURFACE,
LAB_NODE_UNMANAGED,
LAB_NODE_ALL,

View file

@ -20,6 +20,7 @@ enum input_mode {
LAB_INPUT_STATE_RESIZE,
LAB_INPUT_STATE_MENU,
LAB_INPUT_STATE_CYCLE, /* a.k.a. window switching */
LAB_INPUT_STATE_OVERVIEW, /* overview mode */
};
struct seat {

41
include/overview.h Normal file
View file

@ -0,0 +1,41 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_OVERVIEW_H
#define LABWC_OVERVIEW_H
#include <stdbool.h>
#include <wayland-server-core.h>
struct output;
struct view;
struct wlr_scene_node;
struct overview_item {
struct view *view;
struct wlr_scene_tree *tree;
struct wl_list link;
};
struct overview_state {
bool active;
struct wl_list items; /* struct overview_item.link */
struct wlr_scene_tree *tree;
struct output *output;
};
/* Begin overview mode */
void overview_begin(void);
/* End overview mode */
void overview_finish(bool focus_selected);
/* Toggle overview mode */
void overview_toggle(void);
/* Focus the clicked window and close overview */
void overview_on_cursor_release(struct wlr_scene_node *node);
/* Get overview item from scene node */
struct overview_item *node_overview_item_from_node(
struct wlr_scene_node *wlr_scene_node);
#endif /* LABWC_OVERVIEW_H */

View file

@ -165,6 +165,8 @@ struct theme {
float osd_border_color[4];
float osd_label_text_color[4];
float overview_bg_color[4];
struct window_switcher_classic_theme {
int width;
int padding;