mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-17 06:59:43 -05:00
Merge branch 'master' into feature/multiseat
This commit is contained in:
commit
2a9dc60f28
27 changed files with 375 additions and 93 deletions
|
|
@ -261,8 +261,8 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
|
|||
mapping = wlr_output_layout_get_box(cur->state->layout, NULL);
|
||||
}
|
||||
|
||||
double x = mapping->width * x_mm + mapping->x;
|
||||
double y = mapping->height * y_mm + mapping->y;
|
||||
double x = x_mm > 0 ? mapping->width * x_mm + mapping->x : cur->x;
|
||||
double y = y_mm > 0 ? mapping->height * y_mm + mapping->y : cur->y;
|
||||
|
||||
wlr_cursor_warp_unchecked(cur, x, y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -815,3 +815,11 @@ struct wlr_data_device_manager *wlr_data_device_manager_create(
|
|||
|
||||
return manager;
|
||||
}
|
||||
|
||||
void wlr_data_device_manager_destroy(struct wlr_data_device_manager *manager) {
|
||||
if (!manager) {
|
||||
return;
|
||||
}
|
||||
wl_global_destroy(manager->global);
|
||||
free(manager);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,6 @@ void wlr_output_destroy(struct wlr_output *output) {
|
|||
|
||||
void wlr_output_effective_resolution(struct wlr_output *output,
|
||||
int *width, int *height) {
|
||||
// TODO: Scale factor
|
||||
if (output->transform % 2 == 1) {
|
||||
*width = output->height;
|
||||
*height = output->width;
|
||||
|
|
@ -239,6 +238,8 @@ void wlr_output_effective_resolution(struct wlr_output *output,
|
|||
*width = output->width;
|
||||
*height = output->height;
|
||||
}
|
||||
*width /= output->scale;
|
||||
*height /= output->scale;
|
||||
}
|
||||
|
||||
void wlr_output_make_current(struct wlr_output *output) {
|
||||
|
|
@ -269,6 +270,8 @@ static void output_cursor_render(struct wlr_output_cursor *cursor) {
|
|||
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);
|
||||
|
|
@ -471,7 +474,10 @@ void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
|
|||
}
|
||||
}
|
||||
|
||||
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y) {
|
||||
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
|
||||
double x, double y) {
|
||||
x *= cursor->output->scale;
|
||||
y *= cursor->output->scale;
|
||||
cursor->x = x;
|
||||
cursor->y = y;
|
||||
|
||||
|
|
@ -483,7 +489,7 @@ bool wlr_output_cursor_move(struct wlr_output_cursor *cursor, int x, int y) {
|
|||
if (!cursor->output->impl->move_cursor) {
|
||||
return false;
|
||||
}
|
||||
return cursor->output->impl->move_cursor(cursor->output, x, y);
|
||||
return cursor->output->impl->move_cursor(cursor->output, (int)x, (int)y);
|
||||
}
|
||||
|
||||
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output) {
|
||||
|
|
|
|||
|
|
@ -649,8 +649,8 @@ void wlr_surface_get_matrix(struct wlr_surface *surface,
|
|||
float (*matrix)[16],
|
||||
const float (*projection)[16],
|
||||
const float (*transform)[16]) {
|
||||
int width = surface->texture->width / surface->current->scale;
|
||||
int height = surface->texture->height / surface->current->scale;
|
||||
int width = surface->texture->width;
|
||||
int height = surface->texture->height;
|
||||
float scale[16];
|
||||
wlr_matrix_identity(matrix);
|
||||
if (transform) {
|
||||
|
|
@ -905,3 +905,27 @@ struct wlr_subsurface *wlr_surface_subsurface_at(struct wlr_surface *surface,
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wlr_surface_send_enter(struct wlr_surface *surface,
|
||||
struct wlr_output *output) {
|
||||
struct wl_client *client = wl_resource_get_client(surface->resource);
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &output->wl_resources) {
|
||||
if (client == wl_resource_get_client(resource)) {
|
||||
wl_surface_send_enter(surface->resource, resource);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wlr_surface_send_leave(struct wlr_surface *surface,
|
||||
struct wlr_output *output) {
|
||||
struct wl_client *client = wl_resource_get_client(surface->resource);
|
||||
struct wl_resource *resource;
|
||||
wl_resource_for_each(resource, &output->wl_resources) {
|
||||
if (client == wl_resource_get_client(resource)) {
|
||||
wl_surface_send_leave(surface->resource, resource);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,6 @@ static void shell_surface_destroy_popup_state(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void shell_surface_protocol_resize(struct wl_client *client,
|
||||
struct wl_resource *resource, struct wl_resource *seat_resource,
|
||||
uint32_t serial, enum wl_shell_surface_resize edges) {
|
||||
|
|
@ -287,9 +286,8 @@ static void shell_surface_protocol_set_fullscreen(struct wl_client *client,
|
|||
output = wl_resource_get_user_data(output_resource);
|
||||
}
|
||||
|
||||
if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL) {
|
||||
return;
|
||||
}
|
||||
shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN,
|
||||
NULL, NULL);
|
||||
|
||||
struct wlr_wl_shell_surface_set_fullscreen_event *event =
|
||||
calloc(1, sizeof(struct wlr_wl_shell_surface_set_fullscreen_event));
|
||||
|
|
@ -377,9 +375,8 @@ static void shell_surface_protocol_set_maximized(struct wl_client *client,
|
|||
output = wl_resource_get_user_data(output_resource);
|
||||
}
|
||||
|
||||
if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL) {
|
||||
return;
|
||||
}
|
||||
shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED,
|
||||
NULL, NULL);
|
||||
|
||||
struct wlr_wl_shell_surface_set_maximized_event *event =
|
||||
calloc(1, sizeof(struct wlr_wl_shell_surface_set_maximized_event));
|
||||
|
|
|
|||
|
|
@ -664,24 +664,28 @@ static void xdg_toplevel_protocol_set_maximized(struct wl_client *client,
|
|||
struct wl_resource *resource) {
|
||||
struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource);
|
||||
surface->toplevel_state->next.maximized = true;
|
||||
wl_signal_emit(&surface->events.request_maximize, surface);
|
||||
}
|
||||
|
||||
static void xdg_toplevel_protocol_unset_maximized(struct wl_client *client,
|
||||
struct wl_resource *resource) {
|
||||
struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource);
|
||||
surface->toplevel_state->next.maximized = false;
|
||||
wl_signal_emit(&surface->events.request_maximize, surface);
|
||||
}
|
||||
|
||||
static void xdg_toplevel_protocol_set_fullscreen(struct wl_client *client,
|
||||
struct wl_resource *resource, struct wl_resource *output_resource) {
|
||||
struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource);
|
||||
surface->toplevel_state->next.fullscreen = true;
|
||||
wl_signal_emit(&surface->events.request_fullscreen, surface);
|
||||
}
|
||||
|
||||
static void xdg_toplevel_protocol_unset_fullscreen(struct wl_client *client,
|
||||
struct wl_resource *resource) {
|
||||
struct wlr_xdg_surface_v6 *surface = wl_resource_get_user_data(resource);
|
||||
surface->toplevel_state->next.fullscreen = false;
|
||||
wl_signal_emit(&surface->events.request_fullscreen, surface);
|
||||
}
|
||||
|
||||
static void xdg_toplevel_protocol_set_minimized(struct wl_client *client,
|
||||
|
|
@ -1143,6 +1147,8 @@ static void xdg_shell_get_xdg_surface(struct wl_client *wl_client,
|
|||
wl_list_init(&surface->configure_list);
|
||||
wl_list_init(&surface->popups);
|
||||
|
||||
wl_signal_init(&surface->events.request_maximize);
|
||||
wl_signal_init(&surface->events.request_fullscreen);
|
||||
wl_signal_init(&surface->events.request_minimize);
|
||||
wl_signal_init(&surface->events.request_move);
|
||||
wl_signal_init(&surface->events.request_resize);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue