diff options
| author | nasr <nsrddyn@gmail.com> | 2026-10-06 23:32:02 +0200 |
|---|---|---|
| committer | nasr <nsrddyn@gmail.com> | 2026-10-06 23:32:02 +0200 |
| commit | e467661baf3d035fb4726559abee52a0c8897ab0 (patch) | |
| tree | f51bb6caf00a6bde1234fb58cd1285891fe4b4e6 /source/base/base_platform.h | |
| parent | f6d3090f7fa76eb8e0dbe060b8490cb49c001c39 (diff) | |
feature: wayland connection
Diffstat (limited to 'source/base/base_platform.h')
| -rw-r--r-- | source/base/base_platform.h | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/source/base/base_platform.h b/source/base/base_platform.h index aa7ba4b..10f90b0 100644 --- a/source/base/base_platform.h +++ b/source/base/base_platform.h | |||
| @@ -88,7 +88,7 @@ internal s32 x11_read_input(); | |||
| 88 | #define LinuxGetDisplayWdith(display, screen_num) DisplayWidth(display, screen_num) | 88 | #define LinuxGetDisplayWdith(display, screen_num) DisplayWidth(display, screen_num) |
| 89 | #define LinuxGetDisplayHeight(display, screen_num) DisplayHeight(display, screen_num); | 89 | #define LinuxGetDisplayHeight(display, screen_num) DisplayHeight(display, screen_num); |
| 90 | #define LinuxLoadBitMapFromFile(display, window, path, width, height, out, hotspot_x, hotspot_y) \ | 90 | #define LinuxLoadBitMapFromFile(display, window, path, width, height, out, hotspot_x, hotspot_y) \ |
| 91 | XReadBitmapFile(display, window, ) | 91 | XReadBitmapFile(display, window, ) |
| 92 | 92 | ||
| 93 | #include "base_platform_linux_x11.cpp" | 93 | #include "base_platform_linux_x11.cpp" |
| 94 | 94 | ||
| @@ -120,6 +120,34 @@ global_variable const u32 wayland_format_xrgb8888 = 1; | |||
| 120 | global_variable const u32 wayland_header_size = 8; | 120 | global_variable const u32 wayland_header_size = 8; |
| 121 | global_variable const u32 color_channels = 4; | 121 | global_variable const u32 color_channels = 4; |
| 122 | 122 | ||
| 123 | enum state_state_t: u16 { | ||
| 124 | STATE_NONE, | ||
| 125 | STATE_SURFACE_ACKED_CONFIGURE, | ||
| 126 | STATE_SURFACE_ATTACHED, | ||
| 127 | }; | ||
| 128 | |||
| 129 | typedef struct state_t state_t; | ||
| 130 | struct state_t { | ||
| 131 | uint32_t wl_registry; | ||
| 132 | uint32_t wl_shm; | ||
| 133 | uint32_t wl_shm_pool; | ||
| 134 | uint32_t wl_buffer; | ||
| 135 | uint32_t xdg_wm_base; | ||
| 136 | uint32_t xdg_surface; | ||
| 137 | uint32_t wl_compositor; | ||
| 138 | uint32_t wl_surface; | ||
| 139 | uint32_t xdg_toplevel; | ||
| 140 | uint32_t stride; | ||
| 141 | uint32_t w; | ||
| 142 | uint32_t h; | ||
| 143 | uint32_t shm_pool_size; | ||
| 144 | int shm_fd; | ||
| 145 | uint8_t *shm_pool_data; | ||
| 146 | |||
| 147 | state_state_t state; | ||
| 148 | }; | ||
| 149 | |||
| 150 | |||
| 123 | #include "base_platform_linux_wayland.cpp" | 151 | #include "base_platform_linux_wayland.cpp" |
| 124 | 152 | ||
| 125 | #endif // X11 and Wayland -- set by build params | 153 | #endif // X11 and Wayland -- set by build params |
| @@ -189,7 +217,7 @@ internal HWND win32_create_window(HINSTANCE instance, int height, int width, int | |||
| 189 | int display_y, const char *window_name); | 217 | int display_y, const char *window_name); |
| 190 | 218 | ||
| 191 | #define Win32CreateWindow(instance, height, width, display_x, display_y) \ | 219 | #define Win32CreateWindow(instance, height, width, display_x, display_y) \ |
| 192 | win32_create_window(instance, height, width, display_x, display_y) | 220 | win32_create_window(instance, height, width, display_x, display_y) |
| 193 | 221 | ||
| 194 | #define PlatformCreateWindow(instance, height, width, display_x, display_y) \ | 222 | #define PlatformCreateWindow(instance, height, width, display_x, display_y) \ |
| 195 | Win32CreateWindow(instance, height, width, display_x, display_y) | 223 | Win32CreateWindow(instance, height, width, display_x, display_y) |
