xwayland: support minimizing

Allow minimizing xwayland windows.

Co-authored-by: Steve Pronovost <spronovo@microsoft.com>
Co-authored-by: Brenton DeGeer <brdegeer@microsoft.com>
Signed-off-by: Hideyuki Nagase <hideyukn@microsoft.com>
Signed-off-by: Steve Pronovost <spronovo@microsoft.com>
Signed-off-by: Brenton DeGeer <brdegeer@microsoft.com>
dev
Hideyuki Nagase 3 years ago committed by Derek Foreman
parent cc69dc447e
commit d902088bfc
  1. 8
      libweston-desktop/xwayland.c
  2. 1
      shared/xcb-xwayland.c
  3. 1
      shared/xcb-xwayland.h
  4. 33
      xwayland/window-manager.c
  5. 1
      xwayland/xwayland-internal-interface.h

@ -400,6 +400,13 @@ set_maximized(struct weston_desktop_xwayland_surface *surface)
surface->surface, true);
}
static void
set_minimized(struct weston_desktop_xwayland_surface *surface)
{
weston_desktop_api_minimized_requested(surface->desktop,
surface->surface);
}
static void
set_pid(struct weston_desktop_xwayland_surface *surface, pid_t pid)
{
@ -419,6 +426,7 @@ static const struct weston_desktop_xwayland_interface weston_desktop_xwayland_in
.set_title = set_title,
.set_window_geometry = set_window_geometry,
.set_maximized = set_maximized,
.set_minimized = set_minimized,
.set_pid = set_pid,
};

@ -77,6 +77,7 @@ x11_get_atoms(xcb_connection_t *connection, struct atom_x11 *atom)
{ "WM_STATE", F(wm_state) },
{ "WM_S0", F(wm_s0) },
{ "WM_CLIENT_MACHINE", F(wm_client_machine) },
{ "WM_CHANGE_STATE", F(wm_change_state) },
{ "_NET_WM_CM_S0", F(net_wm_cm_s0) },
{ "_NET_WM_NAME", F(net_wm_name) },
{ "_NET_WM_PID", F(net_wm_pid) },

@ -39,6 +39,7 @@ struct atom_x11 {
xcb_atom_t wm_state;
xcb_atom_t wm_s0;
xcb_atom_t wm_client_machine;
xcb_atom_t wm_change_state;
xcb_atom_t net_wm_cm_s0;
xcb_atom_t net_wm_name;
xcb_atom_t net_wm_pid;

@ -1057,6 +1057,9 @@ weston_wm_window_create_frame(struct weston_wm_window *window)
if (window->decorate & MWM_DECOR_MAXIMIZE)
buttons |= FRAME_BUTTON_MAXIMIZE;
if (window->decorate & MWM_DECOR_MINIMIZE)
buttons |= FRAME_BUTTON_MINIMIZE;
window->frame = frame_create(window->wm->theme,
window->width, window->height,
buttons, window->name, NULL);
@ -1803,6 +1806,27 @@ weston_wm_window_handle_state(struct weston_wm_window *window,
}
}
static void
weston_wm_window_handle_iconic_state(struct weston_wm_window *window,
xcb_client_message_event_t *client_message)
{
struct weston_wm *wm = window->wm;
const struct weston_desktop_xwayland_interface *xwayland_interface =
wm->server->compositor->xwayland_interface;
uint32_t iconic_state;
if (!window->shsurf)
return;
iconic_state = client_message->data.data32[0];
if (iconic_state == ICCCM_ICONIC_STATE) {
window->saved_height = window->height;
window->saved_width = window->width;
xwayland_interface->set_minimized(window->shsurf);
}
}
static void
surface_destroy(struct wl_listener *listener, void *data)
{
@ -1880,6 +1904,8 @@ weston_wm_handle_client_message(struct weston_wm *wm,
weston_wm_window_handle_state(window, client_message);
else if (client_message->type == wm->atom.wl_surface_id)
weston_wm_window_handle_surface_id(window, client_message);
else if (client_message->type == wm->atom.wm_change_state)
weston_wm_window_handle_iconic_state(window, client_message);
}
enum cursor_type {
@ -2163,6 +2189,13 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event)
}
frame_status_clear(window->frame, FRAME_STATUS_MAXIMIZE);
}
if (frame_status(window->frame) & FRAME_STATUS_MINIMIZE) {
window->saved_width = window->width;
window->saved_height = window->height;
xwayland_interface->set_minimized(window->shsurf);
frame_status_clear(window->frame, FRAME_STATUS_MINIMIZE);
}
}
static void

@ -59,6 +59,7 @@ struct weston_desktop_xwayland_interface {
int32_t x, int32_t y,
int32_t width, int32_t height);
void (*set_maximized)(struct weston_desktop_xwayland_surface *shsurf);
void (*set_minimized)(struct weston_desktop_xwayland_surface *shsurf);
void (*set_pid)(struct weston_desktop_xwayland_surface *shsurf, pid_t pid);
};

Loading…
Cancel
Save