labwc/include/view-impl-common.h
John Lindgren b053c9e375 view: only focus topmost view if unmapped view was focused
The unmap() handlers should only call desktop_focus_topmost_view() if
the unmapped view was the focused view. Unmapping a view that was not
focused should not change the focus.

I expect this rarely had any effect in practice; it would only matter in
a focus-follows-mouse config where some view other than the one on top
was focused. But it still seems better to fix.

Rather than repeating the logic in two places, create a small
view_impl_unmap() helper. Perhaps more common "unmap" logic could be
moved there in future.
2023-10-15 21:15:11 +01:00

31 lines
905 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_VIEW_IMPL_COMMON_H
#define LABWC_VIEW_IMPL_COMMON_H
/*
* Common code for view->impl functions
*
* Please note: only xdg-shell-toplevel-view and xwayland-view view_impl
* functions should call these functions.
*/
enum z_direction {
LAB_TO_FRONT,
LAB_TO_BACK,
};
struct view;
void view_impl_move_to_front(struct view *view);
void view_impl_move_to_back(struct view *view);
void view_impl_move_sub_views(struct view *parent, enum z_direction z_direction);
void view_impl_map(struct view *view);
void view_impl_unmap(struct view *view);
/*
* Updates view geometry at commit based on current position/size,
* pending move/resize, and committed surface size. The computed
* position may not match pending.x/y exactly in some cases.
*/
void view_impl_apply_geometry(struct view *view, int w, int h);
#endif /* LABWC_VIEW_IMPL_COMMON_H */