From 9164e3c48973a2a07bcb82a2bfff1a50a532e69e Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sun, 2 Jan 2022 17:44:55 +0100 Subject: Text input method for X11: fix for case when text widget is inside subwindow. --- src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx index 1c6c2a6bc..14c56c040 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx @@ -134,6 +134,13 @@ void Fl_Xlib_Graphics_Driver::set_spot(int font, int size, int X, int Y, int W, static XIC ic = NULL; if (!fl_xim_ic || !fl_is_over_the_spot) return; + if (Fl::focus()) { // handle case when text widget is inside subwindow + Fl_Window *focuswin = Fl::focus()->window(); + while (focuswin && focuswin->parent()) { + X += focuswin->x(); Y += focuswin->y(); + focuswin = focuswin->window(); + } + } //XSetICFocus(fl_xim_ic); if (X != fl_spot.x || Y != fl_spot.y) { fl_spot.x = X; -- cgit v1.2.3