Cleanup unneeded code after switching to wlr_scene
This commit is contained in:
parent
a8a82826c3
commit
ac0f6b7e8b
8 changed files with 21 additions and 482 deletions
|
@ -26,7 +26,6 @@ struct kiwmi_desktop {
|
|||
struct wl_list outputs; // struct kiwmi_output::link
|
||||
struct wl_list views; // struct kiwmi_view::link
|
||||
|
||||
float bg_color[4];
|
||||
struct wlr_scene *scene;
|
||||
struct wlr_scene_rect *background_rect;
|
||||
struct wlr_scene_tree *strata[KIWMI_STRATA_COUNT];
|
||||
|
|
|
@ -30,19 +30,10 @@ struct kiwmi_layer {
|
|||
struct wl_listener commit;
|
||||
struct wl_listener map;
|
||||
struct wl_listener unmap;
|
||||
|
||||
struct wlr_box geom;
|
||||
};
|
||||
|
||||
void arrange_layers(struct kiwmi_output *output);
|
||||
|
||||
struct kiwmi_layer *layer_at(
|
||||
struct wl_list *layers,
|
||||
struct wlr_surface **surface,
|
||||
double ox,
|
||||
double oy,
|
||||
double *sx,
|
||||
double *sy);
|
||||
void layer_shell_new_surface_notify(struct wl_listener *listener, void *data);
|
||||
|
||||
#endif /* KIWMI_DESKTOP_LAYER_SHELL_H */
|
||||
|
|
|
@ -30,7 +30,6 @@ enum kiwmi_view_type {
|
|||
|
||||
struct kiwmi_view {
|
||||
struct wl_list link;
|
||||
struct wl_list children; // struct kiwmi_view_child::link
|
||||
struct kiwmi_desktop_surface desktop_surface;
|
||||
|
||||
struct kiwmi_desktop *desktop;
|
||||
|
@ -50,16 +49,10 @@ struct kiwmi_view {
|
|||
struct wl_listener unmap;
|
||||
struct wl_listener commit;
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener new_popup;
|
||||
struct wl_listener new_subsurface;
|
||||
struct wl_listener request_move;
|
||||
struct wl_listener request_resize;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
|
||||
bool mapped;
|
||||
bool hidden;
|
||||
|
||||
struct {
|
||||
struct wl_signal unmap;
|
||||
|
@ -74,58 +67,12 @@ struct kiwmi_view {
|
|||
|
||||
struct kiwmi_view_impl {
|
||||
void (*close)(struct kiwmi_view *view);
|
||||
void (*for_each_surface)(
|
||||
struct kiwmi_view *view,
|
||||
wlr_surface_iterator_func_t callback,
|
||||
void *user_data);
|
||||
pid_t (*get_pid)(struct kiwmi_view *view);
|
||||
void (*set_activated)(struct kiwmi_view *view, bool activated);
|
||||
void (*set_size)(struct kiwmi_view *view, uint32_t width, uint32_t height);
|
||||
const char *(
|
||||
*get_string_prop)(struct kiwmi_view *view, enum kiwmi_view_prop prop);
|
||||
void (*set_tiled)(struct kiwmi_view *view, enum wlr_edges edges);
|
||||
struct wlr_surface *(*surface_at)(
|
||||
struct kiwmi_view *view,
|
||||
double sx,
|
||||
double sy,
|
||||
double *sub_x,
|
||||
double *sub_y);
|
||||
};
|
||||
|
||||
enum kiwmi_view_child_type {
|
||||
KIWMI_VIEW_CHILD_SUBSURFACE,
|
||||
KIWMI_VIEW_CHILD_XDG_POPUP,
|
||||
};
|
||||
|
||||
struct kiwmi_view_child {
|
||||
struct wl_list link;
|
||||
struct wl_list children; // struct kiwmi_view_child::link
|
||||
|
||||
struct kiwmi_view *view;
|
||||
struct kiwmi_view_child *parent;
|
||||
|
||||
enum kiwmi_view_child_type type;
|
||||
const struct kiwmi_view_child_impl *impl;
|
||||
|
||||
struct wlr_surface *wlr_surface;
|
||||
union {
|
||||
struct wlr_subsurface *wlr_subsurface;
|
||||
struct wlr_xdg_popup *wlr_xdg_popup;
|
||||
};
|
||||
|
||||
bool mapped;
|
||||
|
||||
struct wl_listener commit;
|
||||
struct wl_listener map;
|
||||
struct wl_listener unmap;
|
||||
struct wl_listener new_popup;
|
||||
struct wl_listener new_subsurface;
|
||||
struct wl_listener extension_destroy; // the union'ed object destroy
|
||||
struct wl_listener surface_destroy; // wlr_surface::events.destroy
|
||||
};
|
||||
|
||||
struct kiwmi_view_child_impl {
|
||||
void (*reconfigure)(struct kiwmi_view_child *child);
|
||||
};
|
||||
|
||||
struct kiwmi_request_resize_event {
|
||||
|
@ -134,10 +81,6 @@ struct kiwmi_request_resize_event {
|
|||
};
|
||||
|
||||
void view_close(struct kiwmi_view *view);
|
||||
void view_for_each_surface(
|
||||
struct kiwmi_view *view,
|
||||
wlr_surface_iterator_func_t callback,
|
||||
void *user_data);
|
||||
pid_t view_get_pid(struct kiwmi_view *view);
|
||||
void view_get_size(struct kiwmi_view *view, uint32_t *width, uint32_t *height);
|
||||
const char *view_get_app_id(struct kiwmi_view *view);
|
||||
|
@ -157,20 +100,4 @@ struct kiwmi_view *view_create(
|
|||
enum kiwmi_view_type type,
|
||||
const struct kiwmi_view_impl *impl);
|
||||
|
||||
void
|
||||
view_init_subsurfaces(struct kiwmi_view_child *child, struct kiwmi_view *view);
|
||||
bool view_child_is_mapped(struct kiwmi_view_child *child);
|
||||
void view_child_damage(struct kiwmi_view_child *child);
|
||||
void view_child_destroy(struct kiwmi_view_child *child);
|
||||
struct kiwmi_view_child *view_child_create(
|
||||
struct kiwmi_view_child *parent,
|
||||
struct kiwmi_view *view,
|
||||
struct wlr_surface *wlr_surface,
|
||||
enum kiwmi_view_child_type type,
|
||||
const struct kiwmi_view_child_impl *impl);
|
||||
struct kiwmi_view_child *view_child_subsurface_create(
|
||||
struct kiwmi_view_child *parent,
|
||||
struct kiwmi_view *view,
|
||||
struct wlr_subsurface *subsurface);
|
||||
|
||||
#endif /* KIWMI_DESKTOP_VIEW_H */
|
||||
|
|
|
@ -48,11 +48,6 @@ desktop_init(struct kiwmi_desktop *desktop)
|
|||
wlr_xdg_output_manager_v1_create(
|
||||
server->wl_display, desktop->output_layout);
|
||||
|
||||
desktop->bg_color[0] = 0.1f;
|
||||
desktop->bg_color[1] = 0.1f;
|
||||
desktop->bg_color[2] = 0.1f;
|
||||
desktop->bg_color[3] = 1.0f;
|
||||
|
||||
desktop->scene = wlr_scene_create();
|
||||
if (!desktop->scene) {
|
||||
wlr_log(WLR_ERROR, "failed to create scene");
|
||||
|
|
|
@ -251,14 +251,14 @@ arrange_layer(
|
|||
continue;
|
||||
}
|
||||
|
||||
layer->geom = arranged_area;
|
||||
|
||||
wlr_scene_node_set_position(
|
||||
&layer->desktop_surface.tree->node, layer->geom.x, layer->geom.y);
|
||||
&layer->desktop_surface.tree->node,
|
||||
arranged_area.x,
|
||||
arranged_area.y);
|
||||
wlr_scene_node_set_position(
|
||||
&layer->desktop_surface.popups_tree->node,
|
||||
layer->geom.x,
|
||||
layer->geom.y);
|
||||
arranged_area.x,
|
||||
arranged_area.y);
|
||||
|
||||
apply_exclusive(
|
||||
usable_area,
|
||||
|
@ -360,36 +360,6 @@ arrange_layers(struct kiwmi_output *output)
|
|||
seat_focus_layer(seat, topmost);
|
||||
}
|
||||
|
||||
struct kiwmi_layer *
|
||||
layer_at(
|
||||
struct wl_list *layers,
|
||||
struct wlr_surface **surface,
|
||||
double ox,
|
||||
double oy,
|
||||
double *sx,
|
||||
double *sy)
|
||||
{
|
||||
struct kiwmi_layer *layer;
|
||||
wl_list_for_each_reverse (layer, layers, link) {
|
||||
double layer_sx = ox - layer->geom.x;
|
||||
double layer_sy = oy - layer->geom.y;
|
||||
|
||||
double _sx;
|
||||
double _sy;
|
||||
struct wlr_surface *_surface = wlr_layer_surface_v1_surface_at(
|
||||
layer->layer_surface, layer_sx, layer_sy, &_sx, &_sy);
|
||||
|
||||
if (_surface) {
|
||||
*sx = _sx;
|
||||
*sy = _sy;
|
||||
*surface = _surface;
|
||||
return layer;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct kiwmi_output *
|
||||
layer_desktop_surface_get_output(struct kiwmi_desktop_surface *desktop_surface)
|
||||
{
|
||||
|
|
|
@ -25,17 +25,6 @@ view_close(struct kiwmi_view *view)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_for_each_surface(
|
||||
struct kiwmi_view *view,
|
||||
wlr_surface_iterator_func_t callback,
|
||||
void *user_data)
|
||||
{
|
||||
if (view->impl->for_each_surface) {
|
||||
view->impl->for_each_surface(view, callback, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
pid_t
|
||||
view_get_pid(struct kiwmi_view *view)
|
||||
{
|
||||
|
@ -86,22 +75,12 @@ view_set_size(struct kiwmi_view *view, uint32_t width, uint32_t height)
|
|||
{
|
||||
if (view->impl->set_size) {
|
||||
view->impl->set_size(view, width, height);
|
||||
|
||||
struct kiwmi_view_child *child;
|
||||
wl_list_for_each (child, &view->children, link) {
|
||||
if (child->impl && child->impl->reconfigure) {
|
||||
child->impl->reconfigure(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_set_pos(struct kiwmi_view *view, uint32_t x, uint32_t y)
|
||||
{
|
||||
view->x = x;
|
||||
view->y = y;
|
||||
|
||||
wlr_scene_node_set_position(&view->desktop_surface.tree->node, x, y);
|
||||
wlr_scene_node_set_position(&view->desktop_surface.popups_tree->node, x, y);
|
||||
|
||||
|
@ -125,8 +104,6 @@ view_set_tiled(struct kiwmi_view *view, enum wlr_edges edges)
|
|||
void
|
||||
view_set_hidden(struct kiwmi_view *view, bool hidden)
|
||||
{
|
||||
view->hidden = hidden;
|
||||
|
||||
if (!view->mapped) {
|
||||
return;
|
||||
}
|
||||
|
@ -206,31 +183,6 @@ view_resize(struct kiwmi_view *view, uint32_t edges)
|
|||
view_begin_interactive(view, KIWMI_CURSOR_RESIZE, edges);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a kiwmi_view_child for each subsurface of either the 'child' or the
|
||||
* 'view'. 'child' can be NULL, 'view' should never be.
|
||||
*/
|
||||
void
|
||||
view_init_subsurfaces(struct kiwmi_view_child *child, struct kiwmi_view *view)
|
||||
{
|
||||
struct wlr_surface *surface =
|
||||
child ? child->wlr_surface : view->wlr_surface;
|
||||
if (!surface) {
|
||||
wlr_log(WLR_ERROR, "Attempting to init_subsurfaces without a surface");
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_subsurface *subsurface;
|
||||
wl_list_for_each (
|
||||
subsurface, &surface->current.subsurfaces_below, current.link) {
|
||||
view_child_subsurface_create(child, view, subsurface);
|
||||
}
|
||||
wl_list_for_each (
|
||||
subsurface, &surface->current.subsurfaces_above, current.link) {
|
||||
view_child_subsurface_create(child, view, subsurface);
|
||||
}
|
||||
}
|
||||
|
||||
static struct kiwmi_output *
|
||||
view_desktop_surface_get_output(struct kiwmi_desktop_surface *desktop_surface)
|
||||
{
|
||||
|
@ -278,14 +230,8 @@ view_create(
|
|||
view->type = type;
|
||||
view->impl = impl;
|
||||
view->mapped = false;
|
||||
view->hidden = true;
|
||||
view->decoration = NULL;
|
||||
|
||||
view->x = 0;
|
||||
view->y = 0;
|
||||
|
||||
wl_list_init(&view->children);
|
||||
|
||||
view->desktop_surface.type = KIWMI_DESKTOP_SURFACE_VIEW;
|
||||
view->desktop_surface.impl = &view_desktop_surface_impl;
|
||||
|
||||
|
@ -309,171 +255,3 @@ view_create(
|
|||
|
||||
return view;
|
||||
}
|
||||
|
||||
bool
|
||||
view_child_is_mapped(struct kiwmi_view_child *child)
|
||||
{
|
||||
if (!child->mapped) {
|
||||
return false;
|
||||
}
|
||||
|
||||
struct kiwmi_view_child *parent = child->parent;
|
||||
while (parent) {
|
||||
if (!parent->mapped) {
|
||||
return false;
|
||||
}
|
||||
parent = parent->parent;
|
||||
}
|
||||
|
||||
return child->view->mapped;
|
||||
}
|
||||
|
||||
void
|
||||
view_child_destroy(struct kiwmi_view_child *child)
|
||||
{
|
||||
wl_list_remove(&child->link);
|
||||
child->parent = NULL;
|
||||
|
||||
struct kiwmi_view_child *subchild, *tmpchild;
|
||||
wl_list_for_each_safe (subchild, tmpchild, &child->children, link) {
|
||||
subchild->mapped = false;
|
||||
view_child_destroy(subchild);
|
||||
}
|
||||
|
||||
wl_list_remove(&child->commit.link);
|
||||
wl_list_remove(&child->map.link);
|
||||
wl_list_remove(&child->unmap.link);
|
||||
wl_list_remove(&child->new_popup.link);
|
||||
wl_list_remove(&child->new_subsurface.link);
|
||||
wl_list_remove(&child->surface_destroy.link);
|
||||
wl_list_remove(&child->extension_destroy.link);
|
||||
|
||||
free(child);
|
||||
}
|
||||
|
||||
static void
|
||||
view_child_subsurface_extension_destroy_notify(
|
||||
struct wl_listener *listener,
|
||||
void *UNUSED(data))
|
||||
{
|
||||
struct kiwmi_view_child *child =
|
||||
wl_container_of(listener, child, extension_destroy);
|
||||
view_child_destroy(child);
|
||||
}
|
||||
|
||||
static void
|
||||
view_child_surface_destroy_notify(
|
||||
struct wl_listener *listener,
|
||||
void *UNUSED(data))
|
||||
{
|
||||
struct kiwmi_view_child *child =
|
||||
wl_container_of(listener, child, surface_destroy);
|
||||
view_child_destroy(child);
|
||||
}
|
||||
|
||||
static void
|
||||
view_child_commit_notify()
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
view_child_new_subsurface_notify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct kiwmi_view_child *child =
|
||||
wl_container_of(listener, child, new_subsurface);
|
||||
struct wlr_subsurface *subsurface = data;
|
||||
view_child_subsurface_create(child, child->view, subsurface);
|
||||
}
|
||||
|
||||
static void
|
||||
view_child_map_notify(struct wl_listener *listener, void *UNUSED(data))
|
||||
{
|
||||
struct kiwmi_view_child *child = wl_container_of(listener, child, map);
|
||||
child->mapped = true;
|
||||
}
|
||||
|
||||
static void
|
||||
view_child_unmap_notify(struct wl_listener *listener, void *UNUSED(data))
|
||||
{
|
||||
struct kiwmi_view_child *child = wl_container_of(listener, child, unmap);
|
||||
child->mapped = false;
|
||||
}
|
||||
|
||||
struct kiwmi_view_child *
|
||||
view_child_create(
|
||||
struct kiwmi_view_child *parent,
|
||||
struct kiwmi_view *view,
|
||||
struct wlr_surface *wlr_surface,
|
||||
enum kiwmi_view_child_type type,
|
||||
const struct kiwmi_view_child_impl *impl)
|
||||
{
|
||||
struct kiwmi_view_child *child = calloc(1, sizeof(*child));
|
||||
if (!child) {
|
||||
wlr_log(WLR_ERROR, "Failed to allocate view_child");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
child->type = type;
|
||||
child->impl = impl;
|
||||
child->view = view;
|
||||
child->wlr_surface = wlr_surface;
|
||||
child->mapped = false;
|
||||
|
||||
if (parent) {
|
||||
child->parent = parent;
|
||||
wl_list_insert(&parent->children, &child->link);
|
||||
} else {
|
||||
wl_list_insert(&view->children, &child->link);
|
||||
}
|
||||
|
||||
wl_list_init(&child->children);
|
||||
|
||||
child->commit.notify = view_child_commit_notify;
|
||||
wl_signal_add(&wlr_surface->events.commit, &child->commit);
|
||||
|
||||
child->map.notify = view_child_map_notify;
|
||||
child->unmap.notify = view_child_unmap_notify;
|
||||
|
||||
// wlr_surface doesn't have these events, but its extensions usually do
|
||||
wl_list_init(&child->map.link);
|
||||
wl_list_init(&child->unmap.link);
|
||||
|
||||
child->new_subsurface.notify = view_child_new_subsurface_notify;
|
||||
wl_signal_add(&wlr_surface->events.new_subsurface, &child->new_subsurface);
|
||||
|
||||
child->surface_destroy.notify = view_child_surface_destroy_notify;
|
||||
wl_signal_add(&wlr_surface->events.destroy, &child->surface_destroy);
|
||||
|
||||
// Possibly unused
|
||||
wl_list_init(&child->new_popup.link);
|
||||
wl_list_init(&child->extension_destroy.link);
|
||||
|
||||
view_init_subsurfaces(child, child->view);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
struct kiwmi_view_child *
|
||||
view_child_subsurface_create(
|
||||
struct kiwmi_view_child *parent,
|
||||
struct kiwmi_view *view,
|
||||
struct wlr_subsurface *subsurface)
|
||||
{
|
||||
struct kiwmi_view_child *child = view_child_create(
|
||||
parent, view, subsurface->surface, KIWMI_VIEW_CHILD_SUBSURFACE, NULL);
|
||||
if (!child) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
child->wlr_subsurface = subsurface;
|
||||
child->mapped = subsurface->mapped;
|
||||
|
||||
wl_signal_add(&subsurface->events.map, &child->map);
|
||||
wl_signal_add(&subsurface->events.unmap, &child->unmap);
|
||||
|
||||
child->extension_destroy.notify =
|
||||
view_child_subsurface_extension_destroy_notify;
|
||||
wl_signal_add(&subsurface->events.destroy, &child->extension_destroy);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
|
|
@ -26,88 +26,6 @@
|
|||
#include "input/seat.h"
|
||||
#include "server.h"
|
||||
|
||||
static struct kiwmi_view_child *view_child_popup_create(
|
||||
struct kiwmi_view_child *parent,
|
||||
struct kiwmi_view *view,
|
||||
struct wlr_xdg_popup *wlr_popup);
|
||||
|
||||
static void
|
||||
popup_new_popup_notify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct kiwmi_view_child *popup =
|
||||
wl_container_of(listener, popup, new_popup);
|
||||
struct wlr_xdg_popup *wlr_popup = data;
|
||||
view_child_popup_create(popup, popup->view, wlr_popup);
|
||||
}
|
||||
|
||||
static void
|
||||
popup_extension_destroy_notify(struct wl_listener *listener, void *UNUSED(data))
|
||||
{
|
||||
struct kiwmi_view_child *popup =
|
||||
wl_container_of(listener, popup, extension_destroy);
|
||||
view_child_destroy(popup);
|
||||
}
|
||||
|
||||
static void
|
||||
popup_reconfigure(struct kiwmi_view_child *popup)
|
||||
{
|
||||
if (popup->type != KIWMI_VIEW_CHILD_XDG_POPUP) {
|
||||
wlr_log(WLR_ERROR, "Expected an xdg_popup view_child");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct kiwmi_view_child_impl xdg_popup_view_child_impl = {
|
||||
.reconfigure = popup_reconfigure,
|
||||
};
|
||||
|
||||
static struct kiwmi_view_child *
|
||||
view_child_popup_create(
|
||||
struct kiwmi_view_child *parent,
|
||||
struct kiwmi_view *view,
|
||||
struct wlr_xdg_popup *wlr_popup)
|
||||
{
|
||||
struct kiwmi_view_child *child = view_child_create(
|
||||
parent,
|
||||
view,
|
||||
wlr_popup->base->surface,
|
||||
KIWMI_VIEW_CHILD_XDG_POPUP,
|
||||
&xdg_popup_view_child_impl);
|
||||
if (!child) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
child->wlr_xdg_popup = wlr_popup;
|
||||
child->mapped = wlr_popup->base->mapped;
|
||||
|
||||
wl_signal_add(&wlr_popup->base->events.map, &child->map);
|
||||
wl_signal_add(&wlr_popup->base->events.unmap, &child->unmap);
|
||||
|
||||
child->new_popup.notify = popup_new_popup_notify;
|
||||
wl_signal_add(&wlr_popup->base->events.new_popup, &child->new_popup);
|
||||
|
||||
child->extension_destroy.notify = popup_extension_destroy_notify;
|
||||
wl_signal_add(&wlr_popup->base->events.destroy, &child->extension_destroy);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_surface_new_popup_notify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct kiwmi_view *view = wl_container_of(listener, view, new_popup);
|
||||
struct wlr_xdg_popup *wlr_popup = data;
|
||||
view_child_popup_create(NULL, view, wlr_popup);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_surface_new_subsurface_notify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct kiwmi_view *view = wl_container_of(listener, view, new_subsurface);
|
||||
struct wlr_subsurface *subsurface = data;
|
||||
view_child_subsurface_create(NULL, view, subsurface);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_surface_map_notify(struct wl_listener *listener, void *UNUSED(data))
|
||||
{
|
||||
|
@ -143,12 +61,16 @@ xdg_surface_commit_notify(struct wl_listener *listener, void *UNUSED(data))
|
|||
{
|
||||
struct kiwmi_view *view = wl_container_of(listener, view, commit);
|
||||
|
||||
struct kiwmi_desktop *desktop = view->desktop;
|
||||
struct kiwmi_server *server = wl_container_of(desktop, server, desktop);
|
||||
struct kiwmi_cursor *cursor = server->input.cursor;
|
||||
cursor_refresh_focus(cursor, NULL, NULL, NULL);
|
||||
struct wlr_box geom;
|
||||
wlr_xdg_surface_get_geometry(view->xdg_surface, &geom);
|
||||
|
||||
wlr_xdg_surface_get_geometry(view->xdg_surface, &view->geom);
|
||||
if (memcmp(&view->geom, &geom, sizeof(geom)) != 0) {
|
||||
memcpy(&view->geom, &geom, sizeof(geom));
|
||||
|
||||
struct kiwmi_desktop *desktop = view->desktop;
|
||||
struct kiwmi_server *server = wl_container_of(desktop, server, desktop);
|
||||
cursor_refresh_focus(server->input.cursor, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -168,24 +90,15 @@ xdg_surface_destroy_notify(struct wl_listener *listener, void *UNUSED(data))
|
|||
}
|
||||
cursor_refresh_focus(server->input.cursor, NULL, NULL, NULL);
|
||||
|
||||
struct kiwmi_view_child *child, *tmpchild;
|
||||
wl_list_for_each_safe (child, tmpchild, &view->children, link) {
|
||||
child->mapped = false;
|
||||
view_child_destroy(child);
|
||||
}
|
||||
|
||||
if (view->decoration) {
|
||||
view->decoration->view = NULL;
|
||||
}
|
||||
|
||||
wl_list_remove(&view->link);
|
||||
wl_list_remove(&view->children);
|
||||
wl_list_remove(&view->map.link);
|
||||
wl_list_remove(&view->unmap.link);
|
||||
wl_list_remove(&view->commit.link);
|
||||
wl_list_remove(&view->destroy.link);
|
||||
wl_list_remove(&view->new_popup.link);
|
||||
wl_list_remove(&view->new_subsurface.link);
|
||||
wl_list_remove(&view->request_move.link);
|
||||
wl_list_remove(&view->request_resize.link);
|
||||
|
||||
|
@ -228,15 +141,6 @@ xdg_shell_view_close(struct kiwmi_view *view)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_shell_view_for_each_surface(
|
||||
struct kiwmi_view *view,
|
||||
wlr_surface_iterator_func_t callback,
|
||||
void *user_data)
|
||||
{
|
||||
wlr_xdg_surface_for_each_surface(view->xdg_surface, callback, user_data);
|
||||
}
|
||||
|
||||
static pid_t
|
||||
xdg_shell_view_get_pid(struct kiwmi_view *view)
|
||||
{
|
||||
|
@ -284,26 +188,13 @@ xdg_shell_view_set_tiled(struct kiwmi_view *view, enum wlr_edges edges)
|
|||
wlr_xdg_toplevel_set_tiled(view->xdg_surface, edges);
|
||||
}
|
||||
|
||||
struct wlr_surface *
|
||||
xdg_shell_view_surface_at(
|
||||
struct kiwmi_view *view,
|
||||
double sx,
|
||||
double sy,
|
||||
double *sub_x,
|
||||
double *sub_y)
|
||||
{
|
||||
return wlr_xdg_surface_surface_at(view->xdg_surface, sx, sy, sub_x, sub_y);
|
||||
}
|
||||
|
||||
static const struct kiwmi_view_impl xdg_shell_view_impl = {
|
||||
.close = xdg_shell_view_close,
|
||||
.for_each_surface = xdg_shell_view_for_each_surface,
|
||||
.get_pid = xdg_shell_view_get_pid,
|
||||
.get_string_prop = xdg_shell_view_get_string_prop,
|
||||
.set_activated = xdg_shell_view_set_activated,
|
||||
.set_size = xdg_shell_view_set_size,
|
||||
.set_tiled = xdg_shell_view_set_tiled,
|
||||
.surface_at = xdg_shell_view_surface_at,
|
||||
.close = xdg_shell_view_close,
|
||||
.get_pid = xdg_shell_view_get_pid,
|
||||
.get_string_prop = xdg_shell_view_get_string_prop,
|
||||
.set_activated = xdg_shell_view_set_activated,
|
||||
.set_size = xdg_shell_view_set_size,
|
||||
.set_tiled = xdg_shell_view_set_tiled,
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -361,13 +252,6 @@ xdg_shell_new_surface_notify(struct wl_listener *listener, void *data)
|
|||
view->destroy.notify = xdg_surface_destroy_notify;
|
||||
wl_signal_add(&xdg_surface->events.destroy, &view->destroy);
|
||||
|
||||
view->new_popup.notify = xdg_surface_new_popup_notify;
|
||||
wl_signal_add(&xdg_surface->events.new_popup, &view->new_popup);
|
||||
|
||||
view->new_subsurface.notify = xdg_surface_new_subsurface_notify;
|
||||
wl_signal_add(
|
||||
&xdg_surface->surface->events.new_subsurface, &view->new_subsurface);
|
||||
|
||||
view->request_move.notify = xdg_toplevel_request_move_notify;
|
||||
wl_signal_add(
|
||||
&xdg_surface->toplevel->events.request_move, &view->request_move);
|
||||
|
@ -376,8 +260,6 @@ xdg_shell_new_surface_notify(struct wl_listener *listener, void *data)
|
|||
wl_signal_add(
|
||||
&xdg_surface->toplevel->events.request_resize, &view->request_resize);
|
||||
|
||||
view_init_subsurfaces(NULL, view);
|
||||
|
||||
wlr_xdg_surface_get_geometry(view->xdg_surface, &view->geom);
|
||||
|
||||
wl_list_insert(&desktop->views, &view->link);
|
||||
|
|
|
@ -65,10 +65,7 @@ l_kiwmi_server_bg_color(lua_State *L)
|
|||
return luaL_argerror(L, 2, "not a valid color");
|
||||
}
|
||||
|
||||
server->desktop.bg_color[0] = color[0];
|
||||
server->desktop.bg_color[1] = color[1];
|
||||
server->desktop.bg_color[2] = color[2];
|
||||
// ignore alpha
|
||||
// Ignore alpha (color channels are already premultiplied)
|
||||
color[3] = 1.0f;
|
||||
|
||||
wlr_scene_rect_set_color(server->desktop.background_rect, color);
|
||||
|
|
Loading…
Reference in a new issue