mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
Refactor view_move_resize()
This commit is contained in:
parent
57588aa173
commit
e0770a5672
5 changed files with 8 additions and 15 deletions
|
|
@ -222,7 +222,7 @@ void xwayland_unmanaged_create(struct server *server,
|
|||
*/
|
||||
struct wlr_box view_get_surface_geometry(struct view *view);
|
||||
struct wlr_box view_geometry(struct view *view);
|
||||
void view_resize(struct view *view, struct wlr_box geo);
|
||||
void view_move_resize(struct view *view, struct wlr_box geo);
|
||||
void view_minimize(struct view *view);
|
||||
void view_unminimize(struct view *view);
|
||||
void view_for_each_surface(struct view *view,
|
||||
|
|
|
|||
|
|
@ -116,14 +116,9 @@ process_cursor_resize(struct server *server, uint32_t time)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Move */
|
||||
view->x = new_view_geo.x;
|
||||
view->y = new_view_geo.y;
|
||||
|
||||
/* Resize */
|
||||
new_view_geo.width -= 2 * view->xdg_grab_offset;
|
||||
new_view_geo.height -= 2 * view->xdg_grab_offset;
|
||||
view_resize(view, new_view_geo);
|
||||
view_move_resize(view, new_view_geo);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
10
src/view.c
10
src/view.c
|
|
@ -1,15 +1,9 @@
|
|||
#include "labwc.h"
|
||||
|
||||
void
|
||||
view_resize(struct view *view, struct wlr_box geo)
|
||||
view_move_resize(struct view *view, struct wlr_box geo)
|
||||
{
|
||||
struct wlr_box box = {
|
||||
.x = view->x,
|
||||
.y = view->y,
|
||||
.width = geo.width,
|
||||
.height = geo.height,
|
||||
};
|
||||
view->impl->configure(view, box);
|
||||
view->impl->configure(view, geo);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ handle_request_resize(struct wl_listener *listener, void *data)
|
|||
static void
|
||||
xdg_toplevel_view_configure(struct view *view, struct wlr_box geo)
|
||||
{
|
||||
view->x = geo.x;
|
||||
view->y = geo.y;
|
||||
wlr_xdg_toplevel_set_size(view->xdg_surface, (uint32_t)geo.width,
|
||||
(uint32_t)geo.height);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ handle_request_configure(struct wl_listener *listener, void *data)
|
|||
static void
|
||||
configure(struct view *view, struct wlr_box geo)
|
||||
{
|
||||
view->x = geo.x;
|
||||
view->y = geo.y;
|
||||
wlr_xwayland_surface_configure(view->xwayland_surface, (int16_t)geo.x,
|
||||
(int16_t)geo.y, (uint16_t)geo.width,
|
||||
(uint16_t)geo.height);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue