mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
src/xdg.c: prevent interacting with un-initialized xdg toplevels after unmap
Fixes: #2937 Fixes: #2944 Originally-Reported-By: tranzystorekk via IRC
This commit is contained in:
parent
39f79c0cd9
commit
3e3681858e
1 changed files with 33 additions and 2 deletions
35
src/xdg.c
35
src/xdg.c
|
|
@ -488,6 +488,8 @@ xdg_toplevel_view_configure(struct view *view, struct wlr_box geo)
|
||||||
{
|
{
|
||||||
uint32_t serial = 0;
|
uint32_t serial = 0;
|
||||||
|
|
||||||
|
struct wlr_xdg_toplevel *toplevel = xdg_toplevel_from_view(view);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We do not need to send a configure request unless the size
|
* We do not need to send a configure request unless the size
|
||||||
* changed (wayland has no notion of a global position). If the
|
* changed (wayland has no notion of a global position). If the
|
||||||
|
|
@ -496,8 +498,20 @@ xdg_toplevel_view_configure(struct view *view, struct wlr_box geo)
|
||||||
*/
|
*/
|
||||||
if (geo.width != view->pending.width
|
if (geo.width != view->pending.width
|
||||||
|| geo.height != view->pending.height) {
|
|| geo.height != view->pending.height) {
|
||||||
serial = wlr_xdg_toplevel_set_size(xdg_toplevel_from_view(view),
|
if (toplevel->base->initialized) {
|
||||||
geo.width, geo.height);
|
serial = wlr_xdg_toplevel_set_size(toplevel, geo.width, geo.height);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* This may happen, for example, when a panel resizes because a
|
||||||
|
* foreign-toplevel has been destroyed. This would then trigger
|
||||||
|
* a call to desktop_arrange_all_views() which in turn explicitly
|
||||||
|
* also tries to configure unmapped surfaces. This is fine when
|
||||||
|
* trying to resize surfaces before they are mapped but it will
|
||||||
|
* also try to resize surfaces which have been unmapped but their
|
||||||
|
* associated struct view has not been destroyed yet.
|
||||||
|
*/
|
||||||
|
wlr_log(WLR_DEBUG, "Preventing configure of uninitialized surface");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
view->pending = geo;
|
view->pending = geo;
|
||||||
|
|
@ -519,6 +533,10 @@ xdg_toplevel_view_close(struct view *view)
|
||||||
static void
|
static void
|
||||||
xdg_toplevel_view_maximize(struct view *view, enum view_axis maximized)
|
xdg_toplevel_view_maximize(struct view *view, enum view_axis maximized)
|
||||||
{
|
{
|
||||||
|
if (!xdg_toplevel_from_view(view)->base->initialized) {
|
||||||
|
wlr_log(WLR_DEBUG, "Prevented maximize notification for a non-intialized view");
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint32_t serial = wlr_xdg_toplevel_set_maximized(
|
uint32_t serial = wlr_xdg_toplevel_set_maximized(
|
||||||
xdg_toplevel_from_view(view), maximized == VIEW_AXIS_BOTH);
|
xdg_toplevel_from_view(view), maximized == VIEW_AXIS_BOTH);
|
||||||
if (serial > 0) {
|
if (serial > 0) {
|
||||||
|
|
@ -579,6 +597,10 @@ xdg_toplevel_view_append_children(struct view *self, struct wl_array *children)
|
||||||
static void
|
static void
|
||||||
xdg_toplevel_view_set_activated(struct view *view, bool activated)
|
xdg_toplevel_view_set_activated(struct view *view, bool activated)
|
||||||
{
|
{
|
||||||
|
if (!xdg_toplevel_from_view(view)->base->initialized) {
|
||||||
|
wlr_log(WLR_DEBUG, "Prevented activating a non-intialized view");
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint32_t serial = wlr_xdg_toplevel_set_activated(
|
uint32_t serial = wlr_xdg_toplevel_set_activated(
|
||||||
xdg_toplevel_from_view(view), activated);
|
xdg_toplevel_from_view(view), activated);
|
||||||
if (serial > 0) {
|
if (serial > 0) {
|
||||||
|
|
@ -589,6 +611,10 @@ xdg_toplevel_view_set_activated(struct view *view, bool activated)
|
||||||
static void
|
static void
|
||||||
xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen)
|
xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen)
|
||||||
{
|
{
|
||||||
|
if (!xdg_toplevel_from_view(view)->base->initialized) {
|
||||||
|
wlr_log(WLR_DEBUG, "Prevented fullscreening a non-intialized view");
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint32_t serial = wlr_xdg_toplevel_set_fullscreen(
|
uint32_t serial = wlr_xdg_toplevel_set_fullscreen(
|
||||||
xdg_toplevel_from_view(view), fullscreen);
|
xdg_toplevel_from_view(view), fullscreen);
|
||||||
if (serial > 0) {
|
if (serial > 0) {
|
||||||
|
|
@ -604,6 +630,11 @@ xdg_toplevel_view_notify_tiled(struct view *view)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!xdg_toplevel_from_view(view)->base->initialized) {
|
||||||
|
wlr_log(WLR_DEBUG, "Prevented tiling notification for a non-intialized view");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
enum wlr_edges edge = WLR_EDGE_NONE;
|
enum wlr_edges edge = WLR_EDGE_NONE;
|
||||||
|
|
||||||
bool want_edge = rc.snap_tiling_events_mode & LAB_TILING_EVENTS_EDGE;
|
bool want_edge = rc.snap_tiling_events_mode & LAB_TILING_EVENTS_EDGE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue