From ab8a86369c01c7146991ff4ae2ef04b0a1db06ca Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 7 Jul 2018 18:36:20 +1000 Subject: Implement some floating move commands This implements the following for floating containers: * move * move [absolute] position * move [absolute] position mouse --- include/sway/desktop.h | 4 ++++ include/sway/output.h | 2 ++ include/sway/tree/container.h | 6 ++++++ 3 files changed, 12 insertions(+) (limited to 'include') diff --git a/include/sway/desktop.h b/include/sway/desktop.h index f1ad759a..348fb187 100644 --- a/include/sway/desktop.h +++ b/include/sway/desktop.h @@ -1,4 +1,8 @@ #include +struct sway_container; + void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly, bool whole); + +void desktop_damage_whole_container(struct sway_container *con); diff --git a/include/sway/output.h b/include/sway/output.h index b6cda83c..bd25e76e 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -97,4 +97,6 @@ void output_drag_icons_for_each_surface(struct wl_list *drag_icons, struct sway_output *output, struct root_geometry *geo, wlr_surface_iterator_func_t iterator, void *user_data); +struct sway_container *output_get_active_workspace(struct sway_output *output); + #endif diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 728daa84..a69da9db 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -297,4 +297,10 @@ bool container_is_floating(struct sway_container *container); */ void container_get_box(struct sway_container *container, struct wlr_box *box); +/** + * Move a floating container to a new layout-local position. + */ +void container_floating_move_to(struct sway_container *con, + double lx, double ly); + #endif -- cgit v1.2.3-54-g00ecf From b0fc7e98501fc885197de90af6579dc121e7ef46 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 9 Jul 2018 23:41:00 +1000 Subject: Remove duplicate function declaration and add assertion --- include/sway/output.h | 2 -- sway/tree/container.c | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/sway/output.h b/include/sway/output.h index bd25e76e..b6cda83c 100644 --- a/include/sway/output.h +++ b/include/sway/output.h @@ -97,6 +97,4 @@ void output_drag_icons_for_each_surface(struct wl_list *drag_icons, struct sway_output *output, struct root_geometry *geo, wlr_surface_iterator_func_t iterator, void *user_data); -struct sway_container *output_get_active_workspace(struct sway_output *output); - #endif diff --git a/sway/tree/container.c b/sway/tree/container.c index 2df2332c..92408ce6 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -1052,6 +1052,10 @@ static struct sway_container *container_floating_find_output( void container_floating_move_to(struct sway_container *con, double lx, double ly) { + if (!sway_assert(container_is_floating(con), + "Expected a floating container")) { + return; + } desktop_damage_whole_container(con); container_floating_translate(con, lx - con->x, ly - con->y); desktop_damage_whole_container(con); -- cgit v1.2.3-54-g00ecf