mirror of
https://github.com/cage-kiosk/cage.git
synced 2026-03-09 05:34:27 -04:00
view: require non-NULL surface in view_from_wlr_surface
This commit is contained in:
parent
ba9c245393
commit
d708a73aca
2 changed files with 5 additions and 4 deletions
3
seat.c
3
seat.c
|
|
@ -817,6 +817,9 @@ struct cg_view *
|
||||||
seat_get_focus(struct cg_seat *seat)
|
seat_get_focus(struct cg_seat *seat)
|
||||||
{
|
{
|
||||||
struct wlr_surface *prev_surface = seat->seat->keyboard_state.focused_surface;
|
struct wlr_surface *prev_surface = seat->seat->keyboard_state.focused_surface;
|
||||||
|
if (!prev_surface) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return view_from_wlr_surface(prev_surface);
|
return view_from_wlr_surface(prev_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
6
view.c
6
view.c
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 200809L
|
#define _POSIX_C_SOURCE 200809L
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -163,9 +164,6 @@ view_init(struct cg_view *view, struct cg_server *server, enum cg_view_type type
|
||||||
struct cg_view *
|
struct cg_view *
|
||||||
view_from_wlr_surface(struct wlr_surface *surface)
|
view_from_wlr_surface(struct wlr_surface *surface)
|
||||||
{
|
{
|
||||||
if (!surface) {
|
assert(surface);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return surface->data;
|
return surface->data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue