bool sdlwrap_get_wm_info(SDL_SysWMinfo *info) { #ifdef XENON (void)info; return false; #elif SDL_MODERN if (g_window) return SDL_GetWindowWMInfo(g_window, info); else return SDL_GetWMInfo(info) == 1; #else return SDL_GetWMInfo(info) == 1; #endif }
void FnResourcesCallbackCreate(const string& sPathname, void* pvCallbackData) { static bool b = true; if ( b ) { b = false; SDL_SysWMinfo wmi = { 0 }; SDL_GetWMInfo(&wmi); SetWindowPos(wmi.window, HWND_TOP, NULL, NULL, NULL, NULL, SWP_NOMOVE|SWP_NOREPOSITION |SWP_NOSIZE); GetRender()->BeginProjection(eProjectionOrtho); { // GetUi()->FindWindow("splash")->FindChild("frame")->FindChild("frame")->FindChild("image")->ResizeBy(CVec2i(GetRandom(-2, 2), GetRandom(-2,2))); GetGlue()->HandleScript("[ui.splash.frame.frame.loading set text:'loading %s']", sPathname.c_str()); GetUi()->Render(); } GetRender()->EndProjection(eProjectionOrtho); GetRender()->Swap(); GetRender()->Update(); b = true; } }
int get_nearest_monitor_rect( int *x, int *y, int *width, int *height ) { SDL_SysWMinfo info; HMONITOR monitor; MONITORINFO monitorInfo; SDL_VERSION(&info.version); if ( !SDL_GetWMInfo(&info) ) { D( "%s: SDL_GetWMInfo() failed: %s", __FUNCTION__, SDL_GetError()); return -1; } monitor = MonitorFromWindow( info.window, MONITOR_DEFAULTTONEAREST ); monitorInfo.cbSize = sizeof(monitorInfo); GetMonitorInfo( monitor, &monitorInfo ); *x = monitorInfo.rcMonitor.left; *y = monitorInfo.rcMonitor.top; *width = monitorInfo.rcMonitor.right - *x; *height = monitorInfo.rcMonitor.bottom - *y; D("%s: found (x,y,w,h)=(%d,%d,%d,%d)", __FUNCTION__, *x, *y, *width, *height); return 0; }
/** @brief Obtain a reference to the system's native display * @param window : pointer to save the display reference * @return : 0 if the function passed, else 1 */ int8_t GetNativeDisplay( void ) { if (eglSettings[CFG_MODE] == RENDER_RAW) /* RAW FB mode */ { printf( "EGLport: Using EGL_DEFAULT_DISPLAY\n" ); nativeDisplay = EGL_DEFAULT_DISPLAY; } else if (eglSettings[CFG_MODE] == RENDER_SDL) /* SDL/X11 mode */ { #if defined(USE_EGL_SDL) printf( "EGLport: Opening SDL/X11 display\n" ); SDL_VERSION(&sysWmInfo.version); SDL_GetWMInfo(&sysWmInfo); nativeDisplay = (EGLNativeDisplayType)sysWmInfo.info.x11.display; if (nativeDisplay == 0) { printf( "EGLport ERROR: unable to get display!\n" ); return 1; } #else printf( "EGLport ERROR: SDL mode was not enabled in this compile!\n" ); #endif } return 0; }
std::string CClipboard::GetContents() const { std::string contents; #if defined(__APPLE__) || defined(HEADLESS) // Nothing for now #elif defined(WIN32) OpenClipboard(NULL); const void* p = GetClipboardData(CF_TEXT); if (p != NULL) { contents = (char*)p; } CloseClipboard(); #else // only works with the cut-buffer method (xterm) // (and not with the more recent selections method) SDL_SysWMinfo sdlinfo; SDL_VERSION(&sdlinfo.version); if (SDL_GetWMInfo(&sdlinfo)) { sdlinfo.info.x11.lock_func(); Display* display = sdlinfo.info.x11.display; int count = 0; char* msg = XFetchBytes(display, &count); if ((msg != NULL) && (count > 0)) { contents.append((char*)msg, count); } XFree(msg); sdlinfo.info.x11.unlock_func(); } #endif return contents; };
bool SpringApp::GetDisplayGeometry() { SDL_SysWMinfo info; SDL_VERSION(&info.version); if (!SDL_GetWMInfo(&info)) { return false; } gu->screenSizeX = GetSystemMetrics(SM_CXFULLSCREEN); gu->screenSizeY = GetSystemMetrics(SM_CYFULLSCREEN); RECT rect; if (!GetClientRect(info.window, &rect)) { return false; } if((rect.right - rect.left)==0 || (rect.bottom - rect.top)==0) return false; gu->winSizeX = rect.right - rect.left; gu->winSizeY = rect.bottom - rect.top; // translate from client coords to screen coords MapWindowPoints(info.window, HWND_DESKTOP, (LPPOINT)&rect, 2); gu->winPosX = rect.left; gu->winPosY = gu->screenSizeY - gu->winSizeY - rect.top; return true; }
/** * Sets the window titlebar icon. * For Windows, use the embedded resource icon. * For other systems, use a PNG icon. * @param winResource ID for Windows icon. * @param unixPath Path to PNG icon for Unix. */ void setWindowIcon(int winResource, const std::string &unixPath) { #ifdef _WIN32 HINSTANCE handle = GetModuleHandle(NULL); HICON icon = LoadIcon(handle, MAKEINTRESOURCE(winResource)); SDL_SysWMinfo wminfo; SDL_VERSION(&wminfo.version) if (SDL_GetWMInfo(&wminfo)) { HWND hwnd = wminfo.window; SetClassLongPtr(hwnd, GCLP_HICON, (LONG_PTR)icon); } #else // SDL only takes UTF-8 filenames // so here's an ugly hack to match this ugly reasoning std::string utf8 = Language::wstrToUtf8(Language::fsToWstr(unixPath)); SDL_Surface *icon = IMG_Load(utf8.c_str()); if (icon != 0) { SDL_WM_SetIcon(icon, NULL); SDL_FreeSurface(icon); } #endif }
static int init(void) { LOG_DEBUG(2,"Initialising SDL video driver\n"); #ifdef WINDOWS32 if (!getenv("SDL_VIDEODRIVER")) putenv("SDL_VIDEODRIVER=windib"); #endif if (!SDL_WasInit(SDL_INIT_NOPARACHUTE)) { if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) { LOG_ERROR("Failed to initialise SDL: %s\n", SDL_GetError()); return 1; } } if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) { LOG_ERROR("Failed to initialise SDL video driver: %s\n", SDL_GetError()); return 1; } if (set_fullscreen(xroar_fullscreen)) return 1; #ifdef WINDOWS32 { SDL_version sdlver; SDL_SysWMinfo sdlinfo; SDL_VERSION(&sdlver); sdlinfo.version = sdlver; SDL_GetWMInfo(&sdlinfo); windows32_main_hwnd = sdlinfo.window; } #endif set_mode(0); return 0; }
void clippy_init(void) { SDL_SysWMinfo info; has_sys_clip = 0; memset(&info, 0, sizeof(info)); SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info)) { #if defined(USE_X11) if (info.subsystem == SDL_SYSWM_X11) { SDL_Display = info.info.x11.display; SDL_Window = info.info.x11.window; lock_display = info.info.x11.lock_func; unlock_display = info.info.x11.unlock_func; SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); SDL_SetEventFilter(_x11_clip_filter); has_sys_clip = 1; atom_sel = XInternAtom(SDL_Display, "SDL_SELECTION", False); atom_clip = XInternAtom(SDL_Display, "CLIPBOARD", False); orig_xlib_err = XSetErrorHandler(handle_xlib_err); } if (!lock_display) lock_display = __noop_v; if (!unlock_display) unlock_display = __noop_v; #elif defined(WIN32) has_sys_clip = 1; SDL_Window = info.window; #elif defined(__QNXNTO__) has_sys_clip = 1; inputgroup = PhInputGroup(NULL); #endif } }
void Renderer::Init() { #ifdef _WIN32 m_CurrentContext = wglGetCurrentContext(); m_CurrentDC = wglGetCurrentDC(); // release current context wglMakeCurrent( nullptr, nullptr ); #endif #ifdef __linux__ // Rendering works fine under X in a separate thread, but quitting breaks some SDL internals. Haven't figured it out yet. if (!XInitThreads()) { THROW( "XLib is not thread safe." ); } SDL_SysWMinfo wm_info; SDL_VERSION( &wm_info.version ); if ( SDL_GetWMInfo( &wm_info ) ) { // TODO: drag-n-drop for non win32 Display *display = wm_info.info.x11.gfxdisplay; m_CurrentContext = glXGetCurrentContext(); ASSERT( m_CurrentContext, "Error! No current GL context!" ); glXMakeCurrent( display, None, nullptr ); XSync( display, false ); } #endif }
qboolean IN_ShutdownRawMouse(void) { RAWINPUTDEVICE dev = { 1, // usUsagePage - generic desktop controls 2, // usUsage - mouse RIDEV_REMOVE, // dwFlags NULL // hwndTarget }; if (!RegisterRawInputDevices(&dev, 1, sizeof(dev))) { Com_Printf("Mouse release failed. (0x%lx)\n", GetLastError()); return qfalse; } mouseRaw = qfalse; Com_DPrintf("Released raw input mouse.\n"); if (SDLWindowProc) { SDL_SysWMinfo wmInfo; SDL_VERSION(&wmInfo.version); SDL_GetWMInfo(&wmInfo); SetWindowLongPtr(wmInfo.window, GWLP_WNDPROC, (LONG_PTR)SDLWindowProc); SDLWindowProc = NULL; } return qtrue; }
qboolean IN_InitRawMouse(void) { // http://www.usb.org/developers/devclass_docs/Hut1_12.pdf if (!SDLWindowProc) { SDL_SysWMinfo wmInfo; SDL_VERSION(&wmInfo.version); SDL_GetWMInfo(&wmInfo); SDLWindowProc = (WNDPROC)GetWindowLongPtr(wmInfo.window, GWLP_WNDPROC); SetWindowLongPtr(wmInfo.window, GWLP_WNDPROC, (LONG_PTR)RawWndProc); } { RAWINPUTDEVICE dev = { 1, // usUsagePage - generic desktop controls 2, // usUsage - mouse 0, // dwFlags 0 // hwndTarget }; if (!RegisterRawInputDevices(&dev, 1, sizeof(dev))) { Com_Printf("Raw input registration failed. (0x%lx)\n", GetLastError()); return qfalse; } } Com_DPrintf("Registered for raw input.\n"); mouseRaw = qtrue; return qtrue; }
void CHwX11Cursor::Finish() { if (cimages.size()<1) return; //resize images for (std::vector<XcursorImage*>::iterator it = cimages.begin(); it < cimages.end(); ++it) resizeImage(*it, xmaxsize, ymaxsize); XcursorImages *cis = XcursorImagesCreate(cimages.size()); cis->nimage = cimages.size(); for (int i = 0; i < int(cimages.size()); ++i) { XcursorImage* ci = cimages[i]; ci->xhot = (hotSpot==CMouseCursor::TopLeft) ? 0 : ci->width/2; ci->yhot = (hotSpot==CMouseCursor::TopLeft) ? 0 : ci->height/2; cis->images[i] = ci; } SDL_SysWMinfo info; SDL_VERSION(&info.version); if (!SDL_GetWMInfo(&info)) { XcursorImagesDestroy(cis); cimages.clear(); logOutput.Print("SDL error: can't get X11 window info"); return; } cursor = XcursorImagesLoadCursor(info.info.x11.display,cis); XcursorImagesDestroy(cis); cimages.clear(); }
SDL_Thread* SDL_GL_CreateThread(int (*fn)(void *), void *data) { SDL_SysWMinfo info; SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info) == -1) { // Could not get SDL version info. return NULL; } gl_thread_device = GetDC(info.window); gl_thread_context = wglCreateContext(gl_thread_device); if (gl_thread_context == NULL) { // Could not create new OpenGL context return NULL; } BOOL err = wglShareLists(info.hglrc, gl_thread_context); if (err == 0) { int code = GetLastError(); //Could not get OpenGL share lists: %i return NULL; } gl_thread_func = fn; gl_thread_data = data; return SDL_CreateThread(gl_thread_create, NULL); }
int SDL_WM_CreateTempContext() { SDL_SysWMinfo info; SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info) == -1) { // Could not get SDL version info. return 1; } temp_device = GetDC(info.window); temp_context = wglCreateContext(temp_device); if (temp_context == NULL) { // Could not create OpenGL context return 2; } if (!wglShareLists(info.hglrc, temp_context)) { // Could not share lists with temp context. return 3; } return 0; }
static void ResetScreenSaverTimeout() { #ifndef HEADLESS #if defined(WIN32) static unsigned lastreset = 0; unsigned curreset = SDL_GetTicks(); if(globalRendering->active && (curreset - lastreset > 1000)) { lastreset = curreset; int timeout; // reset screen saver timer if(SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &timeout, 0)) SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, timeout, NULL, 0); } #elif defined(__APPLE__) // TODO: implement return; #else static unsigned lastreset = 0; unsigned curreset = SDL_GetTicks(); if(globalRendering->active && (curreset - lastreset > 1000)) { lastreset = curreset; SDL_SysWMinfo info; SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info)) { XForceScreenSaver(info.info.x11.display, ScreenSaverReset); } } #endif #endif }
static const guint16 *sdl_get_keymap(size_t *maplen) { #if defined(WIN32) *maplen = qemu_input_map_atset1_to_qcode_len; return qemu_input_map_atset1_to_qcode; #else #if defined(SDL_VIDEO_DRIVER_X11) SDL_SysWMinfo info; SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info) > 0) { return qemu_xkeymap_mapping_table( info.info.x11.display, maplen); } #endif g_warning("Unsupported SDL video driver / platform.\n" "Assuming Linux KBD scancodes, but probably wrong.\n" "Please report to [email protected]\n" "including the following information:\n" "\n" " - Operating system\n" " - SDL video driver\n"); *maplen = qemu_input_map_xorgkbd_to_qcode_len; return qemu_input_map_xorgkbd_to_qcode; #endif }
// // SDLMouse::debug // void SDLMouse::debug() const { #if defined(_WIN32) && !defined(_XBOX) // get a handle to the window SDL_SysWMinfo wminfo; SDL_VERSION(&wminfo.version) SDL_GetWMInfo(&wminfo); HWND cur_window = wminfo.window; // determine the hwndTarget parameter of the registered rawinput device HWND hwndTarget = NULL; RAWINPUTDEVICE device; if (getMouseRawInputDevice(device)) { hwndTarget = device.hwndTarget; } Printf(PRINT_HIGH, "SDLMouse: Current Window Address: 0x%x, RAWINPUTDEVICE Window: 0x%x\n", cur_window, hwndTarget); WNDPROC wndproc = (WNDPROC)GetWindowLongPtr(cur_window, GWLP_WNDPROC); Printf(PRINT_HIGH, "SDLMouse: Current Window WNDPROC Address: 0x%x\n", wndproc); #endif }
static void copy_to_clipboard_target(const char* text, int clipboard) { Display* dpy; Window window; SDL_SysWMinfo wminfo; Atom selection; SDL_VERSION(&wminfo.version); if (SDL_GetWMInfo(&wminfo) && (wminfo.subsystem == SDL_SYSWM_X11)) { wminfo.info.x11.lock_func(); dpy = wminfo.info.x11.display; window = wminfo.info.x11.window; if (targets_atom == None) targets_atom = XInternAtom(dpy, "TARGETS", False); if (clipboard) { selection = XInternAtom(dpy, "CLIPBOARD", False); if (cur_text_clipboard) free(cur_text_clipboard); cur_text_clipboard = strdup(text); } else { selection = XA_PRIMARY; if (cur_text_primary) free(cur_text_primary); cur_text_primary = strdup(text); } //property = XInternAtom(dpy, "PASTE", 0); XSetSelectionOwner(dpy, selection, window, CurrentTime); wminfo.info.x11.unlock_func(); } }
bool getClipboardContents(std::string& text) { SDL_SysWMinfo info; //logger->log("Clipboard: Retrieving buffer..."); SDL_VERSION(&info.version); if ( SDL_GetWMInfo(&info) ) { Display *dpy = info.info.x11.display; Window us = info.info.x11.window; char *data = NULL; if (!data) data = getSelection(dpy, us, XA_PRIMARY); if (!data) data = getSelection(dpy, us, XA_SECONDARY); if (!data) { Atom XA_CLIPBOARD = XInternAtom(dpy, "CLIPBOARD", 0); data = getSelection(dpy, us, XA_CLIPBOARD); } if (data) { text = strprintf("%s", data); XFree(data); return true; } } return false; }
bool SpringApp::GetDisplayGeometry() { SDL_SysWMinfo info; SDL_VERSION(&info.version); if (!SDL_GetWMInfo(&info)) { return false; } info.info.x11.lock_func(); { Display* display = info.info.x11.display; Window window = info.info.x11.window; XWindowAttributes attrs; XGetWindowAttributes(display, window, &attrs); const Screen* screen = attrs.screen; gu->screenSizeX = WidthOfScreen(screen); gu->screenSizeY = HeightOfScreen(screen); gu->winSizeX = attrs.width; gu->winSizeY = attrs.height; Window tmp; int xp, yp; XTranslateCoordinates(display, window, attrs.root, 0, 0, &xp, &yp, &tmp); gu->winPosX = xp; gu->winPosY = gu->screenSizeY - gu->winSizeY - yp; } info.info.x11.unlock_func(); return true; }
static _Bool init(void) { #ifdef WINDOWS32 if (!getenv("SDL_VIDEODRIVER")) putenv("SDL_VIDEODRIVER=windib"); #endif if (!SDL_WasInit(SDL_INIT_NOPARACHUTE)) { if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) { LOG_ERROR("Failed to initialise SDL: %s\n", SDL_GetError()); return 0; } } if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) { LOG_ERROR("Failed to initialise SDL video: %s\n", SDL_GetError()); return 0; } #ifdef WINDOWS32 { SDL_version sdlver; SDL_SysWMinfo sdlinfo; SDL_VERSION(&sdlver); sdlinfo.version = sdlver; SDL_GetWMInfo(&sdlinfo); windows32_main_hwnd = sdlinfo.window; } #endif return 1; }
static void net_wm_set_property(char *atom, int state) { SDL_SysWMinfo info; SDL_VERSION(&info.version); if ( SDL_GetWMInfo(&info) <= 0 ) { return; } XEvent xev; int set = _NET_WM_STATE_ADD; Atom type, property; if (state == _NET_WM_STATE_TOGGLE) set = _NET_WM_STATE_TOGGLE; else if (!state) set = _NET_WM_STATE_REMOVE; type = XInternAtom(info.info.x11.display, "_NET_WM_STATE", True); if (type == None) return; property = XInternAtom(info.info.x11.display, atom, 0); if (property == None) return; xev.type = ClientMessage; xev.xclient.type = ClientMessage; xev.xclient.window = info.info.x11.wmwindow; xev.xclient.message_type = type; xev.xclient.format = 32; xev.xclient.data.l[0] = set; xev.xclient.data.l[1] = property; xev.xclient.data.l[2] = 0; if (!XSendEvent(info.info.x11.display, DefaultRootWindow(info.info.x11.display), False, SubstructureRedirectMask|SubstructureNotifyMask, &xev)) { fprintf(stderr,"error changing X11 property\n"); } }
int platform_init(int gles_version) { #ifdef FREMANTLE SDL_GLES_Init(gles_version == 2 ? SDL_GLES_VERSION_2_0 : SDL_GLES_VERSION_1_1); screen = SDL_SetVideoMode(0, 0, 0, SDL_FULLSCREEN); SDL_GLES_MakeCurrent(SDL_GLES_CreateContext()); #else /* FREMANTLE */ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, gles_version); screen = SDL_SetVideoMode(0, 0, 0, SDL_OPENGLES | SDL_FULLSCREEN); #endif /* FREMANTLE */ if ( screen==NULL ) { return 0; } #ifndef FREMANTLE /* Set up swipe lock (left and right) */ SDL_SysWMinfo wm; SDL_VERSION(&wm.version); SDL_GetWMInfo(&wm); Display *dpy = wm.info.x11.display; Atom atom = XInternAtom(dpy, "_MEEGOTOUCH_CUSTOM_REGION", False); unsigned int region[] = { 0, MEEGOTOUCH_BORDER, screen->w, screen->h - 2*MEEGOTOUCH_BORDER, }; XChangeProperty(dpy, wm.info.x11.wmwindow, atom, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)region, 4); #endif return 1; }
/* get current display resolution from X11 */ void get_display_res(int *w, int *h) { SDL_SysWMinfo info; *w = *h = -1; SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info) > 0 && info.subsystem == SDL_SYSWM_X11) { XWindowAttributes attrs; Window root, parent, *children; unsigned int n; info.info.x11.lock_func(); /* find the root window */ if (XQueryTree(info.info.x11.display, info.info.x11.wmwindow, &root, &parent, &children, &n)) { if (children != NULL) XFree(children); /* get width and height of the root window */ if (XGetWindowAttributes(info.info.x11.display, root, &attrs)) { *w = attrs.width; *h = attrs.height; } } info.info.x11.unlock_func(); } }
int init_aclip() { SDL_SysWMinfo info; int retval; retval = -1; SDL_VERSION(&info.version); #if SDL_VERSION_ATLEAST(2, 0, 0) if ( SDL_GetWindowWMInfo(host->video->Window(), &info) ) #else if ( SDL_GetWMInfo(&info) ) #endif { /* Save the information for later use */ if ( info.subsystem == SDL_SYSWM_X11 ) { SDL_Display = info.info.x11.display; SDL_window = info.info.x11.window; #if !SDL_VERSION_ATLEAST(2, 0, 0) Lock_Display = info.info.x11.lock_func; Unlock_Display = info.info.x11.unlock_func; #endif /* Enable the special window hook events */ SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); retval = 0; } else { SDL_SetError("SDL is not running on X11"); } } return retval; }
int get_nearest_monitor_rect( int *x, int *y, int *width, int *height ) { SDL_SysWMinfo info; Display* display; int screen; SDL_VERSION(&info.version); if ( !SDL_GetWMInfo(&info) ) { D( "%s: SDL_GetWMInfo() failed: %s", __FUNCTION__, SDL_GetError()); return -1; } if (x11_lib_init() < 0) return -1; display = info.info.x11.display; screen = FF(XDefaultScreen)(display); *x = 0; *y = 0; *width = FF(XDisplayWidth)(display, screen); *height = FF(XDisplayHeight)(display, screen); D("%s: found (x,y,w,h)=(%d,%d,%d,%d)", __FUNCTION__, *x, *y, *width, *height); return 0; }
static int check_for_evdev(void) { SDL_SysWMinfo info; XkbDescPtr desc; int has_evdev = 0; const char *keycodes; SDL_VERSION(&info.version); if (!SDL_GetWMInfo(&info)) return 0; desc = XkbGetKeyboard(info.info.x11.display, XkbGBN_AllComponentsMask, XkbUseCoreKbd); if (desc == NULL || desc->names == NULL) return 0; keycodes = XGetAtomName(info.info.x11.display, desc->names->keycodes); if (keycodes == NULL) fprintf(stderr, "could not lookup keycode name\n"); else if (strstart(keycodes, "evdev", NULL)) has_evdev = 1; else if (!strstart(keycodes, "xfree86", NULL)) fprintf(stderr, "unknown keycodes `%s', please report to [email protected]\n", keycodes); XkbFreeClientMap(desc, XkbGBN_AllComponentsMask, True); return has_evdev; }
static int check_for_evdev(void) { SDL_SysWMinfo info; XkbDescPtr desc = NULL; int has_evdev = 0; char *keycodes = NULL; SDL_VERSION(&info.version); if (!SDL_GetWMInfo(&info)) { return 0; } desc = XkbGetKeyboard(info.info.x11.display, XkbGBN_AllComponentsMask, XkbUseCoreKbd); if (desc && desc->names) { keycodes = XGetAtomName(info.info.x11.display, desc->names->keycodes); if (keycodes == NULL) { fprintf(stderr, "could not lookup keycode name\n"); } else if (strstart(keycodes, "evdev", NULL)) { has_evdev = 1; } else if (!strstart(keycodes, "xfree86", NULL)) { fprintf(stderr, "unknown keycodes `%s', please report to " "[email protected]\n", keycodes); } } if (desc) { XkbFreeKeyboard(desc, XkbGBN_AllComponentsMask, True); } if (keycodes) { XFree(keycodes); } return has_evdev; }
HWND GetHwnd() { SDL_SysWMinfo wmi; SDL_VERSION(&wmi.version); if (!SDL_GetWMInfo(&wmi)) return(NULL); return(wmi.window); }