mirror of
https://github.com/swaywm/sway.git
synced 2026-02-04 04:06:18 -05:00
Merge 25519da970 into 845cdb190f
This commit is contained in:
commit
25b0bc83f1
7 changed files with 1 additions and 108 deletions
|
|
@ -1,17 +0,0 @@
|
|||
#ifndef _SWAY_DECORATION_H
|
||||
#define _SWAY_DECORATION_H
|
||||
|
||||
#include <wlr/types/wlr_server_decoration.h>
|
||||
|
||||
struct sway_server_decoration {
|
||||
struct wlr_server_decoration *wlr_server_decoration;
|
||||
struct wl_list link;
|
||||
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener mode;
|
||||
};
|
||||
|
||||
struct sway_server_decoration *decoration_from_surface(
|
||||
struct wlr_surface *surface);
|
||||
|
||||
#endif
|
||||
|
|
@ -67,10 +67,6 @@ struct sway_server {
|
|||
|
||||
struct wlr_relative_pointer_manager_v1 *relative_pointer_manager;
|
||||
|
||||
struct wlr_server_decoration_manager *server_decoration_manager;
|
||||
struct wl_listener server_decoration;
|
||||
struct wl_list decorations; // sway_server_decoration::link
|
||||
|
||||
struct wlr_xdg_decoration_manager_v1 *xdg_decoration_manager;
|
||||
struct wl_listener xdg_decoration;
|
||||
struct wl_list xdg_decorations; // sway_xdg_decoration::link
|
||||
|
|
@ -182,7 +178,6 @@ void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data);
|
|||
#if WLR_HAS_XWAYLAND
|
||||
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
||||
#endif
|
||||
void handle_server_decoration(struct wl_listener *listener, void *data);
|
||||
void handle_xdg_decoration(struct wl_listener *listener, void *data);
|
||||
void handle_pointer_constraint(struct wl_listener *listener, void *data);
|
||||
void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
#include "sway/decoration.h"
|
||||
#include "sway/desktop/transaction.h"
|
||||
#include "sway/server.h"
|
||||
#include "sway/tree/arrange.h"
|
||||
#include "sway/tree/view.h"
|
||||
#include "log.h"
|
||||
|
||||
static void server_decoration_handle_destroy(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct sway_server_decoration *deco =
|
||||
wl_container_of(listener, deco, destroy);
|
||||
wl_list_remove(&deco->destroy.link);
|
||||
wl_list_remove(&deco->mode.link);
|
||||
wl_list_remove(&deco->link);
|
||||
free(deco);
|
||||
}
|
||||
|
||||
static void server_decoration_handle_mode(struct wl_listener *listener,
|
||||
void *data) {
|
||||
struct sway_server_decoration *deco =
|
||||
wl_container_of(listener, deco, mode);
|
||||
struct sway_view *view =
|
||||
view_from_wlr_surface(deco->wlr_server_decoration->surface);
|
||||
if (view == NULL || view->surface != deco->wlr_server_decoration->surface) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool csd = deco->wlr_server_decoration->mode ==
|
||||
WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT;
|
||||
view_update_csd_from_client(view, csd);
|
||||
|
||||
arrange_container(view->container);
|
||||
transaction_commit_dirty();
|
||||
}
|
||||
|
||||
void handle_server_decoration(struct wl_listener *listener, void *data) {
|
||||
struct wlr_server_decoration *wlr_deco = data;
|
||||
|
||||
struct sway_server_decoration *deco = calloc(1, sizeof(*deco));
|
||||
if (deco == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
deco->wlr_server_decoration = wlr_deco;
|
||||
|
||||
wl_signal_add(&wlr_deco->events.destroy, &deco->destroy);
|
||||
deco->destroy.notify = server_decoration_handle_destroy;
|
||||
|
||||
wl_signal_add(&wlr_deco->events.mode, &deco->mode);
|
||||
deco->mode.notify = server_decoration_handle_mode;
|
||||
|
||||
wl_list_insert(&server.decorations, &deco->link);
|
||||
}
|
||||
|
||||
struct sway_server_decoration *decoration_from_surface(
|
||||
struct wlr_surface *surface) {
|
||||
struct sway_server_decoration *deco;
|
||||
wl_list_for_each(deco, &server.decorations, link) {
|
||||
if (deco->wlr_server_decoration->surface == surface) {
|
||||
return deco;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@
|
|||
#include <wlr/types/wlr_xdg_toplevel_tag_v1.h>
|
||||
#include <wlr/util/edges.h>
|
||||
#include "log.h"
|
||||
#include "sway/decoration.h"
|
||||
#include "sway/scene_descriptor.h"
|
||||
#include "sway/desktop/transaction.h"
|
||||
#include "sway/input/cursor.h"
|
||||
|
|
@ -481,17 +480,12 @@ static void handle_map(struct wl_listener *listener, void *data) {
|
|||
view->natural_width = toplevel->base->geometry.width;
|
||||
view->natural_height = toplevel->base->geometry.height;
|
||||
|
||||
bool csd = false;
|
||||
bool csd = true;
|
||||
|
||||
if (view->xdg_decoration) {
|
||||
enum wlr_xdg_toplevel_decoration_v1_mode mode =
|
||||
view->xdg_decoration->wlr_xdg_decoration->requested_mode;
|
||||
csd = mode == WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE;
|
||||
} else {
|
||||
struct sway_server_decoration *deco =
|
||||
decoration_from_surface(toplevel->base->surface);
|
||||
csd = !deco || deco->wlr_server_decoration->mode ==
|
||||
WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT;
|
||||
}
|
||||
|
||||
view_map(view, toplevel->base->surface,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ sway_sources = files(
|
|||
'commands.c',
|
||||
'config.c',
|
||||
'criteria.c',
|
||||
'decoration.c',
|
||||
'ipc-json.c',
|
||||
'ipc-server.c',
|
||||
'lock.c',
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
#include <wlr/types/wlr_relative_pointer_v1.h>
|
||||
#include <wlr/types/wlr_screencopy_v1.h>
|
||||
#include <wlr/types/wlr_security_context_v1.h>
|
||||
#include <wlr/types/wlr_server_decoration.h>
|
||||
#include <wlr/types/wlr_session_lock_v1.h>
|
||||
#include <wlr/types/wlr_single_pixel_buffer_v1.h>
|
||||
#include <wlr/types/wlr_subcompositor.h>
|
||||
|
|
@ -324,16 +323,6 @@ bool server_init(struct sway_server *server) {
|
|||
|
||||
server->tablet_v2 = wlr_tablet_v2_create(server->wl_display);
|
||||
|
||||
server->server_decoration_manager =
|
||||
wlr_server_decoration_manager_create(server->wl_display);
|
||||
wlr_server_decoration_manager_set_default_mode(
|
||||
server->server_decoration_manager,
|
||||
WLR_SERVER_DECORATION_MANAGER_MODE_SERVER);
|
||||
wl_signal_add(&server->server_decoration_manager->events.new_decoration,
|
||||
&server->server_decoration);
|
||||
server->server_decoration.notify = handle_server_decoration;
|
||||
wl_list_init(&server->decorations);
|
||||
|
||||
server->xdg_decoration_manager =
|
||||
wlr_xdg_decoration_manager_v1_create(server->wl_display);
|
||||
wl_signal_add(
|
||||
|
|
@ -526,7 +515,6 @@ void server_fini(struct sway_server *server) {
|
|||
wl_list_remove(&server->new_output.link);
|
||||
wl_list_remove(&server->layer_shell_surface.link);
|
||||
wl_list_remove(&server->xdg_shell_toplevel.link);
|
||||
wl_list_remove(&server->server_decoration.link);
|
||||
wl_list_remove(&server->xdg_decoration.link);
|
||||
wl_list_remove(&server->pointer_constraint.link);
|
||||
wl_list_remove(&server->output_manager_apply.link);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include <wlr/types/wlr_fractional_scale_v1.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_security_context_v1.h>
|
||||
#include <wlr/types/wlr_server_decoration.h>
|
||||
#include <wlr/types/wlr_subcompositor.h>
|
||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||
#include <wlr/types/wlr_session_lock_v1.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue