mirror of
https://github.com/labwc/labwc.git
synced 2026-02-25 01:40:28 -05:00
Merge f21d3c7d34 into 55a256f2fa
This commit is contained in:
commit
efb647f2b5
3 changed files with 11 additions and 36 deletions
|
|
@ -214,11 +214,13 @@ struct view {
|
||||||
*/
|
*/
|
||||||
struct wlr_box natural_geometry;
|
struct wlr_box natural_geometry;
|
||||||
/*
|
/*
|
||||||
* last_placement represents the last view position set by the user
|
* last_placement represents the last view position set by the user.
|
||||||
* before layout changes. output_name and relative_geo are used to
|
* This is used to keep or restore the view position when the output
|
||||||
* keep or restore the view position relative to the output and
|
* layout changes.
|
||||||
* layout_geo is used to keep the global position when the output is
|
*
|
||||||
* lost.
|
* output_name and relative_geo are used to keep or restore the view
|
||||||
|
* position relative to the output and layout_geo is used to keep the
|
||||||
|
* global position when the output is lost.
|
||||||
*/
|
*/
|
||||||
struct {
|
struct {
|
||||||
char *output_name;
|
char *output_name;
|
||||||
|
|
@ -542,7 +544,6 @@ bool view_titlebar_visible(struct view *view);
|
||||||
void view_set_ssd_mode(struct view *view, enum lab_ssd_mode mode);
|
void view_set_ssd_mode(struct view *view, enum lab_ssd_mode mode);
|
||||||
void view_set_decorations(struct view *view, enum lab_ssd_mode mode, bool force_ssd);
|
void view_set_decorations(struct view *view, enum lab_ssd_mode mode, bool force_ssd);
|
||||||
void view_toggle_fullscreen(struct view *view);
|
void view_toggle_fullscreen(struct view *view);
|
||||||
void views_save_last_placement(struct server *server);
|
|
||||||
void view_adjust_for_layout_change(struct view *view);
|
void view_adjust_for_layout_change(struct view *view);
|
||||||
void view_move_to_edge(struct view *view, enum lab_edge direction, bool snap_to_windows);
|
void view_move_to_edge(struct view *view, enum lab_edge direction, bool snap_to_windows);
|
||||||
void view_grow_to_edge(struct view *view, enum lab_edge direction);
|
void view_grow_to_edge(struct view *view, enum lab_edge direction);
|
||||||
|
|
|
||||||
|
|
@ -190,9 +190,6 @@ handle_output_destroy(struct wl_listener *listener, void *data)
|
||||||
output->workspace_osd = NULL;
|
output->workspace_osd = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save the last placement before clearing view->output */
|
|
||||||
views_save_last_placement(server);
|
|
||||||
|
|
||||||
struct view *view;
|
struct view *view;
|
||||||
wl_list_for_each(view, &server->views, link) {
|
wl_list_for_each(view, &server->views, link) {
|
||||||
if (view->output == output) {
|
if (view->output == output) {
|
||||||
|
|
@ -662,7 +659,6 @@ output_config_apply(struct server *server,
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
server->pending_output_layout_change++;
|
server->pending_output_layout_change++;
|
||||||
views_save_last_placement(server);
|
|
||||||
|
|
||||||
struct wlr_output_configuration_head_v1 *head;
|
struct wlr_output_configuration_head_v1 *head;
|
||||||
wl_list_for_each(head, &config->heads, link) {
|
wl_list_for_each(head, &config->heads, link) {
|
||||||
|
|
|
||||||
30
src/view.c
30
src/view.c
|
|
@ -577,7 +577,7 @@ view_moved(struct view *view)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_last_placement(struct view *view);
|
static void save_last_placement(struct view *view);
|
||||||
|
|
||||||
void
|
void
|
||||||
view_move_resize(struct view *view, struct wlr_box geo)
|
view_move_resize(struct view *view, struct wlr_box geo)
|
||||||
|
|
@ -589,7 +589,7 @@ view_move_resize(struct view *view, struct wlr_box geo)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the move/resize was user-initiated (rather than due to
|
* If the move/resize was user-initiated (rather than due to
|
||||||
* output layout change), then invalidate the saved geometry.
|
* output layout change), then update the last placement info.
|
||||||
*
|
*
|
||||||
* TODO: consider also updating view->output here for floating
|
* TODO: consider also updating view->output here for floating
|
||||||
* views (based on view->pending) rather than waiting until
|
* views (based on view->pending) rather than waiting until
|
||||||
|
|
@ -598,7 +598,7 @@ view_move_resize(struct view *view, struct wlr_box geo)
|
||||||
* Not sure if it might have other side-effects though.
|
* Not sure if it might have other side-effects though.
|
||||||
*/
|
*/
|
||||||
if (!view->adjusting_for_layout_change) {
|
if (!view->adjusting_for_layout_change) {
|
||||||
clear_last_placement(view);
|
save_last_placement(view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1748,16 +1748,6 @@ save_last_placement(struct view *view)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
struct output *output = view->output;
|
struct output *output = view->output;
|
||||||
/*
|
|
||||||
* Save the view's geometry if this is the first layout change
|
|
||||||
* since a user-initiated move/resize. Do not save it again for
|
|
||||||
* subsequent layout changes, since the point is to be able to
|
|
||||||
* restore to the original location after multiple changes
|
|
||||||
* (e.g. output disconnected and then reconnected).
|
|
||||||
*/
|
|
||||||
if (!wlr_box_empty(&view->last_placement.layout_geo)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!output_is_usable(output)) {
|
if (!output_is_usable(output)) {
|
||||||
wlr_log(WLR_ERROR, "cannot save last placement in unusable output");
|
wlr_log(WLR_ERROR, "cannot save last placement in unusable output");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1769,15 +1759,6 @@ save_last_placement(struct view *view)
|
||||||
view->last_placement.relative_geo.y -= output->scene_output->y;
|
view->last_placement.relative_geo.y -= output->scene_output->y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
views_save_last_placement(struct server *server)
|
|
||||||
{
|
|
||||||
struct view *view;
|
|
||||||
wl_list_for_each(view, &server->views, link) {
|
|
||||||
save_last_placement(view);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clear_last_placement(struct view *view)
|
clear_last_placement(struct view *view)
|
||||||
{
|
{
|
||||||
|
|
@ -1792,10 +1773,7 @@ view_adjust_for_layout_change(struct view *view)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
if (wlr_box_empty(&view->last_placement.layout_geo)) {
|
if (wlr_box_empty(&view->last_placement.layout_geo)) {
|
||||||
/*
|
/* Not using assert() just in case */
|
||||||
* views_save_last_placement() should be called before layout
|
|
||||||
* changes. Not using assert() just in case.
|
|
||||||
*/
|
|
||||||
wlr_log(WLR_ERROR, "view has no last placement info");
|
wlr_log(WLR_ERROR, "view has no last placement info");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue