emersion 6 years ago
parent 5f9be1e1aa
commit 7699c5444c

@ -1,7 +1,7 @@
#ifndef _SWAY_INPUT_SEAT_H #ifndef _SWAY_INPUT_SEAT_H
#define _SWAY_INPUT_SEAT_H #define _SWAY_INPUT_SEAT_H
#include <wlr/types/wlr_layer_shell.h> #include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/util/edges.h> #include <wlr/util/edges.h>
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
@ -53,7 +53,7 @@ struct sway_seat {
struct wl_list focus_stack; // list of containers in focus order struct wl_list focus_stack; // list of containers in focus order
// If the focused layer is set, views cannot receive keyboard focus // If the focused layer is set, views cannot receive keyboard focus
struct wlr_layer_surface *focused_layer; struct wlr_layer_surface_v1 *focused_layer;
// If exclusive_client is set, no other clients will receive input events // If exclusive_client is set, no other clients will receive input events
struct wl_client *exclusive_client; struct wl_client *exclusive_client;
@ -119,7 +119,7 @@ void seat_set_focus_surface(struct sway_seat *seat,
struct wlr_surface *surface, bool unfocus); struct wlr_surface *surface, bool unfocus);
void seat_set_focus_layer(struct sway_seat *seat, void seat_set_focus_layer(struct sway_seat *seat,
struct wlr_layer_surface *layer); struct wlr_layer_surface_v1 *layer);
void seat_set_exclusive_client(struct sway_seat *seat, void seat_set_exclusive_client(struct sway_seat *seat,
struct wl_client *client); struct wl_client *client);

@ -3,10 +3,10 @@
#include <stdbool.h> #include <stdbool.h>
#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_surface.h> #include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_layer_shell.h> #include <wlr/types/wlr_layer_shell_v1.h>
struct sway_layer_surface { struct sway_layer_surface {
struct wlr_layer_surface *layer_surface; struct wlr_layer_surface_v1 *layer_surface;
struct wl_list link; struct wl_list link;
struct wl_listener destroy; struct wl_listener destroy;
@ -22,7 +22,7 @@ struct sway_layer_surface {
struct sway_output; struct sway_output;
void arrange_layers(struct sway_output *output); void arrange_layers(struct sway_output *output);
struct sway_layer_surface *layer_from_wlr_layer_surface( struct sway_layer_surface *layer_from_wlr_layer_surface_v1(
struct wlr_layer_surface *layer_surface); struct wlr_layer_surface_v1 *layer_surface);
#endif #endif

@ -7,7 +7,7 @@
#include <wlr/render/wlr_renderer.h> #include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_data_device.h> #include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_layer_shell.h> #include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_server_decoration.h> #include <wlr/types/wlr_server_decoration.h>
#include <wlr/types/wlr_xdg_shell_v6.h> #include <wlr/types/wlr_xdg_shell_v6.h>
#include <wlr/types/wlr_xdg_shell.h> #include <wlr/types/wlr_xdg_shell.h>
@ -35,7 +35,7 @@ struct sway_server {
struct wlr_idle *idle; struct wlr_idle *idle;
struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1; struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1;
struct wlr_layer_shell *layer_shell; struct wlr_layer_shell_v1 *layer_shell;
struct wl_listener layer_shell_surface; struct wl_listener layer_shell_surface;
struct wlr_xdg_shell_v6 *xdg_shell_v6; struct wlr_xdg_shell_v6 *xdg_shell_v6;

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<protocol name="wlr_layer_shell_unstable_v1"> <protocol name="wlr_layer_shell_v1_unstable_v1">
<copyright> <copyright>
Copyright © 2017 Drew DeVault Copyright © 2017 Drew DeVault

@ -3,7 +3,7 @@
#include <string.h> #include <string.h>
#include <wayland-server.h> #include <wayland-server.h>
#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_layer_shell.h> #include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_output_damage.h> #include <wlr/types/wlr_output_damage.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
@ -86,8 +86,8 @@ static void arrange_layer(struct sway_output *output, struct wl_list *list,
wlr_output_effective_resolution(output->wlr_output, wlr_output_effective_resolution(output->wlr_output,
&full_area.width, &full_area.height); &full_area.width, &full_area.height);
wl_list_for_each(sway_layer, list, link) { wl_list_for_each(sway_layer, list, link) {
struct wlr_layer_surface *layer = sway_layer->layer_surface; struct wlr_layer_surface_v1 *layer = sway_layer->layer_surface;
struct wlr_layer_surface_state *state = &layer->current; struct wlr_layer_surface_v1_state *state = &layer->current;
if (exclusive != (state->exclusive_zone > 0)) { if (exclusive != (state->exclusive_zone > 0)) {
continue; continue;
} }
@ -146,7 +146,7 @@ static void arrange_layer(struct sway_output *output, struct wl_list *list,
} }
if (box.width < 0 || box.height < 0) { if (box.width < 0 || box.height < 0) {
// TODO: Bubble up a protocol error? // TODO: Bubble up a protocol error?
wlr_layer_surface_close(layer); wlr_layer_surface_v1_close(layer);
continue; continue;
} }
// Apply // Apply
@ -154,7 +154,7 @@ static void arrange_layer(struct sway_output *output, struct wl_list *list,
apply_exclusive(usable_area, state->anchor, state->exclusive_zone, apply_exclusive(usable_area, state->anchor, state->exclusive_zone,
state->margin.top, state->margin.right, state->margin.top, state->margin.right,
state->margin.bottom, state->margin.left); state->margin.bottom, state->margin.left);
wlr_layer_surface_configure(layer, box.width, box.height); wlr_layer_surface_v1_configure(layer, box.width, box.height);
} }
} }
@ -223,13 +223,13 @@ static void handle_output_destroy(struct wl_listener *listener, void *data) {
wl_list_remove(&sway_layer->link); wl_list_remove(&sway_layer->link);
wl_list_init(&sway_layer->link); wl_list_init(&sway_layer->link);
sway_layer->layer_surface->output = NULL; sway_layer->layer_surface->output = NULL;
wlr_layer_surface_close(sway_layer->layer_surface); wlr_layer_surface_v1_close(sway_layer->layer_surface);
} }
static void handle_surface_commit(struct wl_listener *listener, void *data) { static void handle_surface_commit(struct wl_listener *listener, void *data) {
struct sway_layer_surface *layer = struct sway_layer_surface *layer =
wl_container_of(listener, layer, surface_commit); wl_container_of(listener, layer, surface_commit);
struct wlr_layer_surface *layer_surface = layer->layer_surface; struct wlr_layer_surface_v1 *layer_surface = layer->layer_surface;
struct wlr_output *wlr_output = layer_surface->output; struct wlr_output *wlr_output = layer_surface->output;
if (wlr_output == NULL) { if (wlr_output == NULL) {
return; return;
@ -312,13 +312,13 @@ static void handle_unmap(struct wl_listener *listener, void *data) {
unmap(sway_layer); unmap(sway_layer);
} }
struct sway_layer_surface *layer_from_wlr_layer_surface( struct sway_layer_surface *layer_from_wlr_layer_surface_v1(
struct wlr_layer_surface *layer_surface) { struct wlr_layer_surface_v1 *layer_surface) {
return layer_surface->data; return layer_surface->data;
} }
void handle_layer_shell_surface(struct wl_listener *listener, void *data) { void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
struct wlr_layer_surface *layer_surface = data; struct wlr_layer_surface_v1 *layer_surface = data;
struct sway_server *server = struct sway_server *server =
wl_container_of(listener, server, layer_shell_surface); wl_container_of(listener, server, layer_shell_surface);
wlr_log(WLR_DEBUG, "new layer surface: namespace %s layer %d anchor %d " wlr_log(WLR_DEBUG, "new layer surface: namespace %s layer %d anchor %d "
@ -345,7 +345,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
if (!output) { if (!output) {
if (!sway_assert(root->outputs->length, if (!sway_assert(root->outputs->length,
"cannot auto-assign output for layer")) { "cannot auto-assign output for layer")) {
wlr_layer_surface_close(layer_surface); wlr_layer_surface_v1_close(layer_surface);
return; return;
} }
output = root->outputs->items[0]; output = root->outputs->items[0];
@ -382,7 +382,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
// Temporarily set the layer's current state to client_pending // Temporarily set the layer's current state to client_pending
// So that we can easily arrange it // So that we can easily arrange it
struct wlr_layer_surface_state old_state = layer_surface->current; struct wlr_layer_surface_v1_state old_state = layer_surface->current;
layer_surface->current = layer_surface->client_pending; layer_surface->current = layer_surface->client_pending;
arrange_layers(output); arrange_layers(output);
layer_surface->current = old_state; layer_surface->current = old_state;

@ -182,9 +182,9 @@ void output_layer_for_each_surface(struct sway_output *output,
void *user_data) { void *user_data) {
struct sway_layer_surface *layer_surface; struct sway_layer_surface *layer_surface;
wl_list_for_each(layer_surface, layer_surfaces, link) { wl_list_for_each(layer_surface, layer_surfaces, link) {
struct wlr_layer_surface *wlr_layer_surface = struct wlr_layer_surface_v1 *wlr_layer_surface_v1 =
layer_surface->layer_surface; layer_surface->layer_surface;
output_surface_for_each_surface(output, wlr_layer_surface->surface, output_surface_for_each_surface(output, wlr_layer_surface_v1->surface,
layer_surface->geo.x, layer_surface->geo.y, iterator, layer_surface->geo.x, layer_surface->geo.y, iterator,
user_data); user_data);
} }
@ -240,15 +240,15 @@ struct sway_workspace *output_get_active_workspace(struct sway_output *output) {
} }
bool output_has_opaque_overlay_layer_surface(struct sway_output *output) { bool output_has_opaque_overlay_layer_surface(struct sway_output *output) {
struct wlr_layer_surface *wlr_layer_surface; struct wlr_layer_surface_v1 *wlr_layer_surface_v1;
wl_list_for_each(wlr_layer_surface, &server.layer_shell->surfaces, link) { wl_list_for_each(wlr_layer_surface_v1, &server.layer_shell->surfaces, link) {
if (wlr_layer_surface->output != output->wlr_output || if (wlr_layer_surface_v1->output != output->wlr_output ||
wlr_layer_surface->layer != ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY) { wlr_layer_surface_v1->layer != ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY) {
continue; continue;
} }
struct wlr_surface *wlr_surface = wlr_layer_surface->surface; struct wlr_surface *wlr_surface = wlr_layer_surface_v1->surface;
struct sway_layer_surface *sway_layer_surface = struct sway_layer_surface *sway_layer_surface =
layer_from_wlr_layer_surface(wlr_layer_surface); layer_from_wlr_layer_surface_v1(wlr_layer_surface_v1);
pixman_box32_t output_box = { pixman_box32_t output_box = {
.x2 = output->width, .x2 = output->width,
.y2 = output->height, .y2 = output->height,

@ -807,8 +807,8 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
// Handle clicking a layer surface // Handle clicking a layer surface
if (surface && wlr_surface_is_layer_surface(surface)) { if (surface && wlr_surface_is_layer_surface(surface)) {
struct wlr_layer_surface *layer = struct wlr_layer_surface_v1 *layer =
wlr_layer_surface_from_wlr_surface(surface); wlr_layer_surface_v1_from_wlr_surface(surface);
if (layer->current.keyboard_interactive) { if (layer->current.keyboard_interactive) {
seat_set_focus_layer(seat, layer); seat_set_focus_layer(seat, layer);
} }

@ -769,7 +769,7 @@ void seat_set_focus_surface(struct sway_seat *seat,
} }
void seat_set_focus_layer(struct sway_seat *seat, void seat_set_focus_layer(struct sway_seat *seat,
struct wlr_layer_surface *layer) { struct wlr_layer_surface_v1 *layer) {
if (!layer && seat->focused_layer) { if (!layer && seat->focused_layer) {
seat->focused_layer = NULL; seat->focused_layer = NULL;
struct sway_node *previous = seat_get_focus_inactive(seat, &root->node); struct sway_node *previous = seat_get_focus_inactive(seat, &root->node);

@ -11,7 +11,7 @@
#include <wlr/types/wlr_gamma_control.h> #include <wlr/types/wlr_gamma_control.h>
#include <wlr/types/wlr_gamma_control_v1.h> #include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_idle.h> #include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_layer_shell.h> #include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_primary_selection.h> #include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_screencopy_v1.h> #include <wlr/types/wlr_screencopy_v1.h>
#include <wlr/types/wlr_server_decoration.h> #include <wlr/types/wlr_server_decoration.h>
@ -67,7 +67,7 @@ bool server_init(struct sway_server *server) {
server->idle_inhibit_manager_v1 = server->idle_inhibit_manager_v1 =
sway_idle_inhibit_manager_v1_create(server->wl_display, server->idle); sway_idle_inhibit_manager_v1_create(server->wl_display, server->idle);
server->layer_shell = wlr_layer_shell_create(server->wl_display); server->layer_shell = wlr_layer_shell_v1_create(server->wl_display);
wl_signal_add(&server->layer_shell->events.new_surface, wl_signal_add(&server->layer_shell->events.new_surface,
&server->layer_shell_surface); &server->layer_shell_surface);
server->layer_shell_surface.notify = handle_layer_shell_surface; server->layer_shell_surface.notify = handle_layer_shell_surface;

Loading…
Cancel
Save