mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
view: move MoveRelative code from action.c and restore natural geometry
This commit is contained in:
parent
c6e2f667d3
commit
cb4afadd01
3 changed files with 19 additions and 4 deletions
|
|
@ -165,6 +165,7 @@ void view_close(struct view *view);
|
||||||
void view_move_resize(struct view *view, struct wlr_box geo);
|
void view_move_resize(struct view *view, struct wlr_box geo);
|
||||||
void view_resize_relative(struct view *view,
|
void view_resize_relative(struct view *view,
|
||||||
int left, int right, int top, int bottom);
|
int left, int right, int top, int bottom);
|
||||||
|
void view_move_relative(struct view *view, int x, int y);
|
||||||
void view_move(struct view *view, int x, int y);
|
void view_move(struct view *view, int x, int y);
|
||||||
void view_moved(struct view *view);
|
void view_moved(struct view *view);
|
||||||
void view_minimize(struct view *view, bool minimized);
|
void view_minimize(struct view *view, bool minimized);
|
||||||
|
|
|
||||||
|
|
@ -667,11 +667,10 @@ actions_run(struct view *activator, struct server *server,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_MOVE_RELATIVE:
|
case ACTION_TYPE_MOVE_RELATIVE:
|
||||||
if (view && !view->fullscreen) {
|
if (view) {
|
||||||
int x = get_arg_value_int(action, "x", 0);
|
int x = get_arg_value_int(action, "x", 0);
|
||||||
int y = get_arg_value_int(action, "y", 0);
|
int y = get_arg_value_int(action, "y", 0);
|
||||||
view_maximize(view, false, false);
|
view_move_relative(view, x, y);
|
||||||
view_move(view, view->pending.x + x, view->pending.y + y);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_SEND_TO_DESKTOP:
|
case ACTION_TYPE_SEND_TO_DESKTOP:
|
||||||
|
|
|
||||||
17
src/view.c
17
src/view.c
|
|
@ -206,8 +206,9 @@ view_move_resize(struct view *view, struct wlr_box geo)
|
||||||
void
|
void
|
||||||
view_resize_relative(struct view *view, int left, int right, int top, int bottom)
|
view_resize_relative(struct view *view, int left, int right, int top, int bottom)
|
||||||
{
|
{
|
||||||
if (view->fullscreen || view->maximized)
|
if (view->fullscreen || view->maximized) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
struct wlr_box newgeo = view->pending;
|
struct wlr_box newgeo = view->pending;
|
||||||
newgeo.x -= left;
|
newgeo.x -= left;
|
||||||
newgeo.width += left + right;
|
newgeo.width += left + right;
|
||||||
|
|
@ -217,6 +218,20 @@ view_resize_relative(struct view *view, int left, int right, int top, int bottom
|
||||||
view_set_untiled(view);
|
view_set_untiled(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
view_move_relative(struct view *view, int x, int y)
|
||||||
|
{
|
||||||
|
if (view->fullscreen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
view_maximize(view, false, /*store_natural_geometry*/ false);
|
||||||
|
if (view_is_tiled(view)) {
|
||||||
|
view_set_untiled(view);
|
||||||
|
view_restore_to(view, view->natural_geometry);
|
||||||
|
}
|
||||||
|
view_move(view, view->pending.x + x, view->pending.y + y);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_adjust_size(struct view *view, int *w, int *h)
|
view_adjust_size(struct view *view, int *w, int *h)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue