mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
desktop: refactor desktop_focus_topmost_mapped_view()
Rename from desktop_focus_next_mapped_view() to desktop_focus_topmost_mapped_view() and only take struct server as argument.
This commit is contained in:
parent
11ce73f2d6
commit
5f9c5a9d01
4 changed files with 12 additions and 12 deletions
|
|
@ -232,7 +232,7 @@ void desktop_focus_view(struct seat *seat, struct view *view);
|
||||||
* Note: If current==NULL, the list's second view is returned
|
* Note: If current==NULL, the list's second view is returned
|
||||||
*/
|
*/
|
||||||
struct view *desktop_next_view(struct server *server, struct view *current);
|
struct view *desktop_next_view(struct server *server, struct view *current);
|
||||||
void desktop_focus_next_mapped_view(struct view *current);
|
void desktop_focus_topmost_mapped_view(struct server *server);
|
||||||
struct view *desktop_view_at(struct server *server, double lx, double ly,
|
struct view *desktop_view_at(struct server *server, double lx, double ly,
|
||||||
struct wlr_surface **surface, double *sx,
|
struct wlr_surface **surface, double *sx,
|
||||||
double *sy, int *view_area);
|
double *sy, int *view_area);
|
||||||
|
|
|
||||||
|
|
@ -156,26 +156,26 @@ has_mapped_view(struct wl_list *wl_list)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct view *
|
static struct view *
|
||||||
desktop_next_mapped_view(struct view *current)
|
topmost_mapped_view(struct server *server)
|
||||||
{
|
{
|
||||||
assert(current);
|
|
||||||
struct server *server = current->server;
|
|
||||||
if (!has_mapped_view(&server->views)) {
|
if (!has_mapped_view(&server->views)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
struct view *view = first_view(server);
|
|
||||||
|
/* start from tail of server->views */
|
||||||
|
struct view *view = wl_container_of(server->views.prev, view, link);
|
||||||
do {
|
do {
|
||||||
view = wl_container_of(view->link.next, view, link);
|
view = wl_container_of(view->link.next, view, link);
|
||||||
} while (&view->link == &server->views || !view->mapped);
|
} while (&view->link == &server->views || !view->mapped);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
desktop_focus_next_mapped_view(struct view *current)
|
desktop_focus_topmost_mapped_view(struct server *server)
|
||||||
{
|
{
|
||||||
assert(current);
|
struct view *view = topmost_mapped_view(server);
|
||||||
struct view *view = desktop_next_mapped_view(current);
|
desktop_focus_view(&server->seat, view);
|
||||||
desktop_focus_view(¤t->server->seat, view);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ xdg_toplevel_view_unmap(struct view *view)
|
||||||
{
|
{
|
||||||
view->mapped = false;
|
view->mapped = false;
|
||||||
wl_list_remove(&view->commit.link);
|
wl_list_remove(&view->commit.link);
|
||||||
desktop_focus_next_mapped_view(view);
|
desktop_focus_topmost_mapped_view(view->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct view_impl xdg_toplevel_view_impl = {
|
static const struct view_impl xdg_toplevel_view_impl = {
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ unmap(struct view *view)
|
||||||
{
|
{
|
||||||
view->mapped = false;
|
view->mapped = false;
|
||||||
wl_list_remove(&view->commit.link);
|
wl_list_remove(&view->commit.link);
|
||||||
desktop_focus_next_mapped_view(view);
|
desktop_focus_topmost_mapped_view(view->server);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct view_impl xwl_view_impl = {
|
static const struct view_impl xwl_view_impl = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue