# HG changeset patch # User Alex Baines # Date 1408483733 -3600 # Node ID 903ef7fa1e709b928a48b2e80c2fd826ab703468 # Parent 8110b8a073f6ba283574e5e7e48cef1ecc8abadf Take the window border size into account when positioning the IBus candidate list. diff -r 8110b8a073f6 -r 903ef7fa1e70 src/core/linux/SDL_ibus.c --- a/src/core/linux/SDL_ibus.c Mon Aug 18 18:44:08 2014 -0700 +++ b/src/core/linux/SDL_ibus.c Tue Aug 19 22:28:53 2014 +0100 @@ -22,10 +22,16 @@ #ifdef HAVE_IBUS_IBUS_H #include "SDL.h" +#include "SDL_syswm.h" #include "SDL_ibus.h" #include "SDL_dbus.h" #include "../../video/SDL_sysvideo.h" #include "../../events/SDL_keyboard_c.h" + +#if SDL_VIDEO_DRIVER_X11 + #include "../../video/x11/SDL_x11video.h" +#endif + #include #include #include @@ -545,9 +551,31 @@ SDL_Window *focused_win = SDL_GetFocusWindow(); if(!focused_win) return; + + SDL_SysWMinfo info; + SDL_VERSION(&info.version); + + if(!SDL_GetWindowWMInfo(focused_win, &info)) return; + + int x = 0, y = 0; + + SDL_GetWindowPosition(focused_win, &x, &y); + +#if SDL_VIDEO_DRIVER_X11 + if(info.subsystem == SDL_SYSWM_X11){ + SDL_DisplayData *displaydata = + (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; + + Display *x_disp = info.info.x11.display; + Window x_win = info.info.x11.window; + int x_screen = displaydata->screen; + Window unused; + + X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), + 0, 0, &x, &y, &unused); + } +#endif - int x = 0, y = 0; - SDL_GetWindowPosition(focused_win, &x, &y); x += ibus_cursor_rect.x; y += ibus_cursor_rect.y;