mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
view: add state change signals
This commit is contained in:
parent
043e597376
commit
5e1f91c9d1
4 changed files with 41 additions and 0 deletions
|
|
@ -286,6 +286,16 @@ struct view {
|
||||||
struct wl_listener request_maximize;
|
struct wl_listener request_maximize;
|
||||||
struct wl_listener request_fullscreen;
|
struct wl_listener request_fullscreen;
|
||||||
struct wl_listener set_title;
|
struct wl_listener set_title;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wl_signal new_app_id;
|
||||||
|
struct wl_signal new_title;
|
||||||
|
struct wl_signal new_outputs;
|
||||||
|
struct wl_signal maximized;
|
||||||
|
struct wl_signal minimized;
|
||||||
|
struct wl_signal fullscreened;
|
||||||
|
struct wl_signal activated; /* bool *activated */
|
||||||
|
} events;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct view_query {
|
struct view_query {
|
||||||
|
|
@ -580,6 +590,8 @@ void view_adjust_size(struct view *view, int *w, int *h);
|
||||||
void view_evacuate_region(struct view *view);
|
void view_evacuate_region(struct view *view);
|
||||||
void view_on_output_destroy(struct view *view);
|
void view_on_output_destroy(struct view *view);
|
||||||
void view_connect_map(struct view *view, struct wlr_surface *surface);
|
void view_connect_map(struct view *view, struct wlr_surface *surface);
|
||||||
|
|
||||||
|
void view_init(struct view *view);
|
||||||
void view_destroy(struct view *view);
|
void view_destroy(struct view *view);
|
||||||
|
|
||||||
enum view_axis view_axis_parse(const char *direction);
|
enum view_axis view_axis_parse(const char *direction);
|
||||||
|
|
|
||||||
27
src/view.c
27
src/view.c
|
|
@ -474,6 +474,8 @@ view_set_activated(struct view *view, bool activated)
|
||||||
view->toplevel.handle, activated);
|
view->toplevel.handle, activated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wl_signal_emit_mutable(&view->events.activated, &activated);
|
||||||
|
|
||||||
if (rc.kb_layout_per_window) {
|
if (rc.kb_layout_per_window) {
|
||||||
if (!activated) {
|
if (!activated) {
|
||||||
/* Store configured keyboard layout per view */
|
/* Store configured keyboard layout per view */
|
||||||
|
|
@ -530,6 +532,7 @@ view_update_outputs(struct view *view)
|
||||||
if (view->toplevel.handle) {
|
if (view->toplevel.handle) {
|
||||||
foreign_toplevel_update_outputs(view);
|
foreign_toplevel_update_outputs(view);
|
||||||
}
|
}
|
||||||
|
wl_signal_emit_mutable(&view->events.new_outputs, NULL);
|
||||||
desktop_update_top_layer_visiblity(view->server);
|
desktop_update_top_layer_visiblity(view->server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -742,7 +745,10 @@ _minimize(struct view *view, bool minimized)
|
||||||
if (view->impl->minimize) {
|
if (view->impl->minimize) {
|
||||||
view->impl->minimize(view, minimized);
|
view->impl->minimize(view, minimized);
|
||||||
}
|
}
|
||||||
|
|
||||||
view->minimized = minimized;
|
view->minimized = minimized;
|
||||||
|
wl_signal_emit_mutable(&view->events.minimized, NULL);
|
||||||
|
|
||||||
if (minimized) {
|
if (minimized) {
|
||||||
view->impl->unmap(view, /* client_request */ false);
|
view->impl->unmap(view, /* client_request */ false);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1310,7 +1316,9 @@ set_maximized(struct view *view, enum view_axis maximized)
|
||||||
wlr_foreign_toplevel_handle_v1_set_maximized(
|
wlr_foreign_toplevel_handle_v1_set_maximized(
|
||||||
view->toplevel.handle, (maximized == VIEW_AXIS_BOTH));
|
view->toplevel.handle, (maximized == VIEW_AXIS_BOTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
view->maximized = maximized;
|
view->maximized = maximized;
|
||||||
|
wl_signal_emit_mutable(&view->events.maximized, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensure that follow-up actions like SnapToEdge / SnapToRegion
|
* Ensure that follow-up actions like SnapToEdge / SnapToRegion
|
||||||
|
|
@ -1672,7 +1680,9 @@ set_fullscreen(struct view *view, bool fullscreen)
|
||||||
wlr_foreign_toplevel_handle_v1_set_fullscreen(
|
wlr_foreign_toplevel_handle_v1_set_fullscreen(
|
||||||
view->toplevel.handle, fullscreen);
|
view->toplevel.handle, fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
view->fullscreen = fullscreen;
|
view->fullscreen = fullscreen;
|
||||||
|
wl_signal_emit_mutable(&view->events.fullscreened, NULL);
|
||||||
|
|
||||||
/* Re-show decorations when no longer fullscreen */
|
/* Re-show decorations when no longer fullscreen */
|
||||||
if (!fullscreen && view->ssd_enabled) {
|
if (!fullscreen && view->ssd_enabled) {
|
||||||
|
|
@ -2332,6 +2342,7 @@ view_update_title(struct view *view)
|
||||||
}
|
}
|
||||||
ssd_update_title(view->ssd);
|
ssd_update_title(view->ssd);
|
||||||
wlr_foreign_toplevel_handle_v1_set_title(view->toplevel.handle, title);
|
wlr_foreign_toplevel_handle_v1_set_title(view->toplevel.handle, title);
|
||||||
|
wl_signal_emit_mutable(&view->events.new_title, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -2348,6 +2359,8 @@ view_update_app_id(struct view *view)
|
||||||
if (view->ssd_enabled) {
|
if (view->ssd_enabled) {
|
||||||
ssd_update_window_icon(view->ssd);
|
ssd_update_window_icon(view->ssd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wl_signal_emit_mutable(&view->events.new_app_id, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -2465,6 +2478,20 @@ view_set_shade(struct view *view, bool shaded)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
view_init(struct view *view)
|
||||||
|
{
|
||||||
|
assert(view);
|
||||||
|
|
||||||
|
wl_signal_init(&view->events.new_app_id);
|
||||||
|
wl_signal_init(&view->events.new_title);
|
||||||
|
wl_signal_init(&view->events.new_outputs);
|
||||||
|
wl_signal_init(&view->events.maximized);
|
||||||
|
wl_signal_init(&view->events.minimized);
|
||||||
|
wl_signal_init(&view->events.fullscreened);
|
||||||
|
wl_signal_init(&view->events.activated);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_destroy(struct view *view)
|
view_destroy(struct view *view)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -976,6 +976,7 @@ xdg_toplevel_new(struct wl_listener *listener, void *data)
|
||||||
CONNECT_SIGNAL(toplevel, xdg_toplevel_view, request_show_window_menu);
|
CONNECT_SIGNAL(toplevel, xdg_toplevel_view, request_show_window_menu);
|
||||||
CONNECT_SIGNAL(xdg_surface, xdg_toplevel_view, new_popup);
|
CONNECT_SIGNAL(xdg_surface, xdg_toplevel_view, new_popup);
|
||||||
|
|
||||||
|
view_init(view);
|
||||||
wl_list_insert(&server->views, &view->link);
|
wl_list_insert(&server->views, &view->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1007,6 +1007,7 @@ xwayland_view_create(struct server *server,
|
||||||
CONNECT_SIGNAL(xsurface, xwayland_view, set_window_type);
|
CONNECT_SIGNAL(xsurface, xwayland_view, set_window_type);
|
||||||
CONNECT_SIGNAL(xsurface, xwayland_view, map_request);
|
CONNECT_SIGNAL(xsurface, xwayland_view, map_request);
|
||||||
|
|
||||||
|
view_init(view);
|
||||||
wl_list_insert(&view->server->views, &view->link);
|
wl_list_insert(&view->server->views, &view->link);
|
||||||
|
|
||||||
if (xsurface->surface) {
|
if (xsurface->surface) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue