mirror of
https://github.com/swaywm/sway.git
synced 2026-04-22 06:46:27 -04:00
view: init function should return a success bool
This commit is contained in:
parent
d3ca83acb7
commit
a33ede4c43
4 changed files with 11 additions and 4 deletions
|
|
@ -304,7 +304,7 @@ void view_for_each_popup_surface(struct sway_view *view,
|
||||||
|
|
||||||
// view implementation
|
// view implementation
|
||||||
|
|
||||||
void view_init(struct sway_view *view, enum sway_view_type type,
|
bool view_init(struct sway_view *view, enum sway_view_type type,
|
||||||
const struct sway_view_impl *impl);
|
const struct sway_view_impl *impl);
|
||||||
|
|
||||||
void view_destroy(struct sway_view *view);
|
void view_destroy(struct sway_view *view);
|
||||||
|
|
|
||||||
|
|
@ -519,7 +519,10 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
view_init(&xdg_shell_view->view, SWAY_VIEW_XDG_SHELL, &view_impl);
|
if (!view_init(&xdg_shell_view->view, SWAY_VIEW_XDG_SHELL, &view_impl)) {
|
||||||
|
free(xdg_shell_view);
|
||||||
|
return;
|
||||||
|
}
|
||||||
xdg_shell_view->view.wlr_xdg_toplevel = xdg_surface->toplevel;
|
xdg_shell_view->view.wlr_xdg_toplevel = xdg_surface->toplevel;
|
||||||
|
|
||||||
xdg_shell_view->map.notify = handle_map;
|
xdg_shell_view->map.notify = handle_map;
|
||||||
|
|
|
||||||
|
|
@ -712,7 +712,10 @@ struct sway_xwayland_view *create_xwayland_view(struct wlr_xwayland_surface *xsu
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
view_init(&xwayland_view->view, SWAY_VIEW_XWAYLAND, &view_impl);
|
if (!view_init(&xwayland_view->view, SWAY_VIEW_XWAYLAND, &view_impl)) {
|
||||||
|
free(xwayland_view);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
xwayland_view->view.wlr_xwayland_surface = xsurface;
|
xwayland_view->view.wlr_xwayland_surface = xsurface;
|
||||||
|
|
||||||
wl_signal_add(&xsurface->events.destroy, &xwayland_view->destroy);
|
wl_signal_add(&xsurface->events.destroy, &xwayland_view->destroy);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
#include "pango.h"
|
#include "pango.h"
|
||||||
#include "stringop.h"
|
#include "stringop.h"
|
||||||
|
|
||||||
void view_init(struct sway_view *view, enum sway_view_type type,
|
bool view_init(struct sway_view *view, enum sway_view_type type,
|
||||||
const struct sway_view_impl *impl) {
|
const struct sway_view_impl *impl) {
|
||||||
view->type = type;
|
view->type = type;
|
||||||
view->impl = impl;
|
view->impl = impl;
|
||||||
|
|
@ -42,6 +42,7 @@ void view_init(struct sway_view *view, enum sway_view_type type,
|
||||||
view->allow_request_urgent = true;
|
view->allow_request_urgent = true;
|
||||||
view->shortcuts_inhibit = SHORTCUTS_INHIBIT_DEFAULT;
|
view->shortcuts_inhibit = SHORTCUTS_INHIBIT_DEFAULT;
|
||||||
wl_signal_init(&view->events.unmap);
|
wl_signal_init(&view->events.unmap);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void view_destroy(struct sway_view *view) {
|
void view_destroy(struct sway_view *view) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue