mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-15 08:22:07 -04:00
foreign-toplevel-management: Implement responsiveness event
This commit is contained in:
parent
16e85c6b44
commit
44e640d1e2
2 changed files with 42 additions and 1 deletions
|
|
@ -36,6 +36,11 @@ enum wlr_foreign_toplevel_handle_v1_state {
|
||||||
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN = (1 << 3),
|
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN = (1 << 3),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum wlr_foreign_toplevel_handle_v1_responsiveness {
|
||||||
|
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_RESPONSIVENESS_RESPONSIVE = (0 << 0),
|
||||||
|
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_RESPONSIVENESS_UNRESPONSIVE = (1 << 0),
|
||||||
|
};
|
||||||
|
|
||||||
struct wlr_foreign_toplevel_handle_v1_output {
|
struct wlr_foreign_toplevel_handle_v1_output {
|
||||||
struct wl_list link; // wlr_foreign_toplevel_handle_v1.outputs
|
struct wl_list link; // wlr_foreign_toplevel_handle_v1.outputs
|
||||||
struct wlr_output *output;
|
struct wlr_output *output;
|
||||||
|
|
@ -57,6 +62,7 @@ struct wlr_foreign_toplevel_handle_v1 {
|
||||||
char *app_id;
|
char *app_id;
|
||||||
struct wlr_foreign_toplevel_handle_v1 *parent;
|
struct wlr_foreign_toplevel_handle_v1 *parent;
|
||||||
struct wl_list outputs; // wlr_foreign_toplevel_v1_output.link
|
struct wl_list outputs; // wlr_foreign_toplevel_v1_output.link
|
||||||
|
uint32_t responsiveness; // enum wlr_foreign_toplevel_v1_responsiveness
|
||||||
uint32_t state; // enum wlr_foreign_toplevel_v1_state
|
uint32_t state; // enum wlr_foreign_toplevel_v1_state
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -151,5 +157,7 @@ void wlr_foreign_toplevel_handle_v1_set_parent(
|
||||||
struct wlr_foreign_toplevel_handle_v1 *toplevel,
|
struct wlr_foreign_toplevel_handle_v1 *toplevel,
|
||||||
struct wlr_foreign_toplevel_handle_v1 *parent);
|
struct wlr_foreign_toplevel_handle_v1 *parent);
|
||||||
|
|
||||||
|
void wlr_foreign_toplevel_handle_v1_set_responsive(
|
||||||
|
struct wlr_foreign_toplevel_handle_v1 *toplevel, bool responsive);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "wlr-foreign-toplevel-management-unstable-v1-protocol.h"
|
#include "wlr-foreign-toplevel-management-unstable-v1-protocol.h"
|
||||||
|
|
||||||
#define FOREIGN_TOPLEVEL_MANAGEMENT_V1_VERSION 3
|
#define FOREIGN_TOPLEVEL_MANAGEMENT_V1_VERSION 4
|
||||||
|
|
||||||
static const struct zwlr_foreign_toplevel_handle_v1_interface toplevel_handle_impl;
|
static const struct zwlr_foreign_toplevel_handle_v1_interface toplevel_handle_impl;
|
||||||
|
|
||||||
|
|
@ -486,6 +486,32 @@ void wlr_foreign_toplevel_handle_v1_set_parent(
|
||||||
toplevel_update_idle_source(toplevel);
|
toplevel_update_idle_source(toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wlr_foreign_toplevel_handle_v1_set_responsive(
|
||||||
|
struct wlr_foreign_toplevel_handle_v1 *toplevel, bool responsive) {
|
||||||
|
enum wlr_foreign_toplevel_handle_v1_responsiveness responsiveness;
|
||||||
|
if (responsive) {
|
||||||
|
responsiveness = WLR_FOREIGN_TOPLEVEL_HANDLE_V1_RESPONSIVENESS_RESPONSIVE;
|
||||||
|
} else {
|
||||||
|
responsiveness = WLR_FOREIGN_TOPLEVEL_HANDLE_V1_RESPONSIVENESS_UNRESPONSIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toplevel->responsiveness == responsiveness) {
|
||||||
|
// Only inform clients if the state changed
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct wl_resource *resource;
|
||||||
|
wl_resource_for_each(resource, &toplevel->resources) {
|
||||||
|
if (wl_resource_get_version(resource) <
|
||||||
|
ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_RESPONSIVENESS_SINCE_VERSION) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
zwlr_foreign_toplevel_handle_v1_send_responsiveness(resource, responsiveness);
|
||||||
|
}
|
||||||
|
toplevel->responsiveness = responsiveness;
|
||||||
|
toplevel_update_idle_source(toplevel);
|
||||||
|
}
|
||||||
|
|
||||||
void wlr_foreign_toplevel_handle_v1_destroy(
|
void wlr_foreign_toplevel_handle_v1_destroy(
|
||||||
struct wlr_foreign_toplevel_handle_v1 *toplevel) {
|
struct wlr_foreign_toplevel_handle_v1 *toplevel) {
|
||||||
if (!toplevel) {
|
if (!toplevel) {
|
||||||
|
|
@ -569,6 +595,8 @@ wlr_foreign_toplevel_handle_v1_create(
|
||||||
wl_list_init(&toplevel->resources);
|
wl_list_init(&toplevel->resources);
|
||||||
wl_list_init(&toplevel->outputs);
|
wl_list_init(&toplevel->outputs);
|
||||||
|
|
||||||
|
toplevel->responsiveness = WLR_FOREIGN_TOPLEVEL_HANDLE_V1_RESPONSIVENESS_RESPONSIVE;
|
||||||
|
|
||||||
wl_signal_init(&toplevel->events.request_maximize);
|
wl_signal_init(&toplevel->events.request_maximize);
|
||||||
wl_signal_init(&toplevel->events.request_minimize);
|
wl_signal_init(&toplevel->events.request_minimize);
|
||||||
wl_signal_init(&toplevel->events.request_activate);
|
wl_signal_init(&toplevel->events.request_activate);
|
||||||
|
|
@ -637,6 +665,11 @@ static void toplevel_send_details_to_toplevel_resource(
|
||||||
|
|
||||||
toplevel_resource_send_parent(resource, toplevel->parent);
|
toplevel_resource_send_parent(resource, toplevel->parent);
|
||||||
|
|
||||||
|
if (wl_resource_get_version(resource) >=
|
||||||
|
ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_RESPONSIVENESS_SINCE_VERSION) {
|
||||||
|
zwlr_foreign_toplevel_handle_v1_send_responsiveness(resource, toplevel->responsiveness);
|
||||||
|
}
|
||||||
|
|
||||||
zwlr_foreign_toplevel_handle_v1_send_done(resource);
|
zwlr_foreign_toplevel_handle_v1_send_done(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue