{"action":"created","comment":{"url":"https://api.github.com/repos/freeorion/freeorion/pulls/comments/55936132","id":55936132,"diff_hunk":"@@ -99,22 +99,38 @@ namespace {\n         db.Add(\"UI.mouse-click-repeat-delay\",   UserStringNop(\"OPTIONS_DB_MOUSE_REPEAT_DELAY\"),         360,    RangedValidator<int>(0, 1000));\n         db.Add(\"UI.mouse-click-repeat-interval\",UserStringNop(\"OPTIONS_DB_MOUSE_REPEAT_INTERVAL\"),      15,     RangedValidator<int>(0, 1000));\n \n-        db.Add(\"app-width\",             UserStringNop(\"OPTIONS_DB_APP_WIDTH\"),             1024,   RangedValidator<int>(800, 10240));\n-        db.Add(\"app-height\",            UserStringNop(\"OPTIONS_DB_APP_HEIGHT\"),            768,    RangedValidator<int>(600, 10240));\n-        db.Add(\"app-width-windowed\",    UserStringNop(\"OPTIONS_DB_APP_WIDTH_WINDOWED\"),    1024,   RangedValidator<int>(800, 10240));\n-        db.Add(\"app-height-windowed\",   UserStringNop(\"OPTIONS_DB_APP_HEIGHT_WINDOWED\"),   768,    RangedValidator<int>(600, 10240));\n-\n-        const int CENTRE = static_cast<int>(SDL_WINDOWPOS_CENTERED);\n-        db.Add(\"app-left-windowed\",     UserStringNop(\"OPTIONS_DB_APP_LEFT_WINDOWED\"),     CENTRE, OrValidator<int>( RangedValidator<int>(-10240, 10240),\n-                                                                                                                     DiscreteValidator<int>(CENTRE) ));\n-        db.Add(\"app-top-windowed\",      UserStringNop(\"OPTIONS_DB_APP_TOP_WINDOWED\"),      50,     RangedValidator<int>(-10240, 10240));\n-\n         Hotkey::AddHotkey(\"exit\",       UserStringNop(\"HOTKEY_EXIT\"),       GG::GGK_NONE,   GG::MOD_KEY_NONE);\n         Hotkey::AddHotkey(\"quit\",       UserStringNop(\"HOTKEY_QUIT\"),       GG::GGK_NONE,   GG::MOD_KEY_NONE);\n         Hotkey::AddHotkey(\"fullscreen\", UserStringNop(\"HOTKEY_FULLSCREEN\"), GG::GGK_RETURN, GG::MOD_KEY_ALT);\n     }\n     bool temp_bool = RegisterOptions(&AddOptions);\n \n+    /** These options can only be validated after the graphics system (SDL) is initialized,\n+        so that display size can be detected\n+     */\n+    const int DEFAULT_WIDTH = 1025;\n+    const int DEFAULT_HEIGHT = 768;\n+    const int DEFAULT_LEFT = static_cast<int>(SDL_WINDOWPOS_CENTERED);\n+    const int DEFAULT_TOP = 50;\n+    const int MIN_WIDTH = 800;\n+    const int MIN_HEIGHT = 600;\n+\n+    void AddOptionsAfterGUIInitialization(OptionsDB& db) {\n+        const int max_width_plus_one = HumanClientApp::MaximumPossibleWidth() + 1;\n+        const int max_height_plus_one = HumanClientApp::MaximumPossibleHeight() + 1;\n+\n+        db.Add(\"app-width\",             UserStringNop(\"OPTIONS_DB_APP_WIDTH\"),             DEFAULT_WIDTH,   RangedValidator<int>(MIN_WIDTH, max_width_plus_one));\n+        db.Add(\"app-height\",            UserStringNop(\"OPTIONS_DB_APP_HEIGHT\"),            DEFAULT_HEIGHT,    RangedValidator<int>(MIN_HEIGHT, max_height_plus_one));\n+\n+        db.Add(\"app-width-windowed\",    UserStringNop(\"OPTIONS_DB_APP_WIDTH_WINDOWED\"),    DEFAULT_WIDTH,   RangedValidator<int>(MIN_WIDTH, max_width_plus_one));\n+        db.Add(\"app-height-windowed\",   UserStringNop(\"OPTIONS_DB_APP_HEIGHT_WINDOWED\"),   DEFAULT_HEIGHT,    RangedValidator<int>(MIN_HEIGHT, max_height_plus_one));\n+        db.Add(\"app-left-windowed\",     UserStringNop(\"OPTIONS_DB_APP_LEFT_WINDOWED\"),     DEFAULT_LEFT, OrValidator<int>( RangedValidator<int>(-max_width_plus_one, max_width_plus_one), DiscreteValidator<int>(DEFAULT_LEFT) ));\n+        db.Add(\"app-top-windowed\",      UserStringNop(\"OPTIONS_DB_APP_TOP_WINDOWED\"),      DEFAULT_TOP,     RangedValidator<int>(-max_height_plus_one, max_height_plus_one));\n+","path":"client/human/HumanClientApp.cpp","position":40,"original_position":41,"commit_id":"4487510d693d800b5929db351696f1e0ddd3c0f6","original_commit_id":"c86b1579e7e0f976cd7921a3fb9b2b9f5ab431ca","user":{"login":"LGM-Doyle","id":17235966,"avatar_url":"https://avatars.githubusercontent.com/u/17235966?v=3","gravatar_id":"","url":"https://api.github.com/users/LGM-Doyle","html_url":"https://github.com/LGM-Doyle","followers_url":"https://api.github.com/users/LGM-Doyle/followers","following_url":"https://api.github.com/users/LGM-Doyle/following{/other_user}","gists_url":"https://api.github.com/users/LGM-Doyle/gists{/gist_id}","starred_url":"https://api.github.com/users/LGM-Doyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LGM-Doyle/subscriptions","organizations_url":"https://api.github.com/users/LGM-Doyle/orgs","repos_url":"https://api.github.com/users/LGM-Doyle/repos","events_url":"https://api.github.com/users/LGM-Doyle/events{/privacy}","received_events_url":"https://api.github.com/users/LGM-Doyle/received_events","type":"User","site_admin":false},"body":"I put the blank line to separate fullscreen and windowed options.  I removed it.","created_at":"2016-03-13T12:05:49Z","updated_at":"2016-03-13T12:05:49Z","html_url":"https://github.com/freeorion/freeorion/pull/519#discussion_r55936132","pull_request_url":"https://api.github.com/repos/freeorion/freeorion/pulls/519","_links":{"self":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/comments/55936132"},"html":{"href":"https://github.com/freeorion/freeorion/pull/519#discussion_r55936132"},"pull_request":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/519"}}},"pull_request":{"url":"https://api.github.com/repos/freeorion/freeorion/pulls/519","id":62636792,"html_url":"https://github.com/freeorion/freeorion/pull/519","diff_url":"https://github.com/freeorion/freeorion/pull/519.diff","patch_url":"https://github.com/freeorion/freeorion/pull/519.patch","issue_url":"https://api.github.com/repos/freeorion/freeorion/issues/519","number":519,"state":"open","locked":false,"title":"Fix multimonitor persistence","user":{"login":"LGM-Doyle","id":17235966,"avatar_url":"https://avatars.githubusercontent.com/u/17235966?v=3","gravatar_id":"","url":"https://api.github.com/users/LGM-Doyle","html_url":"https://github.com/LGM-Doyle","followers_url":"https://api.github.com/users/LGM-Doyle/followers","following_url":"https://api.github.com/users/LGM-Doyle/following{/other_user}","gists_url":"https://api.github.com/users/LGM-Doyle/gists{/gist_id}","starred_url":"https://api.github.com/users/LGM-Doyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LGM-Doyle/subscriptions","organizations_url":"https://api.github.com/users/LGM-Doyle/orgs","repos_url":"https://api.github.com/users/LGM-Doyle/repos","events_url":"https://api.github.com/users/LGM-Doyle/events{/privacy}","received_events_url":"https://api.github.com/users/LGM-Doyle/received_events","type":"User","site_admin":false},"body":"This patch further improves the multi-monitor presentation.  It allows for persistence of\r\nwindow sizes, when presenting freeorion in one big window across multiple monitors.  \r\n\r\nPreviously, window sizes were not persisting because the validation  of config.xml sizes was using a maximum size from a single monitor.  \r\n\r\nThis patch adds the ability for SDLGUI to report a maximum possible width/height if\r\nall available monitors are lined up either horizontally/vertically.  That size is used for the validation.  Hence,\r\nno possible valid window sizes are rejected.\r\n\r\nThe patch does not adjust the initial sizes chosen for windows, which are still not great for multi-monitor presentation.","created_at":"2016-03-12T09:30:08Z","updated_at":"2016-03-13T12:05:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e9b76abc054954435d63c873e4146f6371c3665","assignee":null,"milestone":{"url":"https://api.github.com/repos/freeorion/freeorion/milestones/15","html_url":"https://github.com/freeorion/freeorion/milestones/Next%20release","labels_url":"https://api.github.com/repos/freeorion/freeorion/milestones/15/labels","id":1226316,"number":15,"title":"Next release","description":"Bugs, features and pull requests that should be fixed until next release.","creator":{"login":"adrianbroher","id":84891,"avatar_url":"https://avatars.githubusercontent.com/u/84891?v=3","gravatar_id":"","url":"https://api.github.com/users/adrianbroher","html_url":"https://github.com/adrianbroher","followers_url":"https://api.github.com/users/adrianbroher/followers","following_url":"https://api.github.com/users/adrianbroher/following{/other_user}","gists_url":"https://api.github.com/users/adrianbroher/gists{/gist_id}","starred_url":"https://api.github.com/users/adrianbroher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrianbroher/subscriptions","organizations_url":"https://api.github.com/users/adrianbroher/orgs","repos_url":"https://api.github.com/users/adrianbroher/repos","events_url":"https://api.github.com/users/adrianbroher/events{/privacy}","received_events_url":"https://api.github.com/users/adrianbroher/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":186,"state":"open","created_at":"2015-07-26T16:21:09Z","updated_at":"2016-03-13T11:33:04Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/freeorion/freeorion/pulls/519/commits","review_comments_url":"https://api.github.com/repos/freeorion/freeorion/pulls/519/comments","review_comment_url":"https://api.github.com/repos/freeorion/freeorion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/freeorion/freeorion/issues/519/comments","statuses_url":"https://api.github.com/repos/freeorion/freeorion/statuses/4487510d693d800b5929db351696f1e0ddd3c0f6","head":{"label":"LGM-Doyle:fix_multimonitor_persistence","ref":"fix_multimonitor_persistence","sha":"4487510d693d800b5929db351696f1e0ddd3c0f6","user":{"login":"LGM-Doyle","id":17235966,"avatar_url":"https://avatars.githubusercontent.com/u/17235966?v=3","gravatar_id":"","url":"https://api.github.com/users/LGM-Doyle","html_url":"https://github.com/LGM-Doyle","followers_url":"https://api.github.com/users/LGM-Doyle/followers","following_url":"https://api.github.com/users/LGM-Doyle/following{/other_user}","gists_url":"https://api.github.com/users/LGM-Doyle/gists{/gist_id}","starred_url":"https://api.github.com/users/LGM-Doyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LGM-Doyle/subscriptions","organizations_url":"https://api.github.com/users/LGM-Doyle/orgs","repos_url":"https://api.github.com/users/LGM-Doyle/repos","events_url":"https://api.github.com/users/LGM-Doyle/events{/privacy}","received_events_url":"https://api.github.com/users/LGM-Doyle/received_events","type":"User","site_admin":false},"repo":{"id":51704490,"name":"freeorion","full_name":"LGM-Doyle/freeorion","owner":{"login":"LGM-Doyle","id":17235966,"avatar_url":"https://avatars.githubusercontent.com/u/17235966?v=3","gravatar_id":"","url":"https://api.github.com/users/LGM-Doyle","html_url":"https://github.com/LGM-Doyle","followers_url":"https://api.github.com/users/LGM-Doyle/followers","following_url":"https://api.github.com/users/LGM-Doyle/following{/other_user}","gists_url":"https://api.github.com/users/LGM-Doyle/gists{/gist_id}","starred_url":"https://api.github.com/users/LGM-Doyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LGM-Doyle/subscriptions","organizations_url":"https://api.github.com/users/LGM-Doyle/orgs","repos_url":"https://api.github.com/users/LGM-Doyle/repos","events_url":"https://api.github.com/users/LGM-Doyle/events{/privacy}","received_events_url":"https://api.github.com/users/LGM-Doyle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/LGM-Doyle/freeorion","description":"Source code repository of the FreeOrion project.","fork":true,"url":"https://api.github.com/repos/LGM-Doyle/freeorion","forks_url":"https://api.github.com/repos/LGM-Doyle/freeorion/forks","keys_url":"https://api.github.com/repos/LGM-Doyle/freeorion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LGM-Doyle/freeorion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LGM-Doyle/freeorion/teams","hooks_url":"https://api.github.com/repos/LGM-Doyle/freeorion/hooks","issue_events_url":"https://api.github.com/repos/LGM-Doyle/freeorion/issues/events{/number}","events_url":"https://api.github.com/repos/LGM-Doyle/freeorion/events","assignees_url":"https://api.github.com/repos/LGM-Doyle/freeorion/assignees{/user}","branches_url":"https://api.github.com/repos/LGM-Doyle/freeorion/branches{/branch}","tags_url":"https://api.github.com/repos/LGM-Doyle/freeorion/tags","blobs_url":"https://api.github.com/repos/LGM-Doyle/freeorion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LGM-Doyle/freeorion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LGM-Doyle/freeorion/git/refs{/sha}","trees_url":"https://api.github.com/repos/LGM-Doyle/freeorion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LGM-Doyle/freeorion/statuses/{sha}","languages_url":"https://api.github.com/repos/LGM-Doyle/freeorion/languages","stargazers_url":"https://api.github.com/repos/LGM-Doyle/freeorion/stargazers","contributors_url":"https://api.github.com/repos/LGM-Doyle/freeorion/contributors","subscribers_url":"https://api.github.com/repos/LGM-Doyle/freeorion/subscribers","subscription_url":"https://api.github.com/repos/LGM-Doyle/freeorion/subscription","commits_url":"https://api.github.com/repos/LGM-Doyle/freeorion/commits{/sha}","git_commits_url":"https://api.github.com/repos/LGM-Doyle/freeorion/git/commits{/sha}","comments_url":"https://api.github.com/repos/LGM-Doyle/freeorion/comments{/number}","issue_comment_url":"https://api.github.com/repos/LGM-Doyle/freeorion/issues/comments{/number}","contents_url":"https://api.github.com/repos/LGM-Doyle/freeorion/contents/{+path}","compare_url":"https://api.github.com/repos/LGM-Doyle/freeorion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LGM-Doyle/freeorion/merges","archive_url":"https://api.github.com/repos/LGM-Doyle/freeorion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LGM-Doyle/freeorion/downloads","issues_url":"https://api.github.com/repos/LGM-Doyle/freeorion/issues{/number}","pulls_url":"https://api.github.com/repos/LGM-Doyle/freeorion/pulls{/number}","milestones_url":"https://api.github.com/repos/LGM-Doyle/freeorion/milestones{/number}","notifications_url":"https://api.github.com/repos/LGM-Doyle/freeorion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LGM-Doyle/freeorion/labels{/name}","releases_url":"https://api.github.com/repos/LGM-Doyle/freeorion/releases{/id}","deployments_url":"https://api.github.com/repos/LGM-Doyle/freeorion/deployments","created_at":"2016-02-14T17:21:56Z","updated_at":"2016-02-14T17:22:02Z","pushed_at":"2016-03-13T12:04:31Z","git_url":"git://github.com/LGM-Doyle/freeorion.git","ssh_url":"git@github.com:LGM-Doyle/freeorion.git","clone_url":"https://github.com/LGM-Doyle/freeorion.git","svn_url":"https://github.com/LGM-Doyle/freeorion","homepage":"http://www.freeorion.org/","size":509394,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"freeorion:master","ref":"master","sha":"f39ae428710380ba3309edb7ff9ed94046196ab8","user":{"login":"freeorion","id":1025550,"avatar_url":"https://avatars.githubusercontent.com/u/1025550?v=3","gravatar_id":"","url":"https://api.github.com/users/freeorion","html_url":"https://github.com/freeorion","followers_url":"https://api.github.com/users/freeorion/followers","following_url":"https://api.github.com/users/freeorion/following{/other_user}","gists_url":"https://api.github.com/users/freeorion/gists{/gist_id}","starred_url":"https://api.github.com/users/freeorion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freeorion/subscriptions","organizations_url":"https://api.github.com/users/freeorion/orgs","repos_url":"https://api.github.com/users/freeorion/repos","events_url":"https://api.github.com/users/freeorion/events{/privacy}","received_events_url":"https://api.github.com/users/freeorion/received_events","type":"Organization","site_admin":false},"repo":{"id":33066062,"name":"freeorion","full_name":"freeorion/freeorion","owner":{"login":"freeorion","id":1025550,"avatar_url":"https://avatars.githubusercontent.com/u/1025550?v=3","gravatar_id":"","url":"https://api.github.com/users/freeorion","html_url":"https://github.com/freeorion","followers_url":"https://api.github.com/users/freeorion/followers","following_url":"https://api.github.com/users/freeorion/following{/other_user}","gists_url":"https://api.github.com/users/freeorion/gists{/gist_id}","starred_url":"https://api.github.com/users/freeorion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freeorion/subscriptions","organizations_url":"https://api.github.com/users/freeorion/orgs","repos_url":"https://api.github.com/users/freeorion/repos","events_url":"https://api.github.com/users/freeorion/events{/privacy}","received_events_url":"https://api.github.com/users/freeorion/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/freeorion/freeorion","description":"Source code repository of the FreeOrion project.","fork":false,"url":"https://api.github.com/repos/freeorion/freeorion","forks_url":"https://api.github.com/repos/freeorion/freeorion/forks","keys_url":"https://api.github.com/repos/freeorion/freeorion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/freeorion/freeorion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/freeorion/freeorion/teams","hooks_url":"https://api.github.com/repos/freeorion/freeorion/hooks","issue_events_url":"https://api.github.com/repos/freeorion/freeorion/issues/events{/number}","events_url":"https://api.github.com/repos/freeorion/freeorion/events","assignees_url":"https://api.github.com/repos/freeorion/freeorion/assignees{/user}","branches_url":"https://api.github.com/repos/freeorion/freeorion/branches{/branch}","tags_url":"https://api.github.com/repos/freeorion/freeorion/tags","blobs_url":"https://api.github.com/repos/freeorion/freeorion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/freeorion/freeorion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/freeorion/freeorion/git/refs{/sha}","trees_url":"https://api.github.com/repos/freeorion/freeorion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/freeorion/freeorion/statuses/{sha}","languages_url":"https://api.github.com/repos/freeorion/freeorion/languages","stargazers_url":"https://api.github.com/repos/freeorion/freeorion/stargazers","contributors_url":"https://api.github.com/repos/freeorion/freeorion/contributors","subscribers_url":"https://api.github.com/repos/freeorion/freeorion/subscribers","subscription_url":"https://api.github.com/repos/freeorion/freeorion/subscription","commits_url":"https://api.github.com/repos/freeorion/freeorion/commits{/sha}","git_commits_url":"https://api.github.com/repos/freeorion/freeorion/git/commits{/sha}","comments_url":"https://api.github.com/repos/freeorion/freeorion/comments{/number}","issue_comment_url":"https://api.github.com/repos/freeorion/freeorion/issues/comments{/number}","contents_url":"https://api.github.com/repos/freeorion/freeorion/contents/{+path}","compare_url":"https://api.github.com/repos/freeorion/freeorion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/freeorion/freeorion/merges","archive_url":"https://api.github.com/repos/freeorion/freeorion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/freeorion/freeorion/downloads","issues_url":"https://api.github.com/repos/freeorion/freeorion/issues{/number}","pulls_url":"https://api.github.com/repos/freeorion/freeorion/pulls{/number}","milestones_url":"https://api.github.com/repos/freeorion/freeorion/milestones{/number}","notifications_url":"https://api.github.com/repos/freeorion/freeorion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/freeorion/freeorion/labels{/name}","releases_url":"https://api.github.com/repos/freeorion/freeorion/releases{/id}","deployments_url":"https://api.github.com/repos/freeorion/freeorion/deployments","created_at":"2015-03-29T08:22:20Z","updated_at":"2016-03-12T06:17:47Z","pushed_at":"2016-03-13T12:04:31Z","git_url":"git://github.com/freeorion/freeorion.git","ssh_url":"git@github.com:freeorion/freeorion.git","clone_url":"https://github.com/freeorion/freeorion.git","svn_url":"https://github.com/freeorion/freeorion","homepage":"http://www.freeorion.org/","size":527529,"stargazers_count":123,"watchers_count":123,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":23,"forks":52,"open_issues":23,"watchers":123,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/519"},"html":{"href":"https://github.com/freeorion/freeorion/pull/519"},"issue":{"href":"https://api.github.com/repos/freeorion/freeorion/issues/519"},"comments":{"href":"https://api.github.com/repos/freeorion/freeorion/issues/519/comments"},"review_comments":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/519/comments"},"review_comment":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/freeorion/freeorion/pulls/519/commits"},"statuses":{"href":"https://api.github.com/repos/freeorion/freeorion/statuses/4487510d693d800b5929db351696f1e0ddd3c0f6"}}}}