1 /* 2 * Copyright (C) 2016 Google, Inc. 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 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 { 24 public: 25 ShellXcb(Game &game); 26 ~ShellXcb(); 27 28 void run(); quit()29 void quit() { quit_ = true; } 30 31 private: 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 57