~sircmpwn/xrgears

ref: fb9d492b99b8bb61f3c60bd3c976bccb800df57d xrgears/vitamin-k/vikWindow.hpp -rw-r--r-- 870 bytes
fb9d492b — Lubosz Sarnecki move surface and format to swapchain. 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once

#include <stdio.h>
#include <string.h>

namespace vik {
class Window {
public:

  enum window_type {
    AUTO = 0,
    KMS,
    XCB_SIMPLE,
    XCB_MOUSE,
    WAYLAND_XDG,
    WAYLAND_LEGACY,
    KHR_DISPLAY,
    INVALID
  };

  Window() {}
  ~Window() {}

  static inline bool streq(const char *a, const char *b) {
    return strcmp(a, b) == 0;
  }

  static window_type window_type_from_string(const char *s) {
    if (streq(s, "auto"))
      return AUTO;
    else if (streq(s, "kms"))
      return KMS;
    else if (streq(s, "xcb"))
      return XCB_SIMPLE;
    else if (streq(s, "wayland"))
      return WAYLAND_XDG;
    else if (streq(s, "xcb-input"))
      return XCB_MOUSE;
    else if (streq(s, "wayland-legacy"))
      return WAYLAND_LEGACY;
    else if (streq(s, "khr-display"))
      return KHR_DISPLAY;
    else
      return INVALID;
  }

};
}