mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
view: add view_array_append()
...to reduce code duplication. The function populates an array with views which meet any set of critera from: - current-workspace - no-always-on-top - no-skipWindowSwitcher (window-rule) Make src/osd.c use this new interface. Note that always-on-top views are still filtered out from the window-switcher and that desktop_cycle_view() needs to be re-worked before always-on-top views can be opted in.
This commit is contained in:
parent
58b33fb0c9
commit
57b9efeb45
4 changed files with 103 additions and 35 deletions
43
src/view.c
43
src/view.c
|
|
@ -19,6 +19,48 @@
|
|||
#define LAB_FALLBACK_WIDTH 640
|
||||
#define LAB_FALLBACK_HEIGHT 480
|
||||
|
||||
void
|
||||
view_array_append(struct server *server, struct wl_array *views,
|
||||
enum lab_view_criteria criteria)
|
||||
{
|
||||
struct view *view;
|
||||
wl_list_for_each(view, &server->views, link)
|
||||
{
|
||||
if (!isfocusable(view)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (criteria & LAB_VIEW_CRITERIA_CURRENT_WORKSPACE) {
|
||||
/*
|
||||
* Always-on-top views are always on the current
|
||||
* desktop and are special in that they live in a
|
||||
* different tree.
|
||||
*/
|
||||
if (view_is_always_on_top(view)) {
|
||||
goto next;
|
||||
}
|
||||
if (view->scene_tree->node.parent != server->workspace_current->tree) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
next:
|
||||
if (criteria & LAB_VIEW_CRITERIA_NO_ALWAYS_ON_TOP) {
|
||||
if (view_is_always_on_top(view)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (criteria & LAB_VIEW_CRITERIA_NO_SKIP_WINDOW_SWITCHER) {
|
||||
if (window_rules_get_property(view, "skipWindowSwitcher")
|
||||
== LAB_PROP_TRUE) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
struct view **entry = wl_array_add(views, sizeof(*entry));
|
||||
*entry = view;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* All view_apply_xxx_geometry() functions must *not* modify
|
||||
* any state besides repositioning or resizing the view.
|
||||
|
|
@ -1264,3 +1306,4 @@ view_destroy(struct view *view)
|
|||
cursor_update_focus(server);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue