Tony Barbour | 2f18b29 | 2016-02-25 15:44:10 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 Google, Inc. |
| 3 | * |
Jon Ashburn | 43b53e8 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Tony Barbour | 2f18b29 | 2016-02-25 15:44:10 -0700 | [diff] [blame] | 7 | * |
Jon Ashburn | 43b53e8 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Tony Barbour | 2f18b29 | 2016-02-25 15:44:10 -0700 | [diff] [blame] | 9 | * |
Jon Ashburn | 43b53e8 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Tony Barbour | 2f18b29 | 2016-02-25 15:44:10 -0700 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #ifndef SHELL_XCB_H |
| 18 | #define SHELL_XCB_H |
| 19 | |
| 20 | #include <xcb/xcb.h> |
| 21 | #include "Shell.h" |
| 22 | |
| 23 | class ShellXcb : public Shell { |
Mark Lobodzinski | bc9caa5 | 2017-01-26 12:16:30 -0700 | [diff] [blame^] | 24 | public: |
Tony Barbour | 2f18b29 | 2016-02-25 15:44:10 -0700 | [diff] [blame] | 25 | ShellXcb(Game &game); |
| 26 | ~ShellXcb(); |
| 27 | |
| 28 | void run(); |
| 29 | void quit() { quit_ = true; } |
| 30 | |
Mark Lobodzinski | bc9caa5 | 2017-01-26 12:16:30 -0700 | [diff] [blame^] | 31 | private: |
Tony Barbour | 2f18b29 | 2016-02-25 15:44:10 -0700 | [diff] [blame] | 32 | void init_connection(); |
| 33 | |
| 34 | PFN_vkGetInstanceProcAddr load_vk(); |
| 35 | bool can_present(VkPhysicalDevice phy, uint32_t queue_family); |
| 36 | |
| 37 | void create_window(); |
| 38 | VkSurfaceKHR create_surface(VkInstance instance); |
| 39 | |
| 40 | void handle_event(const xcb_generic_event_t *ev); |
| 41 | void loop_wait(); |
| 42 | void loop_poll(); |
| 43 | |
| 44 | xcb_connection_t *c_; |
| 45 | xcb_screen_t *scr_; |
| 46 | xcb_window_t win_; |
| 47 | |
| 48 | xcb_atom_t wm_protocols_; |
| 49 | xcb_atom_t wm_delete_window_; |
| 50 | |
| 51 | void *lib_handle_; |
| 52 | |
| 53 | bool quit_; |
| 54 | }; |
| 55 | |
| 56 | #endif // SHELL_XCB_H |