Merge branch 'master' into surface-transform
This commit is contained in:
commit
466e86b7b2
|
@ -453,11 +453,7 @@ static bool wlr_drm_connector_set_mode(struct wlr_output *output,
|
||||||
|
|
||||||
conn->state = WLR_DRM_CONN_CONNECTED;
|
conn->state = WLR_DRM_CONN_CONNECTED;
|
||||||
conn->output.current_mode = mode;
|
conn->output.current_mode = mode;
|
||||||
if (conn->output.width != mode->width || conn->output.height != mode->height) {
|
wlr_output_update_size(&conn->output, mode->width, mode->height);
|
||||||
conn->output.width = mode->width;
|
|
||||||
conn->output.height = mode->height;
|
|
||||||
wl_signal_emit(&conn->output.events.resolution, &conn->output);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since realloc_crtcs can deallocate planes on OTHER outputs,
|
// Since realloc_crtcs can deallocate planes on OTHER outputs,
|
||||||
// we actually need to reinitalise any than has changed
|
// we actually need to reinitalise any than has changed
|
||||||
|
@ -633,8 +629,10 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output,
|
||||||
struct wlr_box transformed_box;
|
struct wlr_box transformed_box;
|
||||||
wlr_box_transform(&box, transform, &transformed_box);
|
wlr_box_transform(&box, transform, &transformed_box);
|
||||||
|
|
||||||
|
if (plane != NULL) {
|
||||||
transformed_box.x -= plane->cursor_hotspot_x;
|
transformed_box.x -= plane->cursor_hotspot_x;
|
||||||
transformed_box.y -= plane->cursor_hotspot_y;
|
transformed_box.y -= plane->cursor_hotspot_y;
|
||||||
|
}
|
||||||
|
|
||||||
return drm->iface->crtc_move_cursor(drm, conn->crtc, transformed_box.x,
|
return drm->iface->crtc_move_cursor(drm, conn->crtc, transformed_box.x,
|
||||||
transformed_box.y);
|
transformed_box.y);
|
||||||
|
|
|
@ -93,6 +93,12 @@ void parse_edid(struct wlr_output *restrict output, size_t len, const uint8_t *d
|
||||||
uint16_t id = (data[8] << 8) | data[9];
|
uint16_t id = (data[8] << 8) | data[9];
|
||||||
snprintf(output->make, sizeof(output->make), "%s", get_manufacturer(id));
|
snprintf(output->make, sizeof(output->make), "%s", get_manufacturer(id));
|
||||||
|
|
||||||
|
uint16_t model = data[10] | (data[11] << 8);
|
||||||
|
snprintf(output->model, sizeof(output->model), "0x%04X", model);
|
||||||
|
|
||||||
|
uint32_t serial = data[12] | (data[13] << 8) | (data[14] << 8) | (data[15] << 8);
|
||||||
|
snprintf(output->serial, sizeof(output->serial), "0x%08X", serial);
|
||||||
|
|
||||||
output->phys_width = ((data[68] & 0xf0) << 4) | data[66];
|
output->phys_width = ((data[68] & 0xf0) << 4) | data[66];
|
||||||
output->phys_height = ((data[68] & 0x0f) << 8) | data[67];
|
output->phys_height = ((data[68] & 0x0f) << 8) | data[67];
|
||||||
|
|
||||||
|
|
|
@ -347,12 +347,6 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sd_session_get_vt(session->id, &session->base.vtnr);
|
|
||||||
if (ret < 0) {
|
|
||||||
wlr_log(L_ERROR, "Session not running in virtual terminal");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *seat;
|
char *seat;
|
||||||
ret = sd_session_get_seat(session->id, &seat);
|
ret = sd_session_get_seat(session->id, &seat);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -360,6 +354,14 @@ static struct wlr_session *logind_session_create(struct wl_display *disp) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat);
|
snprintf(session->base.seat, sizeof(session->base.seat), "%s", seat);
|
||||||
|
|
||||||
|
if (strcmp(seat, "seat0") == 0) {
|
||||||
|
ret = sd_session_get_vt(session->id, &session->base.vtnr);
|
||||||
|
if (ret < 0) {
|
||||||
|
wlr_log(L_ERROR, "Session not running in virtual terminal");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
free(seat);
|
free(seat);
|
||||||
|
|
||||||
ret = sd_bus_default_system(&session->bus);
|
ret = sd_bus_default_system(&session->bus);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include <EGL/eglext.h>
|
#include <EGL/eglext.h>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
|
@ -117,6 +118,38 @@ struct wlr_wl_backend_output *wlr_wl_output_for_surface(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wlr_wl_output_layout_get_box(struct wlr_wl_backend *backend,
|
||||||
|
struct wlr_box *box) {
|
||||||
|
int min_x = INT_MAX, min_y = INT_MAX;
|
||||||
|
int max_x = INT_MIN, max_y = INT_MIN;
|
||||||
|
|
||||||
|
struct wlr_wl_backend_output *output;
|
||||||
|
wl_list_for_each(output, &backend->outputs, link) {
|
||||||
|
struct wlr_output *wlr_output = &output->wlr_output;
|
||||||
|
|
||||||
|
int width, height;
|
||||||
|
wlr_output_effective_resolution(wlr_output, &width, &height);
|
||||||
|
|
||||||
|
if (wlr_output->lx < min_x) {
|
||||||
|
min_x = wlr_output->lx;
|
||||||
|
}
|
||||||
|
if (wlr_output->ly < min_y) {
|
||||||
|
min_y = wlr_output->ly;
|
||||||
|
}
|
||||||
|
if (wlr_output->lx + width > max_x) {
|
||||||
|
max_x = wlr_output->lx + width;
|
||||||
|
}
|
||||||
|
if (wlr_output->ly + height > max_y) {
|
||||||
|
max_y = wlr_output->ly + height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
box->x = min_x;
|
||||||
|
box->y = min_y;
|
||||||
|
box->width = max_x - min_x;
|
||||||
|
box->height = max_y - min_y;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display) {
|
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display) {
|
||||||
wlr_log(L_INFO, "Creating wayland backend");
|
wlr_log(L_INFO, "Creating wayland backend");
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,14 @@ 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,
|
||||||
|
int32_t width, int32_t height, int32_t refresh) {
|
||||||
|
struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
|
||||||
|
wl_egl_window_resize(output->egl_window, width, height, 0, 0);
|
||||||
|
wlr_output_update_size(&output->wlr_output, width, height);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static void wlr_wl_output_make_current(struct wlr_output *_output) {
|
static void wlr_wl_output_make_current(struct wlr_output *_output) {
|
||||||
struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
|
struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output;
|
||||||
if (!eglMakeCurrent(output->backend->egl.display,
|
if (!eglMakeCurrent(output->backend->egl.display,
|
||||||
|
@ -146,6 +154,8 @@ static void wlr_wl_output_destroy(struct wlr_output *_output) {
|
||||||
wl_signal_emit(&output->backend->backend.events.output_remove,
|
wl_signal_emit(&output->backend->backend.events.output_remove,
|
||||||
&output->wlr_output);
|
&output->wlr_output);
|
||||||
|
|
||||||
|
wl_list_remove(&output->link);
|
||||||
|
|
||||||
if (output->cursor.buf_size != 0) {
|
if (output->cursor.buf_size != 0) {
|
||||||
assert(output->cursor.data);
|
assert(output->cursor.data);
|
||||||
assert(output->cursor.buffer);
|
assert(output->cursor.buffer);
|
||||||
|
@ -163,6 +173,7 @@ static void wlr_wl_output_destroy(struct wlr_output *_output) {
|
||||||
if (output->frame_callback) {
|
if (output->frame_callback) {
|
||||||
wl_callback_destroy(output->frame_callback);
|
wl_callback_destroy(output->frame_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
eglDestroySurface(output->backend->egl.display, output->surface);
|
eglDestroySurface(output->backend->egl.display, output->surface);
|
||||||
wl_egl_window_destroy(output->egl_window);
|
wl_egl_window_destroy(output->egl_window);
|
||||||
zxdg_toplevel_v6_destroy(output->xdg_toplevel);
|
zxdg_toplevel_v6_destroy(output->xdg_toplevel);
|
||||||
|
@ -185,6 +196,7 @@ bool wlr_wl_output_move_cursor(struct wlr_output *_output, int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_output_impl output_impl = {
|
static struct wlr_output_impl output_impl = {
|
||||||
|
.set_custom_mode = wlr_wl_output_set_custom_mode,
|
||||||
.transform = wlr_wl_output_transform,
|
.transform = wlr_wl_output_transform,
|
||||||
.destroy = wlr_wl_output_destroy,
|
.destroy = wlr_wl_output_destroy,
|
||||||
.make_current = wlr_wl_output_make_current,
|
.make_current = wlr_wl_output_make_current,
|
||||||
|
@ -218,14 +230,13 @@ static void xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *x
|
||||||
// loop over states for maximized etc?
|
// loop over states for maximized etc?
|
||||||
wl_egl_window_resize(output->egl_window, width, height, 0, 0);
|
wl_egl_window_resize(output->egl_window, width, height, 0, 0);
|
||||||
wlr_output_update_size(&output->wlr_output, width, height);
|
wlr_output_update_size(&output->wlr_output, width, height);
|
||||||
wl_signal_emit(&output->wlr_output.events.resolution, output);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) {
|
static void xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) {
|
||||||
struct wlr_wl_backend_output *output = data;
|
struct wlr_wl_backend_output *output = data;
|
||||||
assert(output && output->xdg_toplevel == xdg_toplevel);
|
assert(output && output->xdg_toplevel == xdg_toplevel);
|
||||||
|
|
||||||
wl_display_terminate(output->backend->local_display);
|
wlr_output_destroy((struct wlr_output *)output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
|
static struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {
|
||||||
|
|
|
@ -21,7 +21,10 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
|
||||||
struct wlr_wl_pointer *wlr_wl_pointer = (struct wlr_wl_pointer *)dev->pointer;
|
struct wlr_wl_pointer *wlr_wl_pointer = (struct wlr_wl_pointer *)dev->pointer;
|
||||||
struct wlr_wl_backend_output *output =
|
struct wlr_wl_backend_output *output =
|
||||||
wlr_wl_output_for_surface(wlr_wl_dev->backend, surface);
|
wlr_wl_output_for_surface(wlr_wl_dev->backend, surface);
|
||||||
assert(output);
|
if (!output) {
|
||||||
|
// GNOME sends a pointer enter when the surface is being destroyed
|
||||||
|
return;
|
||||||
|
}
|
||||||
wlr_wl_pointer->current_output = output;
|
wlr_wl_pointer->current_output = output;
|
||||||
output->enter_serial = serial;
|
output->enter_serial = serial;
|
||||||
wlr_wl_output_update_cursor(output);
|
wlr_wl_output_update_cursor(output);
|
||||||
|
@ -49,22 +52,29 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_output *wlr_output = &wlr_wl_pointer->current_output->wlr_output;
|
||||||
|
|
||||||
struct wlr_box box;
|
struct wlr_box box;
|
||||||
wl_egl_window_get_attached_size(wlr_wl_pointer->current_output->egl_window,
|
wl_egl_window_get_attached_size(wlr_wl_pointer->current_output->egl_window,
|
||||||
&box.width, &box.height);
|
&box.width, &box.height);
|
||||||
box.x = wl_fixed_to_int(surface_x);
|
box.x = wl_fixed_to_int(surface_x);
|
||||||
box.y = wl_fixed_to_int(surface_y);
|
box.y = wl_fixed_to_int(surface_y);
|
||||||
struct wlr_box transformed;
|
struct wlr_box transformed;
|
||||||
wlr_box_transform(&box,
|
|
||||||
wlr_wl_pointer->current_output->wlr_output.transform, &transformed);
|
wlr_box_transform(&box, wlr_output->transform, &transformed);
|
||||||
|
box.x /= wlr_output->scale;
|
||||||
|
box.y /= wlr_output->scale;
|
||||||
|
|
||||||
|
struct wlr_box layout_box;
|
||||||
|
wlr_wl_output_layout_get_box(wlr_wl_pointer->current_output->backend, &layout_box);
|
||||||
|
|
||||||
struct wlr_event_pointer_motion_absolute wlr_event;
|
struct wlr_event_pointer_motion_absolute wlr_event;
|
||||||
wlr_event.device = dev;
|
wlr_event.device = dev;
|
||||||
wlr_event.time_msec = time;
|
wlr_event.time_msec = time;
|
||||||
wlr_event.width_mm = transformed.width;
|
wlr_event.width_mm = layout_box.width;
|
||||||
wlr_event.height_mm = transformed.height;
|
wlr_event.height_mm = layout_box.height;
|
||||||
wlr_event.x_mm = transformed.x;
|
wlr_event.x_mm = transformed.x + wlr_output->lx + layout_box.x;
|
||||||
wlr_event.y_mm = transformed.y;
|
wlr_event.y_mm = transformed.y + wlr_output->ly + layout_box.y;
|
||||||
wl_signal_emit(&dev->pointer->events.motion_absolute, &wlr_event);
|
wl_signal_emit(&dev->pointer->events.motion_absolute, &wlr_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,6 @@ static bool handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *e
|
||||||
xcb_configure_notify_event_t *ev = (xcb_configure_notify_event_t *)event;
|
xcb_configure_notify_event_t *ev = (xcb_configure_notify_event_t *)event;
|
||||||
|
|
||||||
wlr_output_update_size(&output->wlr_output, ev->width, ev->height);
|
wlr_output_update_size(&output->wlr_output, ev->width, ev->height);
|
||||||
wl_signal_emit(&output->wlr_output.events.resolution, output);
|
|
||||||
|
|
||||||
// Move the pointer to its new location
|
// Move the pointer to its new location
|
||||||
xcb_query_pointer_cookie_t cookie =
|
xcb_query_pointer_cookie_t cookie =
|
||||||
|
@ -267,8 +266,8 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) {
|
||||||
snprintf(output->wlr_output.name, sizeof(output->wlr_output.name), "X11-1");
|
snprintf(output->wlr_output.name, sizeof(output->wlr_output.name), "X11-1");
|
||||||
|
|
||||||
output->win = xcb_generate_id(x11->xcb_conn);
|
output->win = xcb_generate_id(x11->xcb_conn);
|
||||||
xcb_create_window(x11->xcb_conn, XCB_COPY_FROM_PARENT, output->win, x11->screen->root,
|
xcb_create_window(x11->xcb_conn, XCB_COPY_FROM_PARENT, output->win,
|
||||||
0, 0, 1024, 768, 1, XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
x11->screen->root, 0, 0, 1024, 768, 1, XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
x11->screen->root_visual, mask, values);
|
x11->screen->root_visual, mask, values);
|
||||||
|
|
||||||
output->surf = wlr_egl_create_surface(&x11->egl, &output->win);
|
output->surf = wlr_egl_create_surface(&x11->egl, &output->win);
|
||||||
|
@ -329,6 +328,17 @@ static struct wlr_backend_impl backend_impl = {
|
||||||
.get_egl = wlr_x11_backend_get_egl,
|
.get_egl = wlr_x11_backend_get_egl,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool output_set_custom_mode(struct wlr_output *wlr_output, int32_t width,
|
||||||
|
int32_t height, int32_t refresh) {
|
||||||
|
struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output;
|
||||||
|
struct wlr_x11_backend *x11 = output->x11;
|
||||||
|
|
||||||
|
const uint32_t values[] = { width, height };
|
||||||
|
xcb_configure_window(x11->xcb_conn, output->win,
|
||||||
|
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static void output_transform(struct wlr_output *wlr_output, enum wl_output_transform transform) {
|
static void output_transform(struct wlr_output *wlr_output, enum wl_output_transform transform) {
|
||||||
struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output;
|
struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output;
|
||||||
output->wlr_output.transform = transform;
|
output->wlr_output.transform = transform;
|
||||||
|
@ -362,6 +372,7 @@ static void output_swap_buffers(struct wlr_output *wlr_output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_output_impl output_impl = {
|
static struct wlr_output_impl output_impl = {
|
||||||
|
.set_custom_mode = output_set_custom_mode,
|
||||||
.transform = output_transform,
|
.transform = output_transform,
|
||||||
.destroy = output_destroy,
|
.destroy = output_destroy,
|
||||||
.make_current = output_make_current,
|
.make_current = output_make_current,
|
||||||
|
|
|
@ -72,7 +72,7 @@ static void handle_output_add(struct output_state *ostate) {
|
||||||
example_config_get_output(sample->config, ostate->output);
|
example_config_get_output(sample->config, ostate->output);
|
||||||
|
|
||||||
if (o_config) {
|
if (o_config) {
|
||||||
wlr_output_transform(ostate->output, o_config->transform);
|
wlr_output_set_transform(ostate->output, o_config->transform);
|
||||||
wlr_output_layout_add(sample->layout, ostate->output, o_config->x,
|
wlr_output_layout_add(sample->layout, ostate->output, o_config->x,
|
||||||
o_config->y);
|
o_config->y);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -136,7 +136,7 @@ static void handle_output_add(struct output_state *ostate) {
|
||||||
example_config_get_output(sample->config, ostate->output);
|
example_config_get_output(sample->config, ostate->output);
|
||||||
|
|
||||||
if (o_config) {
|
if (o_config) {
|
||||||
wlr_output_transform(ostate->output, o_config->transform);
|
wlr_output_set_transform(ostate->output, o_config->transform);
|
||||||
wlr_output_layout_add(sample->layout, ostate->output, o_config->x,
|
wlr_output_layout_add(sample->layout, ostate->output, o_config->x,
|
||||||
o_config->y);
|
o_config->y);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -101,7 +101,7 @@ static void handle_output_add(struct output_state *ostate) {
|
||||||
example_config_get_output(sample->config, ostate->output);
|
example_config_get_output(sample->config, ostate->output);
|
||||||
|
|
||||||
if (o_config) {
|
if (o_config) {
|
||||||
wlr_output_transform(ostate->output, o_config->transform);
|
wlr_output_set_transform(ostate->output, o_config->transform);
|
||||||
wlr_output_layout_add(sample->layout, ostate->output, o_config->x,
|
wlr_output_layout_add(sample->layout, ostate->output, o_config->x,
|
||||||
o_config->y);
|
o_config->y);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -78,7 +78,7 @@ static void handle_output_add(struct output_state *output) {
|
||||||
struct output_config *conf;
|
struct output_config *conf;
|
||||||
wl_list_for_each(conf, &state->config->outputs, link) {
|
wl_list_for_each(conf, &state->config->outputs, link) {
|
||||||
if (strcmp(conf->name, output->output->name) == 0) {
|
if (strcmp(conf->name, output->output->name) == 0) {
|
||||||
wlr_output_transform(output->output, conf->transform);
|
wlr_output_set_transform(output->output, conf->transform);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <wayland-egl.h>
|
#include <wayland-egl.h>
|
||||||
#include <wlr/render/egl.h>
|
#include <wlr/render/egl.h>
|
||||||
#include <wlr/backend/wayland.h>
|
#include <wlr/backend/wayland.h>
|
||||||
|
#include <wlr/types/wlr_box.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
#include <wlr/types/wlr_input_device.h>
|
#include <wlr/types/wlr_input_device.h>
|
||||||
#include <wayland-util.h>
|
#include <wayland-util.h>
|
||||||
|
@ -75,6 +76,8 @@ void wlr_wl_registry_poll(struct wlr_wl_backend *backend);
|
||||||
void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output);
|
void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output);
|
||||||
struct wlr_wl_backend_output *wlr_wl_output_for_surface(
|
struct wlr_wl_backend_output *wlr_wl_output_for_surface(
|
||||||
struct wlr_wl_backend *backend, struct wl_surface *surface);
|
struct wlr_wl_backend *backend, struct wl_surface *surface);
|
||||||
|
void wlr_wl_output_layout_get_box(struct wlr_wl_backend *backend,
|
||||||
|
struct wlr_box *box);
|
||||||
|
|
||||||
extern const struct wl_seat_listener seat_listener;
|
extern const struct wl_seat_listener seat_listener;
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ struct roots_keyboard_config {
|
||||||
char *layout;
|
char *layout;
|
||||||
char *variant;
|
char *variant;
|
||||||
char *options;
|
char *options;
|
||||||
|
int repeat_rate, repeat_delay;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,6 +51,7 @@ struct roots_cursor_config {
|
||||||
char *mapped_output;
|
char *mapped_output;
|
||||||
struct wlr_box *mapped_box;
|
struct wlr_box *mapped_box;
|
||||||
char *theme;
|
char *theme;
|
||||||
|
char *default_image;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,6 @@ enum roots_cursor_mode {
|
||||||
ROOTS_CURSOR_ROTATE = 3,
|
ROOTS_CURSOR_ROTATE = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum roots_cursor_resize_edge {
|
|
||||||
ROOTS_CURSOR_RESIZE_EDGE_TOP = 1,
|
|
||||||
ROOTS_CURSOR_RESIZE_EDGE_BOTTOM = 2,
|
|
||||||
ROOTS_CURSOR_RESIZE_EDGE_LEFT = 4,
|
|
||||||
ROOTS_CURSOR_RESIZE_EDGE_RIGHT = 8,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct roots_input_event {
|
struct roots_input_event {
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
struct wlr_cursor *cursor;
|
struct wlr_cursor *cursor;
|
||||||
|
@ -27,6 +20,8 @@ struct roots_cursor {
|
||||||
struct roots_seat *seat;
|
struct roots_seat *seat;
|
||||||
struct wlr_cursor *cursor;
|
struct wlr_cursor *cursor;
|
||||||
|
|
||||||
|
const char *default_xcursor;
|
||||||
|
|
||||||
enum roots_cursor_mode mode;
|
enum roots_cursor_mode mode;
|
||||||
|
|
||||||
// state from input (review if this is necessary)
|
// state from input (review if this is necessary)
|
||||||
|
|
|
@ -3,12 +3,10 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define ROOTS_XCURSOR_SIZE 16
|
#define ROOTS_XCURSOR_SIZE 24
|
||||||
|
|
||||||
#define ROOTS_XCURSOR_DEFAULT "left_ptr"
|
#define ROOTS_XCURSOR_DEFAULT "left_ptr"
|
||||||
#define ROOTS_XCURSOR_MOVE "grabbing"
|
#define ROOTS_XCURSOR_MOVE "grabbing"
|
||||||
#define ROOTS_XCURSOR_ROTATE "grabbing"
|
#define ROOTS_XCURSOR_ROTATE "grabbing"
|
||||||
|
|
||||||
const char *roots_xcursor_get_resize_name(uint32_t edges);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
struct wlr_output_impl {
|
struct wlr_output_impl {
|
||||||
void (*enable)(struct wlr_output *output, bool enable);
|
void (*enable)(struct wlr_output *output, bool enable);
|
||||||
bool (*set_mode)(struct wlr_output *output, struct wlr_output_mode *mode);
|
bool (*set_mode)(struct wlr_output *output, struct wlr_output_mode *mode);
|
||||||
|
bool (*set_custom_mode)(struct wlr_output *output, int32_t width,
|
||||||
|
int32_t height, int32_t refresh);
|
||||||
void (*transform)(struct wlr_output *output,
|
void (*transform)(struct wlr_output *output,
|
||||||
enum wl_output_transform transform);
|
enum wl_output_transform transform);
|
||||||
bool (*set_cursor)(struct wlr_output *output, const uint8_t *buf,
|
bool (*set_cursor)(struct wlr_output *output, const uint8_t *buf,
|
||||||
|
|
|
@ -51,10 +51,16 @@ struct wlr_keyboard {
|
||||||
xkb_mod_mask_t group;
|
xkb_mod_mask_t group;
|
||||||
} modifiers;
|
} modifiers;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
int32_t rate;
|
||||||
|
int32_t delay;
|
||||||
|
} repeat_info;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal key;
|
struct wl_signal key;
|
||||||
struct wl_signal modifiers;
|
struct wl_signal modifiers;
|
||||||
struct wl_signal keymap;
|
struct wl_signal keymap;
|
||||||
|
struct wl_signal repeat_info;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
|
@ -74,6 +80,12 @@ struct wlr_event_keyboard_key {
|
||||||
|
|
||||||
void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
|
void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
|
||||||
struct xkb_keymap *keymap);
|
struct xkb_keymap *keymap);
|
||||||
|
/**
|
||||||
|
* Sets the keyboard repeat info. `rate` is in key repeats/second and delay is
|
||||||
|
* in milliseconds.
|
||||||
|
*/
|
||||||
|
void wlr_keyboard_set_repeat_info(struct wlr_keyboard *kb, int32_t rate,
|
||||||
|
int32_t delay);
|
||||||
void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds);
|
void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds);
|
||||||
uint32_t wlr_keyboard_get_modifiers(struct wlr_keyboard *keyboard);
|
uint32_t wlr_keyboard_get_modifiers(struct wlr_keyboard *keyboard);
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ struct wlr_output_cursor {
|
||||||
struct wlr_output *output;
|
struct wlr_output *output;
|
||||||
double x, y;
|
double x, y;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
bool visible;
|
||||||
uint32_t width, height;
|
uint32_t width, height;
|
||||||
int32_t hotspot_x, hotspot_y;
|
int32_t hotspot_x, hotspot_y;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
|
@ -61,6 +62,8 @@ struct wlr_output {
|
||||||
struct wl_signal frame;
|
struct wl_signal frame;
|
||||||
struct wl_signal swap_buffers;
|
struct wl_signal swap_buffers;
|
||||||
struct wl_signal resolution;
|
struct wl_signal resolution;
|
||||||
|
struct wl_signal scale;
|
||||||
|
struct wl_signal transform;
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
|
@ -82,9 +85,12 @@ struct wlr_surface;
|
||||||
void wlr_output_enable(struct wlr_output *output, bool enable);
|
void wlr_output_enable(struct wlr_output *output, bool enable);
|
||||||
bool wlr_output_set_mode(struct wlr_output *output,
|
bool wlr_output_set_mode(struct wlr_output *output,
|
||||||
struct wlr_output_mode *mode);
|
struct wlr_output_mode *mode);
|
||||||
void wlr_output_transform(struct wlr_output *output,
|
bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
|
||||||
|
int32_t height, int32_t refresh);
|
||||||
|
void wlr_output_set_transform(struct wlr_output *output,
|
||||||
enum wl_output_transform transform);
|
enum wl_output_transform transform);
|
||||||
void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly);
|
void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly);
|
||||||
|
void wlr_output_set_scale(struct wlr_output *output, uint32_t scale);
|
||||||
void wlr_output_destroy(struct wlr_output *output);
|
void wlr_output_destroy(struct wlr_output *output);
|
||||||
void wlr_output_effective_resolution(struct wlr_output *output,
|
void wlr_output_effective_resolution(struct wlr_output *output,
|
||||||
int *width, int *height);
|
int *width, int *height);
|
||||||
|
@ -97,6 +103,9 @@ void wlr_output_set_fullscreen_surface(struct wlr_output *output,
|
||||||
struct wlr_surface *surface);
|
struct wlr_surface *surface);
|
||||||
|
|
||||||
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output);
|
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output);
|
||||||
|
/**
|
||||||
|
* Sets the cursor image. The image must be already scaled for the output.
|
||||||
|
*/
|
||||||
bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
|
bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
|
||||||
const uint8_t *pixels, int32_t stride, uint32_t width, uint32_t height,
|
const uint8_t *pixels, int32_t stride, uint32_t width, uint32_t height,
|
||||||
int32_t hotspot_x, int32_t hotspot_y);
|
int32_t hotspot_x, int32_t hotspot_y);
|
||||||
|
|
|
@ -146,6 +146,7 @@ struct wlr_seat_keyboard_state {
|
||||||
|
|
||||||
struct wl_listener keyboard_destroy;
|
struct wl_listener keyboard_destroy;
|
||||||
struct wl_listener keyboard_keymap;
|
struct wl_listener keyboard_keymap;
|
||||||
|
struct wl_listener keyboard_repeat_info;
|
||||||
|
|
||||||
struct wl_listener surface_destroy;
|
struct wl_listener surface_destroy;
|
||||||
struct wl_listener resource_destroy;
|
struct wl_listener resource_destroy;
|
||||||
|
|
|
@ -3,12 +3,35 @@
|
||||||
|
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Possible values to use in request_mode and the event mode. Same as
|
||||||
|
* org_kde_kwin_server_decoration_manager_mode.
|
||||||
|
*/
|
||||||
|
enum wlr_server_decoration_manager_mode {
|
||||||
|
/**
|
||||||
|
* Undecorated: The surface is not decorated at all, neither server nor
|
||||||
|
* client-side. An example is a popup surface which should not be
|
||||||
|
* decorated.
|
||||||
|
*/
|
||||||
|
WLR_SERVER_DECORATION_MANAGER_MODE_NONE = 0,
|
||||||
|
/**
|
||||||
|
* Client-side decoration: The decoration is part of the surface and the
|
||||||
|
* client.
|
||||||
|
*/
|
||||||
|
WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT = 1,
|
||||||
|
/**
|
||||||
|
* Server-side decoration: The server embeds the surface into a decoration
|
||||||
|
* frame.
|
||||||
|
*/
|
||||||
|
WLR_SERVER_DECORATION_MANAGER_MODE_SERVER = 2,
|
||||||
|
};
|
||||||
|
|
||||||
struct wlr_server_decoration_manager {
|
struct wlr_server_decoration_manager {
|
||||||
struct wl_global *wl_global;
|
struct wl_global *wl_global;
|
||||||
struct wl_list wl_resources;
|
struct wl_list wl_resources;
|
||||||
struct wl_list decorations; // wlr_server_decoration::link
|
struct wl_list decorations; // wlr_server_decoration::link
|
||||||
|
|
||||||
uint32_t default_mode; // enum org_kde_kwin_server_decoration_manager_mode
|
uint32_t default_mode; // enum wlr_server_decoration_manager_mode
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal new_decoration;
|
struct wl_signal new_decoration;
|
||||||
|
@ -22,7 +45,7 @@ struct wlr_server_decoration {
|
||||||
struct wlr_surface *surface;
|
struct wlr_surface *surface;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
|
|
||||||
uint32_t mode; // enum org_kde_kwin_server_decoration_manager_mode
|
uint32_t mode; // enum wlr_server_decoration_manager_mode
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
|
|
|
@ -77,6 +77,7 @@ struct wlr_wl_shell_surface {
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
|
struct wl_signal commit;
|
||||||
struct wl_signal ping_timeout;
|
struct wl_signal ping_timeout;
|
||||||
|
|
||||||
struct wl_signal request_move;
|
struct wl_signal request_move;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef WLR_UTIL_EDGES_H
|
||||||
|
#define WLR_UTIL_EDGES_H
|
||||||
|
|
||||||
|
enum wlr_edges {
|
||||||
|
WLR_EDGE_NONE = 0,
|
||||||
|
WLR_EDGE_TOP = 1,
|
||||||
|
WLR_EDGE_BOTTOM = 2,
|
||||||
|
WLR_EDGE_LEFT = 4,
|
||||||
|
WLR_EDGE_RIGHT = 8,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -32,6 +32,7 @@
|
||||||
#define WLR_XCURSOR_H
|
#define WLR_XCURSOR_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <wlr/util/edges.h>
|
||||||
|
|
||||||
struct wlr_xcursor_image {
|
struct wlr_xcursor_image {
|
||||||
uint32_t width; /* actual width */
|
uint32_t width; /* actual width */
|
||||||
|
@ -65,4 +66,9 @@ struct wlr_xcursor *wlr_xcursor_theme_get_cursor(
|
||||||
|
|
||||||
int wlr_xcursor_frame(struct wlr_xcursor *cursor, uint32_t time);
|
int wlr_xcursor_frame(struct wlr_xcursor *cursor, uint32_t time);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the resize cursor image for the given edges.
|
||||||
|
*/
|
||||||
|
const char *wlr_xcursor_get_resize_name(enum wlr_edges edges);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,6 +32,13 @@ struct wlr_xwayland {
|
||||||
struct wl_signal new_surface;
|
struct wl_signal new_surface;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a custom event handler to xwayland. Return 1 if the event was
|
||||||
|
* handled or 0 to use the default wlr-xwayland handler. wlr-xwayland will
|
||||||
|
* free the event.
|
||||||
|
*/
|
||||||
|
int (*user_event_handler)(struct wlr_xwm *xwm, xcb_generic_event_t *event);
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -153,20 +160,18 @@ void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland,
|
||||||
uint8_t *pixels, uint32_t stride, uint32_t width, uint32_t height,
|
uint8_t *pixels, uint32_t stride, uint32_t width, uint32_t height,
|
||||||
int32_t hotspot_x, int32_t hotspot_y);
|
int32_t hotspot_x, int32_t hotspot_y);
|
||||||
|
|
||||||
void wlr_xwayland_surface_activate(struct wlr_xwayland *wlr_xwayland,
|
void wlr_xwayland_surface_activate(struct wlr_xwayland_surface *surface,
|
||||||
struct wlr_xwayland_surface *surface, bool activated);
|
bool activated);
|
||||||
|
|
||||||
void wlr_xwayland_surface_configure(struct wlr_xwayland *wlr_xwayland,
|
void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *surface,
|
||||||
struct wlr_xwayland_surface *surface, int16_t x, int16_t y,
|
int16_t x, int16_t y, uint16_t width, uint16_t height);
|
||||||
uint16_t width, uint16_t height);
|
|
||||||
|
|
||||||
void wlr_xwayland_surface_close(struct wlr_xwayland *wlr_xwayland,
|
void wlr_xwayland_surface_close(struct wlr_xwayland_surface *surface);
|
||||||
struct wlr_xwayland_surface *surface);
|
|
||||||
|
|
||||||
void wlr_xwayland_surface_set_maximized(struct wlr_xwayland *wlr_xwayland,
|
void wlr_xwayland_surface_set_maximized(struct wlr_xwayland_surface *surface,
|
||||||
struct wlr_xwayland_surface *surface, bool maximized);
|
bool maximized);
|
||||||
|
|
||||||
void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland *wlr_xwayland,
|
void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface,
|
||||||
struct wlr_xwayland_surface *surface, bool fullscreen);
|
bool fullscreen);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -87,7 +87,7 @@ if get_option('enable_xwayland')
|
||||||
wlr_parts += [lib_wlr_xwayland]
|
wlr_parts += [lib_wlr_xwayland]
|
||||||
conf_data.set('WLR_HAS_XWAYLAND', true)
|
conf_data.set('WLR_HAS_XWAYLAND', true)
|
||||||
else
|
else
|
||||||
exclude_files += ['xwayland.h']
|
exclude_files += ['xwayland.h', 'xwm.h']
|
||||||
endif
|
endif
|
||||||
configure_file(output: 'config.h', install_dir: 'include/wlr', configuration: conf_data)
|
configure_file(output: 'config.h', install_dir: 'include/wlr', configuration: conf_data)
|
||||||
install_subdir('include/wlr', install_dir: 'include', exclude_files: exclude_files)
|
install_subdir('include/wlr', install_dir: 'include', exclude_files: exclude_files)
|
||||||
|
|
|
@ -176,6 +176,9 @@ static void config_handle_cursor(struct roots_config *config,
|
||||||
} else if (strcmp(name, "theme") == 0) {
|
} else if (strcmp(name, "theme") == 0) {
|
||||||
free(cc->theme);
|
free(cc->theme);
|
||||||
cc->theme = strdup(value);
|
cc->theme = strdup(value);
|
||||||
|
} else if (strcmp(name, "default-image") == 0) {
|
||||||
|
free(cc->default_image);
|
||||||
|
cc->default_image = strdup(value);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "got unknown cursor config: %s", name);
|
wlr_log(L_ERROR, "got unknown cursor config: %s", name);
|
||||||
}
|
}
|
||||||
|
@ -213,6 +216,10 @@ static void config_handle_keyboard(struct roots_config *config,
|
||||||
kc->variant = strdup(value);
|
kc->variant = strdup(value);
|
||||||
} else if (strcmp(name, "options") == 0) {
|
} else if (strcmp(name, "options") == 0) {
|
||||||
kc->options = strdup(value);
|
kc->options = strdup(value);
|
||||||
|
} else if (strcmp(name, "repeat-rate") == 0) {
|
||||||
|
kc->repeat_rate = strtol(value, NULL, 10);
|
||||||
|
} else if (strcmp(name, "repeat-delay") == 0) {
|
||||||
|
kc->repeat_delay = strtol(value, NULL, 10);
|
||||||
} else {
|
} else {
|
||||||
wlr_log(L_ERROR, "got unknown keyboard config: %s", name);
|
wlr_log(L_ERROR, "got unknown keyboard config: %s", name);
|
||||||
}
|
}
|
||||||
|
@ -450,6 +457,7 @@ void roots_config_destroy(struct roots_config *config) {
|
||||||
free(cc->mapped_output);
|
free(cc->mapped_output);
|
||||||
free(cc->mapped_box);
|
free(cc->mapped_box);
|
||||||
free(cc->theme);
|
free(cc->theme);
|
||||||
|
free(cc->default_image);
|
||||||
free(cc);
|
free(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,10 +474,15 @@ void roots_config_destroy(struct roots_config *config) {
|
||||||
|
|
||||||
struct roots_output_config *roots_config_get_output(struct roots_config *config,
|
struct roots_output_config *roots_config_get_output(struct roots_config *config,
|
||||||
struct wlr_output *output) {
|
struct wlr_output *output) {
|
||||||
struct roots_output_config *o_config;
|
char name[83];
|
||||||
wl_list_for_each(o_config, &config->outputs, link) {
|
snprintf(name, sizeof(name), "%s %s %s", output->make, output->model,
|
||||||
if (strcmp(o_config->name, output->name) == 0) {
|
output->serial);
|
||||||
return o_config;
|
|
||||||
|
struct roots_output_config *oc;
|
||||||
|
wl_list_for_each(oc, &config->outputs, link) {
|
||||||
|
if (strcmp(oc->name, output->name) == 0 ||
|
||||||
|
strcmp(oc->name, name) == 0) {
|
||||||
|
return oc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include <wlr/types/wlr_xcursor_manager.h>
|
#include <wlr/types/wlr_xcursor_manager.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
#include <wlr/util/edges.h>
|
||||||
#include "rootston/xcursor.h"
|
#include "rootston/xcursor.h"
|
||||||
#include "rootston/cursor.h"
|
#include "rootston/cursor.h"
|
||||||
|
|
||||||
|
@ -21,6 +22,7 @@ struct roots_cursor *roots_cursor_create(struct roots_seat *seat) {
|
||||||
free(cursor);
|
free(cursor);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
cursor->default_xcursor = ROOTS_XCURSOR_DEFAULT;
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@ static void roots_cursor_update_position(struct roots_cursor *cursor,
|
||||||
}
|
}
|
||||||
if (set_compositor_cursor) {
|
if (set_compositor_cursor) {
|
||||||
wlr_xcursor_manager_set_cursor_image(cursor->xcursor_manager,
|
wlr_xcursor_manager_set_cursor_image(cursor->xcursor_manager,
|
||||||
ROOTS_XCURSOR_DEFAULT, cursor->cursor);
|
cursor->default_xcursor, cursor->cursor);
|
||||||
cursor->cursor_client = NULL;
|
cursor->cursor_client = NULL;
|
||||||
}
|
}
|
||||||
if (view) {
|
if (view) {
|
||||||
|
@ -75,22 +77,22 @@ static void roots_cursor_update_position(struct roots_cursor *cursor,
|
||||||
double y = view->y;
|
double y = view->y;
|
||||||
int width = cursor->view_width;
|
int width = cursor->view_width;
|
||||||
int height = cursor->view_height;
|
int height = cursor->view_height;
|
||||||
if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) {
|
if (cursor->resize_edges & WLR_EDGE_TOP) {
|
||||||
y = cursor->view_y + dy;
|
y = cursor->view_y + dy;
|
||||||
height -= dy;
|
height -= dy;
|
||||||
if (height < 1) {
|
if (height < 1) {
|
||||||
y += height;
|
y += height;
|
||||||
}
|
}
|
||||||
} else if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) {
|
} else if (cursor->resize_edges & WLR_EDGE_BOTTOM) {
|
||||||
height += dy;
|
height += dy;
|
||||||
}
|
}
|
||||||
if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
|
if (cursor->resize_edges & WLR_EDGE_LEFT) {
|
||||||
x = cursor->view_x + dx;
|
x = cursor->view_x + dx;
|
||||||
width -= dx;
|
width -= dx;
|
||||||
if (width < 1) {
|
if (width < 1) {
|
||||||
x += width;
|
x += width;
|
||||||
}
|
}
|
||||||
} else if (cursor->resize_edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
|
} else if (cursor->resize_edges & WLR_EDGE_RIGHT) {
|
||||||
width += dx;
|
width += dx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,14 +149,14 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
|
||||||
case BTN_RIGHT:
|
case BTN_RIGHT:
|
||||||
edges = 0;
|
edges = 0;
|
||||||
if (sx < view->wlr_surface->current->width/2) {
|
if (sx < view->wlr_surface->current->width/2) {
|
||||||
edges |= ROOTS_CURSOR_RESIZE_EDGE_LEFT;
|
edges |= WLR_EDGE_LEFT;
|
||||||
} else {
|
} else {
|
||||||
edges |= ROOTS_CURSOR_RESIZE_EDGE_RIGHT;
|
edges |= WLR_EDGE_RIGHT;
|
||||||
}
|
}
|
||||||
if (sy < view->wlr_surface->current->height/2) {
|
if (sy < view->wlr_surface->current->height/2) {
|
||||||
edges |= ROOTS_CURSOR_RESIZE_EDGE_TOP;
|
edges |= WLR_EDGE_TOP;
|
||||||
} else {
|
} else {
|
||||||
edges |= ROOTS_CURSOR_RESIZE_EDGE_BOTTOM;
|
edges |= WLR_EDGE_BOTTOM;
|
||||||
}
|
}
|
||||||
roots_seat_begin_resize(seat, view, edges);
|
roots_seat_begin_resize(seat, view, edges);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include <wlr/types/wlr_xcursor_manager.h>
|
#include <wlr/types/wlr_xcursor_manager.h>
|
||||||
#include <wlr/types/wlr_xdg_shell_v6.h>
|
#include <wlr/types/wlr_xdg_shell_v6.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include <server-decoration-protocol.h>
|
|
||||||
#include "rootston/server.h"
|
#include "rootston/server.h"
|
||||||
#include "rootston/seat.h"
|
#include "rootston/seat.h"
|
||||||
#include "rootston/xcursor.h"
|
#include "rootston/xcursor.h"
|
||||||
|
@ -407,10 +406,14 @@ struct roots_desktop *desktop_create(struct roots_server *server,
|
||||||
desktop->config = config;
|
desktop->config = config;
|
||||||
|
|
||||||
const char *cursor_theme = NULL;
|
const char *cursor_theme = NULL;
|
||||||
|
const char *cursor_default = ROOTS_XCURSOR_DEFAULT;
|
||||||
struct roots_cursor_config *cc =
|
struct roots_cursor_config *cc =
|
||||||
roots_config_get_cursor(config, ROOTS_CONFIG_DEFAULT_SEAT_NAME);
|
roots_config_get_cursor(config, ROOTS_CONFIG_DEFAULT_SEAT_NAME);
|
||||||
if (cc != NULL) {
|
if (cc != NULL) {
|
||||||
cursor_theme = cc->theme;
|
cursor_theme = cc->theme;
|
||||||
|
if (cc->default_image != NULL) {
|
||||||
|
cursor_default = cc->default_image;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
desktop->xcursor_manager = wlr_xcursor_manager_create(cursor_theme,
|
desktop->xcursor_manager = wlr_xcursor_manager_create(cursor_theme,
|
||||||
|
@ -448,7 +451,7 @@ struct roots_desktop *desktop_create(struct roots_server *server,
|
||||||
wlr_log(L_ERROR, "Cannot load XWayland XCursor theme");
|
wlr_log(L_ERROR, "Cannot load XWayland XCursor theme");
|
||||||
}
|
}
|
||||||
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
|
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
|
||||||
desktop->xcursor_manager, ROOTS_XCURSOR_DEFAULT, 1);
|
desktop->xcursor_manager, cursor_default, 1);
|
||||||
if (xcursor != NULL) {
|
if (xcursor != NULL) {
|
||||||
struct wlr_xcursor_image *image = xcursor->images[0];
|
struct wlr_xcursor_image *image = xcursor->images[0];
|
||||||
wlr_xwayland_set_cursor(desktop->xwayland, image->buffer,
|
wlr_xwayland_set_cursor(desktop->xwayland, image->buffer,
|
||||||
|
@ -466,7 +469,7 @@ struct roots_desktop *desktop_create(struct roots_server *server,
|
||||||
wlr_server_decoration_manager_create(server->wl_display);
|
wlr_server_decoration_manager_create(server->wl_display);
|
||||||
wlr_server_decoration_manager_set_default_mode(
|
wlr_server_decoration_manager_set_default_mode(
|
||||||
desktop->server_decoration_manager,
|
desktop->server_decoration_manager,
|
||||||
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT);
|
WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT);
|
||||||
|
|
||||||
return desktop;
|
return desktop;
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,6 +306,12 @@ static void keyboard_config_merge(struct roots_keyboard_config *config,
|
||||||
if (config->name == NULL) {
|
if (config->name == NULL) {
|
||||||
config->name = fallback->name;
|
config->name = fallback->name;
|
||||||
}
|
}
|
||||||
|
if (config->repeat_rate <= 0) {
|
||||||
|
config->repeat_rate = fallback->repeat_rate;
|
||||||
|
}
|
||||||
|
if (config->repeat_delay <= 0) {
|
||||||
|
config->repeat_delay = fallback->repeat_delay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
|
struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
|
||||||
|
@ -337,8 +343,7 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
|
||||||
keyboard_config_merge(config, &env_config);
|
keyboard_config_merge(config, &env_config);
|
||||||
keyboard->config = config;
|
keyboard->config = config;
|
||||||
|
|
||||||
struct xkb_rule_names rules;
|
struct xkb_rule_names rules = { 0 };
|
||||||
memset(&rules, 0, sizeof(rules));
|
|
||||||
rules.rules = config->rules;
|
rules.rules = config->rules;
|
||||||
rules.model = config->model;
|
rules.model = config->model;
|
||||||
rules.layout = config->layout;
|
rules.layout = config->layout;
|
||||||
|
@ -353,6 +358,10 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
|
||||||
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
|
||||||
xkb_context_unref(context);
|
xkb_context_unref(context);
|
||||||
|
|
||||||
|
int repeat_rate = (config->repeat_rate > 0) ? config->repeat_rate : 25;
|
||||||
|
int repeat_delay = (config->repeat_delay > 0) ? config->repeat_delay : 600;
|
||||||
|
wlr_keyboard_set_repeat_info(device->keyboard, repeat_rate, repeat_delay);
|
||||||
|
|
||||||
return keyboard;
|
return keyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ sources = [
|
||||||
'main.c',
|
'main.c',
|
||||||
'output.c',
|
'output.c',
|
||||||
'seat.c',
|
'seat.c',
|
||||||
'xcursor.c',
|
|
||||||
'xdg_shell_v6.c',
|
'xdg_shell_v6.c',
|
||||||
'wl_shell.c',
|
'wl_shell.c',
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
#include <wlr/types/wlr_wl_shell.h>
|
#include <wlr/types/wlr_wl_shell.h>
|
||||||
#include <wlr/types/wlr_xcursor_manager.h>
|
|
||||||
#include <wlr/types/wlr_xdg_shell_v6.h>
|
#include <wlr/types/wlr_xdg_shell_v6.h>
|
||||||
#include <wlr/render/matrix.h>
|
#include <wlr/render/matrix.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
@ -283,8 +282,15 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
static void set_mode(struct wlr_output *output,
|
static void set_mode(struct wlr_output *output,
|
||||||
struct roots_output_config *oc) {
|
struct roots_output_config *oc) {
|
||||||
struct wlr_output_mode *mode, *best = NULL;
|
|
||||||
int mhz = (int)(oc->mode.refresh_rate * 1000);
|
int mhz = (int)(oc->mode.refresh_rate * 1000);
|
||||||
|
|
||||||
|
if (wl_list_empty(&output->modes)) {
|
||||||
|
// Output has no mode, try setting a custom one
|
||||||
|
wlr_output_set_custom_mode(output, oc->mode.width, oc->mode.height, mhz);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct wlr_output_mode *mode, *best = NULL;
|
||||||
wl_list_for_each(mode, &output->modes, link) {
|
wl_list_for_each(mode, &output->modes, link) {
|
||||||
if (mode->width == oc->mode.width && mode->height == oc->mode.height) {
|
if (mode->width == oc->mode.width && mode->height == oc->mode.height) {
|
||||||
if (mode->refresh == mhz) {
|
if (mode->refresh == mhz) {
|
||||||
|
@ -310,7 +316,7 @@ void output_add_notify(struct wl_listener *listener, void *data) {
|
||||||
struct roots_config *config = desktop->config;
|
struct roots_config *config = desktop->config;
|
||||||
|
|
||||||
wlr_log(L_DEBUG, "Output '%s' added", wlr_output->name);
|
wlr_log(L_DEBUG, "Output '%s' added", wlr_output->name);
|
||||||
wlr_log(L_DEBUG, "%s %s %s %"PRId32"mm x %"PRId32"mm", wlr_output->make,
|
wlr_log(L_DEBUG, "'%s %s %s' %"PRId32"mm x %"PRId32"mm", wlr_output->make,
|
||||||
wlr_output->model, wlr_output->serial, wlr_output->phys_width,
|
wlr_output->model, wlr_output->serial, wlr_output->phys_width,
|
||||||
wlr_output->phys_height);
|
wlr_output->phys_height);
|
||||||
if (wl_list_length(&wlr_output->modes) > 0) {
|
if (wl_list_length(&wlr_output->modes) > 0) {
|
||||||
|
@ -333,22 +339,16 @@ void output_add_notify(struct wl_listener *listener, void *data) {
|
||||||
if (output_config->mode.width) {
|
if (output_config->mode.width) {
|
||||||
set_mode(wlr_output, output_config);
|
set_mode(wlr_output, output_config);
|
||||||
}
|
}
|
||||||
wlr_output->scale = output_config->scale;
|
wlr_output_set_scale(wlr_output, output_config->scale);
|
||||||
wlr_output_transform(wlr_output, output_config->transform);
|
wlr_output_set_transform(wlr_output, output_config->transform);
|
||||||
wlr_output_layout_add(desktop->layout,
|
wlr_output_layout_add(desktop->layout, wlr_output, output_config->x,
|
||||||
wlr_output, output_config->x, output_config->y);
|
output_config->y);
|
||||||
} else {
|
} else {
|
||||||
wlr_output_layout_add_auto(desktop->layout, wlr_output);
|
wlr_output_layout_add_auto(desktop->layout, wlr_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct roots_seat *seat;
|
struct roots_seat *seat;
|
||||||
wl_list_for_each(seat, &input->seats, link) {
|
wl_list_for_each(seat, &input->seats, link) {
|
||||||
if (wlr_xcursor_manager_load(seat->cursor->xcursor_manager,
|
|
||||||
wlr_output->scale)) {
|
|
||||||
wlr_log(L_ERROR, "Cannot load xcursor theme for output '%s' "
|
|
||||||
"with scale %d", wlr_output->name, wlr_output->scale);
|
|
||||||
}
|
|
||||||
|
|
||||||
roots_seat_configure_cursor(seat);
|
roots_seat_configure_cursor(seat);
|
||||||
roots_seat_configure_xcursor(seat);
|
roots_seat_configure_xcursor(seat);
|
||||||
}
|
}
|
||||||
|
|
|
@ -442,8 +442,12 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) {
|
||||||
roots_config_get_cursor(seat->input->config, seat->seat->name);
|
roots_config_get_cursor(seat->input->config, seat->seat->name);
|
||||||
if (cc != NULL) {
|
if (cc != NULL) {
|
||||||
cursor_theme = cc->theme;
|
cursor_theme = cc->theme;
|
||||||
|
if (cc->default_image != NULL) {
|
||||||
|
seat->cursor->default_xcursor = cc->default_image;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!seat->cursor->xcursor_manager) {
|
||||||
seat->cursor->xcursor_manager =
|
seat->cursor->xcursor_manager =
|
||||||
wlr_xcursor_manager_create(cursor_theme, ROOTS_XCURSOR_SIZE);
|
wlr_xcursor_manager_create(cursor_theme, ROOTS_XCURSOR_SIZE);
|
||||||
if (seat->cursor->xcursor_manager == NULL) {
|
if (seat->cursor->xcursor_manager == NULL) {
|
||||||
|
@ -451,6 +455,7 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) {
|
||||||
cursor_theme);
|
cursor_theme);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct roots_output *output;
|
struct roots_output *output;
|
||||||
wl_list_for_each(output, &seat->input->server->desktop->outputs, link) {
|
wl_list_for_each(output, &seat->input->server->desktop->outputs, link) {
|
||||||
|
@ -463,7 +468,7 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager,
|
wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager,
|
||||||
ROOTS_XCURSOR_DEFAULT, seat->cursor->cursor);
|
seat->cursor->default_xcursor, seat->cursor->cursor);
|
||||||
wlr_cursor_warp(seat->cursor->cursor, NULL, seat->cursor->cursor->x,
|
wlr_cursor_warp(seat->cursor->cursor, NULL, seat->cursor->cursor->x,
|
||||||
seat->cursor->cursor->y);
|
seat->cursor->cursor->y);
|
||||||
}
|
}
|
||||||
|
@ -661,8 +666,9 @@ void roots_seat_begin_resize(struct roots_seat *seat, struct roots_view *view,
|
||||||
view_maximize(view, false);
|
view_maximize(view, false);
|
||||||
wlr_seat_pointer_clear_focus(seat->seat);
|
wlr_seat_pointer_clear_focus(seat->seat);
|
||||||
|
|
||||||
|
const char *resize_name = wlr_xcursor_get_resize_name(edges);
|
||||||
wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager,
|
wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager,
|
||||||
roots_xcursor_get_resize_name(edges), seat->cursor->cursor);
|
resize_name, seat->cursor->cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void roots_seat_begin_rotate(struct roots_seat *seat, struct roots_view *view) {
|
void roots_seat_begin_rotate(struct roots_seat *seat, struct roots_view *view) {
|
||||||
|
|
|
@ -150,8 +150,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
||||||
roots_surface->set_state.notify = handle_set_state;
|
roots_surface->set_state.notify = handle_set_state;
|
||||||
wl_signal_add(&surface->events.set_state, &roots_surface->set_state);
|
wl_signal_add(&surface->events.set_state, &roots_surface->set_state);
|
||||||
roots_surface->surface_commit.notify = handle_surface_commit;
|
roots_surface->surface_commit.notify = handle_surface_commit;
|
||||||
wl_signal_add(&surface->surface->events.commit,
|
wl_signal_add(&surface->events.commit, &roots_surface->surface_commit);
|
||||||
&roots_surface->surface_commit);
|
|
||||||
|
|
||||||
struct roots_view *view = calloc(1, sizeof(struct roots_view));
|
struct roots_view *view = calloc(1, sizeof(struct roots_view));
|
||||||
if (!view) {
|
if (!view) {
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "rootston/xcursor.h"
|
|
||||||
#include "rootston/input.h"
|
|
||||||
|
|
||||||
const char *roots_xcursor_get_resize_name(uint32_t edges) {
|
|
||||||
if (edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) {
|
|
||||||
if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
|
|
||||||
return "ne-resize";
|
|
||||||
} else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
|
|
||||||
return "nw-resize";
|
|
||||||
}
|
|
||||||
return "n-resize";
|
|
||||||
} else if (edges & ROOTS_CURSOR_RESIZE_EDGE_BOTTOM) {
|
|
||||||
if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
|
|
||||||
return "se-resize";
|
|
||||||
} else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
|
|
||||||
return "sw-resize";
|
|
||||||
}
|
|
||||||
return "s-resize";
|
|
||||||
} else if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
|
|
||||||
return "e-resize";
|
|
||||||
} else if (edges & ROOTS_CURSOR_RESIZE_EDGE_LEFT) {
|
|
||||||
return "w-resize";
|
|
||||||
}
|
|
||||||
return "se-resize"; // fallback
|
|
||||||
}
|
|
|
@ -11,8 +11,7 @@
|
||||||
|
|
||||||
static void activate(struct roots_view *view, bool active) {
|
static void activate(struct roots_view *view, bool active) {
|
||||||
assert(view->type == ROOTS_XWAYLAND_VIEW);
|
assert(view->type == ROOTS_XWAYLAND_VIEW);
|
||||||
struct wlr_xwayland *xwayland = view->desktop->xwayland;
|
wlr_xwayland_surface_activate(view->xwayland_surface, active);
|
||||||
wlr_xwayland_surface_activate(xwayland, view->xwayland_surface, active);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void move(struct roots_view *view, double x, double y) {
|
static void move(struct roots_view *view, double x, double y) {
|
||||||
|
@ -20,8 +19,8 @@ static void move(struct roots_view *view, double x, double y) {
|
||||||
struct wlr_xwayland_surface *xwayland_surface = view->xwayland_surface;
|
struct wlr_xwayland_surface *xwayland_surface = view->xwayland_surface;
|
||||||
view->x = x;
|
view->x = x;
|
||||||
view->y = y;
|
view->y = y;
|
||||||
wlr_xwayland_surface_configure(view->desktop->xwayland, xwayland_surface,
|
wlr_xwayland_surface_configure(xwayland_surface, x, y,
|
||||||
x, y, xwayland_surface->width, xwayland_surface->height);
|
xwayland_surface->width, xwayland_surface->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apply_size_constraints(
|
static void apply_size_constraints(
|
||||||
|
@ -56,9 +55,8 @@ static void resize(struct roots_view *view, uint32_t width, uint32_t height) {
|
||||||
apply_size_constraints(xwayland_surface, width, height, &constrained_width,
|
apply_size_constraints(xwayland_surface, width, height, &constrained_width,
|
||||||
&constrained_height);
|
&constrained_height);
|
||||||
|
|
||||||
wlr_xwayland_surface_configure(view->desktop->xwayland, xwayland_surface,
|
wlr_xwayland_surface_configure(xwayland_surface, xwayland_surface->x,
|
||||||
xwayland_surface->x, xwayland_surface->y, constrained_width,
|
xwayland_surface->y, constrained_width, constrained_height);
|
||||||
constrained_height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void move_resize(struct roots_view *view, double x, double y,
|
static void move_resize(struct roots_view *view, double x, double y,
|
||||||
|
@ -87,27 +85,25 @@ static void move_resize(struct roots_view *view, double x, double y,
|
||||||
view->pending_move_resize.width = constrained_width;
|
view->pending_move_resize.width = constrained_width;
|
||||||
view->pending_move_resize.height = constrained_height;
|
view->pending_move_resize.height = constrained_height;
|
||||||
|
|
||||||
wlr_xwayland_surface_configure(view->desktop->xwayland, xwayland_surface,
|
wlr_xwayland_surface_configure(xwayland_surface, x, y, constrained_width,
|
||||||
x, y, constrained_width, constrained_height);
|
constrained_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void close(struct roots_view *view) {
|
static void close(struct roots_view *view) {
|
||||||
assert(view->type == ROOTS_XWAYLAND_VIEW);
|
assert(view->type == ROOTS_XWAYLAND_VIEW);
|
||||||
wlr_xwayland_surface_close(view->desktop->xwayland, view->xwayland_surface);
|
wlr_xwayland_surface_close(view->xwayland_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void maximize(struct roots_view *view, bool maximized) {
|
static void maximize(struct roots_view *view, bool maximized) {
|
||||||
assert(view->type == ROOTS_XWAYLAND_VIEW);
|
assert(view->type == ROOTS_XWAYLAND_VIEW);
|
||||||
|
|
||||||
wlr_xwayland_surface_set_maximized(view->desktop->xwayland,
|
wlr_xwayland_surface_set_maximized(view->xwayland_surface, maximized);
|
||||||
view->xwayland_surface, maximized);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_fullscreen(struct roots_view *view, bool fullscreen) {
|
static void set_fullscreen(struct roots_view *view, bool fullscreen) {
|
||||||
assert(view->type == ROOTS_XWAYLAND_VIEW);
|
assert(view->type == ROOTS_XWAYLAND_VIEW);
|
||||||
|
|
||||||
wlr_xwayland_surface_set_fullscreen(view->desktop->xwayland,
|
wlr_xwayland_surface_set_fullscreen(view->xwayland_surface, fullscreen);
|
||||||
view->xwayland_surface, fullscreen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||||
|
@ -139,8 +135,8 @@ static void handle_request_configure(struct wl_listener *listener, void *data) {
|
||||||
roots_surface->view->x = (double)event->x;
|
roots_surface->view->x = (double)event->x;
|
||||||
roots_surface->view->y = (double)event->y;
|
roots_surface->view->y = (double)event->y;
|
||||||
|
|
||||||
wlr_xwayland_surface_configure(roots_surface->view->desktop->xwayland,
|
wlr_xwayland_surface_configure(xwayland_surface, event->x, event->y,
|
||||||
xwayland_surface, event->x, event->y, event->width, event->height);
|
event->width, event->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct roots_seat *guess_seat_for_view(struct roots_view *view) {
|
static struct roots_seat *guess_seat_for_view(struct roots_view *view) {
|
||||||
|
|
|
@ -102,6 +102,11 @@ void wlr_keyboard_init(struct wlr_keyboard *kb,
|
||||||
wl_signal_init(&kb->events.key);
|
wl_signal_init(&kb->events.key);
|
||||||
wl_signal_init(&kb->events.modifiers);
|
wl_signal_init(&kb->events.modifiers);
|
||||||
wl_signal_init(&kb->events.keymap);
|
wl_signal_init(&kb->events.keymap);
|
||||||
|
wl_signal_init(&kb->events.repeat_info);
|
||||||
|
|
||||||
|
// Sane defaults
|
||||||
|
kb->repeat_info.rate = 25;
|
||||||
|
kb->repeat_info.delay = 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
|
void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
|
||||||
|
@ -167,6 +172,16 @@ void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
|
||||||
wl_signal_emit(&kb->events.keymap, kb);
|
wl_signal_emit(&kb->events.keymap, kb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wlr_keyboard_set_repeat_info(struct wlr_keyboard *kb, int32_t rate,
|
||||||
|
int32_t delay) {
|
||||||
|
if (kb->repeat_info.rate == rate && kb->repeat_info.delay == delay) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
kb->repeat_info.rate = rate;
|
||||||
|
kb->repeat_info.delay = delay;
|
||||||
|
wl_signal_emit(&kb->events.repeat_info, kb);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t wlr_keyboard_get_modifiers(struct wlr_keyboard *kb) {
|
uint32_t wlr_keyboard_get_modifiers(struct wlr_keyboard *kb) {
|
||||||
xkb_mod_mask_t mask = kb->modifiers.depressed | kb->modifiers.latched;
|
xkb_mod_mask_t mask = kb->modifiers.depressed | kb->modifiers.latched;
|
||||||
uint32_t modifiers = 0;
|
uint32_t modifiers = 0;
|
||||||
|
|
|
@ -52,6 +52,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
|
||||||
|
|
||||||
static void wlr_output_send_current_mode_to_resource(
|
static void wlr_output_send_current_mode_to_resource(
|
||||||
struct wl_resource *resource) {
|
struct wl_resource *resource) {
|
||||||
|
assert(resource);
|
||||||
struct wlr_output *output = wl_resource_get_user_data(resource);
|
struct wlr_output *output = wl_resource_get_user_data(resource);
|
||||||
assert(output);
|
assert(output);
|
||||||
const uint32_t version = wl_resource_get_version(resource);
|
const uint32_t version = wl_resource_get_version(resource);
|
||||||
|
@ -119,7 +120,6 @@ struct wl_global *wlr_output_create_global(struct wlr_output *wlr_output,
|
||||||
struct wl_global *wl_global = wl_global_create(display,
|
struct wl_global *wl_global = wl_global_create(display,
|
||||||
&wl_output_interface, 3, wlr_output, wl_output_bind);
|
&wl_output_interface, 3, wlr_output, wl_output_bind);
|
||||||
wlr_output->wl_global = wl_global;
|
wlr_output->wl_global = wl_global;
|
||||||
wl_list_init(&wlr_output->wl_resources);
|
|
||||||
return wl_global;
|
return wl_global;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +155,24 @@ bool wlr_output_set_mode(struct wlr_output *output,
|
||||||
bool result = output->impl->set_mode(output, mode);
|
bool result = output->impl->set_mode(output, mode);
|
||||||
if (result) {
|
if (result) {
|
||||||
wlr_output_update_matrix(output);
|
wlr_output_update_matrix(output);
|
||||||
|
|
||||||
|
struct wl_resource *resource;
|
||||||
|
wl_resource_for_each(resource, &output->wl_resources) {
|
||||||
|
wlr_output_send_current_mode_to_resource(resource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
|
||||||
|
int32_t height, int32_t refresh) {
|
||||||
|
if (!output->impl || !output->impl->set_custom_mode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool result = output->impl->set_custom_mode(output, width, height, refresh);
|
||||||
|
if (result) {
|
||||||
|
wlr_output_update_matrix(output);
|
||||||
|
|
||||||
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);
|
wlr_output_send_current_mode_to_resource(resource);
|
||||||
|
@ -168,21 +186,31 @@ void wlr_output_update_size(struct wlr_output *output, int32_t width,
|
||||||
if (output->width == width && output->height == height) {
|
if (output->width == width && output->height == height) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
output->width = width;
|
output->width = width;
|
||||||
output->height = height;
|
output->height = height;
|
||||||
wlr_output_update_matrix(output);
|
wlr_output_update_matrix(output);
|
||||||
if (output->wl_global != NULL) {
|
|
||||||
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);
|
wlr_output_send_current_mode_to_resource(resource);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
wl_signal_emit(&output->events.resolution, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_output_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);
|
wlr_output_update_matrix(output);
|
||||||
|
|
||||||
|
// TODO: only send geometry and done
|
||||||
|
struct wl_resource *resource;
|
||||||
|
wl_resource_for_each(resource, &output->wl_resources) {
|
||||||
|
wl_output_send_to_resource(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
wl_signal_emit(&output->events.transform, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_output_set_position(struct wlr_output *output, int32_t lx,
|
void wlr_output_set_position(struct wlr_output *output, int32_t lx,
|
||||||
|
@ -194,12 +222,29 @@ void wlr_output_set_position(struct wlr_output *output, int32_t lx,
|
||||||
output->lx = lx;
|
output->lx = lx;
|
||||||
output->ly = ly;
|
output->ly = ly;
|
||||||
|
|
||||||
|
// TODO: only send geometry and done
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
wl_resource_for_each(resource, &output->wl_resources) {
|
wl_resource_for_each(resource, &output->wl_resources) {
|
||||||
wl_output_send_to_resource(resource);
|
wl_output_send_to_resource(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wlr_output_set_scale(struct wlr_output *output, uint32_t scale) {
|
||||||
|
if (output->scale == scale) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
output->scale = scale;
|
||||||
|
|
||||||
|
// TODO: only send mode and done
|
||||||
|
struct wl_resource *resource;
|
||||||
|
wl_resource_for_each(resource, &output->wl_resources) {
|
||||||
|
wl_output_send_to_resource(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
wl_signal_emit(&output->events.scale, output);
|
||||||
|
}
|
||||||
|
|
||||||
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
||||||
const struct wlr_output_impl *impl) {
|
const struct wlr_output_impl *impl) {
|
||||||
assert(impl->make_current && impl->swap_buffers && impl->transform);
|
assert(impl->make_current && impl->swap_buffers && impl->transform);
|
||||||
|
@ -209,9 +254,12 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
|
||||||
output->transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
output->transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||||
output->scale = 1;
|
output->scale = 1;
|
||||||
wl_list_init(&output->cursors);
|
wl_list_init(&output->cursors);
|
||||||
|
wl_list_init(&output->wl_resources);
|
||||||
wl_signal_init(&output->events.frame);
|
wl_signal_init(&output->events.frame);
|
||||||
wl_signal_init(&output->events.swap_buffers);
|
wl_signal_init(&output->events.swap_buffers);
|
||||||
wl_signal_init(&output->events.resolution);
|
wl_signal_init(&output->events.resolution);
|
||||||
|
wl_signal_init(&output->events.scale);
|
||||||
|
wl_signal_init(&output->events.transform);
|
||||||
wl_signal_init(&output->events.destroy);
|
wl_signal_init(&output->events.destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,9 +272,9 @@ void wlr_output_destroy(struct wlr_output *output) {
|
||||||
|
|
||||||
struct wlr_output_mode *mode, *tmp_mode;
|
struct wlr_output_mode *mode, *tmp_mode;
|
||||||
wl_list_for_each_safe(mode, tmp_mode, &output->modes, link) {
|
wl_list_for_each_safe(mode, tmp_mode, &output->modes, link) {
|
||||||
|
wl_list_remove(&mode->link);
|
||||||
free(mode);
|
free(mode);
|
||||||
}
|
}
|
||||||
wl_list_remove(&output->modes);
|
|
||||||
if (output->impl && output->impl->destroy) {
|
if (output->impl && output->impl->destroy) {
|
||||||
output->impl->destroy(output);
|
output->impl->destroy(output);
|
||||||
} else {
|
} else {
|
||||||
|
@ -287,12 +335,20 @@ static void output_fullscreen_surface_render(struct wlr_output *output,
|
||||||
wlr_surface_send_frame_done(surface, when);
|
wlr_surface_send_frame_done(surface, when);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the cursor box, scaled for its output.
|
||||||
|
*/
|
||||||
static void output_cursor_get_box(struct wlr_output_cursor *cursor,
|
static void output_cursor_get_box(struct wlr_output_cursor *cursor,
|
||||||
struct wlr_box *box) {
|
struct wlr_box *box) {
|
||||||
box->x = cursor->x - cursor->hotspot_x;
|
box->x = cursor->x - cursor->hotspot_x;
|
||||||
box->y = cursor->y - cursor->hotspot_y;
|
box->y = cursor->y - cursor->hotspot_y;
|
||||||
box->width = cursor->width;
|
box->width = cursor->width;
|
||||||
box->height = cursor->height;
|
box->height = cursor->height;
|
||||||
|
|
||||||
|
if (cursor->surface != NULL) {
|
||||||
|
box->x += cursor->surface->current->sx * cursor->output->scale;
|
||||||
|
box->y += cursor->surface->current->sy * cursor->output->scale;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_cursor_render(struct wlr_output_cursor *cursor,
|
static void output_cursor_render(struct wlr_output_cursor *cursor,
|
||||||
|
@ -308,36 +364,23 @@ static void output_cursor_render(struct wlr_output_cursor *cursor,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box output_box;
|
|
||||||
output_box.x = output_box.y = 0;
|
|
||||||
wlr_output_effective_resolution(cursor->output, &output_box.width,
|
|
||||||
&output_box.height);
|
|
||||||
output_box.width *= cursor->output->scale;
|
|
||||||
output_box.height *= cursor->output->scale;
|
|
||||||
|
|
||||||
struct wlr_box cursor_box;
|
|
||||||
output_cursor_get_box(cursor, &cursor_box);
|
|
||||||
|
|
||||||
struct wlr_box intersection;
|
|
||||||
struct wlr_box *intersection_ptr = &intersection;
|
|
||||||
if (!wlr_box_intersection(&output_box, &cursor_box, &intersection_ptr)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
glViewport(0, 0, cursor->output->width, cursor->output->height);
|
glViewport(0, 0, cursor->output->width, cursor->output->height);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
int x = cursor->x - cursor->hotspot_x;
|
struct wlr_box cursor_box;
|
||||||
int y = cursor->y - cursor->hotspot_y;
|
output_cursor_get_box(cursor, &cursor_box);
|
||||||
if (cursor->surface != NULL) {
|
|
||||||
x += cursor->surface->current->sx;
|
float translate[16];
|
||||||
y += cursor->surface->current->sy;
|
wlr_matrix_translate(&translate, cursor_box.x, cursor_box.y, 0);
|
||||||
}
|
|
||||||
|
float scale[16];
|
||||||
|
wlr_matrix_scale(&scale, cursor_box.width, cursor_box.height, 1);
|
||||||
|
|
||||||
float matrix[16];
|
float matrix[16];
|
||||||
wlr_texture_get_matrix(texture, &matrix, &cursor->output->transform_matrix,
|
wlr_matrix_mul(&translate, &scale, &matrix);
|
||||||
x, y);
|
wlr_matrix_mul(&cursor->output->transform_matrix, &matrix, &matrix);
|
||||||
|
|
||||||
wlr_render_with_matrix(renderer, texture, &matrix);
|
wlr_render_with_matrix(renderer, texture, &matrix);
|
||||||
|
|
||||||
if (cursor->surface != NULL) {
|
if (cursor->surface != NULL) {
|
||||||
|
@ -358,7 +401,8 @@ void wlr_output_swap_buffers(struct wlr_output *output) {
|
||||||
|
|
||||||
struct wlr_output_cursor *cursor;
|
struct wlr_output_cursor *cursor;
|
||||||
wl_list_for_each(cursor, &output->cursors, link) {
|
wl_list_for_each(cursor, &output->cursors, link) {
|
||||||
if (!cursor->enabled || output->hardware_cursor == cursor) {
|
if (!cursor->enabled || !cursor->visible ||
|
||||||
|
output->hardware_cursor == cursor) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
output_cursor_render(cursor, &now);
|
output_cursor_render(cursor, &now);
|
||||||
|
@ -493,11 +537,39 @@ bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
|
||||||
stride, width, height, pixels);
|
stride, width, height, pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void output_cursor_update_visible(struct wlr_output_cursor *cursor) {
|
||||||
|
struct wlr_box output_box;
|
||||||
|
output_box.x = output_box.y = 0;
|
||||||
|
wlr_output_effective_resolution(cursor->output, &output_box.width,
|
||||||
|
&output_box.height);
|
||||||
|
output_box.width *= cursor->output->scale;
|
||||||
|
output_box.height *= cursor->output->scale;
|
||||||
|
|
||||||
|
struct wlr_box cursor_box;
|
||||||
|
output_cursor_get_box(cursor, &cursor_box);
|
||||||
|
|
||||||
|
struct wlr_box intersection;
|
||||||
|
struct wlr_box *intersection_ptr = &intersection;
|
||||||
|
bool visible =
|
||||||
|
wlr_box_intersection(&output_box, &cursor_box, &intersection_ptr);
|
||||||
|
|
||||||
|
if (cursor->surface != NULL) {
|
||||||
|
if (cursor->visible && !visible) {
|
||||||
|
wlr_surface_send_leave(cursor->surface, cursor->output);
|
||||||
|
}
|
||||||
|
if (!cursor->visible && visible) {
|
||||||
|
wlr_surface_send_enter(cursor->surface, cursor->output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor->visible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
static void output_cursor_commit(struct wlr_output_cursor *cursor) {
|
static void output_cursor_commit(struct wlr_output_cursor *cursor) {
|
||||||
// Some clients commit a cursor surface with a NULL buffer to hide it.
|
// Some clients commit a cursor surface with a NULL buffer to hide it.
|
||||||
cursor->enabled = wlr_surface_has_buffer(cursor->surface);
|
cursor->enabled = wlr_surface_has_buffer(cursor->surface);
|
||||||
cursor->width = cursor->surface->current->width;
|
cursor->width = cursor->surface->current->width * cursor->output->scale;
|
||||||
cursor->height = cursor->surface->current->height;
|
cursor->height = cursor->surface->current->height * cursor->output->scale;
|
||||||
|
|
||||||
if (cursor->output->hardware_cursor != cursor) {
|
if (cursor->output->hardware_cursor != cursor) {
|
||||||
cursor->output->needs_swap = true;
|
cursor->output->needs_swap = true;
|
||||||
|
@ -530,8 +602,8 @@ void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor->hotspot_x = hotspot_x;
|
cursor->hotspot_x = hotspot_x * cursor->output->scale;
|
||||||
cursor->hotspot_y = hotspot_y;
|
cursor->hotspot_y = hotspot_y * cursor->output->scale;
|
||||||
|
|
||||||
if (surface && surface == cursor->surface) {
|
if (surface && surface == cursor->surface) {
|
||||||
if (cursor->output->hardware_cursor == cursor &&
|
if (cursor->output->hardware_cursor == cursor &&
|
||||||
|
@ -561,6 +633,9 @@ void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
|
||||||
wl_signal_add(&surface->events.commit, &cursor->surface_commit);
|
wl_signal_add(&surface->events.commit, &cursor->surface_commit);
|
||||||
wl_signal_add(&surface->events.destroy, &cursor->surface_destroy);
|
wl_signal_add(&surface->events.destroy, &cursor->surface_destroy);
|
||||||
output_cursor_commit(cursor);
|
output_cursor_commit(cursor);
|
||||||
|
|
||||||
|
cursor->visible = false;
|
||||||
|
output_cursor_update_visible(cursor);
|
||||||
} else {
|
} else {
|
||||||
cursor->enabled = false;
|
cursor->enabled = false;
|
||||||
cursor->width = 0;
|
cursor->width = 0;
|
||||||
|
@ -576,6 +651,7 @@ bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
|
||||||
y *= cursor->output->scale;
|
y *= cursor->output->scale;
|
||||||
cursor->x = x;
|
cursor->x = x;
|
||||||
cursor->y = y;
|
cursor->y = y;
|
||||||
|
output_cursor_update_visible(cursor);
|
||||||
|
|
||||||
if (cursor->output->hardware_cursor != cursor) {
|
if (cursor->output->hardware_cursor != cursor) {
|
||||||
cursor->output->needs_swap = true;
|
cursor->output->needs_swap = true;
|
||||||
|
|
|
@ -19,6 +19,8 @@ struct wlr_output_layout_output_state {
|
||||||
bool auto_configured;
|
bool auto_configured;
|
||||||
|
|
||||||
struct wl_listener resolution;
|
struct wl_listener resolution;
|
||||||
|
struct wl_listener scale;
|
||||||
|
struct wl_listener transform;
|
||||||
struct wl_listener output_destroy;
|
struct wl_listener output_destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,6 +48,8 @@ static void wlr_output_layout_output_destroy(
|
||||||
struct wlr_output_layout_output *l_output) {
|
struct wlr_output_layout_output *l_output) {
|
||||||
wl_signal_emit(&l_output->events.destroy, l_output);
|
wl_signal_emit(&l_output->events.destroy, l_output);
|
||||||
wl_list_remove(&l_output->state->resolution.link);
|
wl_list_remove(&l_output->state->resolution.link);
|
||||||
|
wl_list_remove(&l_output->state->scale.link);
|
||||||
|
wl_list_remove(&l_output->state->transform.link);
|
||||||
wl_list_remove(&l_output->state->output_destroy.link);
|
wl_list_remove(&l_output->state->output_destroy.link);
|
||||||
wl_list_remove(&l_output->link);
|
wl_list_remove(&l_output->link);
|
||||||
free(l_output->state);
|
free(l_output->state);
|
||||||
|
@ -134,6 +138,18 @@ static void handle_output_resolution(struct wl_listener *listener, void *data) {
|
||||||
wlr_output_layout_reconfigure(state->layout);
|
wlr_output_layout_reconfigure(state->layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_output_scale(struct wl_listener *listener, void *data) {
|
||||||
|
struct wlr_output_layout_output_state *state =
|
||||||
|
wl_container_of(listener, state, scale);
|
||||||
|
wlr_output_layout_reconfigure(state->layout);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handle_output_transform(struct wl_listener *listener, void *data) {
|
||||||
|
struct wlr_output_layout_output_state *state =
|
||||||
|
wl_container_of(listener, state, transform);
|
||||||
|
wlr_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);
|
||||||
|
@ -162,6 +178,10 @@ static struct wlr_output_layout_output *wlr_output_layout_output_create(
|
||||||
|
|
||||||
wl_signal_add(&output->events.resolution, &l_output->state->resolution);
|
wl_signal_add(&output->events.resolution, &l_output->state->resolution);
|
||||||
l_output->state->resolution.notify = handle_output_resolution;
|
l_output->state->resolution.notify = handle_output_resolution;
|
||||||
|
wl_signal_add(&output->events.scale, &l_output->state->scale);
|
||||||
|
l_output->state->scale.notify = handle_output_scale;
|
||||||
|
wl_signal_add(&output->events.transform, &l_output->state->transform);
|
||||||
|
l_output->state->transform.notify = handle_output_transform;
|
||||||
wl_signal_add(&output->events.destroy, &l_output->state->output_destroy);
|
wl_signal_add(&output->events.destroy, &l_output->state->output_destroy);
|
||||||
l_output->state->output_destroy.notify = handle_output_destroy;
|
l_output->state->output_destroy.notify = handle_output_destroy;
|
||||||
|
|
||||||
|
|
|
@ -109,10 +109,18 @@ static void seat_client_send_keymap(struct wlr_seat_client *client,
|
||||||
wl_keyboard_send_keymap(client->keyboard,
|
wl_keyboard_send_keymap(client->keyboard,
|
||||||
WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keyboard->keymap_fd,
|
WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keyboard->keymap_fd,
|
||||||
keyboard->keymap_size);
|
keyboard->keymap_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void seat_client_send_repeat_info(struct wlr_seat_client *client,
|
||||||
|
struct wlr_keyboard *keyboard) {
|
||||||
|
if (!keyboard || !client->keyboard) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (wl_resource_get_version(client->keyboard) >=
|
if (wl_resource_get_version(client->keyboard) >=
|
||||||
WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) {
|
WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) {
|
||||||
wl_keyboard_send_repeat_info(client->keyboard, 25, 600);
|
wl_keyboard_send_repeat_info(client->keyboard,
|
||||||
|
keyboard->repeat_info.rate, keyboard->repeat_info.delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,8 +146,9 @@ static void wl_seat_get_keyboard(struct wl_client *client,
|
||||||
wl_resource_set_implementation(seat_client->keyboard, &wl_keyboard_impl,
|
wl_resource_set_implementation(seat_client->keyboard, &wl_keyboard_impl,
|
||||||
seat_client, &wl_keyboard_destroy);
|
seat_client, &wl_keyboard_destroy);
|
||||||
|
|
||||||
seat_client_send_keymap(seat_client,
|
struct wlr_keyboard *keyboard = seat_client->seat->keyboard_state.keyboard;
|
||||||
seat_client->seat->keyboard_state.keyboard);
|
seat_client_send_keymap(seat_client, keyboard);
|
||||||
|
seat_client_send_repeat_info(seat_client, keyboard);
|
||||||
|
|
||||||
// TODO possibly handle the case where this keyboard needs an enter
|
// TODO possibly handle the case where this keyboard needs an enter
|
||||||
// right away
|
// right away
|
||||||
|
@ -695,6 +704,16 @@ static void handle_keyboard_keymap(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_keyboard_repeat_info(struct wl_listener *listener,
|
||||||
|
void *data) {
|
||||||
|
struct wlr_seat_keyboard_state *state =
|
||||||
|
wl_container_of(listener, state, keyboard_repeat_info);
|
||||||
|
struct wlr_seat_client *client;
|
||||||
|
wl_list_for_each(client, &state->seat->clients, link) {
|
||||||
|
seat_client_send_repeat_info(client, state->keyboard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void handle_keyboard_destroy(struct wl_listener *listener, void *data) {
|
static void handle_keyboard_destroy(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_seat_keyboard_state *state =
|
struct wlr_seat_keyboard_state *state =
|
||||||
wl_container_of(listener, state, keyboard_destroy);
|
wl_container_of(listener, state, keyboard_destroy);
|
||||||
|
@ -713,22 +732,28 @@ void wlr_seat_set_keyboard(struct wlr_seat *seat,
|
||||||
if (seat->keyboard_state.keyboard) {
|
if (seat->keyboard_state.keyboard) {
|
||||||
wl_list_remove(&seat->keyboard_state.keyboard_destroy.link);
|
wl_list_remove(&seat->keyboard_state.keyboard_destroy.link);
|
||||||
wl_list_remove(&seat->keyboard_state.keyboard_keymap.link);
|
wl_list_remove(&seat->keyboard_state.keyboard_keymap.link);
|
||||||
|
wl_list_remove(&seat->keyboard_state.keyboard_repeat_info.link);
|
||||||
seat->keyboard_state.keyboard = NULL;
|
seat->keyboard_state.keyboard = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device) {
|
if (device) {
|
||||||
assert(device->type == WLR_INPUT_DEVICE_KEYBOARD);
|
assert(device->type == WLR_INPUT_DEVICE_KEYBOARD);
|
||||||
|
|
||||||
wl_signal_add(&device->events.destroy,
|
wl_signal_add(&device->events.destroy,
|
||||||
&seat->keyboard_state.keyboard_destroy);
|
&seat->keyboard_state.keyboard_destroy);
|
||||||
seat->keyboard_state.keyboard_destroy.notify = handle_keyboard_destroy;
|
seat->keyboard_state.keyboard_destroy.notify = handle_keyboard_destroy;
|
||||||
|
|
||||||
wl_signal_add(&device->keyboard->events.keymap,
|
wl_signal_add(&device->keyboard->events.keymap,
|
||||||
&seat->keyboard_state.keyboard_keymap);
|
&seat->keyboard_state.keyboard_keymap);
|
||||||
seat->keyboard_state.keyboard_keymap.notify = handle_keyboard_keymap;
|
seat->keyboard_state.keyboard_keymap.notify = handle_keyboard_keymap;
|
||||||
|
wl_signal_add(&device->keyboard->events.repeat_info,
|
||||||
|
&seat->keyboard_state.keyboard_repeat_info);
|
||||||
|
seat->keyboard_state.keyboard_repeat_info.notify =
|
||||||
|
handle_keyboard_repeat_info;
|
||||||
|
|
||||||
struct wlr_seat_client *client;
|
struct wlr_seat_client *client;
|
||||||
wl_list_for_each(client, &seat->clients, link) {
|
wl_list_for_each(client, &seat->clients, link) {
|
||||||
seat_client_send_keymap(client, device->keyboard);
|
seat_client_send_keymap(client, device->keyboard);
|
||||||
|
seat_client_send_repeat_info(client, device->keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
seat->keyboard_state.keyboard = device->keyboard;
|
seat->keyboard_state.keyboard = device->keyboard;
|
||||||
|
@ -835,7 +860,6 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
|
||||||
surface->resource, &keys);
|
surface->resource, &keys);
|
||||||
wl_array_release(&keys);
|
wl_array_release(&keys);
|
||||||
|
|
||||||
wlr_seat_keyboard_send_modifiers(seat);
|
|
||||||
wlr_seat_client_send_selection(client);
|
wlr_seat_client_send_selection(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,6 +881,12 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
|
||||||
|
|
||||||
seat->keyboard_state.focused_client = client;
|
seat->keyboard_state.focused_client = client;
|
||||||
seat->keyboard_state.focused_surface = surface;
|
seat->keyboard_state.focused_surface = surface;
|
||||||
|
|
||||||
|
if (client && client->keyboard && seat->keyboard_state.keyboard) {
|
||||||
|
// tell new client about any modifier change last,
|
||||||
|
// as it targets seat->keyboard_state.focused_client
|
||||||
|
wlr_seat_keyboard_send_modifiers(seat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_seat_keyboard_notify_enter(struct wlr_seat *seat, struct
|
void wlr_seat_keyboard_notify_enter(struct wlr_seat *seat, struct
|
||||||
|
|
|
@ -459,6 +459,8 @@ static void handle_wlr_surface_committed(struct wl_listener *listener,
|
||||||
surface->popup_state->seat);
|
surface->popup_state->seat);
|
||||||
shell_pointer_grab_maybe_end(&grab->pointer_grab);
|
shell_pointer_grab_maybe_end(&grab->pointer_grab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wl_signal_emit(&surface->events.commit, surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int shell_surface_ping_timeout(void *user_data) {
|
static int shell_surface_ping_timeout(void *user_data) {
|
||||||
|
@ -509,6 +511,7 @@ static void shell_protocol_get_shell_surface(struct wl_client *client,
|
||||||
wl_surface->resource);
|
wl_surface->resource);
|
||||||
|
|
||||||
wl_signal_init(&wl_surface->events.destroy);
|
wl_signal_init(&wl_surface->events.destroy);
|
||||||
|
wl_signal_init(&wl_surface->events.commit);
|
||||||
wl_signal_init(&wl_surface->events.ping_timeout);
|
wl_signal_init(&wl_surface->events.ping_timeout);
|
||||||
wl_signal_init(&wl_surface->events.request_move);
|
wl_signal_init(&wl_surface->events.request_move);
|
||||||
wl_signal_init(&wl_surface->events.request_resize);
|
wl_signal_init(&wl_surface->events.request_resize);
|
||||||
|
|
|
@ -326,3 +326,26 @@ 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 wlr_xcursor_frame_and_duration(_cursor, time, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *wlr_xcursor_get_resize_name(enum wlr_edges edges) {
|
||||||
|
if (edges & WLR_EDGE_TOP) {
|
||||||
|
if (edges & WLR_EDGE_RIGHT) {
|
||||||
|
return "ne-resize";
|
||||||
|
} else if (edges & WLR_EDGE_LEFT) {
|
||||||
|
return "nw-resize";
|
||||||
|
}
|
||||||
|
return "n-resize";
|
||||||
|
} else if (edges & WLR_EDGE_BOTTOM) {
|
||||||
|
if (edges & WLR_EDGE_RIGHT) {
|
||||||
|
return "se-resize";
|
||||||
|
} else if (edges & WLR_EDGE_LEFT) {
|
||||||
|
return "sw-resize";
|
||||||
|
}
|
||||||
|
return "s-resize";
|
||||||
|
} else if (edges & WLR_EDGE_RIGHT) {
|
||||||
|
return "e-resize";
|
||||||
|
} else if (edges & WLR_EDGE_LEFT) {
|
||||||
|
return "w-resize";
|
||||||
|
}
|
||||||
|
return "se-resize"; // fallback
|
||||||
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "wlr/util/log.h"
|
#include "wlr/util/log.h"
|
||||||
#include "wlr/xwayland.h"
|
#include "wlr/xwayland.h"
|
||||||
#include "sockets.h"
|
#include "sockets.h"
|
||||||
#include "xwm.h"
|
#include "wlr/xwm.h"
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
static inline int clearenv(void) {
|
static inline int clearenv(void) {
|
||||||
|
|
|
@ -8,10 +8,11 @@
|
||||||
#include <xcb/xcb_image.h>
|
#include <xcb/xcb_image.h>
|
||||||
#include <xcb/render.h>
|
#include <xcb/render.h>
|
||||||
#include "wlr/util/log.h"
|
#include "wlr/util/log.h"
|
||||||
|
#include "wlr/util/edges.h"
|
||||||
#include "wlr/types/wlr_surface.h"
|
#include "wlr/types/wlr_surface.h"
|
||||||
#include "wlr/xwayland.h"
|
#include "wlr/xwayland.h"
|
||||||
#include "wlr/xcursor.h"
|
#include "wlr/xcursor.h"
|
||||||
#include "xwm.h"
|
#include "wlr/xwm.h"
|
||||||
|
|
||||||
#ifdef HAS_XCB_ICCCM
|
#ifdef HAS_XCB_ICCCM
|
||||||
#include <xcb/xcb_icccm.h>
|
#include <xcb/xcb_icccm.h>
|
||||||
|
@ -590,7 +591,7 @@ static void xwm_handle_configure_request(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
if (xsurface->surface == NULL) {
|
if (xsurface->surface == NULL) {
|
||||||
// Surface has not been mapped yet
|
// Surface has not been mapped yet
|
||||||
wlr_xwayland_surface_configure(xwm->xwayland, xsurface, ev->x, ev->y,
|
wlr_xwayland_surface_configure(xsurface, ev->x, ev->y,
|
||||||
ev->width, ev->height);
|
ev->width, ev->height);
|
||||||
} else {
|
} else {
|
||||||
struct wlr_xwayland_surface_configure_event *wlr_event =
|
struct wlr_xwayland_surface_configure_event *wlr_event =
|
||||||
|
@ -742,14 +743,43 @@ static void xwm_handle_surface_id_message(struct wlr_xwm *xwm,
|
||||||
#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10 // move via keyboard
|
#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10 // move via keyboard
|
||||||
#define _NET_WM_MOVERESIZE_CANCEL 11 // cancel operation
|
#define _NET_WM_MOVERESIZE_CANCEL 11 // cancel operation
|
||||||
|
|
||||||
|
static enum wlr_edges net_wm_edges_to_wlr(uint32_t net_wm_edges) {
|
||||||
|
enum wlr_edges edges = WLR_EDGE_NONE;
|
||||||
|
|
||||||
|
switch(net_wm_edges) {
|
||||||
|
case _NET_WM_MOVERESIZE_SIZE_TOPLEFT:
|
||||||
|
edges = WLR_EDGE_TOP | WLR_EDGE_LEFT;
|
||||||
|
break;
|
||||||
|
case _NET_WM_MOVERESIZE_SIZE_TOP:
|
||||||
|
edges = WLR_EDGE_TOP;
|
||||||
|
break;
|
||||||
|
case _NET_WM_MOVERESIZE_SIZE_TOPRIGHT:
|
||||||
|
edges = WLR_EDGE_TOP | WLR_EDGE_RIGHT;
|
||||||
|
break;
|
||||||
|
case _NET_WM_MOVERESIZE_SIZE_RIGHT:
|
||||||
|
edges = WLR_EDGE_RIGHT;
|
||||||
|
break;
|
||||||
|
case _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT:
|
||||||
|
edges = WLR_EDGE_BOTTOM | WLR_EDGE_RIGHT;
|
||||||
|
break;
|
||||||
|
case _NET_WM_MOVERESIZE_SIZE_BOTTOM:
|
||||||
|
edges = WLR_EDGE_BOTTOM;
|
||||||
|
break;
|
||||||
|
case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT:
|
||||||
|
edges = WLR_EDGE_BOTTOM | WLR_EDGE_LEFT;
|
||||||
|
break;
|
||||||
|
case _NET_WM_MOVERESIZE_SIZE_LEFT:
|
||||||
|
edges = WLR_EDGE_LEFT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return edges;
|
||||||
|
}
|
||||||
|
|
||||||
static void xwm_handle_net_wm_moveresize_message(struct wlr_xwm *xwm,
|
static void xwm_handle_net_wm_moveresize_message(struct wlr_xwm *xwm,
|
||||||
xcb_client_message_event_t *ev) {
|
xcb_client_message_event_t *ev) {
|
||||||
// same as xdg-toplevel-v6
|
|
||||||
// TODO need a common enum for this
|
|
||||||
static const int map[] = {
|
|
||||||
5, 1, 9, 8, 10, 2, 6, 4
|
|
||||||
};
|
|
||||||
|
|
||||||
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
|
||||||
if (!xsurface) {
|
if (!xsurface) {
|
||||||
return;
|
return;
|
||||||
|
@ -775,7 +805,7 @@ static void xwm_handle_net_wm_moveresize_message(struct wlr_xwm *xwm,
|
||||||
case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT:
|
case _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT:
|
||||||
case _NET_WM_MOVERESIZE_SIZE_LEFT:
|
case _NET_WM_MOVERESIZE_SIZE_LEFT:
|
||||||
resize_event.surface = xsurface;
|
resize_event.surface = xsurface;
|
||||||
resize_event.edges = map[detail];
|
resize_event.edges = net_wm_edges_to_wlr(detail);
|
||||||
wl_signal_emit(&xsurface->events.request_resize, &resize_event);
|
wl_signal_emit(&xsurface->events.request_resize, &resize_event);
|
||||||
break;
|
break;
|
||||||
case _NET_WM_MOVERESIZE_CANCEL:
|
case _NET_WM_MOVERESIZE_CANCEL:
|
||||||
|
@ -908,6 +938,12 @@ static int x11_event_handler(int fd, uint32_t mask, void *data) {
|
||||||
|
|
||||||
while ((event = xcb_poll_for_event(xwm->xcb_conn))) {
|
while ((event = xcb_poll_for_event(xwm->xcb_conn))) {
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
|
if (xwm->xwayland->user_event_handler &&
|
||||||
|
xwm->xwayland->user_event_handler(xwm, event)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) {
|
switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) {
|
||||||
case XCB_CREATE_NOTIFY:
|
case XCB_CREATE_NOTIFY:
|
||||||
xwm_handle_create_notify(xwm, (xcb_create_notify_event_t *)event);
|
xwm_handle_create_notify(xwm, (xcb_create_notify_event_t *)event);
|
||||||
|
@ -981,25 +1017,24 @@ static void handle_compositor_surface_create(struct wl_listener *listener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_xwayland_surface_activate(struct wlr_xwayland *wlr_xwayland,
|
void wlr_xwayland_surface_activate(struct wlr_xwayland_surface *xsurface,
|
||||||
struct wlr_xwayland_surface *xsurface, bool activated) {
|
bool activated) {
|
||||||
struct wlr_xwayland_surface *focused = wlr_xwayland->xwm->focus_surface;
|
struct wlr_xwayland_surface *focused = xsurface->xwm->focus_surface;
|
||||||
if (activated) {
|
if (activated) {
|
||||||
xwm_surface_activate(wlr_xwayland->xwm, xsurface);
|
xwm_surface_activate(xsurface->xwm, xsurface);
|
||||||
} else if (focused == xsurface) {
|
} else if (focused == xsurface) {
|
||||||
xwm_surface_activate(wlr_xwayland->xwm, NULL);
|
xwm_surface_activate(xsurface->xwm, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_xwayland_surface_configure(struct wlr_xwayland *wlr_xwayland,
|
void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *xsurface,
|
||||||
struct wlr_xwayland_surface *xsurface, int16_t x, int16_t y,
|
int16_t x, int16_t y, uint16_t width, uint16_t height) {
|
||||||
uint16_t width, uint16_t height) {
|
|
||||||
xsurface->x = x;
|
xsurface->x = x;
|
||||||
xsurface->y = y;
|
xsurface->y = y;
|
||||||
xsurface->width = width;
|
xsurface->width = width;
|
||||||
xsurface->height = height;
|
xsurface->height = height;
|
||||||
|
|
||||||
struct wlr_xwm *xwm = wlr_xwayland->xwm;
|
struct wlr_xwm *xwm = xsurface->xwm;
|
||||||
uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
|
uint32_t mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
|
||||||
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT |
|
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT |
|
||||||
XCB_CONFIG_WINDOW_BORDER_WIDTH;
|
XCB_CONFIG_WINDOW_BORDER_WIDTH;
|
||||||
|
@ -1008,9 +1043,8 @@ void wlr_xwayland_surface_configure(struct wlr_xwayland *wlr_xwayland,
|
||||||
xcb_flush(xwm->xcb_conn);
|
xcb_flush(xwm->xcb_conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_xwayland_surface_close(struct wlr_xwayland *wlr_xwayland,
|
void wlr_xwayland_surface_close(struct wlr_xwayland_surface *xsurface) {
|
||||||
struct wlr_xwayland_surface *xsurface) {
|
struct wlr_xwm *xwm = xsurface->xwm;
|
||||||
struct wlr_xwm *xwm = wlr_xwayland->xwm;
|
|
||||||
|
|
||||||
bool supports_delete = false;
|
bool supports_delete = false;
|
||||||
for (size_t i = 0; i < xsurface->protocols_len; i++) {
|
for (size_t i = 0; i < xsurface->protocols_len; i++) {
|
||||||
|
@ -1343,16 +1377,16 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland) {
|
||||||
return xwm;
|
return xwm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_xwayland_surface_set_maximized(struct wlr_xwayland *wlr_xwayland,
|
void wlr_xwayland_surface_set_maximized(struct wlr_xwayland_surface *surface,
|
||||||
struct wlr_xwayland_surface *surface, bool maximized) {
|
bool maximized) {
|
||||||
surface->maximized_horz = maximized;
|
surface->maximized_horz = maximized;
|
||||||
surface->maximized_vert = maximized;
|
surface->maximized_vert = maximized;
|
||||||
xsurface_set_net_wm_state(surface);
|
xsurface_set_net_wm_state(surface);
|
||||||
xcb_flush(surface->xwm->xcb_conn);
|
xcb_flush(surface->xwm->xcb_conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland *wlr_xwayland,
|
void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface,
|
||||||
struct wlr_xwayland_surface *surface, bool fullscreen) {
|
bool fullscreen) {
|
||||||
surface->fullscreen = fullscreen;
|
surface->fullscreen = fullscreen;
|
||||||
xsurface_set_net_wm_state(surface);
|
xsurface_set_net_wm_state(surface);
|
||||||
xcb_flush(surface->xwm->xcb_conn);
|
xcb_flush(surface->xwm->xcb_conn);
|
||||||
|
|
Loading…
Reference in New Issue