{"action":"created","comment":{"url":"https://api.github.com/repos/vberger/smithay/pulls/comments/105709388","pull_request_review_id":26596605,"id":105709388,"diff_hunk":"@@ -0,0 +1,87 @@\n+//! Common traits and types for opengl rendering on graphics backends\n+\n+use nix::c_void;\n+\n+/// Error that can happen when swapping buffers.\n+#[derive(Debug, Clone)]\n+pub enum SwapBuffersError {\n+    /// The OpenGL context has been lost and needs to be recreated.\n+    ///\n+    /// All the objects associated to it (textures, buffers, programs, etc.)\n+    /// need to be recreated from scratch.\n+    ///\n+    /// Operations will have no effect. Functions that read textures, buffers, etc.\n+    /// from OpenGL will return uninitialized data instead.\n+    ///\n+    /// A context loss usually happens on mobile devices when the user puts the\n+    /// application on sleep and wakes it up later. However any OpenGL implementation\n+    /// can theoretically lose the context at any time.\n+    ContextLost,\n+    /// The buffers have already been swapped.\n+    ///\n+    /// This error can be returned when `swap_buffers` has been called multiple times\n+    AlreadySwapped,\n+}\n+\n+/// All APIs related to OpenGL that you can possibly get\n+/// through OpenglRenderer implementations\n+#[derive(Debug, Clone, Copy, PartialEq, Eq)]\n+pub enum Api {\n+    /// The classical OpenGL. Available on Windows, Linux, OS/X.\n+    OpenGl,\n+    /// OpenGL embedded system. Available on Linux, Android.\n+    OpenGlEs,\n+    /// OpenGL for the web. Very similar to OpenGL ES.\n+    WebGl,\n+}\n+\n+/// Describes the pixel format of the main framebuffer\n+#[derive(Debug, Clone, Copy, PartialEq, Eq)]\n+pub struct PixelFormat {\n+    /// Is the format hardware accelerated\n+    pub hardware_accelerated: bool,\n+    /// bits used for colors","path":"src/backend/graphics/opengl.rs","position":43,"original_position":43,"commit_id":"e6c892952564fc79ae47391c821556e8c0875b29","original_commit_id":"e6c892952564fc79ae47391c821556e8c0875b29","user":{"login":"vberger","id":3009227,"avatar_url":"https://avatars0.githubusercontent.com/u/3009227?v=3","gravatar_id":"","url":"https://api.github.com/users/vberger","html_url":"https://github.com/vberger","followers_url":"https://api.github.com/users/vberger/followers","following_url":"https://api.github.com/users/vberger/following{/other_user}","gists_url":"https://api.github.com/users/vberger/gists{/gist_id}","starred_url":"https://api.github.com/users/vberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vberger/subscriptions","organizations_url":"https://api.github.com/users/vberger/orgs","repos_url":"https://api.github.com/users/vberger/repos","events_url":"https://api.github.com/users/vberger/events{/privacy}","received_events_url":"https://api.github.com/users/vberger/received_events","type":"User","site_admin":false},"body":"\"number of bits...\", same for the other fields of this struct","created_at":"2017-03-13T16:43:25Z","updated_at":"2017-03-13T17:02:37Z","html_url":"https://github.com/vberger/smithay/pull/9#discussion_r105709388","pull_request_url":"https://api.github.com/repos/vberger/smithay/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/vberger/smithay/pulls/comments/105709388"},"html":{"href":"https://github.com/vberger/smithay/pull/9#discussion_r105709388"},"pull_request":{"href":"https://api.github.com/repos/vberger/smithay/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/vberger/smithay/pulls/9","id":109536266,"html_url":"https://github.com/vberger/smithay/pull/9","diff_url":"https://github.com/vberger/smithay/pull/9.diff","patch_url":"https://github.com/vberger/smithay/pull/9.patch","issue_url":"https://api.github.com/repos/vberger/smithay/issues/9","number":9,"state":"open","locked":false,"title":"[WIP] First draft of a glutin backend","user":{"login":"Drakulix","id":4404502,"avatar_url":"https://avatars1.githubusercontent.com/u/4404502?v=3","gravatar_id":"","url":"https://api.github.com/users/Drakulix","html_url":"https://github.com/Drakulix","followers_url":"https://api.github.com/users/Drakulix/followers","following_url":"https://api.github.com/users/Drakulix/following{/other_user}","gists_url":"https://api.github.com/users/Drakulix/gists{/gist_id}","starred_url":"https://api.github.com/users/Drakulix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Drakulix/subscriptions","organizations_url":"https://api.github.com/users/Drakulix/orgs","repos_url":"https://api.github.com/users/Drakulix/repos","events_url":"https://api.github.com/users/Drakulix/events{/privacy}","received_events_url":"https://api.github.com/users/Drakulix/received_events","type":"User","site_admin":false},"body":"So here is a good amount of code I have been experimenting and playing with and that needs a lot of discussion, which is why I am uploading it (please don't merge yet, it doesn't even compile).\r\n\r\n- had to enable the \"dlopen\" feature of wayland-server because otherwise things become broken when compiling with glutin (probably because glutin is still using wayland-client 0.7).\r\n- I am thinking about dropping the whole `backend/graphics` module right now. The OpenglRenderer is currently only coping traits and types from `glutin` and `glium`. I also made sure there is a way to layer `gfx-rs` on top of that, but currently there is a lot of code duplication happening right now. I feel there is probably need for a general opengl context library, that just describes how a `GlContext` should look like and that every library uses. But that will not happen any time soon and I don't find it troublesome, if every backend just provides it's own rendering api. We can perhaps layer a very simple optional one for drawing windows on top of all of them. But it is fact, that every rendering backend will work totally different and it does not seem reasonable to merge all OpenGL backends together.\r\n- On the other hand the input trait seems to work out, but it requires a lot of additional discussion about the api:\r\n    - What kind of devices can be up to the compositor to handle? I have no idea, how for example gamepad input works on linux. Is that even abstracted or do all games just talk to the raw device?\r\n    - How does on describe touch events?\r\n    - Do we save Modifiers? (I think we should)\r\n    - I feel like everybody is using it's own types again and that a generic input library just describing how input should look, is needed here. The format in existing libraries is so different, that handling each backend individually makes much less sense here (compared to graphics).\r\n    - I am not sure, if I should continue with the ID's or should just make `InputDevice` generic. But I think this approach avoids much code duplication when dealing with multiple backends at once. If you don't care about the internal identifier of the different backends you should be able to handle all of them with a single handler.\r\n- how difficult would it be to run closures on the event loop for every tick? Getting multi-threaded with opengl contexts is not much fun.","created_at":"2017-03-07T17:58:56Z","updated_at":"2017-03-13T17:02:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce14a045edfa685bea133dae32a361447d1d0b12","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/vberger/smithay/pulls/9/commits","review_comments_url":"https://api.github.com/repos/vberger/smithay/pulls/9/comments","review_comment_url":"https://api.github.com/repos/vberger/smithay/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vberger/smithay/issues/9/comments","statuses_url":"https://api.github.com/repos/vberger/smithay/statuses/e6c892952564fc79ae47391c821556e8c0875b29","head":{"label":"Drakulix:feature/glutin","ref":"feature/glutin","sha":"e6c892952564fc79ae47391c821556e8c0875b29","user":{"login":"Drakulix","id":4404502,"avatar_url":"https://avatars1.githubusercontent.com/u/4404502?v=3","gravatar_id":"","url":"https://api.github.com/users/Drakulix","html_url":"https://github.com/Drakulix","followers_url":"https://api.github.com/users/Drakulix/followers","following_url":"https://api.github.com/users/Drakulix/following{/other_user}","gists_url":"https://api.github.com/users/Drakulix/gists{/gist_id}","starred_url":"https://api.github.com/users/Drakulix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Drakulix/subscriptions","organizations_url":"https://api.github.com/users/Drakulix/orgs","repos_url":"https://api.github.com/users/Drakulix/repos","events_url":"https://api.github.com/users/Drakulix/events{/privacy}","received_events_url":"https://api.github.com/users/Drakulix/received_events","type":"User","site_admin":false},"repo":{"id":83716870,"name":"smithay","full_name":"Drakulix/smithay","owner":{"login":"Drakulix","id":4404502,"avatar_url":"https://avatars1.githubusercontent.com/u/4404502?v=3","gravatar_id":"","url":"https://api.github.com/users/Drakulix","html_url":"https://github.com/Drakulix","followers_url":"https://api.github.com/users/Drakulix/followers","following_url":"https://api.github.com/users/Drakulix/following{/other_user}","gists_url":"https://api.github.com/users/Drakulix/gists{/gist_id}","starred_url":"https://api.github.com/users/Drakulix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Drakulix/subscriptions","organizations_url":"https://api.github.com/users/Drakulix/orgs","repos_url":"https://api.github.com/users/Drakulix/repos","events_url":"https://api.github.com/users/Drakulix/events{/privacy}","received_events_url":"https://api.github.com/users/Drakulix/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Drakulix/smithay","description":"A smithy for rusty wayland compositors","fork":true,"url":"https://api.github.com/repos/Drakulix/smithay","forks_url":"https://api.github.com/repos/Drakulix/smithay/forks","keys_url":"https://api.github.com/repos/Drakulix/smithay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Drakulix/smithay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Drakulix/smithay/teams","hooks_url":"https://api.github.com/repos/Drakulix/smithay/hooks","issue_events_url":"https://api.github.com/repos/Drakulix/smithay/issues/events{/number}","events_url":"https://api.github.com/repos/Drakulix/smithay/events","assignees_url":"https://api.github.com/repos/Drakulix/smithay/assignees{/user}","branches_url":"https://api.github.com/repos/Drakulix/smithay/branches{/branch}","tags_url":"https://api.github.com/repos/Drakulix/smithay/tags","blobs_url":"https://api.github.com/repos/Drakulix/smithay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Drakulix/smithay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Drakulix/smithay/git/refs{/sha}","trees_url":"https://api.github.com/repos/Drakulix/smithay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Drakulix/smithay/statuses/{sha}","languages_url":"https://api.github.com/repos/Drakulix/smithay/languages","stargazers_url":"https://api.github.com/repos/Drakulix/smithay/stargazers","contributors_url":"https://api.github.com/repos/Drakulix/smithay/contributors","subscribers_url":"https://api.github.com/repos/Drakulix/smithay/subscribers","subscription_url":"https://api.github.com/repos/Drakulix/smithay/subscription","commits_url":"https://api.github.com/repos/Drakulix/smithay/commits{/sha}","git_commits_url":"https://api.github.com/repos/Drakulix/smithay/git/commits{/sha}","comments_url":"https://api.github.com/repos/Drakulix/smithay/comments{/number}","issue_comment_url":"https://api.github.com/repos/Drakulix/smithay/issues/comments{/number}","contents_url":"https://api.github.com/repos/Drakulix/smithay/contents/{+path}","compare_url":"https://api.github.com/repos/Drakulix/smithay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Drakulix/smithay/merges","archive_url":"https://api.github.com/repos/Drakulix/smithay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Drakulix/smithay/downloads","issues_url":"https://api.github.com/repos/Drakulix/smithay/issues{/number}","pulls_url":"https://api.github.com/repos/Drakulix/smithay/pulls{/number}","milestones_url":"https://api.github.com/repos/Drakulix/smithay/milestones{/number}","notifications_url":"https://api.github.com/repos/Drakulix/smithay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Drakulix/smithay/labels{/name}","releases_url":"https://api.github.com/repos/Drakulix/smithay/releases{/id}","deployments_url":"https://api.github.com/repos/Drakulix/smithay/deployments","created_at":"2017-03-02T19:34:04Z","updated_at":"2017-03-02T19:34:06Z","pushed_at":"2017-03-12T22:11:53Z","git_url":"git://github.com/Drakulix/smithay.git","ssh_url":"git@github.com:Drakulix/smithay.git","clone_url":"https://github.com/Drakulix/smithay.git","svn_url":"https://github.com/Drakulix/smithay","homepage":null,"size":581,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"vberger:master","ref":"master","sha":"7090bad8ec44ee3f80c10dd3fe49f0f63d16dcd0","user":{"login":"vberger","id":3009227,"avatar_url":"https://avatars0.githubusercontent.com/u/3009227?v=3","gravatar_id":"","url":"https://api.github.com/users/vberger","html_url":"https://github.com/vberger","followers_url":"https://api.github.com/users/vberger/followers","following_url":"https://api.github.com/users/vberger/following{/other_user}","gists_url":"https://api.github.com/users/vberger/gists{/gist_id}","starred_url":"https://api.github.com/users/vberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vberger/subscriptions","organizations_url":"https://api.github.com/users/vberger/orgs","repos_url":"https://api.github.com/users/vberger/repos","events_url":"https://api.github.com/users/vberger/events{/privacy}","received_events_url":"https://api.github.com/users/vberger/received_events","type":"User","site_admin":false},"repo":{"id":79542705,"name":"smithay","full_name":"vberger/smithay","owner":{"login":"vberger","id":3009227,"avatar_url":"https://avatars0.githubusercontent.com/u/3009227?v=3","gravatar_id":"","url":"https://api.github.com/users/vberger","html_url":"https://github.com/vberger","followers_url":"https://api.github.com/users/vberger/followers","following_url":"https://api.github.com/users/vberger/following{/other_user}","gists_url":"https://api.github.com/users/vberger/gists{/gist_id}","starred_url":"https://api.github.com/users/vberger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vberger/subscriptions","organizations_url":"https://api.github.com/users/vberger/orgs","repos_url":"https://api.github.com/users/vberger/repos","events_url":"https://api.github.com/users/vberger/events{/privacy}","received_events_url":"https://api.github.com/users/vberger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vberger/smithay","description":"A smithy for rusty wayland compositors","fork":false,"url":"https://api.github.com/repos/vberger/smithay","forks_url":"https://api.github.com/repos/vberger/smithay/forks","keys_url":"https://api.github.com/repos/vberger/smithay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vberger/smithay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vberger/smithay/teams","hooks_url":"https://api.github.com/repos/vberger/smithay/hooks","issue_events_url":"https://api.github.com/repos/vberger/smithay/issues/events{/number}","events_url":"https://api.github.com/repos/vberger/smithay/events","assignees_url":"https://api.github.com/repos/vberger/smithay/assignees{/user}","branches_url":"https://api.github.com/repos/vberger/smithay/branches{/branch}","tags_url":"https://api.github.com/repos/vberger/smithay/tags","blobs_url":"https://api.github.com/repos/vberger/smithay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vberger/smithay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vberger/smithay/git/refs{/sha}","trees_url":"https://api.github.com/repos/vberger/smithay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vberger/smithay/statuses/{sha}","languages_url":"https://api.github.com/repos/vberger/smithay/languages","stargazers_url":"https://api.github.com/repos/vberger/smithay/stargazers","contributors_url":"https://api.github.com/repos/vberger/smithay/contributors","subscribers_url":"https://api.github.com/repos/vberger/smithay/subscribers","subscription_url":"https://api.github.com/repos/vberger/smithay/subscription","commits_url":"https://api.github.com/repos/vberger/smithay/commits{/sha}","git_commits_url":"https://api.github.com/repos/vberger/smithay/git/commits{/sha}","comments_url":"https://api.github.com/repos/vberger/smithay/comments{/number}","issue_comment_url":"https://api.github.com/repos/vberger/smithay/issues/comments{/number}","contents_url":"https://api.github.com/repos/vberger/smithay/contents/{+path}","compare_url":"https://api.github.com/repos/vberger/smithay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vberger/smithay/merges","archive_url":"https://api.github.com/repos/vberger/smithay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vberger/smithay/downloads","issues_url":"https://api.github.com/repos/vberger/smithay/issues{/number}","pulls_url":"https://api.github.com/repos/vberger/smithay/pulls{/number}","milestones_url":"https://api.github.com/repos/vberger/smithay/milestones{/number}","notifications_url":"https://api.github.com/repos/vberger/smithay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vberger/smithay/labels{/name}","releases_url":"https://api.github.com/repos/vberger/smithay/releases{/id}","deployments_url":"https://api.github.com/repos/vberger/smithay/deployments","created_at":"2017-01-20T08:53:24Z","updated_at":"2017-03-06T16:32:15Z","pushed_at":"2017-03-12T22:11:55Z","git_url":"git://github.com/vberger/smithay.git","ssh_url":"git@github.com:vberger/smithay.git","clone_url":"https://github.com/vberger/smithay.git","svn_url":"https://github.com/vberger/smithay","homepage":null,"size":567,"stargazers_count":5,"watchers_count":5,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":8,"forks":2,"open_issues":8,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vberger/smithay/pulls/9"},"html":{"href":"https://github.com/vberger/smithay/pull/9"},"issue":{"href":"https://api.github.com/repos/vberger/smithay/issues/9"},"comments":{"href":"https://api.github.com/repos/vberger/smithay/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/vberger/smithay/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/vberger/smithay/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vberger/smithay/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/vberger/smithay/statuses/e6c892952564fc79ae47391c821556e8c0875b29"}}}}
{"actor":{"display_login":"vberger"}}