mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
Complete carve up of main.c
This commit is contained in:
parent
657f90e09b
commit
b5c307c32b
4 changed files with 206 additions and 203 deletions
26
view.c
26
view.c
|
|
@ -1,5 +1,31 @@
|
|||
#include "labwc.h"
|
||||
|
||||
static struct view *last_toplevel(struct server *server)
|
||||
{
|
||||
struct view *view;
|
||||
|
||||
wl_list_for_each_reverse (view, &server->views, link) {
|
||||
if (!view->been_mapped) {
|
||||
continue;
|
||||
}
|
||||
if (is_toplevel(view)) {
|
||||
return view;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "warn: found no toplevel view (%s)\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void view_focus_last_toplevel(struct server *server)
|
||||
{
|
||||
/* TODO: write view_nr_toplevel_views() */
|
||||
if (wl_list_length(&server->views) < 2) {
|
||||
return;
|
||||
}
|
||||
struct view *view = last_toplevel(server);
|
||||
focus_view(view, view->surface);
|
||||
}
|
||||
|
||||
static void activate_view(struct view *view)
|
||||
{
|
||||
if (view->type == LAB_XDG_SHELL_VIEW) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue