mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-04 20:55:58 +01:00
Send server-decoration ack event automatically
This commit is contained in:
parent
e84d573b91
commit
a43acae000
5 changed files with 21 additions and 23 deletions
|
@ -37,11 +37,13 @@ struct roots_desktop {
|
|||
struct wlr_xdg_shell_v6 *xdg_shell_v6;
|
||||
struct wlr_gamma_control_manager *gamma_control_manager;
|
||||
struct wlr_screenshooter *screenshooter;
|
||||
struct wlr_server_decoration_manager *server_decoration_manager;
|
||||
|
||||
struct wl_listener output_add;
|
||||
struct wl_listener output_remove;
|
||||
struct wl_listener xdg_shell_v6_surface;
|
||||
struct wl_listener wl_shell_surface;
|
||||
struct wl_listener decoration_new;
|
||||
|
||||
#ifdef HAS_XWAYLAND
|
||||
struct wlr_xwayland *xwayland;
|
||||
|
|
|
@ -22,13 +22,11 @@ struct wlr_server_decoration {
|
|||
struct wlr_surface *surface;
|
||||
struct wl_list link;
|
||||
|
||||
// enum org_kde_kwin_server_decoration_manager_mode
|
||||
uint32_t requested_mode;
|
||||
uint32_t sent_mode;
|
||||
uint32_t mode; // enum org_kde_kwin_server_decoration_manager_mode
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
struct wl_signal request_mode;
|
||||
struct wl_signal mode;
|
||||
} events;
|
||||
|
||||
struct wl_listener surface_destroy_listener;
|
||||
|
@ -43,7 +41,4 @@ void wlr_server_decoration_manager_set_default_mode(
|
|||
void wlr_server_decoration_manager_destroy(
|
||||
struct wlr_server_decoration_manager *manager);
|
||||
|
||||
void wlr_server_decoration_send_mode(struct wlr_server_decoration *decoration,
|
||||
uint32_t mode);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,11 +7,13 @@
|
|||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/types/wlr_cursor.h>
|
||||
#include <wlr/types/wlr_gamma_control.h>
|
||||
#include <wlr/types/wlr_server_decoration.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_wl_shell.h>
|
||||
#include <wlr/types/wlr_xdg_shell_v6.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "rootston/desktop.h"
|
||||
#include <server-decoration-protocol.h>
|
||||
#include "rootston/server.h"
|
||||
#include "rootston/server.h"
|
||||
|
||||
void view_destroy(struct roots_view *view) {
|
||||
|
@ -252,6 +254,11 @@ struct roots_desktop *desktop_create(struct roots_server *server,
|
|||
server->wl_display);
|
||||
desktop->screenshooter = wlr_screenshooter_create(server->wl_display,
|
||||
server->renderer);
|
||||
desktop->server_decoration_manager =
|
||||
wlr_server_decoration_manager_create(server->wl_display);
|
||||
wlr_server_decoration_manager_set_default_mode(
|
||||
desktop->server_decoration_manager,
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_CLIENT);
|
||||
|
||||
return desktop;
|
||||
}
|
||||
|
|
|
@ -17,5 +17,5 @@ if get_option('enable_xwayland')
|
|||
sources += ['xwayland.c']
|
||||
endif
|
||||
executable(
|
||||
'rootston', sources, dependencies: wlroots
|
||||
'rootston', sources, dependencies: [wlroots, wlr_protos]
|
||||
)
|
||||
|
|
|
@ -14,17 +14,13 @@ static void server_decoration_handle_request_mode(struct wl_client *client,
|
|||
struct wl_resource *resource, uint32_t mode) {
|
||||
struct wlr_server_decoration *decoration =
|
||||
wl_resource_get_user_data(resource);
|
||||
decoration->requested_mode = mode;
|
||||
wl_signal_emit(&decoration->events.request_mode, decoration);
|
||||
}
|
||||
|
||||
void wlr_server_decoration_send_mode(struct wlr_server_decoration *decoration,
|
||||
uint32_t mode) {
|
||||
if (decoration->sent_mode == mode) {
|
||||
if (decoration->mode == mode) {
|
||||
return;
|
||||
}
|
||||
org_kde_kwin_server_decoration_send_mode(decoration->resource, mode);
|
||||
decoration->sent_mode = mode;
|
||||
decoration->mode = mode;
|
||||
wl_signal_emit(&decoration->events.mode, decoration);
|
||||
org_kde_kwin_server_decoration_send_mode(decoration->resource,
|
||||
decoration->mode);
|
||||
}
|
||||
|
||||
static void server_decoration_destroy(
|
||||
|
@ -71,8 +67,7 @@ static void server_decoration_manager_handle_create(struct wl_client *client,
|
|||
return;
|
||||
}
|
||||
decoration->surface = surface;
|
||||
decoration->requested_mode =
|
||||
ORG_KDE_KWIN_SERVER_DECORATION_MANAGER_MODE_NONE;
|
||||
decoration->mode = manager->default_mode;
|
||||
|
||||
int version = wl_resource_get_version(manager_resource);
|
||||
decoration->resource = wl_resource_create(client,
|
||||
|
@ -90,7 +85,7 @@ static void server_decoration_manager_handle_create(struct wl_client *client,
|
|||
decoration->resource);
|
||||
|
||||
wl_signal_init(&decoration->events.destroy);
|
||||
wl_signal_init(&decoration->events.request_mode);
|
||||
wl_signal_init(&decoration->events.mode);
|
||||
|
||||
wl_signal_add(&surface->events.destroy,
|
||||
&decoration->surface_destroy_listener);
|
||||
|
@ -100,8 +95,7 @@ static void server_decoration_manager_handle_create(struct wl_client *client,
|
|||
wl_list_insert(&manager->decorations, &decoration->link);
|
||||
|
||||
org_kde_kwin_server_decoration_send_mode(decoration->resource,
|
||||
manager->default_mode);
|
||||
decoration->sent_mode = manager->default_mode;
|
||||
decoration->mode);
|
||||
|
||||
wl_signal_emit(&manager->events.new_decoration, decoration);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue