Don't use the wlr_ prefix for static functions
This commit is contained in:
parent
71ca45e2c0
commit
625a7a48dc
|
@ -15,13 +15,13 @@
|
||||||
#include "backend/drm/drm.h"
|
#include "backend/drm/drm.h"
|
||||||
#include "util/signal.h"
|
#include "util/signal.h"
|
||||||
|
|
||||||
static bool wlr_drm_backend_start(struct wlr_backend *backend) {
|
static bool backend_start(struct wlr_backend *backend) {
|
||||||
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
|
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
|
||||||
scan_drm_connectors(drm);
|
scan_drm_connectors(drm);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_drm_backend_destroy(struct wlr_backend *backend) {
|
static void backend_destroy(struct wlr_backend *backend) {
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -48,16 +48,16 @@ static void wlr_drm_backend_destroy(struct wlr_backend *backend) {
|
||||||
free(drm);
|
free(drm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_renderer *wlr_drm_backend_get_renderer(
|
static struct wlr_renderer *backend_get_renderer(
|
||||||
struct wlr_backend *backend) {
|
struct wlr_backend *backend) {
|
||||||
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
|
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
|
||||||
return drm->renderer.wlr_rend;
|
return drm->renderer.wlr_rend;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_backend_impl backend_impl = {
|
static struct wlr_backend_impl backend_impl = {
|
||||||
.start = wlr_drm_backend_start,
|
.start = backend_start,
|
||||||
.destroy = wlr_drm_backend_destroy,
|
.destroy = backend_destroy,
|
||||||
.get_renderer = wlr_drm_backend_get_renderer,
|
.get_renderer = backend_get_renderer,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wlr_backend_is_drm(struct wlr_backend *b) {
|
bool wlr_backend_is_drm(struct wlr_backend *b) {
|
||||||
|
@ -110,7 +110,7 @@ static void drm_invalidated(struct wl_listener *listener, void *data) {
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_drm_backend *drm =
|
struct wlr_drm_backend *drm =
|
||||||
wl_container_of(listener, drm, display_destroy);
|
wl_container_of(listener, drm, display_destroy);
|
||||||
wlr_drm_backend_destroy(&drm->backend);
|
backend_destroy(&drm->backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
|
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
|
||||||
|
|
|
@ -7,23 +7,23 @@
|
||||||
#include "backend/libinput.h"
|
#include "backend/libinput.h"
|
||||||
#include "util/signal.h"
|
#include "util/signal.h"
|
||||||
|
|
||||||
static int wlr_libinput_open_restricted(const char *path,
|
static int libinput_open_restricted(const char *path,
|
||||||
int flags, void *_backend) {
|
int flags, void *_backend) {
|
||||||
struct wlr_libinput_backend *backend = _backend;
|
struct wlr_libinput_backend *backend = _backend;
|
||||||
return wlr_session_open_file(backend->session, path);
|
return wlr_session_open_file(backend->session, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_libinput_close_restricted(int fd, void *_backend) {
|
static void libinput_close_restricted(int fd, void *_backend) {
|
||||||
struct wlr_libinput_backend *backend = _backend;
|
struct wlr_libinput_backend *backend = _backend;
|
||||||
wlr_session_close_file(backend->session, fd);
|
wlr_session_close_file(backend->session, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct libinput_interface libinput_impl = {
|
static const struct libinput_interface libinput_impl = {
|
||||||
.open_restricted = wlr_libinput_open_restricted,
|
.open_restricted = libinput_open_restricted,
|
||||||
.close_restricted = wlr_libinput_close_restricted
|
.close_restricted = libinput_close_restricted
|
||||||
};
|
};
|
||||||
|
|
||||||
static int wlr_libinput_readable(int fd, uint32_t mask, void *_backend) {
|
static int handle_libinput_readable(int fd, uint32_t mask, void *_backend) {
|
||||||
struct wlr_libinput_backend *backend = _backend;
|
struct wlr_libinput_backend *backend = _backend;
|
||||||
if (libinput_dispatch(backend->libinput_context) != 0) {
|
if (libinput_dispatch(backend->libinput_context) != 0) {
|
||||||
wlr_log(L_ERROR, "Failed to dispatch libinput");
|
wlr_log(L_ERROR, "Failed to dispatch libinput");
|
||||||
|
@ -38,12 +38,12 @@ static int wlr_libinput_readable(int fd, uint32_t mask, void *_backend) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_libinput_log(struct libinput *libinput_context,
|
static void log_libinput(struct libinput *libinput_context,
|
||||||
enum libinput_log_priority priority, const char *fmt, va_list args) {
|
enum libinput_log_priority priority, const char *fmt, va_list args) {
|
||||||
_wlr_vlog(L_ERROR, fmt, args);
|
_wlr_vlog(L_ERROR, fmt, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
|
static bool backend_start(struct wlr_backend *_backend) {
|
||||||
struct wlr_libinput_backend *backend =
|
struct wlr_libinput_backend *backend =
|
||||||
(struct wlr_libinput_backend *)_backend;
|
(struct wlr_libinput_backend *)_backend;
|
||||||
wlr_log(L_DEBUG, "Initializing libinput");
|
wlr_log(L_DEBUG, "Initializing libinput");
|
||||||
|
@ -62,7 +62,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: More sophisticated logging
|
// TODO: More sophisticated logging
|
||||||
libinput_log_set_handler(backend->libinput_context, wlr_libinput_log);
|
libinput_log_set_handler(backend->libinput_context, log_libinput);
|
||||||
libinput_log_set_priority(backend->libinput_context, LIBINPUT_LOG_PRIORITY_ERROR);
|
libinput_log_set_priority(backend->libinput_context, LIBINPUT_LOG_PRIORITY_ERROR);
|
||||||
|
|
||||||
int libinput_fd = libinput_get_fd(backend->libinput_context);
|
int libinput_fd = libinput_get_fd(backend->libinput_context);
|
||||||
|
@ -73,7 +73,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!no_devs && backend->wlr_device_lists.length == 0) {
|
if (!no_devs && backend->wlr_device_lists.length == 0) {
|
||||||
wlr_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend);
|
handle_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend);
|
||||||
if (backend->wlr_device_lists.length == 0) {
|
if (backend->wlr_device_lists.length == 0) {
|
||||||
wlr_log(L_ERROR, "libinput initialization failed, no input devices");
|
wlr_log(L_ERROR, "libinput initialization failed, no input devices");
|
||||||
wlr_log(L_ERROR, "Set WLR_LIBINPUT_NO_DEVICES=1 to suppress this check");
|
wlr_log(L_ERROR, "Set WLR_LIBINPUT_NO_DEVICES=1 to suppress this check");
|
||||||
|
@ -87,7 +87,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
|
||||||
wl_event_source_remove(backend->input_event);
|
wl_event_source_remove(backend->input_event);
|
||||||
}
|
}
|
||||||
backend->input_event = wl_event_loop_add_fd(event_loop, libinput_fd,
|
backend->input_event = wl_event_loop_add_fd(event_loop, libinput_fd,
|
||||||
WL_EVENT_READABLE, wlr_libinput_readable, backend);
|
WL_EVENT_READABLE, handle_libinput_readable, backend);
|
||||||
if (!backend->input_event) {
|
if (!backend->input_event) {
|
||||||
wlr_log(L_ERROR, "Failed to create input event on event loop");
|
wlr_log(L_ERROR, "Failed to create input event on event loop");
|
||||||
return false;
|
return false;
|
||||||
|
@ -96,7 +96,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) {
|
static void backend_destroy(struct wlr_backend *wlr_backend) {
|
||||||
if (!wlr_backend) {
|
if (!wlr_backend) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -125,9 +125,9 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) {
|
||||||
free(backend);
|
free(backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_backend_impl backend_impl = {
|
static const struct wlr_backend_impl backend_impl = {
|
||||||
.start = wlr_libinput_backend_start,
|
.start = backend_start,
|
||||||
.destroy = wlr_libinput_backend_destroy
|
.destroy = backend_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wlr_backend_is_libinput(struct wlr_backend *b) {
|
bool wlr_backend_is_libinput(struct wlr_backend *b) {
|
||||||
|
@ -153,7 +153,7 @@ static void session_signal(struct wl_listener *listener, void *data) {
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_libinput_backend *backend =
|
struct wlr_libinput_backend *backend =
|
||||||
wl_container_of(listener, backend, display_destroy);
|
wl_container_of(listener, backend, display_destroy);
|
||||||
wlr_libinput_backend_destroy(&backend->backend);
|
backend_destroy(&backend->backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
|
struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct wlr_input_device *get_appropriate_device(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_libinput_device_destroy(struct wlr_input_device *_dev) {
|
static void input_device_destroy(struct wlr_input_device *_dev) {
|
||||||
struct wlr_libinput_input_device *dev = (struct wlr_libinput_input_device *)_dev;
|
struct wlr_libinput_input_device *dev = (struct wlr_libinput_input_device *)_dev;
|
||||||
libinput_device_unref(dev->handle);
|
libinput_device_unref(dev->handle);
|
||||||
wl_list_remove(&dev->wlr_input_device.link);
|
wl_list_remove(&dev->wlr_input_device.link);
|
||||||
|
@ -32,7 +32,7 @@ static void wlr_libinput_device_destroy(struct wlr_input_device *_dev) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wlr_input_device_impl input_device_impl = {
|
static const struct wlr_input_device_impl input_device_impl = {
|
||||||
.destroy = wlr_libinput_device_destroy
|
.destroy = input_device_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct wlr_input_device *allocate_device(
|
static struct wlr_input_device *allocate_device(
|
||||||
|
|
|
@ -12,20 +12,20 @@ struct wlr_libinput_keyboard {
|
||||||
struct libinput_device *libinput_dev;
|
struct libinput_device *libinput_dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void wlr_libinput_keyboard_set_leds(struct wlr_keyboard *wlr_kb, uint32_t leds) {
|
static void keyboard_set_leds(struct wlr_keyboard *wlr_kb, uint32_t leds) {
|
||||||
struct wlr_libinput_keyboard *wlr_libinput_kb = (struct wlr_libinput_keyboard *)wlr_kb;
|
struct wlr_libinput_keyboard *wlr_libinput_kb = (struct wlr_libinput_keyboard *)wlr_kb;
|
||||||
libinput_device_led_update(wlr_libinput_kb->libinput_dev, leds);
|
libinput_device_led_update(wlr_libinput_kb->libinput_dev, leds);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_libinput_keyboard_destroy(struct wlr_keyboard *wlr_kb) {
|
static void keyboard_destroy(struct wlr_keyboard *wlr_kb) {
|
||||||
struct wlr_libinput_keyboard *wlr_libinput_kb =
|
struct wlr_libinput_keyboard *wlr_libinput_kb =
|
||||||
(struct wlr_libinput_keyboard *)wlr_kb;
|
(struct wlr_libinput_keyboard *)wlr_kb;
|
||||||
libinput_device_unref(wlr_libinput_kb->libinput_dev);
|
libinput_device_unref(wlr_libinput_kb->libinput_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_keyboard_impl impl = {
|
struct wlr_keyboard_impl impl = {
|
||||||
.destroy = wlr_libinput_keyboard_destroy,
|
.destroy = keyboard_destroy,
|
||||||
.led_update = wlr_libinput_keyboard_set_leds
|
.led_update = keyboard_set_leds
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_keyboard *create_libinput_keyboard(
|
struct wlr_keyboard *create_libinput_keyboard(
|
||||||
|
|
|
@ -39,7 +39,7 @@ static int dispatch_events(int fd, uint32_t mask, void *data) {
|
||||||
* compositor and creates surfaces for each output, then registers globals on
|
* compositor and creates surfaces for each output, then registers globals on
|
||||||
* the specified display.
|
* the specified display.
|
||||||
*/
|
*/
|
||||||
static bool wlr_wl_backend_start(struct wlr_backend *_backend) {
|
static bool backend_start(struct wlr_backend *_backend) {
|
||||||
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend;
|
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend;
|
||||||
wlr_log(L_INFO, "Initializating wayland backend");
|
wlr_log(L_INFO, "Initializating wayland backend");
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ static bool wlr_wl_backend_start(struct wlr_backend *_backend) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_wl_backend_destroy(struct wlr_backend *wlr_backend) {
|
static void backend_destroy(struct wlr_backend *wlr_backend) {
|
||||||
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend;
|
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend;
|
||||||
if (backend == NULL) {
|
if (backend == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -110,16 +110,16 @@ static void wlr_wl_backend_destroy(struct wlr_backend *wlr_backend) {
|
||||||
free(backend);
|
free(backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_renderer *wlr_wl_backend_get_renderer(
|
static struct wlr_renderer *backend_get_renderer(
|
||||||
struct wlr_backend *wlr_backend) {
|
struct wlr_backend *wlr_backend) {
|
||||||
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend;
|
struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend;
|
||||||
return backend->renderer;
|
return backend->renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_backend_impl backend_impl = {
|
static struct wlr_backend_impl backend_impl = {
|
||||||
.start = wlr_wl_backend_start,
|
.start = backend_start,
|
||||||
.destroy = wlr_wl_backend_destroy,
|
.destroy = backend_destroy,
|
||||||
.get_renderer = wlr_wl_backend_get_renderer,
|
.get_renderer = backend_get_renderer,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wlr_backend_is_wl(struct wlr_backend *b) {
|
bool wlr_backend_is_wl(struct wlr_backend *b) {
|
||||||
|
@ -172,7 +172,7 @@ void get_wl_output_layout_box(struct wlr_wl_backend *backend,
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_wl_backend *backend =
|
struct wlr_wl_backend *backend =
|
||||||
wl_container_of(listener, backend, local_display_destroy);
|
wl_container_of(listener, backend, local_display_destroy);
|
||||||
wlr_wl_backend_destroy(&backend->backend);
|
backend_destroy(&backend->backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, const char *remote) {
|
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, const char *remote) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ static struct wl_callback_listener frame_listener = {
|
||||||
.done = surface_frame_callback
|
.done = surface_frame_callback
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool wlr_wl_output_set_custom_mode(struct wlr_output *_output,
|
static bool output_set_custom_mode(struct wlr_output *_output,
|
||||||
int32_t width, int32_t height, int32_t refresh) {
|
int32_t width, int32_t height, int32_t refresh) {
|
||||||
struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
|
struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
|
||||||
wl_egl_window_resize(output->egl_window, width, height, 0, 0);
|
wl_egl_window_resize(output->egl_window, width, height, 0, 0);
|
||||||
|
@ -40,7 +40,7 @@ static bool wlr_wl_output_set_custom_mode(struct wlr_output *_output,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_wl_output_make_current(struct wlr_output *wlr_output,
|
static bool output_make_current(struct wlr_output *wlr_output,
|
||||||
int *buffer_age) {
|
int *buffer_age) {
|
||||||
struct wlr_wl_backend_output *output =
|
struct wlr_wl_backend_output *output =
|
||||||
(struct wlr_wl_backend_output *)wlr_output;
|
(struct wlr_wl_backend_output *)wlr_output;
|
||||||
|
@ -48,7 +48,7 @@ static bool wlr_wl_output_make_current(struct wlr_output *wlr_output,
|
||||||
buffer_age);
|
buffer_age);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_wl_output_swap_buffers(struct wlr_output *wlr_output,
|
static bool output_swap_buffers(struct wlr_output *wlr_output,
|
||||||
pixman_region32_t *damage) {
|
pixman_region32_t *damage) {
|
||||||
struct wlr_wl_backend_output *output =
|
struct wlr_wl_backend_output *output =
|
||||||
(struct wlr_wl_backend_output *)wlr_output;
|
(struct wlr_wl_backend_output *)wlr_output;
|
||||||
|
@ -65,13 +65,13 @@ static bool wlr_wl_output_swap_buffers(struct wlr_output *wlr_output,
|
||||||
damage);
|
damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_wl_output_transform(struct wlr_output *_output,
|
static void output_transform(struct wlr_output *_output,
|
||||||
enum wl_output_transform transform) {
|
enum wl_output_transform transform) {
|
||||||
struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
|
struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
|
||||||
output->wlr_output.transform = transform;
|
output->wlr_output.transform = transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
|
static bool output_set_cursor(struct wlr_output *_output,
|
||||||
const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
|
const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height,
|
||||||
int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) {
|
int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) {
|
||||||
struct wlr_wl_backend_output *output =
|
struct wlr_wl_backend_output *output =
|
||||||
|
@ -157,7 +157,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_wl_output_destroy(struct wlr_output *wlr_output) {
|
static void output_destroy(struct wlr_output *wlr_output) {
|
||||||
struct wlr_wl_backend_output *output =
|
struct wlr_wl_backend_output *output =
|
||||||
(struct wlr_wl_backend_output *)wlr_output;
|
(struct wlr_wl_backend_output *)wlr_output;
|
||||||
if (output == NULL) {
|
if (output == NULL) {
|
||||||
|
@ -200,19 +200,19 @@ void update_wl_output_cursor(struct wlr_wl_backend_output *output) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wl_output_move_cursor(struct wlr_output *_output, int x, int y) {
|
bool output_move_cursor(struct wlr_output *_output, int x, int y) {
|
||||||
// TODO: only return true if x == current x and y == current y
|
// TODO: only return true if x == current x and y == current y
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_output_impl output_impl = {
|
static const struct wlr_output_impl output_impl = {
|
||||||
.set_custom_mode = wlr_wl_output_set_custom_mode,
|
.set_custom_mode = output_set_custom_mode,
|
||||||
.transform = wlr_wl_output_transform,
|
.transform = output_transform,
|
||||||
.destroy = wlr_wl_output_destroy,
|
.destroy = output_destroy,
|
||||||
.make_current = wlr_wl_output_make_current,
|
.make_current = output_make_current,
|
||||||
.swap_buffers = wlr_wl_output_swap_buffers,
|
.swap_buffers = output_swap_buffers,
|
||||||
.set_cursor = wlr_wl_output_set_cursor,
|
.set_cursor = output_set_cursor,
|
||||||
.move_cursor = wl_output_move_cursor,
|
.move_cursor = output_move_cursor,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wlr_output_is_wl(struct wlr_output *wlr_output) {
|
bool wlr_output_is_wl(struct wlr_output *wlr_output) {
|
||||||
|
|
|
@ -235,7 +235,7 @@ static struct wlr_input_device *allocate_device(struct wlr_wl_backend *backend,
|
||||||
return wlr_device;
|
return wlr_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_wl_pointer_handle_output_destroy(struct wl_listener *listener,
|
static void pointer_handle_output_destroy(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct wlr_wl_pointer *wlr_wl_pointer =
|
struct wlr_wl_pointer *wlr_wl_pointer =
|
||||||
wl_container_of(listener, wlr_wl_pointer, output_destroy_listener);
|
wl_container_of(listener, wlr_wl_pointer, output_destroy_listener);
|
||||||
|
@ -256,7 +256,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wlr_wl_pointer->output_destroy_listener.notify =
|
wlr_wl_pointer->output_destroy_listener.notify =
|
||||||
wlr_wl_pointer_handle_output_destroy;
|
pointer_handle_output_destroy;
|
||||||
|
|
||||||
struct wlr_input_device *wlr_device;
|
struct wlr_input_device *wlr_device;
|
||||||
if (!(wlr_device = allocate_device(backend, WLR_INPUT_DEVICE_POINTER))) {
|
if (!(wlr_device = allocate_device(backend, WLR_INPUT_DEVICE_POINTER))) {
|
||||||
|
|
|
@ -120,7 +120,7 @@ static int x11_event(int fd, uint32_t mask, void *data) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_x11_backend_start(struct wlr_backend *backend) {
|
static bool backend_start(struct wlr_backend *backend) {
|
||||||
struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
|
struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
|
||||||
x11->started = true;
|
x11->started = true;
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_x11_backend_destroy(struct wlr_backend *backend) {
|
static void backend_destroy(struct wlr_backend *backend) {
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -250,16 +250,16 @@ static void wlr_x11_backend_destroy(struct wlr_backend *backend) {
|
||||||
free(x11);
|
free(x11);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_renderer *wlr_x11_backend_get_renderer(
|
static struct wlr_renderer *backend_get_renderer(
|
||||||
struct wlr_backend *backend) {
|
struct wlr_backend *backend) {
|
||||||
struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
|
struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend;
|
||||||
return x11->renderer;
|
return x11->renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wlr_backend_impl backend_impl = {
|
static const struct wlr_backend_impl backend_impl = {
|
||||||
.start = wlr_x11_backend_start,
|
.start = backend_start,
|
||||||
.destroy = wlr_x11_backend_destroy,
|
.destroy = backend_destroy,
|
||||||
.get_renderer = wlr_x11_backend_get_renderer,
|
.get_renderer = backend_get_renderer,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wlr_backend_is_x11(struct wlr_backend *backend) {
|
bool wlr_backend_is_x11(struct wlr_backend *backend) {
|
||||||
|
@ -269,7 +269,7 @@ bool wlr_backend_is_x11(struct wlr_backend *backend) {
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_x11_backend *x11 =
|
struct wlr_x11_backend *x11 =
|
||||||
wl_container_of(listener, x11, display_destroy);
|
wl_container_of(listener, x11, display_destroy);
|
||||||
wlr_x11_backend_destroy(&x11->backend);
|
backend_destroy(&x11->backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
|
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
|
||||||
|
|
|
@ -107,7 +107,7 @@ static void output_cursor_destroy(
|
||||||
free(output_cursor);
|
free(output_cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_cursor_detach_output_layout(struct wlr_cursor *cur) {
|
static void cursor_detach_output_layout(struct wlr_cursor *cur) {
|
||||||
if (!cur->state->layout) {
|
if (!cur->state->layout) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ static void wlr_cursor_detach_output_layout(struct wlr_cursor *cur) {
|
||||||
cur->state->layout = NULL;
|
cur->state->layout = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_cursor_device_destroy(struct wlr_cursor_device *c_device) {
|
static void cursor_device_destroy(struct wlr_cursor_device *c_device) {
|
||||||
struct wlr_input_device *dev = c_device->device;
|
struct wlr_input_device *dev = c_device->device;
|
||||||
if (dev->type == WLR_INPUT_DEVICE_POINTER) {
|
if (dev->type == WLR_INPUT_DEVICE_POINTER) {
|
||||||
wl_list_remove(&c_device->motion.link);
|
wl_list_remove(&c_device->motion.link);
|
||||||
|
@ -150,11 +150,11 @@ static void wlr_cursor_device_destroy(struct wlr_cursor_device *c_device) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_cursor_destroy(struct wlr_cursor *cur) {
|
void wlr_cursor_destroy(struct wlr_cursor *cur) {
|
||||||
wlr_cursor_detach_output_layout(cur);
|
cursor_detach_output_layout(cur);
|
||||||
|
|
||||||
struct wlr_cursor_device *device, *device_tmp = NULL;
|
struct wlr_cursor_device *device, *device_tmp = NULL;
|
||||||
wl_list_for_each_safe(device, device_tmp, &cur->state->devices, link) {
|
wl_list_for_each_safe(device, device_tmp, &cur->state->devices, link) {
|
||||||
wlr_cursor_device_destroy(device);
|
cursor_device_destroy(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(cur->state);
|
free(cur->state);
|
||||||
|
@ -174,7 +174,7 @@ static struct wlr_cursor_device *get_cursor_device(struct wlr_cursor *cur,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_cursor_warp_unchecked(struct wlr_cursor *cur,
|
static void cursor_warp_unchecked(struct wlr_cursor *cur,
|
||||||
double x, double y) {
|
double x, double y) {
|
||||||
assert(cur->state->layout);
|
assert(cur->state->layout);
|
||||||
|
|
||||||
|
@ -241,12 +241,12 @@ bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
|
||||||
|
|
||||||
if (mapping) {
|
if (mapping) {
|
||||||
if (wlr_box_contains_point(mapping, x, y)) {
|
if (wlr_box_contains_point(mapping, x, y)) {
|
||||||
wlr_cursor_warp_unchecked(cur, x, y);
|
cursor_warp_unchecked(cur, x, y);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
} else if (wlr_output_layout_contains_point(cur->state->layout, NULL,
|
} else if (wlr_output_layout_contains_point(cur->state->layout, NULL,
|
||||||
x, y)) {
|
x, y)) {
|
||||||
wlr_cursor_warp_unchecked(cur, x, y);
|
cursor_warp_unchecked(cur, x, y);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
|
||||||
x = x >= 0 ? mapping->width * x + mapping->x : cur->x;
|
x = x >= 0 ? mapping->width * x + mapping->x : cur->x;
|
||||||
y = y >= 0 ? mapping->height * y + mapping->y : cur->y;
|
y = y >= 0 ? mapping->height * y + mapping->y : cur->y;
|
||||||
|
|
||||||
wlr_cursor_warp_unchecked(cur, x, y);
|
cursor_warp_unchecked(cur, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
|
void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
|
||||||
|
@ -295,7 +295,7 @@ void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_cursor_warp_unchecked(cur, x, y);
|
cursor_warp_unchecked(cur, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels,
|
void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels,
|
||||||
|
@ -414,7 +414,7 @@ static void handle_device_destroy(struct wl_listener *listener, void *data) {
|
||||||
wlr_cursor_detach_input_device(c_device->cursor, c_device->device);
|
wlr_cursor_detach_input_device(c_device->cursor, c_device->device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_cursor_device *wlr_cursor_device_create(
|
static struct wlr_cursor_device *cursor_device_create(
|
||||||
struct wlr_cursor *cursor, struct wlr_input_device *device) {
|
struct wlr_cursor *cursor, struct wlr_input_device *device) {
|
||||||
struct wlr_cursor_device *c_device =
|
struct wlr_cursor_device *c_device =
|
||||||
calloc(1, sizeof(struct wlr_cursor_device));
|
calloc(1, sizeof(struct wlr_cursor_device));
|
||||||
|
@ -496,7 +496,7 @@ void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_cursor_device_create(cur, dev);
|
cursor_device_create(cur, dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
|
void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
|
||||||
|
@ -504,7 +504,7 @@ void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
|
||||||
struct wlr_cursor_device *c_device, *tmp = NULL;
|
struct wlr_cursor_device *c_device, *tmp = NULL;
|
||||||
wl_list_for_each_safe(c_device, tmp, &cur->state->devices, link) {
|
wl_list_for_each_safe(c_device, tmp, &cur->state->devices, link) {
|
||||||
if (c_device->device == dev) {
|
if (c_device->device == dev) {
|
||||||
wlr_cursor_device_destroy(c_device);
|
cursor_device_destroy(c_device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
|
||||||
static void handle_layout_destroy(struct wl_listener *listener, void *data) {
|
static void handle_layout_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_cursor_state *state =
|
struct wlr_cursor_state *state =
|
||||||
wl_container_of(listener, state, layout_destroy);
|
wl_container_of(listener, state, layout_destroy);
|
||||||
wlr_cursor_detach_output_layout(state->cursor);
|
cursor_detach_output_layout(state->cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_layout_output_destroy(struct wl_listener *listener,
|
static void handle_layout_output_destroy(struct wl_listener *listener,
|
||||||
|
@ -567,13 +567,13 @@ static void handle_layout_change(struct wl_listener *listener, void *data) {
|
||||||
wlr_output_layout_closest_point(layout, NULL, state->cursor->x,
|
wlr_output_layout_closest_point(layout, NULL, state->cursor->x,
|
||||||
state->cursor->y, &x, &y);
|
state->cursor->y, &x, &y);
|
||||||
|
|
||||||
wlr_cursor_warp_unchecked(state->cursor, x, y);
|
cursor_warp_unchecked(state->cursor, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
|
void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
|
||||||
struct wlr_output_layout *l) {
|
struct wlr_output_layout *l) {
|
||||||
wlr_cursor_detach_output_layout(cur);
|
cursor_detach_output_layout(cur);
|
||||||
|
|
||||||
if (l == NULL) {
|
if (l == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -219,7 +219,7 @@ static void handle_offer_source_destroyed(struct wl_listener *listener,
|
||||||
offer->source = NULL;
|
offer->source = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_data_offer *wlr_data_source_send_offer(
|
static struct wlr_data_offer *data_source_send_offer(
|
||||||
struct wlr_data_source *source,
|
struct wlr_data_source *source,
|
||||||
struct wlr_seat_client *target) {
|
struct wlr_seat_client *target) {
|
||||||
if (wl_list_empty(&target->data_devices)) {
|
if (wl_list_empty(&target->data_devices)) {
|
||||||
|
@ -268,7 +268,7 @@ void wlr_seat_client_send_selection(struct wlr_seat_client *seat_client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seat_client->seat->selection_source) {
|
if (seat_client->seat->selection_source) {
|
||||||
struct wlr_data_offer *offer = wlr_data_source_send_offer(
|
struct wlr_data_offer *offer = data_source_send_offer(
|
||||||
seat_client->seat->selection_source, seat_client);
|
seat_client->seat->selection_source, seat_client);
|
||||||
if (offer == NULL) {
|
if (offer == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -375,7 +375,7 @@ static void handle_drag_seat_client_destroy(struct wl_listener *listener,
|
||||||
wl_list_remove(&drag->seat_client_destroy.link);
|
wl_list_remove(&drag->seat_client_destroy.link);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_drag_set_focus(struct wlr_drag *drag,
|
static void drag_set_focus(struct wlr_drag *drag,
|
||||||
struct wlr_surface *surface, double sx, double sy) {
|
struct wlr_surface *surface, double sx, double sy) {
|
||||||
if (drag->focus == surface) {
|
if (drag->focus == surface) {
|
||||||
return;
|
return;
|
||||||
|
@ -420,7 +420,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
|
||||||
struct wl_resource *offer_resource = NULL;
|
struct wl_resource *offer_resource = NULL;
|
||||||
if (drag->source) {
|
if (drag->source) {
|
||||||
drag->source->accepted = false;
|
drag->source->accepted = false;
|
||||||
struct wlr_data_offer *offer = wlr_data_source_send_offer(drag->source,
|
struct wlr_data_offer *offer = data_source_send_offer(drag->source,
|
||||||
focus_client);
|
focus_client);
|
||||||
if (offer != NULL) {
|
if (offer != NULL) {
|
||||||
data_offer_update_action(offer);
|
data_offer_update_action(offer);
|
||||||
|
@ -454,7 +454,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
|
||||||
wlr_signal_emit_safe(&drag->events.focus, drag);
|
wlr_signal_emit_safe(&drag->events.focus, drag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_drag_end(struct wlr_drag *drag) {
|
static void drag_end(struct wlr_drag *drag) {
|
||||||
if (!drag->cancelling) {
|
if (!drag->cancelling) {
|
||||||
drag->cancelling = true;
|
drag->cancelling = true;
|
||||||
if (drag->is_pointer_grab) {
|
if (drag->is_pointer_grab) {
|
||||||
|
@ -468,7 +468,7 @@ static void wlr_drag_end(struct wlr_drag *drag) {
|
||||||
wl_list_remove(&drag->source_destroy.link);
|
wl_list_remove(&drag->source_destroy.link);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_drag_set_focus(drag, NULL, 0, 0);
|
drag_set_focus(drag, NULL, 0, 0);
|
||||||
|
|
||||||
if (drag->icon) {
|
if (drag->icon) {
|
||||||
drag->icon->mapped = false;
|
drag->icon->mapped = false;
|
||||||
|
@ -484,7 +484,7 @@ static void wlr_drag_end(struct wlr_drag *drag) {
|
||||||
static void pointer_drag_enter(struct wlr_seat_pointer_grab *grab,
|
static void pointer_drag_enter(struct wlr_seat_pointer_grab *grab,
|
||||||
struct wlr_surface *surface, double sx, double sy) {
|
struct wlr_surface *surface, double sx, double sy) {
|
||||||
struct wlr_drag *drag = grab->data;
|
struct wlr_drag *drag = grab->data;
|
||||||
wlr_drag_set_focus(drag, surface, sx, sy);
|
drag_set_focus(drag, surface, sx, sy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pointer_drag_motion(struct wlr_seat_pointer_grab *grab,
|
static void pointer_drag_motion(struct wlr_seat_pointer_grab *grab,
|
||||||
|
@ -540,7 +540,7 @@ static uint32_t pointer_drag_button(struct wlr_seat_pointer_grab *grab,
|
||||||
|
|
||||||
if (grab->seat->pointer_state.button_count == 0 &&
|
if (grab->seat->pointer_state.button_count == 0 &&
|
||||||
state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
||||||
wlr_drag_end(drag);
|
drag_end(drag);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -553,7 +553,7 @@ static void pointer_drag_axis(struct wlr_seat_pointer_grab *grab, uint32_t time,
|
||||||
|
|
||||||
static void pointer_drag_cancel(struct wlr_seat_pointer_grab *grab) {
|
static void pointer_drag_cancel(struct wlr_seat_pointer_grab *grab) {
|
||||||
struct wlr_drag *drag = grab->data;
|
struct wlr_drag *drag = grab->data;
|
||||||
wlr_drag_end(drag);
|
drag_end(drag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wlr_pointer_grab_interface
|
static const struct wlr_pointer_grab_interface
|
||||||
|
@ -585,7 +585,7 @@ static void touch_drag_up(struct wlr_seat_touch_grab *grab, uint32_t time,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_drag_end(drag);
|
drag_end(drag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void touch_drag_motion(struct wlr_seat_touch_grab *grab, uint32_t time,
|
static void touch_drag_motion(struct wlr_seat_touch_grab *grab, uint32_t time,
|
||||||
|
@ -604,12 +604,12 @@ static void touch_drag_motion(struct wlr_seat_touch_grab *grab, uint32_t time,
|
||||||
static void touch_drag_enter(struct wlr_seat_touch_grab *grab, uint32_t time,
|
static void touch_drag_enter(struct wlr_seat_touch_grab *grab, uint32_t time,
|
||||||
struct wlr_touch_point *point) {
|
struct wlr_touch_point *point) {
|
||||||
struct wlr_drag *drag = grab->data;
|
struct wlr_drag *drag = grab->data;
|
||||||
wlr_drag_set_focus(drag, point->focus_surface, point->sx, point->sy);
|
drag_set_focus(drag, point->focus_surface, point->sx, point->sy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void touch_drag_cancel(struct wlr_seat_touch_grab *grab) {
|
static void touch_drag_cancel(struct wlr_seat_touch_grab *grab) {
|
||||||
struct wlr_drag *drag = grab->data;
|
struct wlr_drag *drag = grab->data;
|
||||||
wlr_drag_end(drag);
|
drag_end(drag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wlr_touch_grab_interface
|
static const struct wlr_touch_grab_interface
|
||||||
|
@ -641,7 +641,7 @@ static void keyboard_drag_modifiers(struct wlr_seat_keyboard_grab *grab,
|
||||||
|
|
||||||
static void keyboard_drag_cancel(struct wlr_seat_keyboard_grab *grab) {
|
static void keyboard_drag_cancel(struct wlr_seat_keyboard_grab *grab) {
|
||||||
struct wlr_drag *drag = grab->data;
|
struct wlr_drag *drag = grab->data;
|
||||||
wlr_drag_end(drag);
|
drag_end(drag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wlr_keyboard_grab_interface
|
static const struct wlr_keyboard_grab_interface
|
||||||
|
@ -660,10 +660,10 @@ static void drag_handle_icon_destroy(struct wl_listener *listener, void *data) {
|
||||||
static void drag_handle_drag_source_destroy(struct wl_listener *listener,
|
static void drag_handle_drag_source_destroy(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct wlr_drag *drag = wl_container_of(listener, drag, source_destroy);
|
struct wlr_drag *drag = wl_container_of(listener, drag, source_destroy);
|
||||||
wlr_drag_end(drag);
|
drag_end(drag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_drag_icon_destroy(struct wlr_drag_icon *icon) {
|
static void drag_icon_destroy(struct wlr_drag_icon *icon) {
|
||||||
if (!icon) {
|
if (!icon) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -679,7 +679,7 @@ static void handle_drag_icon_surface_destroy(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct wlr_drag_icon *icon =
|
struct wlr_drag_icon *icon =
|
||||||
wl_container_of(listener, icon, surface_destroy);
|
wl_container_of(listener, icon, surface_destroy);
|
||||||
wlr_drag_icon_destroy(icon);
|
drag_icon_destroy(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_drag_icon_surface_commit(struct wlr_surface *surface,
|
static void handle_drag_icon_surface_commit(struct wlr_surface *surface,
|
||||||
|
@ -694,10 +694,10 @@ static void handle_drag_icon_seat_client_destroy(struct wl_listener *listener,
|
||||||
struct wlr_drag_icon *icon =
|
struct wlr_drag_icon *icon =
|
||||||
wl_container_of(listener, icon, seat_client_destroy);
|
wl_container_of(listener, icon, seat_client_destroy);
|
||||||
|
|
||||||
wlr_drag_icon_destroy(icon);
|
drag_icon_destroy(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_drag_icon *wlr_drag_icon_create(
|
static struct wlr_drag_icon *drag_icon_create(
|
||||||
struct wlr_surface *icon_surface, struct wlr_seat_client *client,
|
struct wlr_surface *icon_surface, struct wlr_seat_client *client,
|
||||||
bool is_pointer, int32_t touch_id) {
|
bool is_pointer, int32_t touch_id) {
|
||||||
struct wlr_drag_icon *icon = calloc(1, sizeof(struct wlr_drag_icon));
|
struct wlr_drag_icon *icon = calloc(1, sizeof(struct wlr_drag_icon));
|
||||||
|
@ -780,7 +780,7 @@ static bool seat_client_start_drag(struct wlr_seat_client *client,
|
||||||
if (icon_surface) {
|
if (icon_surface) {
|
||||||
int32_t touch_id = (point ? point->touch_id : 0);
|
int32_t touch_id = (point ? point->touch_id : 0);
|
||||||
struct wlr_drag_icon *icon =
|
struct wlr_drag_icon *icon =
|
||||||
wlr_drag_icon_create(icon_surface, client, drag->is_pointer_grab,
|
drag_icon_create(icon_surface, client, drag->is_pointer_grab,
|
||||||
touch_id);
|
touch_id);
|
||||||
if (!icon) {
|
if (!icon) {
|
||||||
free(drag);
|
free(drag);
|
||||||
|
@ -817,7 +817,7 @@ static bool seat_client_start_drag(struct wlr_seat_client *client,
|
||||||
} else {
|
} else {
|
||||||
assert(point);
|
assert(point);
|
||||||
wlr_seat_touch_start_grab(seat, &drag->touch_grab);
|
wlr_seat_touch_start_grab(seat, &drag->touch_grab);
|
||||||
wlr_drag_set_focus(drag, point->surface, point->sx, point->sy);
|
drag_set_focus(drag, point->surface, point->sx, point->sy);
|
||||||
}
|
}
|
||||||
|
|
||||||
seat->drag = drag; // TODO: unset this thing somewhere
|
seat->drag = drag; // TODO: unset this thing somewhere
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
#include "wayland-server.h"
|
#include "wayland-server.h"
|
||||||
#include "idle-inhibit-unstable-v1-protocol.h"
|
#include "idle-inhibit-unstable-v1-protocol.h"
|
||||||
|
|
||||||
static struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl;
|
static const struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl;
|
||||||
|
|
||||||
static struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl;
|
static const struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl;
|
||||||
|
|
||||||
static struct wlr_idle_inhibit_manager_v1 *
|
static struct wlr_idle_inhibit_manager_v1 *
|
||||||
wlr_idle_inhibit_manager_v1_from_resource(struct wl_resource *resource) {
|
wlr_idle_inhibit_manager_v1_from_resource(struct wl_resource *resource) {
|
||||||
|
@ -50,11 +50,11 @@ static void idle_inhibitor_v1_handle_destroy(struct wl_client *client,
|
||||||
wl_resource_destroy(manager_resource);
|
wl_resource_destroy(manager_resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl = {
|
static const struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl = {
|
||||||
.destroy = idle_inhibitor_v1_handle_destroy,
|
.destroy = idle_inhibitor_v1_handle_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void wlr_create_inhibitor(struct wl_client *client,
|
static void manager_create_inhibitor(struct wl_client *client,
|
||||||
struct wl_resource *resource, uint32_t id,
|
struct wl_resource *resource, uint32_t id,
|
||||||
struct wl_resource *surface_resource) {
|
struct wl_resource *surface_resource) {
|
||||||
struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
|
struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
|
||||||
|
@ -96,14 +96,14 @@ static void idle_inhibit_manager_v1_destroy(struct wl_resource *resource) {
|
||||||
wl_list_remove(wl_resource_get_link(resource));
|
wl_list_remove(wl_resource_get_link(resource));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void idle_inhibit_manager_v1_handle_destroy(struct wl_client *client,
|
static void manager_destroy(struct wl_client *client,
|
||||||
struct wl_resource *manager_resource) {
|
struct wl_resource *manager_resource) {
|
||||||
wl_resource_destroy(manager_resource);
|
wl_resource_destroy(manager_resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl = {
|
static const struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl = {
|
||||||
.destroy = idle_inhibit_manager_v1_handle_destroy,
|
.destroy = manager_destroy,
|
||||||
.create_inhibitor = wlr_create_inhibitor,
|
.create_inhibitor = manager_create_inhibitor,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
static void handle_display_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
|
|
@ -195,7 +195,7 @@ static void layer_surface_resource_destroy(struct wl_resource *resource) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_layer_surface_state_changed(struct wlr_layer_surface *surface) {
|
static bool layer_surface_state_changed(struct wlr_layer_surface *surface) {
|
||||||
struct wlr_layer_surface_state *state;
|
struct wlr_layer_surface_state *state;
|
||||||
if (wl_list_empty(&surface->configure_list)) {
|
if (wl_list_empty(&surface->configure_list)) {
|
||||||
if (surface->acked_configure) {
|
if (surface->acked_configure) {
|
||||||
|
@ -220,7 +220,7 @@ void wlr_layer_surface_configure(struct wlr_layer_surface *surface,
|
||||||
uint32_t width, uint32_t height) {
|
uint32_t width, uint32_t height) {
|
||||||
surface->server_pending.actual_width = width;
|
surface->server_pending.actual_width = width;
|
||||||
surface->server_pending.actual_height = height;
|
surface->server_pending.actual_height = height;
|
||||||
if (wlr_layer_surface_state_changed(surface)) {
|
if (layer_surface_state_changed(surface)) {
|
||||||
struct wl_display *display =
|
struct wl_display *display =
|
||||||
wl_client_get_display(wl_resource_get_client(surface->resource));
|
wl_client_get_display(wl_resource_get_client(surface->resource));
|
||||||
struct wlr_layer_surface_configure *configure =
|
struct wlr_layer_surface_configure *configure =
|
||||||
|
@ -249,7 +249,7 @@ void wlr_layer_surface_close(struct wlr_layer_surface *surface) {
|
||||||
zwlr_layer_surface_v1_send_closed(surface->resource);
|
zwlr_layer_surface_v1_send_closed(surface->resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
|
static void handle_surface_committed(struct wlr_surface *wlr_surface,
|
||||||
void *role_data) {
|
void *role_data) {
|
||||||
struct wlr_layer_surface *surface = role_data;
|
struct wlr_layer_surface *surface = role_data;
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client,
|
||||||
wl_signal_init(&surface->events.new_popup);
|
wl_signal_init(&surface->events.new_popup);
|
||||||
|
|
||||||
wlr_surface_set_role_committed(surface->surface,
|
wlr_surface_set_role_committed(surface->surface,
|
||||||
handle_wlr_surface_committed, surface);
|
handle_surface_committed, surface);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new layer_surface %p (res %p)",
|
wlr_log(L_DEBUG, "new layer_surface %p (res %p)",
|
||||||
surface, surface->resource);
|
surface, surface->resource);
|
||||||
|
|
|
@ -48,7 +48,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_output_send_current_mode_to_resource(
|
static void output_send_current_mode_to_resource(
|
||||||
struct wl_resource *resource) {
|
struct wl_resource *resource) {
|
||||||
struct wlr_output *output = wlr_output_from_resource(resource);
|
struct wlr_output *output = wlr_output_from_resource(resource);
|
||||||
const uint32_t version = wl_resource_get_version(resource);
|
const uint32_t version = wl_resource_get_version(resource);
|
||||||
|
@ -138,7 +138,7 @@ void wlr_output_update_enabled(struct wlr_output *output, bool enabled) {
|
||||||
wlr_signal_emit_safe(&output->events.enable, output);
|
wlr_signal_emit_safe(&output->events.enable, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_output_update_matrix(struct wlr_output *output) {
|
static void output_update_matrix(struct wlr_output *output) {
|
||||||
wlr_matrix_projection(output->transform_matrix, output->width,
|
wlr_matrix_projection(output->transform_matrix, output->width,
|
||||||
output->height, output->transform);
|
output->height, output->transform);
|
||||||
}
|
}
|
||||||
|
@ -185,13 +185,13 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
|
||||||
|
|
||||||
output->width = width;
|
output->width = width;
|
||||||
output->height = height;
|
output->height = height;
|
||||||
wlr_output_update_matrix(output);
|
output_update_matrix(output);
|
||||||
|
|
||||||
output->refresh = refresh;
|
output->refresh = refresh;
|
||||||
|
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &output->wl_resources) {
|
wl_resource_for_each(resource, &output->wl_resources) {
|
||||||
wlr_output_send_current_mode_to_resource(resource);
|
output_send_current_mode_to_resource(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_signal_emit_safe(&output->events.mode, output);
|
wlr_signal_emit_safe(&output->events.mode, output);
|
||||||
|
@ -200,7 +200,7 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
|
||||||
void wlr_output_set_transform(struct wlr_output *output,
|
void wlr_output_set_transform(struct wlr_output *output,
|
||||||
enum wl_output_transform transform) {
|
enum wl_output_transform transform) {
|
||||||
output->impl->transform(output, transform);
|
output->impl->transform(output, transform);
|
||||||
wlr_output_update_matrix(output);
|
output_update_matrix(output);
|
||||||
|
|
||||||
// TODO: only send geometry and done
|
// TODO: only send geometry and done
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct wlr_output_layout *wlr_output_layout_create() {
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_output_layout_output_destroy(
|
static void output_layout_output_destroy(
|
||||||
struct wlr_output_layout_output *l_output) {
|
struct wlr_output_layout_output *l_output) {
|
||||||
wlr_signal_emit_safe(&l_output->events.destroy, l_output);
|
wlr_signal_emit_safe(&l_output->events.destroy, l_output);
|
||||||
wlr_output_destroy_global(l_output->output);
|
wlr_output_destroy_global(l_output->output);
|
||||||
|
@ -67,14 +67,14 @@ void wlr_output_layout_destroy(struct wlr_output_layout *layout) {
|
||||||
|
|
||||||
struct wlr_output_layout_output *l_output, *temp;
|
struct wlr_output_layout_output *l_output, *temp;
|
||||||
wl_list_for_each_safe(l_output, temp, &layout->outputs, link) {
|
wl_list_for_each_safe(l_output, temp, &layout->outputs, link) {
|
||||||
wlr_output_layout_output_destroy(l_output);
|
output_layout_output_destroy(l_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(layout->state);
|
free(layout->state);
|
||||||
free(layout);
|
free(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_box *wlr_output_layout_output_get_box(
|
static struct wlr_box *output_layout_output_get_box(
|
||||||
struct wlr_output_layout_output *l_output) {
|
struct wlr_output_layout_output *l_output) {
|
||||||
l_output->state->_box.x = l_output->x;
|
l_output->state->_box.x = l_output->x;
|
||||||
l_output->state->_box.y = l_output->y;
|
l_output->state->_box.y = l_output->y;
|
||||||
|
@ -92,7 +92,7 @@ static struct wlr_box *wlr_output_layout_output_get_box(
|
||||||
* Auto configured outputs are placed to the right of the north east corner of
|
* Auto configured outputs are placed to the right of the north east corner of
|
||||||
* the rightmost output in the layout in a horizontal line.
|
* the rightmost output in the layout in a horizontal line.
|
||||||
*/
|
*/
|
||||||
static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
|
static void output_layout_reconfigure(struct wlr_output_layout *layout) {
|
||||||
int max_x = INT_MIN;
|
int max_x = INT_MIN;
|
||||||
int max_x_y = INT_MIN; // y value for the max_x output
|
int max_x_y = INT_MIN; // y value for the max_x output
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
|
struct wlr_box *box = output_layout_output_get_box(l_output);
|
||||||
if (box->x + box->width > max_x) {
|
if (box->x + box->width > max_x) {
|
||||||
max_x = box->x + box->width;
|
max_x = box->x + box->width;
|
||||||
max_x_y = box->y;
|
max_x_y = box->y;
|
||||||
|
@ -121,7 +121,7 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
|
||||||
if (!l_output->state->auto_configured) {
|
if (!l_output->state->auto_configured) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
|
struct wlr_box *box = output_layout_output_get_box(l_output);
|
||||||
l_output->x = max_x;
|
l_output->x = max_x;
|
||||||
l_output->y = max_x_y;
|
l_output->y = max_x_y;
|
||||||
max_x += box->width;
|
max_x += box->width;
|
||||||
|
@ -137,30 +137,30 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
|
||||||
static void handle_output_mode(struct wl_listener *listener, void *data) {
|
static void handle_output_mode(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_output_layout_output_state *state =
|
struct wlr_output_layout_output_state *state =
|
||||||
wl_container_of(listener, state, mode);
|
wl_container_of(listener, state, mode);
|
||||||
wlr_output_layout_reconfigure(state->layout);
|
output_layout_reconfigure(state->layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_output_scale(struct wl_listener *listener, void *data) {
|
static void handle_output_scale(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_output_layout_output_state *state =
|
struct wlr_output_layout_output_state *state =
|
||||||
wl_container_of(listener, state, scale);
|
wl_container_of(listener, state, scale);
|
||||||
wlr_output_layout_reconfigure(state->layout);
|
output_layout_reconfigure(state->layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_output_transform(struct wl_listener *listener, void *data) {
|
static void handle_output_transform(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_output_layout_output_state *state =
|
struct wlr_output_layout_output_state *state =
|
||||||
wl_container_of(listener, state, transform);
|
wl_container_of(listener, state, transform);
|
||||||
wlr_output_layout_reconfigure(state->layout);
|
output_layout_reconfigure(state->layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_output_layout_output_state *state =
|
struct wlr_output_layout_output_state *state =
|
||||||
wl_container_of(listener, state, output_destroy);
|
wl_container_of(listener, state, output_destroy);
|
||||||
struct wlr_output_layout *layout = state->layout;
|
struct wlr_output_layout *layout = state->layout;
|
||||||
wlr_output_layout_output_destroy(state->l_output);
|
output_layout_output_destroy(state->l_output);
|
||||||
wlr_output_layout_reconfigure(layout);
|
output_layout_reconfigure(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_output_layout_output *wlr_output_layout_output_create(
|
static struct wlr_output_layout_output *output_layout_output_create(
|
||||||
struct wlr_output_layout *layout, struct wlr_output *output) {
|
struct wlr_output_layout *layout, struct wlr_output *output) {
|
||||||
struct wlr_output_layout_output *l_output =
|
struct wlr_output_layout_output *l_output =
|
||||||
calloc(1, sizeof(struct wlr_output_layout_output));
|
calloc(1, sizeof(struct wlr_output_layout_output));
|
||||||
|
@ -195,7 +195,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
|
||||||
struct wlr_output_layout_output *l_output =
|
struct wlr_output_layout_output *l_output =
|
||||||
wlr_output_layout_get(layout, output);
|
wlr_output_layout_get(layout, output);
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
l_output = wlr_output_layout_output_create(layout, output);
|
l_output = output_layout_output_create(layout, output);
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
|
wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
|
||||||
return;
|
return;
|
||||||
|
@ -204,7 +204,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
|
||||||
l_output->x = lx;
|
l_output->x = lx;
|
||||||
l_output->y = ly;
|
l_output->y = ly;
|
||||||
l_output->state->auto_configured = false;
|
l_output->state->auto_configured = false;
|
||||||
wlr_output_layout_reconfigure(layout);
|
output_layout_reconfigure(layout);
|
||||||
wlr_output_create_global(output);
|
wlr_output_create_global(output);
|
||||||
wlr_signal_emit_safe(&layout->events.add, l_output);
|
wlr_signal_emit_safe(&layout->events.add, l_output);
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ bool wlr_output_layout_contains_point(struct wlr_output_layout *layout,
|
||||||
if (reference) {
|
if (reference) {
|
||||||
struct wlr_output_layout_output *l_output =
|
struct wlr_output_layout_output *l_output =
|
||||||
wlr_output_layout_get(layout, reference);
|
wlr_output_layout_get(layout, reference);
|
||||||
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
|
struct wlr_box *box = output_layout_output_get_box(l_output);
|
||||||
return wlr_box_contains_point(box, lx, ly);
|
return wlr_box_contains_point(box, lx, ly);
|
||||||
} else {
|
} else {
|
||||||
return !!wlr_output_layout_output_at(layout, lx, ly);
|
return !!wlr_output_layout_output_at(layout, lx, ly);
|
||||||
|
@ -240,7 +240,7 @@ bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
|
||||||
struct wlr_output_layout_output *l_output;
|
struct wlr_output_layout_output *l_output;
|
||||||
wl_list_for_each(l_output, &layout->outputs, link) {
|
wl_list_for_each(l_output, &layout->outputs, link) {
|
||||||
struct wlr_box *output_box =
|
struct wlr_box *output_box =
|
||||||
wlr_output_layout_output_get_box(l_output);
|
output_layout_output_get_box(l_output);
|
||||||
if (wlr_box_intersection(output_box, target_lbox, &out_box)) {
|
if (wlr_box_intersection(output_box, target_lbox, &out_box)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box *output_box = wlr_output_layout_output_get_box(l_output);
|
struct wlr_box *output_box = output_layout_output_get_box(l_output);
|
||||||
return wlr_box_intersection(output_box, target_lbox, &out_box);
|
return wlr_box_intersection(output_box, target_lbox, &out_box);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout,
|
||||||
double lx, double ly) {
|
double lx, double ly) {
|
||||||
struct wlr_output_layout_output *l_output;
|
struct wlr_output_layout_output *l_output;
|
||||||
wl_list_for_each(l_output, &layout->outputs, link) {
|
wl_list_for_each(l_output, &layout->outputs, link) {
|
||||||
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
|
struct wlr_box *box = output_layout_output_get_box(l_output);
|
||||||
if (wlr_box_contains_point(box, lx, ly)) {
|
if (wlr_box_contains_point(box, lx, ly)) {
|
||||||
return l_output->output;
|
return l_output->output;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ void wlr_output_layout_move(struct wlr_output_layout *layout,
|
||||||
l_output->x = lx;
|
l_output->x = lx;
|
||||||
l_output->y = ly;
|
l_output->y = ly;
|
||||||
l_output->state->auto_configured = false;
|
l_output->state->auto_configured = false;
|
||||||
wlr_output_layout_reconfigure(layout);
|
output_layout_reconfigure(layout);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "output not found in this layout: %s", output->name);
|
wlr_log(L_ERROR, "output not found in this layout: %s", output->name);
|
||||||
}
|
}
|
||||||
|
@ -289,8 +289,8 @@ void wlr_output_layout_remove(struct wlr_output_layout *layout,
|
||||||
struct wlr_output_layout_output *l_output =
|
struct wlr_output_layout_output *l_output =
|
||||||
wlr_output_layout_get(layout, output);
|
wlr_output_layout_get(layout, output);
|
||||||
if (l_output) {
|
if (l_output) {
|
||||||
wlr_output_layout_output_destroy(l_output);
|
output_layout_output_destroy(l_output);
|
||||||
wlr_output_layout_reconfigure(layout);
|
output_layout_reconfigure(layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ void wlr_output_layout_closest_point(struct wlr_output_layout *layout,
|
||||||
}
|
}
|
||||||
|
|
||||||
double output_x, output_y, output_distance;
|
double output_x, output_y, output_distance;
|
||||||
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
|
struct wlr_box *box = output_layout_output_get_box(l_output);
|
||||||
wlr_box_closest_point(box, lx, ly, &output_x, &output_y);
|
wlr_box_closest_point(box, lx, ly, &output_x, &output_y);
|
||||||
|
|
||||||
// calculate squared distance suitable for comparison
|
// calculate squared distance suitable for comparison
|
||||||
|
@ -359,7 +359,7 @@ struct wlr_box *wlr_output_layout_get_box(
|
||||||
l_output = wlr_output_layout_get(layout, reference);
|
l_output = wlr_output_layout_get(layout, reference);
|
||||||
|
|
||||||
if (l_output) {
|
if (l_output) {
|
||||||
return wlr_output_layout_output_get_box(l_output);
|
return output_layout_output_get_box(l_output);
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ struct wlr_box *wlr_output_layout_get_box(
|
||||||
int min_x = INT_MAX, min_y = INT_MAX;
|
int min_x = INT_MAX, min_y = INT_MAX;
|
||||||
int max_x = INT_MIN, max_y = INT_MIN;
|
int max_x = INT_MIN, max_y = INT_MIN;
|
||||||
wl_list_for_each(l_output, &layout->outputs, link) {
|
wl_list_for_each(l_output, &layout->outputs, link) {
|
||||||
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
|
struct wlr_box *box = output_layout_output_get_box(l_output);
|
||||||
|
|
||||||
if (box->x < min_x) {
|
if (box->x < min_x) {
|
||||||
min_x = box->x;
|
min_x = box->x;
|
||||||
|
@ -400,7 +400,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
|
||||||
struct wlr_output_layout_output *l_output =
|
struct wlr_output_layout_output *l_output =
|
||||||
wlr_output_layout_get(layout, output);
|
wlr_output_layout_get(layout, output);
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
l_output = wlr_output_layout_output_create(layout, output);
|
l_output = output_layout_output_create(layout, output);
|
||||||
if (!l_output) {
|
if (!l_output) {
|
||||||
wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
|
wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
|
||||||
return;
|
return;
|
||||||
|
@ -408,7 +408,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
|
||||||
}
|
}
|
||||||
|
|
||||||
l_output->state->auto_configured = true;
|
l_output->state->auto_configured = true;
|
||||||
wlr_output_layout_reconfigure(layout);
|
output_layout_reconfigure(layout);
|
||||||
wlr_output_create_global(output);
|
wlr_output_create_global(output);
|
||||||
wlr_signal_emit_safe(&layout->events.add, l_output);
|
wlr_signal_emit_safe(&layout->events.add, l_output);
|
||||||
}
|
}
|
||||||
|
@ -445,7 +445,7 @@ struct wlr_output *wlr_output_layout_adjacent_output(
|
||||||
if (reference != NULL && reference == l_output->output) {
|
if (reference != NULL && reference == l_output->output) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
|
struct wlr_box *box = output_layout_output_get_box(l_output);
|
||||||
|
|
||||||
bool match = false;
|
bool match = false;
|
||||||
// test to make sure this output is in the given direction
|
// test to make sure this output is in the given direction
|
||||||
|
|
|
@ -185,7 +185,7 @@ static void wl_seat_get_touch(struct wl_client *client,
|
||||||
wl_list_insert(&seat_client->touches, wl_resource_get_link(resource));
|
wl_list_insert(&seat_client->touches, wl_resource_get_link(resource));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_seat_client_resource_destroy(struct wl_resource *seat_resource) {
|
static void seat_client_resource_destroy(struct wl_resource *seat_resource) {
|
||||||
struct wlr_seat_client *client =
|
struct wlr_seat_client *client =
|
||||||
wlr_seat_client_from_resource(seat_resource);
|
wlr_seat_client_from_resource(seat_resource);
|
||||||
wlr_signal_emit_safe(&client->events.destroy, client);
|
wlr_signal_emit_safe(&client->events.destroy, client);
|
||||||
|
@ -251,7 +251,7 @@ static void wl_seat_bind(struct wl_client *client, void *_wlr_seat,
|
||||||
wl_list_init(&seat_client->data_devices);
|
wl_list_init(&seat_client->data_devices);
|
||||||
wl_list_init(&seat_client->primary_selection_devices);
|
wl_list_init(&seat_client->primary_selection_devices);
|
||||||
wl_resource_set_implementation(seat_client->wl_resource, &wl_seat_impl,
|
wl_resource_set_implementation(seat_client->wl_resource, &wl_seat_impl,
|
||||||
seat_client, wlr_seat_client_resource_destroy);
|
seat_client, seat_client_resource_destroy);
|
||||||
wl_list_insert(&wlr_seat->clients, &seat_client->link);
|
wl_list_insert(&wlr_seat->clients, &seat_client->link);
|
||||||
if (version >= WL_SEAT_NAME_SINCE_VERSION) {
|
if (version >= WL_SEAT_NAME_SINCE_VERSION) {
|
||||||
wl_seat_send_name(seat_client->wl_resource, wlr_seat->name);
|
wl_seat_send_name(seat_client->wl_resource, wlr_seat->name);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <wlr/util/region.h>
|
#include <wlr/util/region.h>
|
||||||
#include "util/signal.h"
|
#include "util/signal.h"
|
||||||
|
|
||||||
static void wlr_surface_state_reset_buffer(struct wlr_surface_state *state) {
|
static void surface_state_reset_buffer(struct wlr_surface_state *state) {
|
||||||
if (state->buffer) {
|
if (state->buffer) {
|
||||||
wl_list_remove(&state->buffer_destroy_listener.link);
|
wl_list_remove(&state->buffer_destroy_listener.link);
|
||||||
state->buffer = NULL;
|
state->buffer = NULL;
|
||||||
|
@ -26,7 +26,7 @@ static void buffer_destroy(struct wl_listener *listener, void *data) {
|
||||||
state->buffer = NULL;
|
state->buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_surface_state_release_buffer(struct wlr_surface_state *state) {
|
static void surface_state_release_buffer(struct wlr_surface_state *state) {
|
||||||
if (state->buffer) {
|
if (state->buffer) {
|
||||||
wl_resource_post_event(state->buffer, WL_BUFFER_RELEASE);
|
wl_resource_post_event(state->buffer, WL_BUFFER_RELEASE);
|
||||||
wl_list_remove(&state->buffer_destroy_listener.link);
|
wl_list_remove(&state->buffer_destroy_listener.link);
|
||||||
|
@ -34,7 +34,7 @@ static void wlr_surface_state_release_buffer(struct wlr_surface_state *state) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_surface_state_set_buffer(struct wlr_surface_state *state,
|
static void surface_state_set_buffer(struct wlr_surface_state *state,
|
||||||
struct wl_resource *buffer) {
|
struct wl_resource *buffer) {
|
||||||
state->buffer = buffer;
|
state->buffer = buffer;
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
|
@ -57,8 +57,8 @@ static void surface_attach(struct wl_client *client,
|
||||||
surface->pending->invalid |= WLR_SURFACE_INVALID_BUFFER;
|
surface->pending->invalid |= WLR_SURFACE_INVALID_BUFFER;
|
||||||
surface->pending->sx = sx;
|
surface->pending->sx = sx;
|
||||||
surface->pending->sy = sy;
|
surface->pending->sy = sy;
|
||||||
wlr_surface_state_reset_buffer(surface->pending);
|
surface_state_reset_buffer(surface->pending);
|
||||||
wlr_surface_state_set_buffer(surface->pending, buffer);
|
surface_state_set_buffer(surface->pending, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void surface_damage(struct wl_client *client,
|
static void surface_damage(struct wl_client *client,
|
||||||
|
@ -143,7 +143,7 @@ static void surface_set_input_region(struct wl_client *client,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_surface_update_size(struct wlr_surface *surface,
|
static bool surface_update_size(struct wlr_surface *surface,
|
||||||
struct wlr_surface_state *state) {
|
struct wlr_surface_state *state) {
|
||||||
if (!state->buffer) {
|
if (!state->buffer) {
|
||||||
pixman_region32_union_rect(&state->surface_damage,
|
pixman_region32_union_rect(&state->surface_damage,
|
||||||
|
@ -207,7 +207,7 @@ static bool wlr_surface_update_size(struct wlr_surface *surface,
|
||||||
/**
|
/**
|
||||||
* Append pending state to current state and clear pending state.
|
* Append pending state to current state and clear pending state.
|
||||||
*/
|
*/
|
||||||
static void wlr_surface_move_state(struct wlr_surface *surface,
|
static void surface_move_state(struct wlr_surface *surface,
|
||||||
struct wlr_surface_state *next, struct wlr_surface_state *state) {
|
struct wlr_surface_state *next, struct wlr_surface_state *state) {
|
||||||
bool update_damage = false;
|
bool update_damage = false;
|
||||||
bool update_size = false;
|
bool update_size = false;
|
||||||
|
@ -224,15 +224,15 @@ static void wlr_surface_move_state(struct wlr_surface *surface,
|
||||||
update_size = true;
|
update_size = true;
|
||||||
}
|
}
|
||||||
if ((next->invalid & WLR_SURFACE_INVALID_BUFFER)) {
|
if ((next->invalid & WLR_SURFACE_INVALID_BUFFER)) {
|
||||||
wlr_surface_state_release_buffer(state);
|
surface_state_release_buffer(state);
|
||||||
wlr_surface_state_set_buffer(state, next->buffer);
|
surface_state_set_buffer(state, next->buffer);
|
||||||
wlr_surface_state_reset_buffer(next);
|
surface_state_reset_buffer(next);
|
||||||
state->sx = next->sx;
|
state->sx = next->sx;
|
||||||
state->sy = next->sy;
|
state->sy = next->sy;
|
||||||
update_size = true;
|
update_size = true;
|
||||||
}
|
}
|
||||||
if (update_size) {
|
if (update_size) {
|
||||||
update_damage = wlr_surface_update_size(surface, state);
|
update_damage = surface_update_size(surface, state);
|
||||||
}
|
}
|
||||||
if ((next->invalid & WLR_SURFACE_INVALID_SURFACE_DAMAGE)) {
|
if ((next->invalid & WLR_SURFACE_INVALID_SURFACE_DAMAGE)) {
|
||||||
pixman_region32_intersect_rect(&next->surface_damage,
|
pixman_region32_intersect_rect(&next->surface_damage,
|
||||||
|
@ -312,7 +312,7 @@ static void wlr_surface_move_state(struct wlr_surface *surface,
|
||||||
next->invalid = 0;
|
next->invalid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
|
static void surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
|
||||||
// XXX: This is probably the wrong way to do it, because this damage should
|
// XXX: This is probably the wrong way to do it, because this damage should
|
||||||
// come from the client, but weston doesn't do it correctly either and it
|
// come from the client, but weston doesn't do it correctly either and it
|
||||||
// seems to work ok. See the comment on weston_surface_damage for more info
|
// seems to work ok. See the comment on weston_surface_damage for more info
|
||||||
|
@ -327,11 +327,11 @@ static void wlr_surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
|
||||||
|
|
||||||
struct wlr_subsurface *child;
|
struct wlr_subsurface *child;
|
||||||
wl_list_for_each(child, &subsurface->surface->subsurfaces, parent_link) {
|
wl_list_for_each(child, &subsurface->surface->subsurfaces, parent_link) {
|
||||||
wlr_surface_damage_subsurfaces(child);
|
surface_damage_subsurfaces(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_surface_apply_damage(struct wlr_surface *surface,
|
static void surface_apply_damage(struct wlr_surface *surface,
|
||||||
bool invalid_buffer, bool reupload_buffer) {
|
bool invalid_buffer, bool reupload_buffer) {
|
||||||
struct wl_resource *resource = surface->current->buffer;
|
struct wl_resource *resource = surface->current->buffer;
|
||||||
if (resource == NULL) {
|
if (resource == NULL) {
|
||||||
|
@ -392,17 +392,17 @@ static void wlr_surface_apply_damage(struct wlr_surface *surface,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_surface_state_release_buffer(surface->current);
|
surface_state_release_buffer(surface->current);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_surface_commit_pending(struct wlr_surface *surface) {
|
static void surface_commit_pending(struct wlr_surface *surface) {
|
||||||
int32_t oldw = surface->current->buffer_width;
|
int32_t oldw = surface->current->buffer_width;
|
||||||
int32_t oldh = surface->current->buffer_height;
|
int32_t oldh = surface->current->buffer_height;
|
||||||
|
|
||||||
bool invalid_buffer = surface->pending->invalid & WLR_SURFACE_INVALID_BUFFER;
|
bool invalid_buffer = surface->pending->invalid & WLR_SURFACE_INVALID_BUFFER;
|
||||||
bool null_buffer_commit = invalid_buffer && surface->pending->buffer == NULL;
|
bool null_buffer_commit = invalid_buffer && surface->pending->buffer == NULL;
|
||||||
|
|
||||||
wlr_surface_move_state(surface, surface->pending, surface->current);
|
surface_move_state(surface, surface->pending, surface->current);
|
||||||
|
|
||||||
if (null_buffer_commit) {
|
if (null_buffer_commit) {
|
||||||
wlr_texture_destroy(surface->texture);
|
wlr_texture_destroy(surface->texture);
|
||||||
|
@ -411,7 +411,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
|
||||||
|
|
||||||
bool reupload_buffer = oldw != surface->current->buffer_width ||
|
bool reupload_buffer = oldw != surface->current->buffer_width ||
|
||||||
oldh != surface->current->buffer_height;
|
oldh != surface->current->buffer_height;
|
||||||
wlr_surface_apply_damage(surface, invalid_buffer, reupload_buffer);
|
surface_apply_damage(surface, invalid_buffer, reupload_buffer);
|
||||||
|
|
||||||
// commit subsurface order
|
// commit subsurface order
|
||||||
struct wlr_subsurface *subsurface;
|
struct wlr_subsurface *subsurface;
|
||||||
|
@ -422,7 +422,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
|
||||||
|
|
||||||
if (subsurface->reordered) {
|
if (subsurface->reordered) {
|
||||||
// TODO: damage all the subsurfaces
|
// TODO: damage all the subsurfaces
|
||||||
wlr_surface_damage_subsurfaces(subsurface);
|
surface_damage_subsurfaces(subsurface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
|
||||||
pixman_region32_clear(&surface->current->buffer_damage);
|
pixman_region32_clear(&surface->current->buffer_damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
|
static bool subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
|
||||||
while (1) {
|
while (1) {
|
||||||
if (subsurface->synchronized) {
|
if (subsurface->synchronized) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -459,43 +459,43 @@ static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
|
||||||
/**
|
/**
|
||||||
* Recursive function to commit the effectively synchronized children.
|
* Recursive function to commit the effectively synchronized children.
|
||||||
*/
|
*/
|
||||||
static void wlr_subsurface_parent_commit(struct wlr_subsurface *subsurface,
|
static void subsurface_parent_commit(struct wlr_subsurface *subsurface,
|
||||||
bool synchronized) {
|
bool synchronized) {
|
||||||
struct wlr_surface *surface = subsurface->surface;
|
struct wlr_surface *surface = subsurface->surface;
|
||||||
if (synchronized || subsurface->synchronized) {
|
if (synchronized || subsurface->synchronized) {
|
||||||
if (subsurface->has_cache) {
|
if (subsurface->has_cache) {
|
||||||
wlr_surface_move_state(surface, subsurface->cached, surface->pending);
|
surface_move_state(surface, subsurface->cached, surface->pending);
|
||||||
wlr_surface_commit_pending(surface);
|
surface_commit_pending(surface);
|
||||||
subsurface->has_cache = false;
|
subsurface->has_cache = false;
|
||||||
subsurface->cached->invalid = 0;
|
subsurface->cached->invalid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_subsurface *tmp;
|
struct wlr_subsurface *tmp;
|
||||||
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
|
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
|
||||||
wlr_subsurface_parent_commit(tmp, true);
|
subsurface_parent_commit(tmp, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_subsurface_commit(struct wlr_subsurface *subsurface) {
|
static void subsurface_commit(struct wlr_subsurface *subsurface) {
|
||||||
struct wlr_surface *surface = subsurface->surface;
|
struct wlr_surface *surface = subsurface->surface;
|
||||||
|
|
||||||
if (wlr_subsurface_is_synchronized(subsurface)) {
|
if (subsurface_is_synchronized(subsurface)) {
|
||||||
wlr_surface_move_state(surface, surface->pending, subsurface->cached);
|
surface_move_state(surface, surface->pending, subsurface->cached);
|
||||||
subsurface->has_cache = true;
|
subsurface->has_cache = true;
|
||||||
} else {
|
} else {
|
||||||
if (subsurface->has_cache) {
|
if (subsurface->has_cache) {
|
||||||
wlr_surface_move_state(surface, subsurface->cached, surface->pending);
|
surface_move_state(surface, subsurface->cached, surface->pending);
|
||||||
wlr_surface_commit_pending(surface);
|
surface_commit_pending(surface);
|
||||||
subsurface->has_cache = false;
|
subsurface->has_cache = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
wlr_surface_commit_pending(surface);
|
surface_commit_pending(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_subsurface *tmp;
|
struct wlr_subsurface *tmp;
|
||||||
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
|
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
|
||||||
wlr_subsurface_parent_commit(tmp, false);
|
subsurface_parent_commit(tmp, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -507,15 +507,15 @@ static void surface_commit(struct wl_client *client,
|
||||||
if (wlr_surface_is_subsurface(surface)) {
|
if (wlr_surface_is_subsurface(surface)) {
|
||||||
struct wlr_subsurface *subsurface =
|
struct wlr_subsurface *subsurface =
|
||||||
wlr_subsurface_from_surface(surface);
|
wlr_subsurface_from_surface(surface);
|
||||||
wlr_subsurface_commit(subsurface);
|
subsurface_commit(subsurface);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_surface_commit_pending(surface);
|
surface_commit_pending(surface);
|
||||||
|
|
||||||
struct wlr_subsurface *tmp;
|
struct wlr_subsurface *tmp;
|
||||||
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
|
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
|
||||||
wlr_subsurface_parent_commit(tmp, false);
|
subsurface_parent_commit(tmp, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,7 +567,7 @@ struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource) {
|
||||||
return wl_resource_get_user_data(resource);
|
return wl_resource_get_user_data(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_surface_state *wlr_surface_state_create() {
|
static struct wlr_surface_state *surface_state_create() {
|
||||||
struct wlr_surface_state *state =
|
struct wlr_surface_state *state =
|
||||||
calloc(1, sizeof(struct wlr_surface_state));
|
calloc(1, sizeof(struct wlr_surface_state));
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
|
@ -588,8 +588,8 @@ static struct wlr_surface_state *wlr_surface_state_create() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_surface_state_destroy(struct wlr_surface_state *state) {
|
static void surface_state_destroy(struct wlr_surface_state *state) {
|
||||||
wlr_surface_state_reset_buffer(state);
|
surface_state_reset_buffer(state);
|
||||||
struct wlr_frame_callback *cb, *tmp;
|
struct wlr_frame_callback *cb, *tmp;
|
||||||
wl_list_for_each_safe(cb, tmp, &state->frame_callback_list, link) {
|
wl_list_for_each_safe(cb, tmp, &state->frame_callback_list, link) {
|
||||||
wl_resource_destroy(cb->resource);
|
wl_resource_destroy(cb->resource);
|
||||||
|
@ -607,7 +607,7 @@ static void subsurface_destroy(struct wlr_subsurface *subsurface) {
|
||||||
wlr_signal_emit_safe(&subsurface->events.destroy, subsurface);
|
wlr_signal_emit_safe(&subsurface->events.destroy, subsurface);
|
||||||
|
|
||||||
wl_list_remove(&subsurface->surface_destroy.link);
|
wl_list_remove(&subsurface->surface_destroy.link);
|
||||||
wlr_surface_state_destroy(subsurface->cached);
|
surface_state_destroy(subsurface->cached);
|
||||||
|
|
||||||
if (subsurface->parent) {
|
if (subsurface->parent) {
|
||||||
wl_list_remove(&subsurface->parent_link);
|
wl_list_remove(&subsurface->parent_link);
|
||||||
|
@ -628,8 +628,8 @@ static void destroy_surface(struct wl_resource *resource) {
|
||||||
wlr_signal_emit_safe(&surface->events.destroy, surface);
|
wlr_signal_emit_safe(&surface->events.destroy, surface);
|
||||||
|
|
||||||
wlr_texture_destroy(surface->texture);
|
wlr_texture_destroy(surface->texture);
|
||||||
wlr_surface_state_destroy(surface->pending);
|
surface_state_destroy(surface->pending);
|
||||||
wlr_surface_state_destroy(surface->current);
|
surface_state_destroy(surface->current);
|
||||||
|
|
||||||
free(surface);
|
free(surface);
|
||||||
}
|
}
|
||||||
|
@ -645,8 +645,8 @@ struct wlr_surface *wlr_surface_create(struct wl_resource *res,
|
||||||
surface->renderer = renderer;
|
surface->renderer = renderer;
|
||||||
surface->resource = res;
|
surface->resource = res;
|
||||||
|
|
||||||
surface->current = wlr_surface_state_create();
|
surface->current = surface_state_create();
|
||||||
surface->pending = wlr_surface_state_create();
|
surface->pending = surface_state_create();
|
||||||
|
|
||||||
wl_signal_init(&surface->events.commit);
|
wl_signal_init(&surface->events.commit);
|
||||||
wl_signal_init(&surface->events.destroy);
|
wl_signal_init(&surface->events.destroy);
|
||||||
|
@ -794,9 +794,9 @@ static void subsurface_set_desync(struct wl_client *client,
|
||||||
if (subsurface && subsurface->synchronized) {
|
if (subsurface && subsurface->synchronized) {
|
||||||
subsurface->synchronized = false;
|
subsurface->synchronized = false;
|
||||||
|
|
||||||
if (!wlr_subsurface_is_synchronized(subsurface)) {
|
if (!subsurface_is_synchronized(subsurface)) {
|
||||||
// TODO: do a synchronized commit to flush the cache
|
// TODO: do a synchronized commit to flush the cache
|
||||||
wlr_subsurface_parent_commit(subsurface, true);
|
subsurface_parent_commit(subsurface, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -837,7 +837,7 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface,
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
subsurface->cached = wlr_surface_state_create();
|
subsurface->cached = surface_state_create();
|
||||||
if (subsurface->cached == NULL) {
|
if (subsurface->cached == NULL) {
|
||||||
free(subsurface);
|
free(subsurface);
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
|
@ -860,7 +860,7 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface,
|
||||||
subsurface->resource =
|
subsurface->resource =
|
||||||
wl_resource_create(client, &wl_subsurface_interface, 1, id);
|
wl_resource_create(client, &wl_subsurface_interface, 1, id);
|
||||||
if (subsurface->resource == NULL) {
|
if (subsurface->resource == NULL) {
|
||||||
wlr_surface_state_destroy(subsurface->cached);
|
surface_state_destroy(subsurface->cached);
|
||||||
free(subsurface);
|
free(subsurface);
|
||||||
wl_client_post_no_memory(client);
|
wl_client_post_no_memory(client);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -461,13 +461,13 @@ static void shell_surface_resource_destroy(struct wl_resource *resource) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_wlr_surface_destroyed(struct wl_listener *listener,
|
static void shell_surface_handle_surface_destroy(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct wlr_wl_shell_surface *surface =
|
struct wlr_wl_shell_surface *surface =
|
||||||
wl_container_of(listener, surface, surface_destroy_listener);
|
wl_container_of(listener, surface, surface_destroy_listener);
|
||||||
shell_surface_destroy(surface);
|
shell_surface_destroy(surface);
|
||||||
}
|
}
|
||||||
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
|
static void handle_surface_committed(struct wlr_surface *wlr_surface,
|
||||||
void *role_data) {
|
void *role_data) {
|
||||||
struct wlr_wl_shell_surface *surface = role_data;
|
struct wlr_wl_shell_surface *surface = role_data;
|
||||||
if (!surface->configured &&
|
if (!surface->configured &&
|
||||||
|
@ -556,9 +556,10 @@ static void shell_protocol_get_shell_surface(struct wl_client *client,
|
||||||
|
|
||||||
wl_signal_add(&wl_surface->surface->events.destroy,
|
wl_signal_add(&wl_surface->surface->events.destroy,
|
||||||
&wl_surface->surface_destroy_listener);
|
&wl_surface->surface_destroy_listener);
|
||||||
wl_surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
|
wl_surface->surface_destroy_listener.notify =
|
||||||
|
shell_surface_handle_surface_destroy;
|
||||||
|
|
||||||
wlr_surface_set_role_committed(surface, handle_wlr_surface_committed,
|
wlr_surface_set_role_committed(surface, handle_surface_committed,
|
||||||
wl_surface);
|
wl_surface);
|
||||||
|
|
||||||
struct wl_display *display = wl_client_get_display(client);
|
struct wl_display *display = wl_client_get_display(client);
|
||||||
|
|
|
@ -122,7 +122,7 @@ static const struct wlr_keyboard_grab_interface xdg_keyboard_grab_impl = {
|
||||||
|
|
||||||
static void xdg_surface_destroy(struct wlr_xdg_surface *surface);
|
static void xdg_surface_destroy(struct wlr_xdg_surface *surface);
|
||||||
|
|
||||||
static void wlr_xdg_popup_grab_handle_seat_destroy(
|
static void xdg_popup_grab_handle_seat_destroy(
|
||||||
struct wl_listener *listener, void *data) {
|
struct wl_listener *listener, void *data) {
|
||||||
struct wlr_xdg_popup_grab *xdg_grab =
|
struct wlr_xdg_popup_grab *xdg_grab =
|
||||||
wl_container_of(listener, xdg_grab, seat_destroy);
|
wl_container_of(listener, xdg_grab, seat_destroy);
|
||||||
|
@ -162,7 +162,7 @@ static struct wlr_xdg_popup_grab *xdg_shell_popup_grab_from_seat(
|
||||||
wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
|
wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
|
||||||
xdg_grab->seat = seat;
|
xdg_grab->seat = seat;
|
||||||
|
|
||||||
xdg_grab->seat_destroy.notify = wlr_xdg_popup_grab_handle_seat_destroy;
|
xdg_grab->seat_destroy.notify = xdg_popup_grab_handle_seat_destroy;
|
||||||
wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
|
wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
|
||||||
|
|
||||||
return xdg_grab;
|
return xdg_grab;
|
||||||
|
@ -910,7 +910,7 @@ static void xdg_surface_handle_get_toplevel(struct wl_client *client,
|
||||||
xdg_toplevel_resource_destroy);
|
xdg_toplevel_resource_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_toplevel_ack_configure(
|
static void xdg_toplevel_ack_configure(
|
||||||
struct wlr_xdg_surface *surface,
|
struct wlr_xdg_surface *surface,
|
||||||
struct wlr_xdg_surface_configure *configure) {
|
struct wlr_xdg_surface_configure *configure) {
|
||||||
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
||||||
|
@ -961,7 +961,7 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
|
||||||
assert(0 && "not reached");
|
assert(0 && "not reached");
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
||||||
wlr_xdg_toplevel_ack_configure(surface, configure);
|
xdg_toplevel_ack_configure(surface, configure);
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_ROLE_POPUP:
|
case WLR_XDG_SURFACE_ROLE_POPUP:
|
||||||
break;
|
break;
|
||||||
|
@ -1013,7 +1013,7 @@ static const struct xdg_surface_interface xdg_surface_implementation = {
|
||||||
.set_window_geometry = xdg_surface_handle_set_window_geometry,
|
.set_window_geometry = xdg_surface_handle_set_window_geometry,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool wlr_xdg_surface_toplevel_state_compare(
|
static bool xdg_surface_toplevel_state_compare(
|
||||||
struct wlr_xdg_toplevel *state) {
|
struct wlr_xdg_toplevel *state) {
|
||||||
struct {
|
struct {
|
||||||
struct wlr_xdg_toplevel_state state;
|
struct wlr_xdg_toplevel_state state;
|
||||||
|
@ -1063,7 +1063,7 @@ static bool wlr_xdg_surface_toplevel_state_compare(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_toplevel_send_configure(
|
static void toplevel_send_configure(
|
||||||
struct wlr_xdg_surface *surface,
|
struct wlr_xdg_surface *surface,
|
||||||
struct wlr_xdg_surface_configure *configure) {
|
struct wlr_xdg_surface_configure *configure) {
|
||||||
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
||||||
|
@ -1125,7 +1125,7 @@ error_out:
|
||||||
wl_resource_post_no_memory(surface->toplevel->resource);
|
wl_resource_post_no_memory(surface->toplevel->resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_surface_send_configure(void *user_data) {
|
static void surface_send_configure(void *user_data) {
|
||||||
struct wlr_xdg_surface *surface = user_data;
|
struct wlr_xdg_surface *surface = user_data;
|
||||||
|
|
||||||
surface->configure_idle = NULL;
|
surface->configure_idle = NULL;
|
||||||
|
@ -1145,7 +1145,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
|
||||||
assert(0 && "not reached");
|
assert(0 && "not reached");
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
||||||
wlr_xdg_toplevel_send_configure(surface, configure);
|
toplevel_send_configure(surface, configure);
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_ROLE_POPUP:
|
case WLR_XDG_SURFACE_ROLE_POPUP:
|
||||||
xdg_popup_send_configure(surface->popup->resource,
|
xdg_popup_send_configure(surface->popup->resource,
|
||||||
|
@ -1159,7 +1159,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
|
||||||
xdg_surface_send_configure(surface->resource, configure->serial);
|
xdg_surface_send_configure(surface->resource, configure->serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t wlr_xdg_surface_schedule_configure(
|
static uint32_t xdg_surface_schedule_configure(
|
||||||
struct wlr_xdg_surface *surface) {
|
struct wlr_xdg_surface *surface) {
|
||||||
struct wl_display *display = wl_client_get_display(surface->client->client);
|
struct wl_display *display = wl_client_get_display(surface->client->client);
|
||||||
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
||||||
|
@ -1171,7 +1171,7 @@ static uint32_t wlr_xdg_surface_schedule_configure(
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
||||||
pending_same =
|
pending_same =
|
||||||
wlr_xdg_surface_toplevel_state_compare(surface->toplevel);
|
xdg_surface_toplevel_state_compare(surface->toplevel);
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_ROLE_POPUP:
|
case WLR_XDG_SURFACE_ROLE_POPUP:
|
||||||
break;
|
break;
|
||||||
|
@ -1195,26 +1195,26 @@ static uint32_t wlr_xdg_surface_schedule_configure(
|
||||||
|
|
||||||
surface->configure_next_serial = wl_display_next_serial(display);
|
surface->configure_next_serial = wl_display_next_serial(display);
|
||||||
surface->configure_idle = wl_event_loop_add_idle(loop,
|
surface->configure_idle = wl_event_loop_add_idle(loop,
|
||||||
wlr_xdg_surface_send_configure, surface);
|
surface_send_configure, surface);
|
||||||
return surface->configure_next_serial;
|
return surface->configure_next_serial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_wlr_surface_destroyed(struct wl_listener *listener,
|
static void xdg_surface_handle_surface_destroy(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct wlr_xdg_surface *xdg_surface =
|
struct wlr_xdg_surface *xdg_surface =
|
||||||
wl_container_of(listener, xdg_surface, surface_destroy_listener);
|
wl_container_of(listener, xdg_surface, surface_destroy_listener);
|
||||||
xdg_surface_destroy(xdg_surface);
|
xdg_surface_destroy(xdg_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_surface_toplevel_committed(
|
static void xdg_surface_toplevel_committed(
|
||||||
struct wlr_xdg_surface *surface) {
|
struct wlr_xdg_surface *surface) {
|
||||||
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
||||||
|
|
||||||
if (!surface->toplevel->added) {
|
if (!surface->toplevel->added) {
|
||||||
// on the first commit, send a configure request to tell the client it
|
// on the first commit, send a configure request to tell the client it
|
||||||
// is added
|
// is added
|
||||||
wlr_xdg_surface_schedule_configure(surface);
|
xdg_surface_schedule_configure(surface);
|
||||||
surface->toplevel->added = true;
|
surface->toplevel->added = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1230,7 +1230,7 @@ static void wlr_xdg_surface_toplevel_committed(
|
||||||
surface->toplevel->client_pending.min_height;
|
surface->toplevel->client_pending.min_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_surface_popup_committed(
|
static void xdg_surface_popup_committed(
|
||||||
struct wlr_xdg_surface *surface) {
|
struct wlr_xdg_surface *surface) {
|
||||||
assert(surface->role == WLR_XDG_SURFACE_ROLE_POPUP);
|
assert(surface->role == WLR_XDG_SURFACE_ROLE_POPUP);
|
||||||
|
|
||||||
|
@ -1242,12 +1242,12 @@ static void wlr_xdg_surface_popup_committed(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!surface->popup->committed) {
|
if (!surface->popup->committed) {
|
||||||
wlr_xdg_surface_schedule_configure(surface);
|
xdg_surface_schedule_configure(surface);
|
||||||
surface->popup->committed = true;
|
surface->popup->committed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
|
static void handle_surface_committed(struct wlr_surface *wlr_surface,
|
||||||
void *role_data) {
|
void *role_data) {
|
||||||
struct wlr_xdg_surface *surface = role_data;
|
struct wlr_xdg_surface *surface = role_data;
|
||||||
|
|
||||||
|
@ -1273,10 +1273,10 @@ static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
|
||||||
"xdg_surface must have a role");
|
"xdg_surface must have a role");
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
||||||
wlr_xdg_surface_toplevel_committed(surface);
|
xdg_surface_toplevel_committed(surface);
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_ROLE_POPUP:
|
case WLR_XDG_SURFACE_ROLE_POPUP:
|
||||||
wlr_xdg_surface_popup_committed(surface);
|
xdg_surface_popup_committed(surface);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1350,10 +1350,11 @@ static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client,
|
||||||
|
|
||||||
wl_signal_add(&surface->surface->events.destroy,
|
wl_signal_add(&surface->surface->events.destroy,
|
||||||
&surface->surface_destroy_listener);
|
&surface->surface_destroy_listener);
|
||||||
surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
|
surface->surface_destroy_listener.notify =
|
||||||
|
xdg_surface_handle_surface_destroy;
|
||||||
|
|
||||||
wlr_surface_set_role_committed(surface->surface,
|
wlr_surface_set_role_committed(surface->surface,
|
||||||
handle_wlr_surface_committed, surface);
|
handle_surface_committed, surface);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
|
wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
|
||||||
wl_resource_set_implementation(surface->resource,
|
wl_resource_set_implementation(surface->resource,
|
||||||
|
@ -1394,7 +1395,7 @@ static const struct xdg_wm_base_interface xdg_shell_impl = {
|
||||||
.pong = xdg_shell_handle_pong,
|
.pong = xdg_shell_handle_pong,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void wlr_xdg_client_destroy(struct wl_resource *resource) {
|
static void xdg_client_handle_resource_destroy(struct wl_resource *resource) {
|
||||||
struct wlr_xdg_client *client = xdg_client_from_resource(resource);
|
struct wlr_xdg_client *client = xdg_client_from_resource(resource);
|
||||||
|
|
||||||
struct wlr_xdg_surface *surface, *tmp = NULL;
|
struct wlr_xdg_surface *surface, *tmp = NULL;
|
||||||
|
@ -1410,7 +1411,7 @@ static void wlr_xdg_client_destroy(struct wl_resource *resource) {
|
||||||
free(client);
|
free(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wlr_xdg_client_ping_timeout(void *user_data) {
|
static int xdg_client_ping_timeout(void *user_data) {
|
||||||
struct wlr_xdg_client *client = user_data;
|
struct wlr_xdg_client *client = user_data;
|
||||||
|
|
||||||
struct wlr_xdg_surface *surface;
|
struct wlr_xdg_surface *surface;
|
||||||
|
@ -1447,13 +1448,13 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
|
||||||
client->shell = xdg_shell;
|
client->shell = xdg_shell;
|
||||||
|
|
||||||
wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
|
wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
|
||||||
wlr_xdg_client_destroy);
|
xdg_client_handle_resource_destroy);
|
||||||
wl_list_insert(&xdg_shell->clients, &client->link);
|
wl_list_insert(&xdg_shell->clients, &client->link);
|
||||||
|
|
||||||
struct wl_display *display = wl_client_get_display(client->client);
|
struct wl_display *display = wl_client_get_display(client->client);
|
||||||
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
||||||
client->ping_timer = wl_event_loop_add_timer(loop,
|
client->ping_timer = wl_event_loop_add_timer(loop,
|
||||||
wlr_xdg_client_ping_timeout, client);
|
xdg_client_ping_timeout, client);
|
||||||
if (client->ping_timer == NULL) {
|
if (client->ping_timer == NULL) {
|
||||||
wl_client_post_no_memory(client->client);
|
wl_client_post_no_memory(client->client);
|
||||||
}
|
}
|
||||||
|
@ -1522,7 +1523,7 @@ uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_surface *surface,
|
||||||
surface->toplevel->server_pending.width = width;
|
surface->toplevel->server_pending.width = width;
|
||||||
surface->toplevel->server_pending.height = height;
|
surface->toplevel->server_pending.height = height;
|
||||||
|
|
||||||
return wlr_xdg_surface_schedule_configure(surface);
|
return xdg_surface_schedule_configure(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
|
uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
|
||||||
|
@ -1530,7 +1531,7 @@ uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
|
||||||
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
||||||
surface->toplevel->server_pending.activated = activated;
|
surface->toplevel->server_pending.activated = activated;
|
||||||
|
|
||||||
return wlr_xdg_surface_schedule_configure(surface);
|
return xdg_surface_schedule_configure(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
|
uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
|
||||||
|
@ -1538,7 +1539,7 @@ uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
|
||||||
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
||||||
surface->toplevel->server_pending.maximized = maximized;
|
surface->toplevel->server_pending.maximized = maximized;
|
||||||
|
|
||||||
return wlr_xdg_surface_schedule_configure(surface);
|
return xdg_surface_schedule_configure(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
|
uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
|
||||||
|
@ -1546,7 +1547,7 @@ uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
|
||||||
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
||||||
surface->toplevel->server_pending.fullscreen = fullscreen;
|
surface->toplevel->server_pending.fullscreen = fullscreen;
|
||||||
|
|
||||||
return wlr_xdg_surface_schedule_configure(surface);
|
return xdg_surface_schedule_configure(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
|
uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
|
||||||
|
@ -1554,7 +1555,7 @@ uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
|
||||||
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
|
||||||
surface->toplevel->server_pending.resizing = resizing;
|
surface->toplevel->server_pending.resizing = resizing;
|
||||||
|
|
||||||
return wlr_xdg_surface_schedule_configure(surface);
|
return xdg_surface_schedule_configure(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface) {
|
void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface) {
|
||||||
|
@ -1669,7 +1670,7 @@ void wlr_xdg_popup_get_toplevel_coords(struct wlr_xdg_popup *popup,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
|
static void xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
|
||||||
struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
|
struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
|
||||||
int popup_width = popup->geometry.width;
|
int popup_width = popup->geometry.width;
|
||||||
int popup_height = popup->geometry.height;
|
int popup_height = popup->geometry.height;
|
||||||
|
@ -1697,10 +1698,10 @@ static void wlr_xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
|
static bool xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
|
||||||
struct wlr_box *toplevel_sx_box) {
|
struct wlr_box *toplevel_sx_box) {
|
||||||
int offset_x = 0, offset_y = 0;
|
int offset_x = 0, offset_y = 0;
|
||||||
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_x, &offset_y);
|
&offset_x, &offset_y);
|
||||||
|
|
||||||
if (!offset_x && !offset_y) {
|
if (!offset_x && !offset_y) {
|
||||||
|
@ -1725,7 +1726,7 @@ static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
|
||||||
popup->geometry =
|
popup->geometry =
|
||||||
wlr_xdg_positioner_get_geometry(&popup->positioner);
|
wlr_xdg_positioner_get_geometry(&popup->positioner);
|
||||||
|
|
||||||
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_x, &offset_y);
|
&offset_x, &offset_y);
|
||||||
|
|
||||||
if (!offset_x && !offset_y) {
|
if (!offset_x && !offset_y) {
|
||||||
|
@ -1747,10 +1748,10 @@ static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
|
static bool xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
|
||||||
struct wlr_box *toplevel_sx_box) {
|
struct wlr_box *toplevel_sx_box) {
|
||||||
int offset_x = 0, offset_y = 0;
|
int offset_x = 0, offset_y = 0;
|
||||||
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_x, &offset_y);
|
&offset_x, &offset_y);
|
||||||
|
|
||||||
if (!offset_x && !offset_y) {
|
if (!offset_x && !offset_y) {
|
||||||
|
@ -1784,16 +1785,16 @@ static bool wlr_xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
|
||||||
popup->geometry.y += toplevel_sx_box->y - toplevel_y;
|
popup->geometry.y += toplevel_sx_box->y - toplevel_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_x, &offset_y);
|
&offset_x, &offset_y);
|
||||||
|
|
||||||
return !offset_x && !offset_y;
|
return !offset_x && !offset_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
|
static bool xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
|
||||||
struct wlr_box *toplevel_sx_box) {
|
struct wlr_box *toplevel_sx_box) {
|
||||||
int offset_x, offset_y;
|
int offset_x, offset_y;
|
||||||
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_x, &offset_y);
|
&offset_x, &offset_y);
|
||||||
|
|
||||||
if (!offset_x && !offset_y) {
|
if (!offset_x && !offset_y) {
|
||||||
|
@ -1815,7 +1816,7 @@ static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
|
||||||
popup->geometry.height -= offset_y;
|
popup->geometry.height -= offset_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_y, &offset_y);
|
&offset_y, &offset_y);
|
||||||
|
|
||||||
return !offset_x && !offset_y;
|
return !offset_x && !offset_y;
|
||||||
|
@ -1823,13 +1824,13 @@ static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
|
||||||
|
|
||||||
void wlr_xdg_popup_unconstrain_from_box(struct wlr_xdg_popup *popup,
|
void wlr_xdg_popup_unconstrain_from_box(struct wlr_xdg_popup *popup,
|
||||||
struct wlr_box *toplevel_sx_box) {
|
struct wlr_box *toplevel_sx_box) {
|
||||||
if (wlr_xdg_popup_unconstrain_flip(popup, toplevel_sx_box)) {
|
if (xdg_popup_unconstrain_flip(popup, toplevel_sx_box)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (wlr_xdg_popup_unconstrain_slide(popup, toplevel_sx_box)) {
|
if (xdg_popup_unconstrain_slide(popup, toplevel_sx_box)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (wlr_xdg_popup_unconstrain_resize(popup, toplevel_sx_box)) {
|
if (xdg_popup_unconstrain_resize(popup, toplevel_sx_box)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ static const struct wlr_keyboard_grab_interface xdg_keyboard_grab_impl = {
|
||||||
|
|
||||||
static void xdg_surface_destroy(struct wlr_xdg_surface_v6 *surface);
|
static void xdg_surface_destroy(struct wlr_xdg_surface_v6 *surface);
|
||||||
|
|
||||||
static void wlr_xdg_popup_grab_handle_seat_destroy(
|
static void xdg_popup_grab_handle_seat_destroy(
|
||||||
struct wl_listener *listener, void *data) {
|
struct wl_listener *listener, void *data) {
|
||||||
struct wlr_xdg_popup_grab_v6 *xdg_grab =
|
struct wlr_xdg_popup_grab_v6 *xdg_grab =
|
||||||
wl_container_of(listener, xdg_grab, seat_destroy);
|
wl_container_of(listener, xdg_grab, seat_destroy);
|
||||||
|
@ -172,7 +172,7 @@ static struct wlr_xdg_popup_grab_v6 *xdg_shell_popup_grab_from_seat(
|
||||||
wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
|
wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
|
||||||
xdg_grab->seat = seat;
|
xdg_grab->seat = seat;
|
||||||
|
|
||||||
xdg_grab->seat_destroy.notify = wlr_xdg_popup_grab_handle_seat_destroy;
|
xdg_grab->seat_destroy.notify = xdg_popup_grab_handle_seat_destroy;
|
||||||
wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
|
wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
|
||||||
|
|
||||||
return xdg_grab;
|
return xdg_grab;
|
||||||
|
@ -924,7 +924,7 @@ static void xdg_surface_handle_get_toplevel(struct wl_client *client,
|
||||||
xdg_toplevel_resource_destroy);
|
xdg_toplevel_resource_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_toplevel_v6_ack_configure(
|
static void xdg_toplevel_v6_ack_configure(
|
||||||
struct wlr_xdg_surface_v6 *surface,
|
struct wlr_xdg_surface_v6 *surface,
|
||||||
struct wlr_xdg_surface_v6_configure *configure) {
|
struct wlr_xdg_surface_v6_configure *configure) {
|
||||||
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
||||||
|
@ -975,7 +975,7 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
|
||||||
assert(0 && "not reached");
|
assert(0 && "not reached");
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
|
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
|
||||||
wlr_xdg_toplevel_v6_ack_configure(surface, configure);
|
xdg_toplevel_v6_ack_configure(surface, configure);
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
|
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
|
||||||
break;
|
break;
|
||||||
|
@ -1027,7 +1027,7 @@ static const struct zxdg_surface_v6_interface zxdg_surface_v6_implementation = {
|
||||||
.set_window_geometry = xdg_surface_handle_set_window_geometry,
|
.set_window_geometry = xdg_surface_handle_set_window_geometry,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool wlr_xdg_surface_v6_toplevel_state_compare(
|
static bool xdg_surface_v6_toplevel_state_compare(
|
||||||
struct wlr_xdg_toplevel_v6 *state) {
|
struct wlr_xdg_toplevel_v6 *state) {
|
||||||
struct {
|
struct {
|
||||||
struct wlr_xdg_toplevel_v6_state state;
|
struct wlr_xdg_toplevel_v6_state state;
|
||||||
|
@ -1077,7 +1077,7 @@ static bool wlr_xdg_surface_v6_toplevel_state_compare(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_toplevel_v6_send_configure(
|
static void xdg_toplevel_v6_send_configure(
|
||||||
struct wlr_xdg_surface_v6 *surface,
|
struct wlr_xdg_surface_v6 *surface,
|
||||||
struct wlr_xdg_surface_v6_configure *configure) {
|
struct wlr_xdg_surface_v6_configure *configure) {
|
||||||
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
||||||
|
@ -1143,7 +1143,7 @@ error_out:
|
||||||
wl_resource_post_no_memory(surface->toplevel->resource);
|
wl_resource_post_no_memory(surface->toplevel->resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_surface_send_configure(void *user_data) {
|
static void xdg_surface_send_configure(void *user_data) {
|
||||||
struct wlr_xdg_surface_v6 *surface = user_data;
|
struct wlr_xdg_surface_v6 *surface = user_data;
|
||||||
|
|
||||||
surface->configure_idle = NULL;
|
surface->configure_idle = NULL;
|
||||||
|
@ -1163,7 +1163,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
|
||||||
assert(0 && "not reached");
|
assert(0 && "not reached");
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
|
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
|
||||||
wlr_xdg_toplevel_v6_send_configure(surface, configure);
|
xdg_toplevel_v6_send_configure(surface, configure);
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
|
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
|
||||||
zxdg_popup_v6_send_configure(surface->popup->resource,
|
zxdg_popup_v6_send_configure(surface->popup->resource,
|
||||||
|
@ -1177,7 +1177,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
|
||||||
zxdg_surface_v6_send_configure(surface->resource, configure->serial);
|
zxdg_surface_v6_send_configure(surface->resource, configure->serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t wlr_xdg_surface_v6_schedule_configure(
|
static uint32_t xdg_surface_v6_schedule_configure(
|
||||||
struct wlr_xdg_surface_v6 *surface) {
|
struct wlr_xdg_surface_v6 *surface) {
|
||||||
struct wl_display *display = wl_client_get_display(surface->client->client);
|
struct wl_display *display = wl_client_get_display(surface->client->client);
|
||||||
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
||||||
|
@ -1189,7 +1189,7 @@ static uint32_t wlr_xdg_surface_v6_schedule_configure(
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
|
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
|
||||||
pending_same =
|
pending_same =
|
||||||
wlr_xdg_surface_v6_toplevel_state_compare(surface->toplevel);
|
xdg_surface_v6_toplevel_state_compare(surface->toplevel);
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
|
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
|
||||||
break;
|
break;
|
||||||
|
@ -1213,26 +1213,26 @@ static uint32_t wlr_xdg_surface_v6_schedule_configure(
|
||||||
|
|
||||||
surface->configure_next_serial = wl_display_next_serial(display);
|
surface->configure_next_serial = wl_display_next_serial(display);
|
||||||
surface->configure_idle = wl_event_loop_add_idle(loop,
|
surface->configure_idle = wl_event_loop_add_idle(loop,
|
||||||
wlr_xdg_surface_send_configure, surface);
|
xdg_surface_send_configure, surface);
|
||||||
return surface->configure_next_serial;
|
return surface->configure_next_serial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_wlr_surface_destroyed(struct wl_listener *listener,
|
static void xdg_surface_handle_surface_destroy(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct wlr_xdg_surface_v6 *xdg_surface =
|
struct wlr_xdg_surface_v6 *xdg_surface =
|
||||||
wl_container_of(listener, xdg_surface, surface_destroy_listener);
|
wl_container_of(listener, xdg_surface, surface_destroy_listener);
|
||||||
xdg_surface_destroy(xdg_surface);
|
xdg_surface_destroy(xdg_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_surface_v6_toplevel_committed(
|
static void xdg_surface_v6_toplevel_committed(
|
||||||
struct wlr_xdg_surface_v6 *surface) {
|
struct wlr_xdg_surface_v6 *surface) {
|
||||||
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
||||||
|
|
||||||
if (!surface->toplevel->added) {
|
if (!surface->toplevel->added) {
|
||||||
// on the first commit, send a configure request to tell the client it
|
// on the first commit, send a configure request to tell the client it
|
||||||
// is added
|
// is added
|
||||||
wlr_xdg_surface_v6_schedule_configure(surface);
|
xdg_surface_v6_schedule_configure(surface);
|
||||||
surface->toplevel->added = true;
|
surface->toplevel->added = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1248,17 +1248,17 @@ static void wlr_xdg_surface_v6_toplevel_committed(
|
||||||
surface->toplevel->client_pending.min_height;
|
surface->toplevel->client_pending.min_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_surface_v6_popup_committed(
|
static void xdg_surface_v6_popup_committed(
|
||||||
struct wlr_xdg_surface_v6 *surface) {
|
struct wlr_xdg_surface_v6 *surface) {
|
||||||
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP);
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP);
|
||||||
|
|
||||||
if (!surface->popup->committed) {
|
if (!surface->popup->committed) {
|
||||||
wlr_xdg_surface_v6_schedule_configure(surface);
|
xdg_surface_v6_schedule_configure(surface);
|
||||||
surface->popup->committed = true;
|
surface->popup->committed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
|
static void handle_surface_committed(struct wlr_surface *wlr_surface,
|
||||||
void *role_data) {
|
void *role_data) {
|
||||||
struct wlr_xdg_surface_v6 *surface = role_data;
|
struct wlr_xdg_surface_v6 *surface = role_data;
|
||||||
|
|
||||||
|
@ -1284,10 +1284,10 @@ static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
|
||||||
"xdg_surface must have a role");
|
"xdg_surface must have a role");
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
|
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
|
||||||
wlr_xdg_surface_v6_toplevel_committed(surface);
|
xdg_surface_v6_toplevel_committed(surface);
|
||||||
break;
|
break;
|
||||||
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
|
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
|
||||||
wlr_xdg_surface_v6_popup_committed(surface);
|
xdg_surface_v6_popup_committed(surface);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1361,10 +1361,11 @@ static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client,
|
||||||
|
|
||||||
wl_signal_add(&surface->surface->events.destroy,
|
wl_signal_add(&surface->surface->events.destroy,
|
||||||
&surface->surface_destroy_listener);
|
&surface->surface_destroy_listener);
|
||||||
surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
|
surface->surface_destroy_listener.notify =
|
||||||
|
xdg_surface_handle_surface_destroy;
|
||||||
|
|
||||||
wlr_surface_set_role_committed(surface->surface,
|
wlr_surface_set_role_committed(surface->surface,
|
||||||
handle_wlr_surface_committed, surface);
|
handle_surface_committed, surface);
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
|
wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
|
||||||
wl_resource_set_implementation(surface->resource,
|
wl_resource_set_implementation(surface->resource,
|
||||||
|
@ -1405,7 +1406,8 @@ static const struct zxdg_shell_v6_interface xdg_shell_impl = {
|
||||||
.pong = xdg_shell_handle_pong,
|
.pong = xdg_shell_handle_pong,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void wlr_xdg_client_v6_destroy(struct wl_resource *resource) {
|
static void xdg_client_v6_handle_resource_destroy(
|
||||||
|
struct wl_resource *resource) {
|
||||||
struct wlr_xdg_client_v6 *client = xdg_client_from_resource(resource);
|
struct wlr_xdg_client_v6 *client = xdg_client_from_resource(resource);
|
||||||
|
|
||||||
struct wlr_xdg_surface_v6 *surface, *tmp = NULL;
|
struct wlr_xdg_surface_v6 *surface, *tmp = NULL;
|
||||||
|
@ -1421,7 +1423,7 @@ static void wlr_xdg_client_v6_destroy(struct wl_resource *resource) {
|
||||||
free(client);
|
free(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wlr_xdg_client_v6_ping_timeout(void *user_data) {
|
static int xdg_client_v6_ping_timeout(void *user_data) {
|
||||||
struct wlr_xdg_client_v6 *client = user_data;
|
struct wlr_xdg_client_v6 *client = user_data;
|
||||||
|
|
||||||
struct wlr_xdg_surface_v6 *surface;
|
struct wlr_xdg_surface_v6 *surface;
|
||||||
|
@ -1458,13 +1460,13 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
|
||||||
client->shell = xdg_shell;
|
client->shell = xdg_shell;
|
||||||
|
|
||||||
wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
|
wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
|
||||||
wlr_xdg_client_v6_destroy);
|
xdg_client_v6_handle_resource_destroy);
|
||||||
wl_list_insert(&xdg_shell->clients, &client->link);
|
wl_list_insert(&xdg_shell->clients, &client->link);
|
||||||
|
|
||||||
struct wl_display *display = wl_client_get_display(client->client);
|
struct wl_display *display = wl_client_get_display(client->client);
|
||||||
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
struct wl_event_loop *loop = wl_display_get_event_loop(display);
|
||||||
client->ping_timer = wl_event_loop_add_timer(loop,
|
client->ping_timer = wl_event_loop_add_timer(loop,
|
||||||
wlr_xdg_client_v6_ping_timeout, client);
|
xdg_client_v6_ping_timeout, client);
|
||||||
if (client->ping_timer == NULL) {
|
if (client->ping_timer == NULL) {
|
||||||
wl_client_post_no_memory(client->client);
|
wl_client_post_no_memory(client->client);
|
||||||
}
|
}
|
||||||
|
@ -1533,7 +1535,7 @@ uint32_t wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface,
|
||||||
surface->toplevel->server_pending.width = width;
|
surface->toplevel->server_pending.width = width;
|
||||||
surface->toplevel->server_pending.height = height;
|
surface->toplevel->server_pending.height = height;
|
||||||
|
|
||||||
return wlr_xdg_surface_v6_schedule_configure(surface);
|
return xdg_surface_v6_schedule_configure(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
|
uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
|
||||||
|
@ -1541,7 +1543,7 @@ uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
|
||||||
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
||||||
surface->toplevel->server_pending.activated = activated;
|
surface->toplevel->server_pending.activated = activated;
|
||||||
|
|
||||||
return wlr_xdg_surface_v6_schedule_configure(surface);
|
return xdg_surface_v6_schedule_configure(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
|
uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
|
||||||
|
@ -1549,7 +1551,7 @@ uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
|
||||||
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
||||||
surface->toplevel->server_pending.maximized = maximized;
|
surface->toplevel->server_pending.maximized = maximized;
|
||||||
|
|
||||||
return wlr_xdg_surface_v6_schedule_configure(surface);
|
return xdg_surface_v6_schedule_configure(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
|
uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
|
||||||
|
@ -1557,7 +1559,7 @@ uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
|
||||||
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
||||||
surface->toplevel->server_pending.fullscreen = fullscreen;
|
surface->toplevel->server_pending.fullscreen = fullscreen;
|
||||||
|
|
||||||
return wlr_xdg_surface_v6_schedule_configure(surface);
|
return xdg_surface_v6_schedule_configure(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
|
uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
|
||||||
|
@ -1565,7 +1567,7 @@ uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
|
||||||
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
|
||||||
surface->toplevel->server_pending.resizing = resizing;
|
surface->toplevel->server_pending.resizing = resizing;
|
||||||
|
|
||||||
return wlr_xdg_surface_v6_schedule_configure(surface);
|
return xdg_surface_v6_schedule_configure(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_xdg_surface_v6_send_close(struct wlr_xdg_surface_v6 *surface) {
|
void wlr_xdg_surface_v6_send_close(struct wlr_xdg_surface_v6 *surface) {
|
||||||
|
@ -1677,7 +1679,7 @@ void wlr_xdg_popup_v6_get_toplevel_coords(struct wlr_xdg_popup_v6 *popup,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
|
static void xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
|
||||||
struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
|
struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
|
||||||
int popup_width = popup->geometry.width;
|
int popup_width = popup->geometry.width;
|
||||||
int popup_height = popup->geometry.height;
|
int popup_height = popup->geometry.height;
|
||||||
|
@ -1705,10 +1707,10 @@ static void wlr_xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
|
static bool xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
|
||||||
struct wlr_box *toplevel_sx_box) {
|
struct wlr_box *toplevel_sx_box) {
|
||||||
int offset_x = 0, offset_y = 0;
|
int offset_x = 0, offset_y = 0;
|
||||||
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_x, &offset_y);
|
&offset_x, &offset_y);
|
||||||
|
|
||||||
if (!offset_x && !offset_y) {
|
if (!offset_x && !offset_y) {
|
||||||
|
@ -1733,7 +1735,7 @@ static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
|
||||||
popup->geometry =
|
popup->geometry =
|
||||||
wlr_xdg_positioner_v6_get_geometry(&popup->positioner);
|
wlr_xdg_positioner_v6_get_geometry(&popup->positioner);
|
||||||
|
|
||||||
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_x, &offset_y);
|
&offset_x, &offset_y);
|
||||||
|
|
||||||
if (!offset_x && !offset_y) {
|
if (!offset_x && !offset_y) {
|
||||||
|
@ -1755,10 +1757,10 @@ static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
|
static bool xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
|
||||||
struct wlr_box *toplevel_sx_box) {
|
struct wlr_box *toplevel_sx_box) {
|
||||||
int offset_x = 0, offset_y = 0;
|
int offset_x = 0, offset_y = 0;
|
||||||
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_x, &offset_y);
|
&offset_x, &offset_y);
|
||||||
|
|
||||||
if (!offset_x && !offset_y) {
|
if (!offset_x && !offset_y) {
|
||||||
|
@ -1792,16 +1794,16 @@ static bool wlr_xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
|
||||||
popup->geometry.y += toplevel_sx_box->y - toplevel_y;
|
popup->geometry.y += toplevel_sx_box->y - toplevel_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_x, &offset_y);
|
&offset_x, &offset_y);
|
||||||
|
|
||||||
return !offset_x && !offset_y;
|
return !offset_x && !offset_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
|
static bool xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
|
||||||
struct wlr_box *toplevel_sx_box) {
|
struct wlr_box *toplevel_sx_box) {
|
||||||
int offset_x, offset_y;
|
int offset_x, offset_y;
|
||||||
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_x, &offset_y);
|
&offset_x, &offset_y);
|
||||||
|
|
||||||
if (!offset_x && !offset_y) {
|
if (!offset_x && !offset_y) {
|
||||||
|
@ -1823,7 +1825,7 @@ static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
|
||||||
popup->geometry.height -= offset_y;
|
popup->geometry.height -= offset_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
|
||||||
&offset_y, &offset_y);
|
&offset_y, &offset_y);
|
||||||
|
|
||||||
return !offset_x && !offset_y;
|
return !offset_x && !offset_y;
|
||||||
|
@ -1831,13 +1833,13 @@ static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
|
||||||
|
|
||||||
void wlr_xdg_popup_v6_unconstrain_from_box(struct wlr_xdg_popup_v6 *popup,
|
void wlr_xdg_popup_v6_unconstrain_from_box(struct wlr_xdg_popup_v6 *popup,
|
||||||
struct wlr_box *toplevel_sx_box) {
|
struct wlr_box *toplevel_sx_box) {
|
||||||
if (wlr_xdg_popup_v6_unconstrain_flip(popup, toplevel_sx_box)) {
|
if (xdg_popup_v6_unconstrain_flip(popup, toplevel_sx_box)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (wlr_xdg_popup_v6_unconstrain_slide(popup, toplevel_sx_box)) {
|
if (xdg_popup_v6_unconstrain_slide(popup, toplevel_sx_box)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (wlr_xdg_popup_v6_unconstrain_resize(popup, toplevel_sx_box)) {
|
if (xdg_popup_v6_unconstrain_resize(popup, toplevel_sx_box)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <wlr/xcursor.h>
|
#include <wlr/xcursor.h>
|
||||||
#include "xcursor/xcursor.h"
|
#include "xcursor/xcursor.h"
|
||||||
|
|
||||||
static void wlr_xcursor_destroy(struct wlr_xcursor *cursor) {
|
static void xcursor_destroy(struct wlr_xcursor *cursor) {
|
||||||
for (size_t i = 0; i < cursor->image_count; i++) {
|
for (size_t i = 0; i < cursor->image_count; i++) {
|
||||||
free(cursor->images[i]->buffer);
|
free(cursor->images[i]->buffer);
|
||||||
free(cursor->images[i]);
|
free(cursor->images[i]);
|
||||||
|
@ -45,7 +45,7 @@ static void wlr_xcursor_destroy(struct wlr_xcursor *cursor) {
|
||||||
|
|
||||||
#include "xcursor/cursor_data.h"
|
#include "xcursor/cursor_data.h"
|
||||||
|
|
||||||
static struct wlr_xcursor *wlr_xcursor_create_from_data(
|
static struct wlr_xcursor *xcursor_create_from_data(
|
||||||
struct cursor_metadata *metadata, struct wlr_xcursor_theme *theme) {
|
struct cursor_metadata *metadata, struct wlr_xcursor_theme *theme) {
|
||||||
struct wlr_xcursor *cursor;
|
struct wlr_xcursor *cursor;
|
||||||
struct wlr_xcursor_image *image;
|
struct wlr_xcursor_image *image;
|
||||||
|
@ -117,7 +117,7 @@ static void load_default_theme(struct wlr_xcursor_theme *theme) {
|
||||||
|
|
||||||
for (i = 0; i < theme->cursor_count; ++i) {
|
for (i = 0; i < theme->cursor_count; ++i) {
|
||||||
theme->cursors[i] =
|
theme->cursors[i] =
|
||||||
wlr_xcursor_create_from_data(&cursor_metadata[i], theme);
|
xcursor_create_from_data(&cursor_metadata[i], theme);
|
||||||
|
|
||||||
if (theme->cursors[i] == NULL) {
|
if (theme->cursors[i] == NULL) {
|
||||||
break;
|
break;
|
||||||
|
@ -126,7 +126,7 @@ static void load_default_theme(struct wlr_xcursor_theme *theme) {
|
||||||
theme->cursor_count = i;
|
theme->cursor_count = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_xcursor *wlr_xcursor_create_from_xcursor_images(
|
static struct wlr_xcursor *xcursor_create_from_xcursor_images(
|
||||||
XcursorImages *images, struct wlr_xcursor_theme *theme) {
|
XcursorImages *images, struct wlr_xcursor_theme *theme) {
|
||||||
struct wlr_xcursor *cursor;
|
struct wlr_xcursor *cursor;
|
||||||
struct wlr_xcursor_image *image;
|
struct wlr_xcursor_image *image;
|
||||||
|
@ -193,7 +193,7 @@ static void load_callback(XcursorImages *images, void *data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor = wlr_xcursor_create_from_xcursor_images(images, theme);
|
cursor = xcursor_create_from_xcursor_images(images, theme);
|
||||||
|
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
theme->cursor_count++;
|
theme->cursor_count++;
|
||||||
|
@ -259,7 +259,7 @@ void wlr_xcursor_theme_destroy(struct wlr_xcursor_theme *theme) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < theme->cursor_count; i++) {
|
for (i = 0; i < theme->cursor_count; i++) {
|
||||||
wlr_xcursor_destroy(theme->cursors[i]);
|
xcursor_destroy(theme->cursors[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(theme->name);
|
free(theme->name);
|
||||||
|
@ -280,7 +280,7 @@ struct wlr_xcursor *wlr_xcursor_theme_get_cursor(struct wlr_xcursor_theme *theme
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wlr_xcursor_frame_and_duration(struct wlr_xcursor *cursor,
|
static int xcursor_frame_and_duration(struct wlr_xcursor *cursor,
|
||||||
uint32_t time, uint32_t *duration) {
|
uint32_t time, uint32_t *duration) {
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
int i;
|
int i;
|
||||||
|
@ -323,7 +323,7 @@ static int wlr_xcursor_frame_and_duration(struct wlr_xcursor *cursor,
|
||||||
}
|
}
|
||||||
|
|
||||||
int wlr_xcursor_frame(struct wlr_xcursor *_cursor, uint32_t time) {
|
int wlr_xcursor_frame(struct wlr_xcursor *_cursor, uint32_t time) {
|
||||||
return wlr_xcursor_frame_and_duration(_cursor, time, NULL);
|
return xcursor_frame_and_duration(_cursor, time, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *wlr_xcursor_get_resize_name(enum wlr_edges edges) {
|
const char *wlr_xcursor_get_resize_name(enum wlr_edges edges) {
|
||||||
|
|
|
@ -128,7 +128,7 @@ static void exec_xwayland(struct wlr_xwayland *wlr_xwayland) {
|
||||||
execvp("Xwayland", argv);
|
execvp("Xwayland", argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
|
static void xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
|
||||||
if (!wlr_xwayland || wlr_xwayland->display == -1) {
|
if (!wlr_xwayland || wlr_xwayland->display == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
|
static bool xwayland_start(struct wlr_xwayland *wlr_xwayland,
|
||||||
struct wl_display *wl_display, struct wlr_compositor *compositor);
|
struct wl_display *wl_display, struct wlr_compositor *compositor);
|
||||||
|
|
||||||
static void handle_client_destroy(struct wl_listener *listener, void *data) {
|
static void handle_client_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
@ -176,11 +176,11 @@ static void handle_client_destroy(struct wl_listener *listener, void *data) {
|
||||||
wlr_xwayland->client = NULL;
|
wlr_xwayland->client = NULL;
|
||||||
wl_list_remove(&wlr_xwayland->client_destroy.link);
|
wl_list_remove(&wlr_xwayland->client_destroy.link);
|
||||||
|
|
||||||
wlr_xwayland_finish(wlr_xwayland);
|
xwayland_finish(wlr_xwayland);
|
||||||
|
|
||||||
if (time(NULL) - wlr_xwayland->server_start > 5) {
|
if (time(NULL) - wlr_xwayland->server_start > 5) {
|
||||||
wlr_log(L_INFO, "Restarting Xwayland");
|
wlr_log(L_INFO, "Restarting Xwayland");
|
||||||
wlr_xwayland_start(wlr_xwayland, wlr_xwayland->wl_display,
|
xwayland_start(wlr_xwayland, wlr_xwayland->wl_display,
|
||||||
wlr_xwayland->compositor);
|
wlr_xwayland->compositor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ static int xserver_handle_ready(int signal_number, void *data) {
|
||||||
|
|
||||||
wlr_xwayland->xwm = xwm_create(wlr_xwayland);
|
wlr_xwayland->xwm = xwm_create(wlr_xwayland);
|
||||||
if (!wlr_xwayland->xwm) {
|
if (!wlr_xwayland->xwm) {
|
||||||
wlr_xwayland_finish(wlr_xwayland);
|
xwayland_finish(wlr_xwayland);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ static int xserver_handle_ready(int signal_number, void *data) {
|
||||||
return 1; /* wayland event loop dispatcher's count */
|
return 1; /* wayland event loop dispatcher's count */
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
|
static bool xwayland_start(struct wlr_xwayland *wlr_xwayland,
|
||||||
struct wl_display *wl_display, struct wlr_compositor *compositor) {
|
struct wl_display *wl_display, struct wlr_compositor *compositor) {
|
||||||
memset(wlr_xwayland, 0, offsetof(struct wlr_xwayland, seat));
|
memset(wlr_xwayland, 0, offsetof(struct wlr_xwayland, seat));
|
||||||
wlr_xwayland->wl_display = wl_display;
|
wlr_xwayland->wl_display = wl_display;
|
||||||
|
@ -261,13 +261,13 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
|
||||||
|
|
||||||
wlr_xwayland->display = open_display_sockets(wlr_xwayland->x_fd);
|
wlr_xwayland->display = open_display_sockets(wlr_xwayland->x_fd);
|
||||||
if (wlr_xwayland->display < 0) {
|
if (wlr_xwayland->display < 0) {
|
||||||
wlr_xwayland_finish(wlr_xwayland);
|
xwayland_finish(wlr_xwayland);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wl_fd) != 0 ||
|
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wl_fd) != 0 ||
|
||||||
socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wm_fd) != 0) {
|
socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wm_fd) != 0) {
|
||||||
wlr_log_errno(L_ERROR, "failed to create socketpair");
|
wlr_log_errno(L_ERROR, "failed to create socketpair");
|
||||||
wlr_xwayland_finish(wlr_xwayland);
|
xwayland_finish(wlr_xwayland);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
|
||||||
|
|
||||||
if (!(wlr_xwayland->client = wl_client_create(wl_display, wlr_xwayland->wl_fd[0]))) {
|
if (!(wlr_xwayland->client = wl_client_create(wl_display, wlr_xwayland->wl_fd[0]))) {
|
||||||
wlr_log_errno(L_ERROR, "wl_client_create failed");
|
wlr_log_errno(L_ERROR, "wl_client_create failed");
|
||||||
wlr_xwayland_finish(wlr_xwayland);
|
xwayland_finish(wlr_xwayland);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
|
||||||
}
|
}
|
||||||
if (wlr_xwayland->pid < 0) {
|
if (wlr_xwayland->pid < 0) {
|
||||||
wlr_log_errno(L_ERROR, "fork failed");
|
wlr_log_errno(L_ERROR, "fork failed");
|
||||||
wlr_xwayland_finish(wlr_xwayland);
|
xwayland_finish(wlr_xwayland);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
|
||||||
|
|
||||||
void wlr_xwayland_destroy(struct wlr_xwayland *wlr_xwayland) {
|
void wlr_xwayland_destroy(struct wlr_xwayland *wlr_xwayland) {
|
||||||
wlr_xwayland_set_seat(wlr_xwayland, NULL);
|
wlr_xwayland_set_seat(wlr_xwayland, NULL);
|
||||||
wlr_xwayland_finish(wlr_xwayland);
|
xwayland_finish(wlr_xwayland);
|
||||||
free(wlr_xwayland);
|
free(wlr_xwayland);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display,
|
||||||
|
|
||||||
wl_signal_init(&wlr_xwayland->events.new_surface);
|
wl_signal_init(&wlr_xwayland->events.new_surface);
|
||||||
wl_signal_init(&wlr_xwayland->events.ready);
|
wl_signal_init(&wlr_xwayland->events.ready);
|
||||||
if (wlr_xwayland_start(wlr_xwayland, wl_display, compositor)) {
|
if (xwayland_start(wlr_xwayland, wl_display, compositor)) {
|
||||||
return wlr_xwayland;
|
return wlr_xwayland;
|
||||||
}
|
}
|
||||||
free(wlr_xwayland);
|
free(wlr_xwayland);
|
||||||
|
@ -380,7 +380,7 @@ void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland,
|
||||||
wlr_xwayland->cursor->hotspot_y = hotspot_y;
|
wlr_xwayland->cursor->hotspot_y = hotspot_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wlr_xwayland_handle_seat_destroy(struct wl_listener *listener,
|
static void xwayland_handle_seat_destroy(struct wl_listener *listener,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct wlr_xwayland *xwayland =
|
struct wlr_xwayland *xwayland =
|
||||||
wl_container_of(listener, xwayland, seat_destroy);
|
wl_container_of(listener, xwayland, seat_destroy);
|
||||||
|
@ -404,6 +404,6 @@ void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
xwayland->seat_destroy.notify = wlr_xwayland_handle_seat_destroy;
|
xwayland->seat_destroy.notify = xwayland_handle_seat_destroy;
|
||||||
wl_signal_add(&seat->events.destroy, &xwayland->seat_destroy);
|
wl_signal_add(&seat->events.destroy, &xwayland->seat_destroy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,7 @@ static void xsurface_set_net_wm_state(struct wlr_xwayland_surface *xsurface) {
|
||||||
|
|
||||||
static void xsurface_unmap(struct wlr_xwayland_surface *surface);
|
static void xsurface_unmap(struct wlr_xwayland_surface *surface);
|
||||||
|
|
||||||
static void wlr_xwayland_surface_destroy(
|
static void xwayland_surface_destroy(
|
||||||
struct wlr_xwayland_surface *xsurface) {
|
struct wlr_xwayland_surface *xsurface) {
|
||||||
xsurface_unmap(xsurface);
|
xsurface_unmap(xsurface);
|
||||||
|
|
||||||
|
@ -708,7 +708,7 @@ static void xwm_handle_destroy_notify(struct wlr_xwm *xwm,
|
||||||
if (xsurface == NULL) {
|
if (xsurface == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wlr_xwayland_surface_destroy(xsurface);
|
xwayland_surface_destroy(xsurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xwm_handle_configure_request(struct wlr_xwm *xwm,
|
static void xwm_handle_configure_request(struct wlr_xwm *xwm,
|
||||||
|
@ -1304,10 +1304,10 @@ void xwm_destroy(struct wlr_xwm *xwm) {
|
||||||
#endif
|
#endif
|
||||||
struct wlr_xwayland_surface *xsurface, *tmp;
|
struct wlr_xwayland_surface *xsurface, *tmp;
|
||||||
wl_list_for_each_safe(xsurface, tmp, &xwm->surfaces, link) {
|
wl_list_for_each_safe(xsurface, tmp, &xwm->surfaces, link) {
|
||||||
wlr_xwayland_surface_destroy(xsurface);
|
xwayland_surface_destroy(xsurface);
|
||||||
}
|
}
|
||||||
wl_list_for_each_safe(xsurface, tmp, &xwm->unpaired_surfaces, link) {
|
wl_list_for_each_safe(xsurface, tmp, &xwm->unpaired_surfaces, link) {
|
||||||
wlr_xwayland_surface_destroy(xsurface);
|
xwayland_surface_destroy(xsurface);
|
||||||
}
|
}
|
||||||
wl_list_remove(&xwm->compositor_new_surface.link);
|
wl_list_remove(&xwm->compositor_new_surface.link);
|
||||||
wl_list_remove(&xwm->compositor_destroy.link);
|
wl_list_remove(&xwm->compositor_destroy.link);
|
||||||
|
|
Loading…
Reference in New Issue