[weston v2 3/8] xwm: Don't resize windows if the application have these hints
Louis-Francis Ratté-Boulianne
lfrb at collabora.com
Mon Nov 13 21:20:51 UTC 2017
If the minimum and maximum size hints are equal, that means the
application doesn't want the window manager to allow resizing.
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
---
xwayland/window-manager.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 4b84b24e..c70938c4 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -973,6 +973,15 @@ weston_wm_window_set_net_wm_state(struct weston_wm_window *window)
i, property);
}
+static inline bool
+weston_wm_window_is_resizable(struct weston_wm_window *window)
+{
+ return (window->size_hints.min_width <= 0 ||
+ window->size_hints.min_height <= 0 ||
+ window->size_hints.min_width != window->size_hints.max_width ||
+ window->size_hints.min_height != window->size_hints.max_height);
+}
+
static void
weston_wm_window_create_frame(struct weston_wm_window *window)
{
@@ -981,7 +990,8 @@ weston_wm_window_create_frame(struct weston_wm_window *window)
int x, y, width, height;
int buttons = FRAME_BUTTON_CLOSE;
- if (window->decorate & MWM_DECOR_MAXIMIZE)
+ if (window->decorate & MWM_DECOR_MAXIMIZE &&
+ weston_wm_window_is_resizable(window))
buttons |= FRAME_BUTTON_MAXIMIZE;
window->frame = frame_create(window->wm->theme,
@@ -2133,7 +2143,7 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event)
}
if (frame_status(window->frame) & FRAME_STATUS_RESIZE) {
- if (pointer)
+ if (pointer && weston_wm_window_is_resizable(window))
xwayland_interface->resize(window->shsurf, pointer, location);
frame_status_clear(window->frame, FRAME_STATUS_RESIZE);
}
@@ -2174,8 +2184,10 @@ weston_wm_handle_motion(struct weston_wm *wm, xcb_generic_event_t *event)
if (frame_status(window->frame) & FRAME_STATUS_REPAINT)
weston_wm_window_schedule_repaint(window);
- cursor = get_cursor_for_location(location);
- weston_wm_window_set_cursor(wm, window->frame_id, cursor);
+ if (weston_wm_window_is_resizable(window)) {
+ cursor = get_cursor_for_location(location);
+ weston_wm_window_set_cursor(wm, window->frame_id, cursor);
+ }
}
static void
@@ -2195,8 +2207,10 @@ weston_wm_handle_enter(struct weston_wm *wm, xcb_generic_event_t *event)
if (frame_status(window->frame) & FRAME_STATUS_REPAINT)
weston_wm_window_schedule_repaint(window);
- cursor = get_cursor_for_location(location);
- weston_wm_window_set_cursor(wm, window->frame_id, cursor);
+ if (weston_wm_window_is_resizable(window)) {
+ cursor = get_cursor_for_location(location);
+ weston_wm_window_set_cursor(wm, window->frame_id, cursor);
+ }
}
static void
--
2.13.0
More information about the wayland-devel
mailing list