Update to wlroots 0.15.0

This patch was source from the FreeBSD ports collection and created by 
Jan Beich <jbeich@FreeBSD.org> in commit 2af7805da5c5fc73eb28fba4065cead63c4bb5ab

https://cgit.freebsd.org/ports/commit/x11-wm/hikari/files/patch-wlroots-0.15?id=2af7805da5c5fc73eb28fba4065cead63c4bb5ab
This commit is contained in:
alex 2021-12-22 16:00:43 +00:00
parent 6a1b33156c
commit d958a0cfaf
20 changed files with 42 additions and 34 deletions

View File

@ -1,7 +1,7 @@
#if !defined(HIKARI_BORDER_H)
#define HIKARI_BORDER_H
#include <wlr/types/wlr_box.h>
#include <wlr/util/box.h>
#include <hikari/output.h>

View File

@ -1,7 +1,7 @@
#if !defined(HIKARI_GEOMETRY_H)
#define HIKARI_GEOMETRY_H
#include <wlr/types/wlr_box.h>
#include <wlr/util/box.h>
void
hikari_geometry_split_vertical(struct wlr_box *src,

View File

@ -1,7 +1,7 @@
#if !defined(HIKARIINDICATOR_FRAME_H)
#define HIKARIINDICATOR_FRAME_H
#include <wlr/types/wlr_box.h>
#include <wlr/util/box.h>
struct hikari_view;
struct hikari_renderer;

View File

@ -3,7 +3,7 @@
#include <stdlib.h>
#include <wlr/types/wlr_box.h>
#include <wlr/util/box.h>
#include <hikari/memory.h>

View File

@ -1,7 +1,7 @@
#if !defined(HIKARI_OPERATION_H)
#define HIKARI_OPERATION_H
#include <wlr/types/wlr_box.h>
#include <wlr/util/box.h>
struct hikari_tile;

View File

@ -51,6 +51,7 @@ struct hikari_server {
struct wl_event_loop *event_loop;
struct wlr_backend *backend;
struct wlr_renderer *renderer;
struct wlr_allocator *allocator;
struct wlr_xdg_output_manager_v1 *output_manager;
struct wlr_data_device_manager *data_device_manager;

View File

@ -3,7 +3,7 @@
#include <wayland-util.h>
#include <wlr/types/wlr_box.h>
#include <wlr/util/box.h>
struct hikari_group;
struct hikari_layout;

View File

@ -1,7 +1,7 @@
#if !defined(HIKARI_SPLIT_H)
#define HIKARI_SPLIT_H
#include <wlr/types/wlr_box.h>
#include <wlr/util/box.h>
struct hikari_renderer;
struct hikari_sheet;

View File

@ -1,7 +1,7 @@
#if !defined(HIKARI_TILE_H)
#define HIKARI_TILE_H
#include <wlr/types/wlr_box.h>
#include <wlr/util/box.h>
struct hikari_layout;
struct hikari_view;

View File

@ -4,9 +4,9 @@
#include <assert.h>
#include <wayland-util.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_output_damage.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/util/box.h>
#include <hikari/border.h>
#include <hikari/group.h>

View File

@ -4,8 +4,8 @@
#include <wayland-server-core.h>
#include <wayland-util.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/util/box.h>
#include <hikari/node.h>

View File

@ -80,8 +80,7 @@ hikari_indicator_bar_update(struct hikari_indicator_bar *indicator_bar,
struct hikari_font *font = &hikari_configuration->font;
int width = hikari_configuration->font.character_width * len + 8;
int height = hikari_configuration->font.height;
struct wlr_renderer *wlr_renderer =
wlr_backend_get_renderer(output->wlr_output->backend);
struct wlr_renderer *wlr_renderer = output->wlr_output->renderer;
indicator_bar->width = width;

View File

@ -199,7 +199,7 @@ hikari_layer_init(
layer->node.focus = focus;
layer->node.for_each_surface = for_each_surface;
layer->output = output;
layer->layer = wlr_layer_surface->client_pending.layer;
layer->layer = wlr_layer_surface->pending.layer;
layer->surface = wlr_layer_surface;
layer->mapped = false;
@ -309,8 +309,8 @@ damage_popup(struct hikari_layer_popup *layer_popup, bool whole)
struct wlr_xdg_popup *popup = layer_popup->popup;
struct wlr_surface *surface = popup->base->surface;
int popup_sx = popup->geometry.x - popup->base->geometry.x;
int popup_sy = popup->geometry.y - popup->base->geometry.y;
int popup_sx = popup->geometry.x - popup->base->current.geometry.x;
int popup_sy = popup->geometry.y - popup->base->current.geometry.y;
int ox = popup_sx, oy = popup_sy;
struct hikari_layer *layer;

View File

@ -19,8 +19,7 @@ init_indicator_circle(float color[static 4])
const int size = 100;
struct wlr_texture *texture;
struct wlr_renderer *wlr_renderer =
wlr_backend_get_renderer(hikari_server.backend);
struct wlr_renderer *wlr_renderer = hikari_server.renderer;
cairo_surface_t *surface =
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, size, size);

View File

@ -84,8 +84,7 @@ hikari_output_load_background(struct hikari_output *output,
unsigned char *data = cairo_image_surface_get_data(output_surface);
int stride = cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, output_width);
struct wlr_renderer *renderer =
wlr_backend_get_renderer(output->wlr_output->backend);
struct wlr_renderer *renderer = output->wlr_output->renderer;
output->background = wlr_texture_from_pixels(
renderer, DRM_FORMAT_ARGB8888, stride, output_width, output_height, data);
@ -196,7 +195,7 @@ close_layers(struct wl_list *layers)
{
struct hikari_layer *layer, *layer_temp;
wl_list_for_each_safe (layer, layer_temp, layers, layer_surfaces) {
wlr_layer_surface_v1_close(layer->surface);
wlr_layer_surface_v1_destroy(layer->surface);
layer->output = NULL;
}
}
@ -257,7 +256,7 @@ hikari_output_init(struct hikari_output *output, struct wlr_output *wlr_output)
if (!wl_list_empty(&wlr_output->modes)) {
struct wlr_output_mode *mode =
wl_container_of(wlr_output->modes.prev, mode, link);
wl_container_of(wlr_output->modes.next, mode, link);
wlr_output_set_mode(wlr_output, mode);
}

View File

@ -487,8 +487,7 @@ static inline void
render_output(struct hikari_output *output, pixman_region32_t *damage)
{
struct wlr_output *wlr_output = output->wlr_output;
struct wlr_renderer *wlr_renderer =
wlr_backend_get_renderer(wlr_output->backend);
struct wlr_renderer *wlr_renderer = wlr_output->renderer;
struct hikari_renderer renderer = {
.wlr_output = wlr_output, .wlr_renderer = wlr_renderer, .damage = damage

View File

@ -5,9 +5,11 @@
#include <unistd.h>
#include <wlr/backend.h>
#include <wlr/backend/headless.h>
#include <wlr/backend/libinput.h>
#include <wlr/backend/noop.h>
#include <wlr/backend/session.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_data_control_v1.h>
#include <wlr/types/wlr_data_device.h>
@ -213,6 +215,10 @@ new_output_handler(struct wl_listener *listener, void *data)
struct wlr_output *wlr_output = data;
struct hikari_output *output = hikari_malloc(sizeof(struct hikari_output));
if (!wlr_output_init_render(wlr_output, server->allocator, server->renderer)) {
exit(EXIT_FAILURE);
}
hikari_output_init(output, wlr_output);
hikari_cursor_reset_image(&server->cursor);
}
@ -766,9 +772,9 @@ done:
static void
init_noop_output(struct hikari_server *server)
{
server->noop_backend = wlr_noop_backend_create(server->display);
server->noop_backend = wlr_headless_backend_create(server->display);
struct wlr_output *wlr_output = wlr_noop_add_output(server->noop_backend);
struct wlr_output *wlr_output = wlr_headless_add_output(server->noop_backend, 800, 600);
struct hikari_output *noop_output =
hikari_malloc(sizeof(struct hikari_output));
@ -816,8 +822,7 @@ server_init(struct hikari_server *server, char *config_path)
signal(SIGPIPE, SIG_IGN);
server->renderer = wlr_backend_get_renderer(server->backend);
server->renderer = wlr_renderer_autocreate(server->backend);
if (server->renderer == NULL) {
wl_display_destroy(server->display);
exit(EXIT_FAILURE);
@ -825,6 +830,12 @@ server_init(struct hikari_server *server, char *config_path)
wlr_renderer_init_wl_display(server->renderer, server->display);
server->allocator = wlr_allocator_autocreate(server->backend, server->renderer);
if (server->allocator == NULL) {
wl_display_destroy(server->display);
exit(EXIT_FAILURE);
}
server->socket = wl_display_add_socket_auto(server->display);
if (server->socket == NULL) {
wl_display_destroy(server->display);

View File

@ -809,13 +809,13 @@ hikari_view_map(struct hikari_view *view, struct wlr_surface *surface)
wl_signal_add(&surface->events.new_subsurface, &view->new_subsurface);
struct wlr_subsurface *wlr_subsurface;
wl_list_for_each (wlr_subsurface, &surface->subsurfaces_below, parent_link) {
wl_list_for_each (wlr_subsurface, &surface->current.subsurfaces_below, current.link) {
struct hikari_view_subsurface *subsurface =
(struct hikari_view_subsurface *)malloc(
sizeof(struct hikari_view_subsurface));
hikari_view_subsurface_init(subsurface, view, wlr_subsurface);
}
wl_list_for_each (wlr_subsurface, &surface->subsurfaces_above, parent_link) {
wl_list_for_each (wlr_subsurface, &surface->current.subsurfaces_above, current.link) {
struct hikari_view_subsurface *subsurface =
(struct hikari_view_subsurface *)malloc(
sizeof(struct hikari_view_subsurface));
@ -1695,10 +1695,10 @@ hikari_view_child_init(struct hikari_view_child *view_child,
wl_list_insert(&parent->children, &view_child->link);
struct wlr_subsurface *subsurface;
wl_list_for_each (subsurface, &surface->subsurfaces_below, parent_link) {
wl_list_for_each (subsurface, &surface->current.subsurfaces_below, current.link) {
view_subsurface_create(subsurface, parent);
}
wl_list_for_each (subsurface, &surface->subsurfaces_above, parent_link) {
wl_list_for_each (subsurface, &surface->current.subsurfaces_above, current.link) {
view_subsurface_create(subsurface, parent);
}
}

View File

@ -120,7 +120,7 @@ hikari_workspace_quit_view(struct hikari_workspace *workspace)
if (focus_layer != NULL) {
assert(focus_view == NULL);
wlr_layer_surface_v1_close(focus_layer->surface);
wlr_layer_surface_v1_destroy(focus_layer->surface);
return;
}
#endif

View File

@ -47,7 +47,7 @@ commit_handler(struct wl_listener *listener, void *data)
struct hikari_view *view = (struct hikari_view *)xdg_view;
struct wlr_xdg_surface *surface = xdg_view->surface;
uint32_t serial = surface->configure_serial;
uint32_t serial = surface->current.configure_serial;
assert(view->surface != NULL);