Take the window border size into account when positioning the IBus candidate list.

main
Alex Baines 2014-08-19 22:28:53 +01:00
parent eba65c66a3
commit 6f84f37c0a
1 changed files with 29 additions and 1 deletions

View File

@ -22,10 +22,16 @@
#ifdef HAVE_IBUS_IBUS_H #ifdef HAVE_IBUS_IBUS_H
#include "SDL.h" #include "SDL.h"
#include "SDL_syswm.h"
#include "SDL_ibus.h" #include "SDL_ibus.h"
#include "SDL_dbus.h" #include "SDL_dbus.h"
#include "../../video/SDL_sysvideo.h" #include "../../video/SDL_sysvideo.h"
#include "../../events/SDL_keyboard_c.h" #include "../../events/SDL_keyboard_c.h"
#if SDL_VIDEO_DRIVER_X11
#include "../../video/x11/SDL_x11video.h"
#endif
#include <sys/inotify.h> #include <sys/inotify.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
@ -546,8 +552,30 @@ SDL_IBus_UpdateTextRect(SDL_Rect *rect)
if(!focused_win) return; if(!focused_win) return;
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if(!SDL_GetWindowWMInfo(focused_win, &info)) return;
int x = 0, y = 0; int x = 0, y = 0;
SDL_GetWindowPosition(focused_win, &x, &y); 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
x += ibus_cursor_rect.x; x += ibus_cursor_rect.x;
y += ibus_cursor_rect.y; y += ibus_cursor_rect.y;