{"action":"created","comment":{"url":"https://api.github.com/repos/swaywm/sway/pulls/comments/184880550","pull_request_review_id":116164128,"id":184880550,"diff_hunk":"@@ -0,0 +1,20 @@\n+#ifndef _SWAY_ARRANGE_H\n+#define _SWAY_ARRANGE_H\n+\n+struct sway_container;\n+\n+void arrange_windows(struct sway_container *container);\n+\n+// Determine the root container's geometry, then iterate to everything below\n+void arrange_root(void);\n+\n+// Determine the output's geometry, then iterate to everything below\n+void arrange_output(struct sway_container *output);","path":"include/sway/tree/arrange.h","position":12,"original_position":12,"commit_id":"167c2e1aa99aa8011e169b0fb61c47953cc9a5f6","original_commit_id":"26bae0f1cff6b66b1df7e95c5662eb2f23ac44e4","user":{"login":"SirCmpwn","id":1310872,"avatar_url":"https://avatars0.githubusercontent.com/u/1310872?v=4","gravatar_id":"","url":"https://api.github.com/users/SirCmpwn","html_url":"https://github.com/SirCmpwn","followers_url":"https://api.github.com/users/SirCmpwn/followers","following_url":"https://api.github.com/users/SirCmpwn/following{/other_user}","gists_url":"https://api.github.com/users/SirCmpwn/gists{/gist_id}","starred_url":"https://api.github.com/users/SirCmpwn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SirCmpwn/subscriptions","organizations_url":"https://api.github.com/users/SirCmpwn/orgs","repos_url":"https://api.github.com/users/SirCmpwn/repos","events_url":"https://api.github.com/users/SirCmpwn/events{/privacy}","received_events_url":"https://api.github.com/users/SirCmpwn/received_events","type":"User","site_admin":false},"body":"¯\\\\\\_(ツ)\\_/¯\r\n\r\nSort it out between yourselves","created_at":"2018-04-29T11:59:04Z","updated_at":"2018-04-29T11:59:04Z","html_url":"https://github.com/swaywm/sway/pull/1854#discussion_r184880550","pull_request_url":"https://api.github.com/repos/swaywm/sway/pulls/1854","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/swaywm/sway/pulls/comments/184880550"},"html":{"href":"https://github.com/swaywm/sway/pull/1854#discussion_r184880550"},"pull_request":{"href":"https://api.github.com/repos/swaywm/sway/pulls/1854"}},"in_reply_to_id":184683250},"pull_request":{"url":"https://api.github.com/repos/swaywm/sway/pulls/1854","id":183761594,"html_url":"https://github.com/swaywm/sway/pull/1854","diff_url":"https://github.com/swaywm/sway/pull/1854.diff","patch_url":"https://github.com/swaywm/sway/pull/1854.patch","issue_url":"https://api.github.com/repos/swaywm/sway/issues/1854","number":1854,"state":"open","locked":false,"title":"Refactor arrange_windows()","user":{"login":"RyanDwyer","id":2436833,"avatar_url":"https://avatars3.githubusercontent.com/u/2436833?v=4","gravatar_id":"","url":"https://api.github.com/users/RyanDwyer","html_url":"https://github.com/RyanDwyer","followers_url":"https://api.github.com/users/RyanDwyer/followers","following_url":"https://api.github.com/users/RyanDwyer/following{/other_user}","gists_url":"https://api.github.com/users/RyanDwyer/gists{/gist_id}","starred_url":"https://api.github.com/users/RyanDwyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RyanDwyer/subscriptions","organizations_url":"https://api.github.com/users/RyanDwyer/orgs","repos_url":"https://api.github.com/users/RyanDwyer/repos","events_url":"https://api.github.com/users/RyanDwyer/events{/privacy}","received_events_url":"https://api.github.com/users/RyanDwyer/received_events","type":"User","site_admin":false},"body":"The arrange_windows() function hurts my brain. Here's a refactor for your consideration.\r\n\r\n* I've split `arrange_windows()` into a function for each container type. So you can call `arrange_root()`, `arrange_output(output)`, `arrange_workspace(workspace)` or `arrange_children_of(workspace_or_container)`. Each one iterates its children and recurses as needed.\r\n* For convenience, if you don't know what type of container you're dealing with and just want it to work, you can pass it to `arrange_windows(whatever)` and it'll figure it out.\r\n* Because there's now several more functions related to arranging, I've moved this out of layout.c and into a new file.\r\n* Passing -1, -1 to the function is now unnecessary, as it gets it from the provided parent and updates the child's dimensions before iterating into it.\r\n* Previously, `arrange_windows()` had inconsistent behaviour as to whether it would update properties on the passed container (eg. root and output would only work with their children). Now they always update the given container's properties, except for `arrange_children_of()` which is obvious from the name.\r\n* The `apply_{horiz,vert}_layout()` functions no longer need `start` and `end` variables passed to them, as it always uses the full children list.\r\n* Additionally, they no longer pass the parent's dimensions separately.\r\n* The `apply_{horiz,vert}_layout()` functions no longer recurse. They only set the child's properties, then execution is returned to `arrange_children_of()` which handles the recursion. This means the function call stack is `arrange_children_of()` => `arrange_children_of()` rather than `arrange_children_of()` => `apply_horiz_layout()` => `arrange_children_of()` which I believe is easier to follow.\r\n* Fullscreen is implemented differently this way. It saves the view's dimensions and restores them. Previously it was calling `view_configure()` without changing the swayc's stored width and height.\r\n\r\nAlso note I had to split view_set_fullscreen() into a lower level function called view_set_fullscreen_raw(), because I had to call the lower level one from elsewhere without having it go and rearrange the windows on me.","created_at":"2018-04-24T14:45:08Z","updated_at":"2018-04-29T11:59:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1750dba4bf6acde7888e4dbdfd74a2243bed6060","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/swaywm/sway/pulls/1854/commits","review_comments_url":"https://api.github.com/repos/swaywm/sway/pulls/1854/comments","review_comment_url":"https://api.github.com/repos/swaywm/sway/pulls/comments{/number}","comments_url":"https://api.github.com/repos/swaywm/sway/issues/1854/comments","statuses_url":"https://api.github.com/repos/swaywm/sway/statuses/167c2e1aa99aa8011e169b0fb61c47953cc9a5f6","head":{"label":"RyanDwyer:refactor-arrange-windows","ref":"refactor-arrange-windows","sha":"167c2e1aa99aa8011e169b0fb61c47953cc9a5f6","user":{"login":"RyanDwyer","id":2436833,"avatar_url":"https://avatars3.githubusercontent.com/u/2436833?v=4","gravatar_id":"","url":"https://api.github.com/users/RyanDwyer","html_url":"https://github.com/RyanDwyer","followers_url":"https://api.github.com/users/RyanDwyer/followers","following_url":"https://api.github.com/users/RyanDwyer/following{/other_user}","gists_url":"https://api.github.com/users/RyanDwyer/gists{/gist_id}","starred_url":"https://api.github.com/users/RyanDwyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RyanDwyer/subscriptions","organizations_url":"https://api.github.com/users/RyanDwyer/orgs","repos_url":"https://api.github.com/users/RyanDwyer/repos","events_url":"https://api.github.com/users/RyanDwyer/events{/privacy}","received_events_url":"https://api.github.com/users/RyanDwyer/received_events","type":"User","site_admin":false},"repo":{"id":68437977,"name":"sway","full_name":"RyanDwyer/sway","owner":{"login":"RyanDwyer","id":2436833,"avatar_url":"https://avatars3.githubusercontent.com/u/2436833?v=4","gravatar_id":"","url":"https://api.github.com/users/RyanDwyer","html_url":"https://github.com/RyanDwyer","followers_url":"https://api.github.com/users/RyanDwyer/followers","following_url":"https://api.github.com/users/RyanDwyer/following{/other_user}","gists_url":"https://api.github.com/users/RyanDwyer/gists{/gist_id}","starred_url":"https://api.github.com/users/RyanDwyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RyanDwyer/subscriptions","organizations_url":"https://api.github.com/users/RyanDwyer/orgs","repos_url":"https://api.github.com/users/RyanDwyer/repos","events_url":"https://api.github.com/users/RyanDwyer/events{/privacy}","received_events_url":"https://api.github.com/users/RyanDwyer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RyanDwyer/sway","description":"i3-compatible Wayland compositor","fork":true,"url":"https://api.github.com/repos/RyanDwyer/sway","forks_url":"https://api.github.com/repos/RyanDwyer/sway/forks","keys_url":"https://api.github.com/repos/RyanDwyer/sway/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RyanDwyer/sway/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RyanDwyer/sway/teams","hooks_url":"https://api.github.com/repos/RyanDwyer/sway/hooks","issue_events_url":"https://api.github.com/repos/RyanDwyer/sway/issues/events{/number}","events_url":"https://api.github.com/repos/RyanDwyer/sway/events","assignees_url":"https://api.github.com/repos/RyanDwyer/sway/assignees{/user}","branches_url":"https://api.github.com/repos/RyanDwyer/sway/branches{/branch}","tags_url":"https://api.github.com/repos/RyanDwyer/sway/tags","blobs_url":"https://api.github.com/repos/RyanDwyer/sway/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RyanDwyer/sway/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RyanDwyer/sway/git/refs{/sha}","trees_url":"https://api.github.com/repos/RyanDwyer/sway/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RyanDwyer/sway/statuses/{sha}","languages_url":"https://api.github.com/repos/RyanDwyer/sway/languages","stargazers_url":"https://api.github.com/repos/RyanDwyer/sway/stargazers","contributors_url":"https://api.github.com/repos/RyanDwyer/sway/contributors","subscribers_url":"https://api.github.com/repos/RyanDwyer/sway/subscribers","subscription_url":"https://api.github.com/repos/RyanDwyer/sway/subscription","commits_url":"https://api.github.com/repos/RyanDwyer/sway/commits{/sha}","git_commits_url":"https://api.github.com/repos/RyanDwyer/sway/git/commits{/sha}","comments_url":"https://api.github.com/repos/RyanDwyer/sway/comments{/number}","issue_comment_url":"https://api.github.com/repos/RyanDwyer/sway/issues/comments{/number}","contents_url":"https://api.github.com/repos/RyanDwyer/sway/contents/{+path}","compare_url":"https://api.github.com/repos/RyanDwyer/sway/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RyanDwyer/sway/merges","archive_url":"https://api.github.com/repos/RyanDwyer/sway/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RyanDwyer/sway/downloads","issues_url":"https://api.github.com/repos/RyanDwyer/sway/issues{/number}","pulls_url":"https://api.github.com/repos/RyanDwyer/sway/pulls{/number}","milestones_url":"https://api.github.com/repos/RyanDwyer/sway/milestones{/number}","notifications_url":"https://api.github.com/repos/RyanDwyer/sway/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RyanDwyer/sway/labels{/name}","releases_url":"https://api.github.com/repos/RyanDwyer/sway/releases{/id}","deployments_url":"https://api.github.com/repos/RyanDwyer/sway/deployments","created_at":"2016-09-17T07:19:41Z","updated_at":"2018-04-26T12:21:48Z","pushed_at":"2018-04-28T01:26:37Z","git_url":"git://github.com/RyanDwyer/sway.git","ssh_url":"git@github.com:RyanDwyer/sway.git","clone_url":"https://github.com/RyanDwyer/sway.git","svn_url":"https://github.com/RyanDwyer/sway","homepage":"http://swaywm.org/","size":22530,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"swaywm:master","ref":"master","sha":"85ec7002068277fe82dcc139ebb401b515ca5d80","user":{"login":"swaywm","id":32400794,"avatar_url":"https://avatars1.githubusercontent.com/u/32400794?v=4","gravatar_id":"","url":"https://api.github.com/users/swaywm","html_url":"https://github.com/swaywm","followers_url":"https://api.github.com/users/swaywm/followers","following_url":"https://api.github.com/users/swaywm/following{/other_user}","gists_url":"https://api.github.com/users/swaywm/gists{/gist_id}","starred_url":"https://api.github.com/users/swaywm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swaywm/subscriptions","organizations_url":"https://api.github.com/users/swaywm/orgs","repos_url":"https://api.github.com/users/swaywm/repos","events_url":"https://api.github.com/users/swaywm/events{/privacy}","received_events_url":"https://api.github.com/users/swaywm/received_events","type":"Organization","site_admin":false},"repo":{"id":40217904,"name":"sway","full_name":"swaywm/sway","owner":{"login":"swaywm","id":32400794,"avatar_url":"https://avatars1.githubusercontent.com/u/32400794?v=4","gravatar_id":"","url":"https://api.github.com/users/swaywm","html_url":"https://github.com/swaywm","followers_url":"https://api.github.com/users/swaywm/followers","following_url":"https://api.github.com/users/swaywm/following{/other_user}","gists_url":"https://api.github.com/users/swaywm/gists{/gist_id}","starred_url":"https://api.github.com/users/swaywm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swaywm/subscriptions","organizations_url":"https://api.github.com/users/swaywm/orgs","repos_url":"https://api.github.com/users/swaywm/repos","events_url":"https://api.github.com/users/swaywm/events{/privacy}","received_events_url":"https://api.github.com/users/swaywm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/swaywm/sway","description":"i3-compatible Wayland compositor","fork":false,"url":"https://api.github.com/repos/swaywm/sway","forks_url":"https://api.github.com/repos/swaywm/sway/forks","keys_url":"https://api.github.com/repos/swaywm/sway/keys{/key_id}","collaborators_url":"https://api.github.com/repos/swaywm/sway/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/swaywm/sway/teams","hooks_url":"https://api.github.com/repos/swaywm/sway/hooks","issue_events_url":"https://api.github.com/repos/swaywm/sway/issues/events{/number}","events_url":"https://api.github.com/repos/swaywm/sway/events","assignees_url":"https://api.github.com/repos/swaywm/sway/assignees{/user}","branches_url":"https://api.github.com/repos/swaywm/sway/branches{/branch}","tags_url":"https://api.github.com/repos/swaywm/sway/tags","blobs_url":"https://api.github.com/repos/swaywm/sway/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/swaywm/sway/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/swaywm/sway/git/refs{/sha}","trees_url":"https://api.github.com/repos/swaywm/sway/git/trees{/sha}","statuses_url":"https://api.github.com/repos/swaywm/sway/statuses/{sha}","languages_url":"https://api.github.com/repos/swaywm/sway/languages","stargazers_url":"https://api.github.com/repos/swaywm/sway/stargazers","contributors_url":"https://api.github.com/repos/swaywm/sway/contributors","subscribers_url":"https://api.github.com/repos/swaywm/sway/subscribers","subscription_url":"https://api.github.com/repos/swaywm/sway/subscription","commits_url":"https://api.github.com/repos/swaywm/sway/commits{/sha}","git_commits_url":"https://api.github.com/repos/swaywm/sway/git/commits{/sha}","comments_url":"https://api.github.com/repos/swaywm/sway/comments{/number}","issue_comment_url":"https://api.github.com/repos/swaywm/sway/issues/comments{/number}","contents_url":"https://api.github.com/repos/swaywm/sway/contents/{+path}","compare_url":"https://api.github.com/repos/swaywm/sway/compare/{base}...{head}","merges_url":"https://api.github.com/repos/swaywm/sway/merges","archive_url":"https://api.github.com/repos/swaywm/sway/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/swaywm/sway/downloads","issues_url":"https://api.github.com/repos/swaywm/sway/issues{/number}","pulls_url":"https://api.github.com/repos/swaywm/sway/pulls{/number}","milestones_url":"https://api.github.com/repos/swaywm/sway/milestones{/number}","notifications_url":"https://api.github.com/repos/swaywm/sway/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/swaywm/sway/labels{/name}","releases_url":"https://api.github.com/repos/swaywm/sway/releases{/id}","deployments_url":"https://api.github.com/repos/swaywm/sway/deployments","created_at":"2015-08-05T01:31:45Z","updated_at":"2018-04-29T01:15:35Z","pushed_at":"2018-04-29T10:16:30Z","git_url":"git://github.com/swaywm/sway.git","ssh_url":"git@github.com:swaywm/sway.git","clone_url":"https://github.com/swaywm/sway.git","svn_url":"https://github.com/swaywm/sway","homepage":"http://swaywm.org/","size":22798,"stargazers_count":3814,"watchers_count":3814,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":237,"mirror_url":null,"archived":false,"open_issues_count":201,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":237,"open_issues":201,"watchers":3814,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/swaywm/sway/pulls/1854"},"html":{"href":"https://github.com/swaywm/sway/pull/1854"},"issue":{"href":"https://api.github.com/repos/swaywm/sway/issues/1854"},"comments":{"href":"https://api.github.com/repos/swaywm/sway/issues/1854/comments"},"review_comments":{"href":"https://api.github.com/repos/swaywm/sway/pulls/1854/comments"},"review_comment":{"href":"https://api.github.com/repos/swaywm/sway/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/swaywm/sway/pulls/1854/commits"},"statuses":{"href":"https://api.github.com/repos/swaywm/sway/statuses/167c2e1aa99aa8011e169b0fb61c47953cc9a5f6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"SirCmpwn"}}