X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvideo%2Fomapdss%2Flinux%2Fxenv.c;h=5a81cc7a5fd12409f3337675c84be9a2ec9a54b0;hb=ee7e6b2d8bc82029aac405d13f719f4532851224;hp=40bf92c91d5bfcdeb2673c11181fae527fda9b2c;hpb=090bcb85b9cebd193299c9e93f4de8c5888094f4;p=sdl_omap.git diff --git a/src/video/omapdss/linux/xenv.c b/src/video/omapdss/linux/xenv.c index 40bf92c..5a81cc7 100644 --- a/src/video/omapdss/linux/xenv.c +++ b/src/video/omapdss/linux/xenv.c @@ -58,12 +58,16 @@ struct xstuff { FPTR(XPending); FPTR(XLookupKeysym); FPTR(XkbSetDetectableAutoRepeat); + FPTR(XkbKeycodeToKeysym); FPTR(XStoreName); FPTR(XIconifyWindow); FPTR(XMoveResizeWindow); FPTR(XInternAtom); + FPTR(XAllocWMHints); + FPTR(XGetWMHints); FPTR(XSetWMHints); FPTR(XSync); + FPTR(XFree); }; static struct xstuff g_xstuff; @@ -117,12 +121,16 @@ static int x11h_init(int *xenv_flags, const char *window_title) FPTR_LINK(g_xstuff, x11lib, XPending); FPTR_LINK(g_xstuff, x11lib, XLookupKeysym); FPTR_LINK(g_xstuff, x11lib, XkbSetDetectableAutoRepeat); + FPTR_LINK(g_xstuff, x11lib, XkbKeycodeToKeysym); FPTR_LINK(g_xstuff, x11lib, XStoreName); FPTR_LINK(g_xstuff, x11lib, XIconifyWindow); FPTR_LINK(g_xstuff, x11lib, XMoveResizeWindow); FPTR_LINK(g_xstuff, x11lib, XInternAtom); + FPTR_LINK(g_xstuff, x11lib, XAllocWMHints); + FPTR_LINK(g_xstuff, x11lib, XGetWMHints); FPTR_LINK(g_xstuff, x11lib, XSetWMHints); FPTR_LINK(g_xstuff, x11lib, XSync); + FPTR_LINK(g_xstuff, x11lib, XFree); //XInitThreads(); @@ -259,7 +267,7 @@ static int x11h_minimize(void) Window window = g_xstuff.window; int screen = DefaultScreen(g_xstuff.display); int display_width, display_height; - XWMHints wm_hints; + XWMHints *wm_hints; XEvent evt; g_xstuff.pXWithdrawWindow(display, window, screen); @@ -268,9 +276,16 @@ static int x11h_minimize(void) g_xstuff.pXChangeWindowAttributes(display, window, CWOverrideRedirect, &attributes); - wm_hints.flags = StateHint; - wm_hints.initial_state = IconicState; - g_xstuff.pXSetWMHints(display, window, &wm_hints); + wm_hints = g_xstuff.pXGetWMHints(display, window); + if (wm_hints == NULL) { + wm_hints = XAllocWMHints(); + wm_hints->flags = 0; + } + wm_hints->flags |= StateHint; + wm_hints->initial_state = IconicState; + g_xstuff.pXSetWMHints(display, window, wm_hints); + g_xstuff.pXFree(wm_hints); + wm_hints = NULL; g_xstuff.pXMapWindow(display, window); @@ -424,6 +439,29 @@ int xenv_minimize(void) return -1; } +int xenv_keycode_to_keysym(int kc, int shift) +{ + if (g_xstuff.display) + return g_xstuff.pXkbKeycodeToKeysym(g_xstuff.display, + kc, 0, shift); + + return -1; +} + +int xenv_get_window(void **display, int *screen, void **window) +{ + *display = *window = NULL; + *screen = 0; + if (g_xstuff.display && g_xstuff.window) { + *display = g_xstuff.display; + *screen = DefaultScreen(g_xstuff.display); + *window = (void *)g_xstuff.window; + return 0; + } + + return -1; +} + void xenv_finish(void) { // TODO: cleanup X?