mirror of
https://github.com/labwc/labwc.git
synced 2026-02-08 10:06:59 -05:00
view: account for base size in resize indicator
For views with a non-pixel size increment (e.g. X11 terminals), it's helpful to subtract the base size of the window (typically including menu bar, scrollbars, etc.) before computing the number of size increments (e.g. cells/characters). This way, the displayed size will exactly match the terminal grid (e.g. 80x25 or whatever). wlr_box isn't really the best fit for size hints, so let's define a struct view_size_hints and a nice view_get_size_hints() function, wrapping view->impl->get_size_hints(). This also seems like a great opportunity to make view_adjust_size() window-system-agnostic and eliminate xwayland_apply_size_hints().
This commit is contained in:
parent
48e0b3f6a6
commit
ce36cbac2d
5 changed files with 90 additions and 77 deletions
|
|
@ -37,6 +37,17 @@ enum view_edge {
|
|||
};
|
||||
|
||||
struct view;
|
||||
|
||||
/* Basic size hints (subset of XSizeHints from X11) */
|
||||
struct view_size_hints {
|
||||
int min_width;
|
||||
int min_height;
|
||||
int width_inc;
|
||||
int height_inc;
|
||||
int base_width;
|
||||
int base_height;
|
||||
};
|
||||
|
||||
struct view_impl {
|
||||
void (*configure)(struct view *view, struct wlr_box geo);
|
||||
void (*close)(struct view *view);
|
||||
|
|
@ -57,7 +68,7 @@ struct view_impl {
|
|||
void (*move_to_back)(struct view *view);
|
||||
struct view *(*get_root)(struct view *self);
|
||||
void (*append_children)(struct view *self, struct wl_array *children);
|
||||
void (*fill_size_hints)(struct view *self, struct wlr_box *box);
|
||||
struct view_size_hints (*get_size_hints)(struct view *self);
|
||||
};
|
||||
|
||||
struct view {
|
||||
|
|
@ -306,6 +317,7 @@ void view_update_title(struct view *view);
|
|||
void view_update_app_id(struct view *view);
|
||||
void view_reload_ssd(struct view *view);
|
||||
|
||||
struct view_size_hints view_get_size_hints(struct view *view);
|
||||
void view_adjust_size(struct view *view, int *w, int *h);
|
||||
|
||||
void view_evacuate_region(struct view *view);
|
||||
|
|
|
|||
|
|
@ -48,8 +48,6 @@ void xwayland_view_create(struct server *server,
|
|||
|
||||
struct wlr_xwayland_surface *xwayland_surface_from_view(struct view *view);
|
||||
|
||||
bool xwayland_apply_size_hints(struct view *view, int *w, int *h);
|
||||
|
||||
void xwayland_server_init(struct server *server,
|
||||
struct wlr_compositor *compositor);
|
||||
void xwayland_server_finish(struct server *server);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue