{"action":"opened","issue":{"url":"https://api.github.com/repos/julianghionoiu/dev-screen-record/issues/3","repository_url":"https://api.github.com/repos/julianghionoiu/dev-screen-record","labels_url":"https://api.github.com/repos/julianghionoiu/dev-screen-record/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/julianghionoiu/dev-screen-record/issues/3/comments","events_url":"https://api.github.com/repos/julianghionoiu/dev-screen-record/issues/3/events","html_url":"https://github.com/julianghionoiu/dev-screen-record/issues/3","id":347641413,"node_id":"MDU6SXNzdWUzNDc2NDE0MTM=","number":3,"title":"InputFromScreen does not account for the default screen's position","user":{"login":"Jezorko","id":18513492,"node_id":"MDQ6VXNlcjE4NTEzNDky","avatar_url":"https://avatars1.githubusercontent.com/u/18513492?v=4","gravatar_id":"","url":"https://api.github.com/users/Jezorko","html_url":"https://github.com/Jezorko","followers_url":"https://api.github.com/users/Jezorko/followers","following_url":"https://api.github.com/users/Jezorko/following{/other_user}","gists_url":"https://api.github.com/users/Jezorko/gists{/gist_id}","starred_url":"https://api.github.com/users/Jezorko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jezorko/subscriptions","organizations_url":"https://api.github.com/users/Jezorko/orgs","repos_url":"https://api.github.com/users/Jezorko/repos","events_url":"https://api.github.com/users/Jezorko/events{/privacy}","received_events_url":"https://api.github.com/users/Jezorko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-04T19:07:05Z","updated_at":"2018-08-04T19:07:05Z","closed_at":null,"author_association":"NONE","body":"Only the size of the screen is used to determine screen bounds ([see here](https://github.com/julianghionoiu/dev-screen-record/blob/8d5761d1aaefdc3513e263dcbe3689b8a3b4949b/src/main/java/tdl/record/screen/image/input/InputFromScreen.java#L25)).\r\n\r\nConsider the following use case:\r\n\r\n![two screens of various sizes, primary screen positioned on the right from the secondary screen](https://i.imgur.com/c56c829.png)\r\n\r\nThere are two screens, **primary** and **secondary**.\r\nThe primary screen's dimensions are 1600px by 900px. It is positioned to the right from the secondary screen, with position offset being equal to the size of the secondary screen—in this case 1400px.\r\n\r\nThe `InputFromScreen` class will determine primary screen bounds correctly as 1600x900, but without the position. Therefore the region marked with a red border on the image below will be recorded:\r\n\r\n![two screens like on the image above, with a red border indicating the recording region](https://i.imgur.com/PplvXcd.png)\r\n\r\nThis can be fixed by using the [GraphicsConfiguration#getBounds()](https://docs.oracle.com/javase/8/docs/api/java/awt/GraphicsConfiguration.html) method of the default [GraphicsDevice](https://docs.oracle.com/javase/8/docs/api/java/awt/GraphicsDevice.html) like:\r\n\r\n```java\r\nthis.screenBounds = GraphicsEnvironment.getLocalGraphicsEnvironment()\r\n                                       .getDefaultScreenDevice()\r\n                                       .getDefaultConfiguration()\r\n                                       .getBounds();\r\n```\r\n\r\nNow, I did not check if the rectangle is properly handled downstream, so this might not be a sufficient solution all by itself."}}
{"actor":{"display_login":"Jezorko"}}