| 90 | } |
| 91 | |
| 92 | int main(int /*_argc*/, const char* const* /*_argv*/) |
| 93 | { |
| 94 | XInitThreads(); |
| 95 | Display* display = XOpenDisplay(NULL); |
| 96 | |
| 97 | int32_t screen = DefaultScreen(display); |
| 98 | int32_t depth = DefaultDepth(display, screen); |
| 99 | Visual* visual = DefaultVisual(display, screen); |
| 100 | Window root = RootWindow(display, screen); |
| 101 | |
| 102 | XSetWindowAttributes windowAttrs; |
| 103 | windowAttrs.background_pixel = 0; |
| 104 | windowAttrs.background_pixmap = 0; |
| 105 | windowAttrs.border_pixel = 0; |
| 106 | windowAttrs.event_mask = 0 |
| 107 | | ButtonPressMask |
| 108 | | ButtonReleaseMask |
| 109 | | ExposureMask |
| 110 | | KeyPressMask |
| 111 | | KeyReleaseMask |
| 112 | | PointerMotionMask |
| 113 | | StructureNotifyMask |
| 114 | ; |
| 115 | |
| 116 | Window window = XCreateWindow(display |
| 117 | , root |
| 118 | , 0, 0 |
| 119 | , width, height, 0 |
| 120 | , depth |
| 121 | , InputOutput |
| 122 | , visual |
| 123 | , CWBorderPixel|CWEventMask |
| 124 | , &windowAttrs |
| 125 | ); |
| 126 | |
| 127 | // Clear window to black. |
| 128 | XSetWindowAttributes attr; |
| 129 | memset(&attr, 0, sizeof(attr) ); |
| 130 | XChangeWindowAttributes(display, window, CWBackPixel, &attr); |
| 131 | |
| 132 | const char* wmDeleteWindowName = "WM_DELETE_WINDOW"; |
| 133 | Atom wmDeleteWindow; |
| 134 | XInternAtoms(display, (char **)&wmDeleteWindowName, 1, False, &wmDeleteWindow); |
| 135 | XSetWMProtocols(display, window, &wmDeleteWindow, 1); |
| 136 | |
| 137 | XMapWindow(display, window); |
| 138 | XStoreName(display, window, s_applicationName); |
| 139 | |
| 140 | XClassHint* hint = XAllocClassHint(); |
| 141 | hint->res_name = const_cast<char*>(s_applicationName); |
| 142 | hint->res_class = const_cast<char*>(s_applicationClass); |
| 143 | XSetClassHint(display, window, hint); |
| 144 | XFree(hint); |
| 145 | |
| 146 | XIM im = XOpenIM(display, NULL, NULL, NULL); |
| 147 | |
| 148 | XIC ic = XCreateIC(im |
| 149 | , XNInputStyle |
nothing calls this directly
no test coverage detected