|
|
|
@ -15,7 +15,11 @@
|
|
|
|
|
#include "util/signal.h"
|
|
|
|
|
#include "xdg-shell-unstable-v6-client-protocol.h"
|
|
|
|
|
|
|
|
|
|
int os_create_anonymous_file(off_t size);
|
|
|
|
|
static struct wlr_wl_output *get_wl_output_from_output(
|
|
|
|
|
struct wlr_output *wlr_output) {
|
|
|
|
|
assert(wlr_output_is_wl(wlr_output));
|
|
|
|
|
return (struct wlr_wl_output *)wlr_output;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct wl_callback_listener frame_listener;
|
|
|
|
|
|
|
|
|
@ -33,9 +37,9 @@ static struct wl_callback_listener frame_listener = {
|
|
|
|
|
.done = surface_frame_callback
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static bool output_set_custom_mode(struct wlr_output *_output,
|
|
|
|
|
static bool output_set_custom_mode(struct wlr_output *wlr_output,
|
|
|
|
|
int32_t width, int32_t height, int32_t refresh) {
|
|
|
|
|
struct wlr_wl_output *output = (struct wlr_wl_output *)_output;
|
|
|
|
|
struct wlr_wl_output *output = get_wl_output_from_output(wlr_output);
|
|
|
|
|
wl_egl_window_resize(output->egl_window, width, height, 0, 0);
|
|
|
|
|
wlr_output_update_custom_mode(&output->wlr_output, width, height, 0);
|
|
|
|
|
return true;
|
|
|
|
@ -44,7 +48,7 @@ static bool output_set_custom_mode(struct wlr_output *_output,
|
|
|
|
|
static bool output_make_current(struct wlr_output *wlr_output,
|
|
|
|
|
int *buffer_age) {
|
|
|
|
|
struct wlr_wl_output *output =
|
|
|
|
|
(struct wlr_wl_output *)wlr_output;
|
|
|
|
|
get_wl_output_from_output(wlr_output);
|
|
|
|
|
return wlr_egl_make_current(&output->backend->egl, output->egl_surface,
|
|
|
|
|
buffer_age);
|
|
|
|
|
}
|
|
|
|
@ -52,7 +56,7 @@ static bool output_make_current(struct wlr_output *wlr_output,
|
|
|
|
|
static bool output_swap_buffers(struct wlr_output *wlr_output,
|
|
|
|
|
pixman_region32_t *damage) {
|
|
|
|
|
struct wlr_wl_output *output =
|
|
|
|
|
(struct wlr_wl_output *)wlr_output;
|
|
|
|
|
get_wl_output_from_output(wlr_output);
|
|
|
|
|
|
|
|
|
|
if (output->frame_callback != NULL) {
|
|
|
|
|
wlr_log(WLR_ERROR, "Skipping buffer swap");
|
|
|
|
@ -66,21 +70,22 @@ static bool output_swap_buffers(struct wlr_output *wlr_output,
|
|
|
|
|
damage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void output_transform(struct wlr_output *_output,
|
|
|
|
|
static void output_transform(struct wlr_output *wlr_output,
|
|
|
|
|
enum wl_output_transform transform) {
|
|
|
|
|
struct wlr_wl_output *output = (struct wlr_wl_output *)_output;
|
|
|
|
|
struct wlr_wl_output *output = get_wl_output_from_output(wlr_output);
|
|
|
|
|
output->wlr_output.transform = transform;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool output_set_cursor(struct wlr_output *wlr_output,
|
|
|
|
|
struct wlr_texture *texture, int32_t scale,
|
|
|
|
|
enum wl_output_transform transform, int32_t hotspot_x, int32_t hotspot_y,
|
|
|
|
|
bool update_texture) {
|
|
|
|
|
struct wlr_wl_output *output = (struct wlr_wl_output *)wlr_output;
|
|
|
|
|
enum wl_output_transform transform,
|
|
|
|
|
int32_t hotspot_x, int32_t hotspot_y, bool update_texture) {
|
|
|
|
|
struct wlr_wl_output *output = get_wl_output_from_output(wlr_output);
|
|
|
|
|
struct wlr_wl_backend *backend = output->backend;
|
|
|
|
|
|
|
|
|
|
struct wlr_box hotspot = { .x = hotspot_x, .y = hotspot_y };
|
|
|
|
|
wlr_box_transform(&hotspot, wlr_output_transform_invert(wlr_output->transform),
|
|
|
|
|
wlr_box_transform(&hotspot,
|
|
|
|
|
wlr_output_transform_invert(wlr_output->transform),
|
|
|
|
|
output->cursor.width, output->cursor.height, &hotspot);
|
|
|
|
|
|
|
|
|
|
// TODO: use output->wlr_output.transform to transform pixels and hotpot
|
|
|
|
@ -147,8 +152,7 @@ static bool output_set_cursor(struct wlr_output *wlr_output,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void output_destroy(struct wlr_output *wlr_output) {
|
|
|
|
|
struct wlr_wl_output *output =
|
|
|
|
|
(struct wlr_wl_output *)wlr_output;
|
|
|
|
|
struct wlr_wl_output *output = get_wl_output_from_output(wlr_output);
|
|
|
|
|
if (output == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -215,7 +219,8 @@ static struct zxdg_surface_v6_listener xdg_surface_listener = {
|
|
|
|
|
.configure = xdg_surface_handle_configure,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *xdg_toplevel,
|
|
|
|
|
static void xdg_toplevel_handle_configure(void *data,
|
|
|
|
|
struct zxdg_toplevel_v6 *xdg_toplevel,
|
|
|
|
|
int32_t width, int32_t height, struct wl_array *states) {
|
|
|
|
|
struct wlr_wl_output *output = data;
|
|
|
|
|
assert(output && output->xdg_toplevel == xdg_toplevel);
|
|
|
|
@ -228,7 +233,8 @@ static void xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *x
|
|
|
|
|
wlr_output_update_custom_mode(&output->wlr_output, width, height, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) {
|
|
|
|
|
static void xdg_toplevel_handle_close(void *data,
|
|
|
|
|
struct zxdg_toplevel_v6 *xdg_toplevel) {
|
|
|
|
|
struct wlr_wl_output *output = data;
|
|
|
|
|
assert(output && output->xdg_toplevel == xdg_toplevel);
|
|
|
|
|
|
|
|
|
@ -240,9 +246,8 @@ static struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
|
|
|
|
|
.close = xdg_toplevel_handle_close,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) {
|
|
|
|
|
assert(wlr_backend_is_wl(_backend));
|
|
|
|
|
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend;
|
|
|
|
|
struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) {
|
|
|
|
|
struct wlr_wl_backend *backend = get_wl_backend_from_backend(wlr_backend);
|
|
|
|
|
if (!backend->started) {
|
|
|
|
|
++backend->requested_outputs;
|
|
|
|
|
return NULL;
|
|
|
|
|