xdg-shell: Rename set_transient_for to set_parent
It's a confusing name that comes from the ICCCM. The ICCCM is best forgotten about. With the addition of the potential new "transient" role meaning a parent-relative toplevel like a long-lived popup, used for e.g. tooltips, the set_transient_for name will become even more confusing.
This commit is contained in:
parent
11f1433e0a
commit
c815d62b85
@ -64,7 +64,7 @@ new_window(struct stacking *stacking, struct window *parent_window)
|
|||||||
struct widget *new_widget;
|
struct widget *new_widget;
|
||||||
|
|
||||||
new_window = window_create(stacking->display);
|
new_window = window_create(stacking->display);
|
||||||
window_set_transient_for(new_window, parent_window);
|
window_set_parent(new_window, parent_window);
|
||||||
|
|
||||||
new_widget = window_frame_create(new_window, new_window);
|
new_widget = window_frame_create(new_window, new_window);
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ draw_string(cairo_t *cr,
|
|||||||
static void
|
static void
|
||||||
set_window_background_colour(cairo_t *cr, struct window *window)
|
set_window_background_colour(cairo_t *cr, struct window *window)
|
||||||
{
|
{
|
||||||
if (window_get_transient_for(window))
|
if (window_get_parent(window))
|
||||||
cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 0.4);
|
cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 0.4);
|
||||||
else if (window_is_maximized(window))
|
else if (window_is_maximized(window))
|
||||||
cairo_set_source_rgba(cr, 1.0, 1.0, 0.0, 0.6);
|
cairo_set_source_rgba(cr, 1.0, 1.0, 0.0, 0.6);
|
||||||
@ -276,7 +276,7 @@ redraw_handler(struct widget *widget, void *data)
|
|||||||
" (n)ew window, (p)opup,\n"
|
" (n)ew window, (p)opup,\n"
|
||||||
" (q)uit, (t)ransient window\n",
|
" (q)uit, (t)ransient window\n",
|
||||||
window, window_is_fullscreen(window),
|
window, window_is_fullscreen(window),
|
||||||
window_is_maximized(window), window_get_transient_for(window) ? 1 : 0);
|
window_is_maximized(window), window_get_parent(window) ? 1 : 0);
|
||||||
|
|
||||||
cairo_destroy(cr);
|
cairo_destroy(cr);
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ struct window {
|
|||||||
struct xdg_surface *xdg_surface;
|
struct xdg_surface *xdg_surface;
|
||||||
struct xdg_popup *xdg_popup;
|
struct xdg_popup *xdg_popup;
|
||||||
|
|
||||||
struct window *transient_for;
|
struct window *parent;
|
||||||
|
|
||||||
struct window_frame *frame;
|
struct window_frame *frame;
|
||||||
|
|
||||||
@ -3912,19 +3912,19 @@ static const struct xdg_surface_listener xdg_surface_listener = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
window_sync_transient_for(struct window *window)
|
window_sync_parent(struct window *window)
|
||||||
{
|
{
|
||||||
struct wl_surface *parent_surface;
|
struct wl_surface *parent_surface;
|
||||||
|
|
||||||
if (!window->xdg_surface)
|
if (!window->xdg_surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (window->transient_for)
|
if (window->parent)
|
||||||
parent_surface = window->transient_for->main_surface->surface;
|
parent_surface = window->parent->main_surface->surface;
|
||||||
else
|
else
|
||||||
parent_surface = NULL;
|
parent_surface = NULL;
|
||||||
|
|
||||||
xdg_surface_set_transient_for(window->xdg_surface, parent_surface);
|
xdg_surface_set_parent(window->xdg_surface, parent_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3955,7 +3955,7 @@ window_flush(struct window *window)
|
|||||||
|
|
||||||
if (!window->custom) {
|
if (!window->custom) {
|
||||||
if (window->xdg_surface) {
|
if (window->xdg_surface) {
|
||||||
window_sync_transient_for(window);
|
window_sync_parent(window);
|
||||||
window_sync_margin(window);
|
window_sync_margin(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4428,17 +4428,17 @@ window_create_custom(struct display *display)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
window_set_transient_for(struct window *window,
|
window_set_parent(struct window *window,
|
||||||
struct window *parent_window)
|
struct window *parent_window)
|
||||||
{
|
{
|
||||||
window->transient_for = parent_window;
|
window->parent = parent_window;
|
||||||
window_sync_transient_for(window);
|
window_sync_parent(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct window *
|
struct window *
|
||||||
window_get_transient_for(struct window *window)
|
window_get_parent(struct window *window)
|
||||||
{
|
{
|
||||||
return window->transient_for;
|
return window->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -275,9 +275,9 @@ struct window *
|
|||||||
window_create_custom(struct display *display);
|
window_create_custom(struct display *display);
|
||||||
|
|
||||||
void
|
void
|
||||||
window_set_transient_for(struct window *window, struct window *parent_window);
|
window_set_parent(struct window *window, struct window *parent_window);
|
||||||
struct window *
|
struct window *
|
||||||
window_get_transient_for(struct window *window);
|
window_get_parent(struct window *window);
|
||||||
|
|
||||||
int
|
int
|
||||||
window_has_focus(struct window *window);
|
window_has_focus(struct window *window);
|
||||||
|
@ -3354,9 +3354,9 @@ xdg_surface_destroy(struct wl_client *client,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xdg_surface_set_transient_for(struct wl_client *client,
|
xdg_surface_set_parent(struct wl_client *client,
|
||||||
struct wl_resource *resource,
|
struct wl_resource *resource,
|
||||||
struct wl_resource *parent_resource)
|
struct wl_resource *parent_resource)
|
||||||
{
|
{
|
||||||
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
||||||
struct weston_surface *parent;
|
struct weston_surface *parent;
|
||||||
@ -3515,7 +3515,7 @@ xdg_surface_set_minimized(struct wl_client *client,
|
|||||||
|
|
||||||
static const struct xdg_surface_interface xdg_surface_implementation = {
|
static const struct xdg_surface_interface xdg_surface_implementation = {
|
||||||
xdg_surface_destroy,
|
xdg_surface_destroy,
|
||||||
xdg_surface_set_transient_for,
|
xdg_surface_set_parent,
|
||||||
xdg_surface_set_margin,
|
xdg_surface_set_margin,
|
||||||
xdg_surface_set_title,
|
xdg_surface_set_title,
|
||||||
xdg_surface_set_app_id,
|
xdg_surface_set_app_id,
|
||||||
|
@ -137,11 +137,8 @@
|
|||||||
</description>
|
</description>
|
||||||
</request>
|
</request>
|
||||||
|
|
||||||
<request name="set_transient_for">
|
<request name="set_parent">
|
||||||
<description summary="surface is a child of another surface">
|
<description summary="surface is a child of another surface">
|
||||||
Setting a surface as transient of another means that it is child
|
|
||||||
of another surface.
|
|
||||||
|
|
||||||
Child surfaces are stacked above their parents, and will be
|
Child surfaces are stacked above their parents, and will be
|
||||||
unmapped if the parent is unmapped too. They should not appear
|
unmapped if the parent is unmapped too. They should not appear
|
||||||
on task bars and alt+tab.
|
on task bars and alt+tab.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user