core: Add support for custom window placement rules

Add support for assigning a window a custom window placement rule used
for calculating the initial window position as well as defining how a
window is constrained.

The custom rule is a declarative rule which defines a set of parameters
which the placing algorithm and constrain algorithm uses for
calculating the position of a window. It is meant to be used to
implement positioning of menus and other popup windows created via
Wayland.

A custom placement rule replaces any other placement or constraint
rule.

https://bugzilla.gnome.org/show_bug.cgi?id=769936
This commit is contained in:
Jonas Ådahl
2016-02-01 18:46:11 +08:00
parent 9fb891d216
commit 8833991201
7 changed files with 374 additions and 8 deletions

View File

@ -84,8 +84,6 @@ static void set_net_wm_state (MetaWindow *window);
static void meta_window_set_above (MetaWindow *window,
gboolean new_value);
static void meta_window_force_placement (MetaWindow *window);
static void meta_window_show (MetaWindow *window);
static void meta_window_hide (MetaWindow *window);
@ -296,6 +294,7 @@ meta_window_finalize (GObject *object)
g_free (window->gtk_window_object_path);
g_free (window->gtk_app_menu_object_path);
g_free (window->gtk_menubar_object_path);
g_free (window->placement_rule);
G_OBJECT_CLASS (meta_window_parent_class)->finalize (object);
}
@ -2168,7 +2167,7 @@ window_would_be_covered (const MetaWindow *newbie)
return FALSE; /* none found */
}
static void
void
meta_window_force_placement (MetaWindow *window)
{
if (window->placed)
@ -7883,3 +7882,9 @@ meta_window_emit_size_changed (MetaWindow *window)
{
g_signal_emit (window, window_signals[SIZE_CHANGED], 0);
}
MetaPlacementRule *
meta_window_get_placement_rule (MetaWindow *window)
{
return window->placement_rule;
}