window: Add wrappers for xdg_surface_set_transient_for
This commit is contained in:
committed by
Kristian Høgsberg
parent
0790e3978a
commit
53686048cc
@@ -245,6 +245,8 @@ 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_frame *frame;
|
struct window_frame *frame;
|
||||||
|
|
||||||
/* struct surface::link, contains also main_surface */
|
/* struct surface::link, contains also main_surface */
|
||||||
@@ -3912,6 +3914,22 @@ static const struct xdg_surface_listener xdg_surface_listener = {
|
|||||||
handle_surface_focused_unset,
|
handle_surface_focused_unset,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
window_sync_transient_for(struct window *window)
|
||||||
|
{
|
||||||
|
struct wl_surface *parent_surface;
|
||||||
|
|
||||||
|
if (!window->xdg_surface)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (window->transient_for)
|
||||||
|
parent_surface = window->transient_for->main_surface->surface;
|
||||||
|
else
|
||||||
|
parent_surface = NULL;
|
||||||
|
|
||||||
|
xdg_surface_set_transient_for(window->xdg_surface, parent_surface);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
window_flush(struct window *window)
|
window_flush(struct window *window)
|
||||||
{
|
{
|
||||||
@@ -3926,6 +3944,8 @@ window_flush(struct window *window)
|
|||||||
xdg_surface_set_user_data(window->xdg_surface, window);
|
xdg_surface_set_user_data(window->xdg_surface, window);
|
||||||
xdg_surface_add_listener(window->xdg_surface,
|
xdg_surface_add_listener(window->xdg_surface,
|
||||||
&xdg_surface_listener, window);
|
&xdg_surface_listener, window);
|
||||||
|
|
||||||
|
window_sync_transient_for(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4372,6 +4392,20 @@ window_create_custom(struct display *display)
|
|||||||
return window_create_internal(display, 1);
|
return window_create_internal(display, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
window_set_transient_for(struct window *window,
|
||||||
|
struct window *parent_window)
|
||||||
|
{
|
||||||
|
window->transient_for = parent_window;
|
||||||
|
window_sync_transient_for(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct window *
|
||||||
|
window_get_transient_for(struct window *window)
|
||||||
|
{
|
||||||
|
return window->transient_for;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
menu_set_item(struct menu *menu, int sy)
|
menu_set_item(struct menu *menu, int sy)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -272,6 +272,11 @@ window_create(struct display *display);
|
|||||||
struct window *
|
struct window *
|
||||||
window_create_custom(struct display *display);
|
window_create_custom(struct display *display);
|
||||||
|
|
||||||
|
void
|
||||||
|
window_set_transient_for(struct window *window, struct window *parent_window);
|
||||||
|
struct window *
|
||||||
|
window_get_transient_for(struct window *window);
|
||||||
|
|
||||||
int
|
int
|
||||||
window_has_focus(struct window *window);
|
window_has_focus(struct window *window);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user