mirror of
https://github.com/labwc/labwc.git
synced 2025-11-30 06:59:52 -05:00
view: deduplicate foreign-toplevel creation code
This commit is contained in:
parent
3c0e010c58
commit
4b0903cfa9
4 changed files with 12 additions and 49 deletions
|
|
@ -10,8 +10,6 @@
|
||||||
|
|
||||||
struct view;
|
struct view;
|
||||||
|
|
||||||
void view_impl_init_foreign_toplevel(struct view *view);
|
|
||||||
|
|
||||||
void view_impl_map(struct view *view);
|
void view_impl_map(struct view *view);
|
||||||
void view_impl_unmap(struct view *view);
|
void view_impl_unmap(struct view *view);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,24 +6,6 @@
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include "window-rules.h"
|
#include "window-rules.h"
|
||||||
|
|
||||||
void
|
|
||||||
view_impl_init_foreign_toplevel(struct view *view)
|
|
||||||
{
|
|
||||||
if (view->foreign_toplevel) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
view->foreign_toplevel = foreign_toplevel_create(view);
|
|
||||||
|
|
||||||
if (view->impl->get_parent) {
|
|
||||||
struct view *parent = view->impl->get_parent(view);
|
|
||||||
if (parent && parent->foreign_toplevel) {
|
|
||||||
foreign_toplevel_set_parent(view->foreign_toplevel,
|
|
||||||
parent->foreign_toplevel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
view_impl_map(struct view *view)
|
view_impl_map(struct view *view)
|
||||||
{
|
{
|
||||||
|
|
@ -34,15 +16,19 @@ view_impl_map(struct view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It's tempting to just never create the foreign-toplevel handle in the
|
* Create foreign-toplevel handle, respecting skipTaskbar rules.
|
||||||
* map handlers, but the app_id/title might not have been set at that
|
* Also exclude unfocusable views (popups, floating toolbars,
|
||||||
* point, so it's safer to process the property here
|
* etc.) as these should not be shown in taskbars/docks/etc.
|
||||||
*/
|
*/
|
||||||
enum property ret = window_rules_get_property(view, "skipTaskbar");
|
if (!view->foreign_toplevel && view_is_focusable(view)
|
||||||
if (ret == LAB_PROP_TRUE) {
|
&& window_rules_get_property(view, "skipTaskbar")
|
||||||
if (view->foreign_toplevel) {
|
!= LAB_PROP_TRUE) {
|
||||||
foreign_toplevel_destroy(view->foreign_toplevel);
|
view->foreign_toplevel = foreign_toplevel_create(view);
|
||||||
view->foreign_toplevel = NULL;
|
|
||||||
|
struct view *parent = view->impl->get_parent(view);
|
||||||
|
if (parent && parent->foreign_toplevel) {
|
||||||
|
foreign_toplevel_set_parent(view->foreign_toplevel,
|
||||||
|
parent->foreign_toplevel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -760,14 +760,6 @@ handle_map(struct wl_listener *listener, void *data)
|
||||||
|
|
||||||
view->mapped = true;
|
view->mapped = true;
|
||||||
|
|
||||||
if (!view->foreign_toplevel) {
|
|
||||||
view_impl_init_foreign_toplevel(view);
|
|
||||||
/*
|
|
||||||
* Initial outputs will be synced via
|
|
||||||
* view->events.new_outputs on view_moved()
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!view->been_mapped) {
|
if (!view->been_mapped) {
|
||||||
if (view_wants_decorations(view)) {
|
if (view_wants_decorations(view)) {
|
||||||
view_set_ssd_mode(view, LAB_SSD_MODE_FULL);
|
view_set_ssd_mode(view, LAB_SSD_MODE_FULL);
|
||||||
|
|
|
||||||
|
|
@ -832,19 +832,6 @@ handle_map(struct wl_listener *listener, void *data)
|
||||||
view->content_tree = tree;
|
view->content_tree = tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Exclude unfocusable views from wlr-foreign-toplevel. These
|
|
||||||
* views (notifications, floating toolbars, etc.) should not be
|
|
||||||
* shown in taskbars/docks/etc.
|
|
||||||
*/
|
|
||||||
if (!view->foreign_toplevel && view_is_focusable(view)) {
|
|
||||||
view_impl_init_foreign_toplevel(view);
|
|
||||||
/*
|
|
||||||
* Initial outputs will be synced via
|
|
||||||
* view->events.new_outputs on view_moved()
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!view->been_mapped) {
|
if (!view->been_mapped) {
|
||||||
check_natural_geometry(view);
|
check_natural_geometry(view);
|
||||||
set_initial_position(view, xwayland_surface);
|
set_initial_position(view, xwayland_surface);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue