mirror of
https://github.com/swaywm/sway.git
synced 2024-11-22 16:01:27 +00:00
Convert to *_try_from_wlr_surface()
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3991
This commit is contained in:
parent
b31e97e55d
commit
9959e6b8dc
|
@ -53,12 +53,9 @@ static struct wlr_surface *layer_surface_at(struct sway_output *output,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool surface_is_xdg_popup(struct wlr_surface *surface) {
|
static bool surface_is_xdg_popup(struct wlr_surface *surface) {
|
||||||
if (wlr_surface_is_xdg_surface(surface)) {
|
struct wlr_xdg_surface *xdg_surface =
|
||||||
struct wlr_xdg_surface *xdg_surface =
|
wlr_xdg_surface_try_from_wlr_surface(surface);
|
||||||
wlr_xdg_surface_from_wlr_surface(surface);
|
return xdg_surface != NULL && xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP;
|
||||||
return xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_surface *layer_surface_popup_at(struct sway_output *output,
|
static struct wlr_surface *layer_surface_popup_at(struct sway_output *output,
|
||||||
|
|
|
@ -228,17 +228,15 @@ static void handle_tablet_tool_tip(struct sway_seat *seat,
|
||||||
struct sway_container *cont = node && node->type == N_CONTAINER ?
|
struct sway_container *cont = node && node->type == N_CONTAINER ?
|
||||||
node->sway_container : NULL;
|
node->sway_container : NULL;
|
||||||
|
|
||||||
|
struct wlr_layer_surface_v1 *layer;
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
struct wlr_xwayland_surface *xsurface;
|
struct wlr_xwayland_surface *xsurface;
|
||||||
#endif
|
#endif
|
||||||
if (wlr_surface_is_layer_surface(surface)) {
|
if ((layer = wlr_layer_surface_v1_try_from_wlr_surface(surface)) &&
|
||||||
|
layer->current.keyboard_interactive) {
|
||||||
// Handle tapping a layer surface
|
// Handle tapping a layer surface
|
||||||
struct wlr_layer_surface_v1 *layer =
|
seat_set_focus_layer(seat, layer);
|
||||||
wlr_layer_surface_v1_from_wlr_surface(surface);
|
transaction_commit_dirty();
|
||||||
if (layer->current.keyboard_interactive) {
|
|
||||||
seat_set_focus_layer(seat, layer);
|
|
||||||
transaction_commit_dirty();
|
|
||||||
}
|
|
||||||
} else if (cont) {
|
} else if (cont) {
|
||||||
bool is_floating_or_child = container_is_floating_or_child(cont);
|
bool is_floating_or_child = container_is_floating_or_child(cont);
|
||||||
bool is_fullscreen_or_child = container_is_fullscreen_or_child(cont);
|
bool is_fullscreen_or_child = container_is_fullscreen_or_child(cont);
|
||||||
|
@ -368,9 +366,9 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle clicking a layer surface
|
// Handle clicking a layer surface
|
||||||
if (surface && wlr_surface_is_layer_surface(surface)) {
|
struct wlr_layer_surface_v1 *layer;
|
||||||
struct wlr_layer_surface_v1 *layer =
|
if (surface &&
|
||||||
wlr_layer_surface_v1_from_wlr_surface(surface);
|
(layer = wlr_layer_surface_v1_try_from_wlr_surface(surface))) {
|
||||||
if (layer->current.keyboard_interactive) {
|
if (layer->current.keyboard_interactive) {
|
||||||
seat_set_focus_layer(seat, layer);
|
seat_set_focus_layer(seat, layer);
|
||||||
transaction_commit_dirty();
|
transaction_commit_dirty();
|
||||||
|
|
|
@ -387,16 +387,16 @@ struct sway_container *tiling_container_at(struct sway_node *parent,
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool surface_is_popup(struct wlr_surface *surface) {
|
static bool surface_is_popup(struct wlr_surface *surface) {
|
||||||
while (!wlr_surface_is_xdg_surface(surface)) {
|
while (wlr_xdg_surface_try_from_wlr_surface(surface) == NULL) {
|
||||||
if (!wlr_surface_is_subsurface(surface)) {
|
struct wlr_subsurface *subsurface =
|
||||||
|
wlr_subsurface_try_from_wlr_surface(surface);
|
||||||
|
if (subsurface == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
struct wlr_subsurface *subsurface =
|
|
||||||
wlr_subsurface_from_wlr_surface(surface);
|
|
||||||
surface = subsurface->parent;
|
surface = subsurface->parent;
|
||||||
}
|
}
|
||||||
struct wlr_xdg_surface *xdg_surface =
|
struct wlr_xdg_surface *xdg_surface =
|
||||||
wlr_xdg_surface_from_wlr_surface(surface);
|
wlr_xdg_surface_try_from_wlr_surface(surface);
|
||||||
return xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP;
|
return xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -951,7 +951,7 @@ static void subsurface_get_view_coords(struct sway_view_child *child,
|
||||||
*sx = *sy = 0;
|
*sx = *sy = 0;
|
||||||
}
|
}
|
||||||
struct wlr_subsurface *subsurface =
|
struct wlr_subsurface *subsurface =
|
||||||
wlr_subsurface_from_wlr_surface(surface);
|
wlr_subsurface_try_from_wlr_surface(surface);
|
||||||
*sx += subsurface->current.x;
|
*sx += subsurface->current.x;
|
||||||
*sy += subsurface->current.y;
|
*sy += subsurface->current.y;
|
||||||
}
|
}
|
||||||
|
@ -1187,12 +1187,8 @@ void view_child_destroy(struct sway_view_child *child) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
|
struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
|
||||||
if (wlr_surface_is_xdg_surface(wlr_surface)) {
|
struct wlr_xdg_surface *xdg_surface;
|
||||||
struct wlr_xdg_surface *xdg_surface =
|
if ((xdg_surface = wlr_xdg_surface_try_from_wlr_surface(wlr_surface))) {
|
||||||
wlr_xdg_surface_from_wlr_surface(wlr_surface);
|
|
||||||
if (xdg_surface == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return view_from_wlr_xdg_surface(xdg_surface);
|
return view_from_wlr_xdg_surface(xdg_surface);
|
||||||
}
|
}
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
|
@ -1201,15 +1197,11 @@ struct sway_view *view_from_wlr_surface(struct wlr_surface *wlr_surface) {
|
||||||
return view_from_wlr_xwayland_surface(xsurface);
|
return view_from_wlr_xwayland_surface(xsurface);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (wlr_surface_is_subsurface(wlr_surface)) {
|
struct wlr_subsurface *subsurface;
|
||||||
struct wlr_subsurface *subsurface =
|
if ((subsurface = wlr_subsurface_try_from_wlr_surface(wlr_surface))) {
|
||||||
wlr_subsurface_from_wlr_surface(wlr_surface);
|
|
||||||
if (subsurface == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return view_from_wlr_surface(subsurface->parent);
|
return view_from_wlr_surface(subsurface->parent);
|
||||||
}
|
}
|
||||||
if (wlr_surface_is_layer_surface(wlr_surface)) {
|
if (wlr_layer_surface_v1_try_from_wlr_surface(wlr_surface) != NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,8 @@ void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
const struct wlr_xdg_activation_v1_request_activate_event *event = data;
|
const struct wlr_xdg_activation_v1_request_activate_event *event = data;
|
||||||
|
|
||||||
if (!wlr_surface_is_xdg_surface(event->surface)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct wlr_xdg_surface *xdg_surface =
|
struct wlr_xdg_surface *xdg_surface =
|
||||||
wlr_xdg_surface_from_wlr_surface(event->surface);
|
wlr_xdg_surface_try_from_wlr_surface(event->surface);
|
||||||
if (xdg_surface == NULL) {
|
if (xdg_surface == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue