mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-02-26 01:40:35 -05:00
wlr-foreign-toplevel: slight refactor
This commit is contained in:
parent
41e2331843
commit
648c64b7e4
1 changed files with 14 additions and 37 deletions
|
|
@ -395,60 +395,37 @@ static void toplevel_send_state(struct wlr_foreign_toplevel_handle_v1 *toplevel)
|
||||||
toplevel_update_idle_source(toplevel);
|
toplevel_update_idle_source(toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_foreign_toplevel_handle_v1_set_maximized(
|
static void set_state(struct wlr_foreign_toplevel_handle_v1 *toplevel,
|
||||||
struct wlr_foreign_toplevel_handle_v1 *toplevel, bool maximized) {
|
bool new_state_val, enum wlr_foreign_toplevel_handle_v1_state state) {
|
||||||
if (maximized == !!(toplevel->state &
|
if (new_state_val == !!(toplevel->state & state)) {
|
||||||
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (maximized) {
|
if (new_state_val) {
|
||||||
toplevel->state |= WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED;
|
toplevel->state |= state;
|
||||||
} else {
|
} else {
|
||||||
toplevel->state &= ~WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED;
|
toplevel->state &= ~state;
|
||||||
}
|
}
|
||||||
toplevel_send_state(toplevel);
|
toplevel_send_state(toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wlr_foreign_toplevel_handle_v1_set_maximized(
|
||||||
|
struct wlr_foreign_toplevel_handle_v1 *toplevel, bool maximized) {
|
||||||
|
set_state(toplevel, maximized, WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED);
|
||||||
|
}
|
||||||
|
|
||||||
void wlr_foreign_toplevel_handle_v1_set_minimized(
|
void wlr_foreign_toplevel_handle_v1_set_minimized(
|
||||||
struct wlr_foreign_toplevel_handle_v1 *toplevel, bool minimized) {
|
struct wlr_foreign_toplevel_handle_v1 *toplevel, bool minimized) {
|
||||||
if (minimized == !!(toplevel->state &
|
set_state(toplevel, minimized, WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED);
|
||||||
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (minimized) {
|
|
||||||
toplevel->state |= WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED;
|
|
||||||
} else {
|
|
||||||
toplevel->state &= ~WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED;
|
|
||||||
}
|
|
||||||
toplevel_send_state(toplevel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_foreign_toplevel_handle_v1_set_activated(
|
void wlr_foreign_toplevel_handle_v1_set_activated(
|
||||||
struct wlr_foreign_toplevel_handle_v1 *toplevel, bool activated) {
|
struct wlr_foreign_toplevel_handle_v1 *toplevel, bool activated) {
|
||||||
if (activated == !!(toplevel->state &
|
set_state(toplevel, activated, WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED);
|
||||||
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (activated) {
|
|
||||||
toplevel->state |= WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED;
|
|
||||||
} else {
|
|
||||||
toplevel->state &= ~WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED;
|
|
||||||
}
|
|
||||||
toplevel_send_state(toplevel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_foreign_toplevel_handle_v1_set_fullscreen(
|
void wlr_foreign_toplevel_handle_v1_set_fullscreen(
|
||||||
struct wlr_foreign_toplevel_handle_v1 * toplevel, bool fullscreen) {
|
struct wlr_foreign_toplevel_handle_v1 * toplevel, bool fullscreen) {
|
||||||
if (fullscreen == !!(toplevel->state &
|
set_state(toplevel, fullscreen, WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN);
|
||||||
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (fullscreen) {
|
|
||||||
toplevel->state |= WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN;
|
|
||||||
} else {
|
|
||||||
toplevel->state &= ~WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN;
|
|
||||||
}
|
|
||||||
toplevel_send_state(toplevel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void toplevel_resource_send_parent(
|
static void toplevel_resource_send_parent(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue