[Bf-blender-cvs] [f85893fb967] workspaces: Fix layout cycling not working

Julian Eisel noreply at git.blender.org
Thu Jun 1 17:42:33 CEST 2017


Commit: f85893fb967fcd3576291e92a75a6f86ed32d678
Author: Julian Eisel
Date:   Thu Jun 1 17:41:14 2017 +0200
Branches: workspaces
https://developer.blender.org/rBf85893fb967fcd3576291e92a75a6f86ed32d678

Fix layout cycling not working

Also added comment for layout iterator.

===================================================================

M	source/blender/blenkernel/intern/workspace.c
M	source/blender/editors/screen/workspace_layout_edit.c

===================================================================

diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 12bfedff6d2..8afad317dce 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -207,7 +207,7 @@ WorkSpaceLayout *BKE_workspace_layout_add(
 	BLI_assert(!workspaces_is_screen_used(G.main, screen));
 	layout->screen = screen;
 	workspace_layout_name_set(workspace, layout, name);
-	BLI_addhead(&workspace->layouts, layout);
+	BLI_addtail(&workspace->layouts, layout);
 
 	return layout;
 }
@@ -266,6 +266,14 @@ WorkSpaceLayout *BKE_workspace_layout_find_global(
 	return NULL;
 }
 
+/**
+ * Circular workspace layout iterator.
+ *
+ * \param callback: Custom function which gets executed for each layout. Can return false to stop iterating.
+ * \param arg: Custom data passed to each \a callback call.
+ *
+ * \return the layout at which \a callback returned false.
+ */
 WorkSpaceLayout *BKE_workspace_layout_iter_circular(
         const WorkSpace *workspace, WorkSpaceLayout *start,
         bool (*callback)(const WorkSpaceLayout *layout, void *arg),
diff --git a/source/blender/editors/screen/workspace_layout_edit.c b/source/blender/editors/screen/workspace_layout_edit.c
index 39f8170eb9a..e4dd841f833 100644
--- a/source/blender/editors/screen/workspace_layout_edit.c
+++ b/source/blender/editors/screen/workspace_layout_edit.c
@@ -105,7 +105,7 @@ bool workspace_layout_set_poll(const WorkSpaceLayout *layout)
 	return ((BKE_screen_is_used(screen) == false) &&
 	        /* in typical usage temp screens should have a nonzero winid
 	         * (all temp screens should be used, or closed & freed). */
-	        (screen->temp == false) &
+	        (screen->temp == false) &&
 	        (BKE_screen_is_fullscreen_area(screen) == false) &&
 	        (screen->id.name[2] != '.' || !(U.uiflag & USER_HIDE_DOT)));
 }
@@ -160,7 +160,8 @@ bool ED_workspace_layout_delete(
 
 static bool workspace_layout_cycle_iter_cb(const WorkSpaceLayout *layout, void *UNUSED(arg))
 {
-	return workspace_layout_set_poll(layout);
+	/* return false to stop iterator when we have found a layout to activate */
+	return !workspace_layout_set_poll(layout);
 }
 
 bool ED_workspace_layout_cycle(




More information about the Bf-blender-cvs mailing list