mirror of
https://github.com/labwc/labwc.git
synced 2026-03-23 05:34:52 -04:00
The basic idea is to set the initial geometry from the surface exactly once, just before we need it, i.e. either (1) when mapping the view or (2) right before processing an initial maximize/fullscreen request. I've consolidated various parts of the initial geometry setup to take place at this point (in ensure_initial_geometry_and_output()). The main motivation is to have a valid, adjusted floating geometry for the view *before* saving the natural geometry when processing an initial maximize/fullscreen request. This reduces code duplication and addresses a FIXME in set_initial_position(), as well as fixing an issue where the natural geometry could exceed the usable output area. Some other minor changes: - The initial output is now set directly from the surface geometry if the "application/user-set position" hint is given. This is unlikely to matter in practice, but theoretically an initially maximized view could now appear on a different (application-chosen) output. - Floating view size is now constrained to the usable area even if a position hint is set. It seemed inconsistent that `xterm -g 200x200` was constrained but `xterm -g 200x200+0+0` was not.
88 lines
2.3 KiB
C
88 lines
2.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef LABWC_XWAYLAND_H
|
|
#define LABWC_XWAYLAND_H
|
|
#include "config.h"
|
|
|
|
#if HAVE_XWAYLAND
|
|
#include "view.h"
|
|
|
|
struct wlr_compositor;
|
|
struct wlr_output;
|
|
struct wlr_output_layout;
|
|
|
|
struct xwayland_unmanaged {
|
|
struct wlr_xwayland_surface *xwayland_surface;
|
|
struct wlr_scene_node *node;
|
|
struct wl_list link;
|
|
|
|
struct mappable mappable;
|
|
|
|
struct wl_listener associate;
|
|
struct wl_listener dissociate;
|
|
struct wl_listener grab_focus;
|
|
struct wl_listener request_activate;
|
|
struct wl_listener request_configure;
|
|
/* struct wl_listener request_fullscreen; */
|
|
struct wl_listener set_geometry;
|
|
struct wl_listener destroy;
|
|
struct wl_listener set_override_redirect;
|
|
|
|
/*
|
|
* True if the surface has performed a keyboard grab. labwc
|
|
* honors keyboard grabs and will give the surface focus when
|
|
* it's mapped (which may occur slightly later) and on top.
|
|
*/
|
|
bool ever_grabbed_focus;
|
|
};
|
|
|
|
struct xwayland_view {
|
|
struct view base;
|
|
struct wlr_xwayland_surface *xwayland_surface;
|
|
bool focused_before_map;
|
|
bool initial_geometry_set;
|
|
|
|
/* Events unique to XWayland views */
|
|
struct wl_listener associate;
|
|
struct wl_listener dissociate;
|
|
struct wl_listener request_above;
|
|
struct wl_listener request_activate;
|
|
struct wl_listener request_close;
|
|
struct wl_listener request_configure;
|
|
struct wl_listener set_class;
|
|
struct wl_listener set_decorations;
|
|
struct wl_listener set_override_redirect;
|
|
struct wl_listener set_strut_partial;
|
|
struct wl_listener set_window_type;
|
|
struct wl_listener focus_in;
|
|
struct wl_listener map_request;
|
|
|
|
/* Not (yet) implemented */
|
|
/* struct wl_listener set_role; */
|
|
/* struct wl_listener set_hints; */
|
|
|
|
/* Events coming in from the view itself */
|
|
struct {
|
|
struct wl_listener always_on_top;
|
|
} on_view;
|
|
|
|
};
|
|
|
|
void xwayland_unmanaged_create(struct wlr_xwayland_surface *xsurface, bool mapped);
|
|
|
|
void xwayland_view_create(struct wlr_xwayland_surface *xsurface, bool mapped);
|
|
|
|
void xwayland_server_init(struct wlr_compositor *compositor);
|
|
void xwayland_server_finish(void);
|
|
|
|
void xwayland_adjust_usable_area(struct view *view,
|
|
struct wlr_output_layout *layout, struct wlr_output *output,
|
|
struct wlr_box *usable);
|
|
|
|
void xwayland_update_workarea(void);
|
|
|
|
void xwayland_reset_cursor(void);
|
|
|
|
void xwayland_flush(void);
|
|
|
|
#endif /* HAVE_XWAYLAND */
|
|
#endif /* LABWC_XWAYLAND_H */
|