FLTK logo

[master] 3565aa1 - Windows platform: account for GUI scaling when using input method.

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 3565aa1 - Windows platform: account for GUI scaling when using input method. "ManoloFLTK" Dec 13, 2021  
 
commit 3565aa1e60833a9e547a014081af5915a2e2732b
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Mon Dec 13 10:39:54 2021 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Mon Dec 13 10:40:05 2021 +0100

    Windows platform: account for GUI scaling when using input method.

 src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
index 0ee5cf9..e32d1ae 100644
--- src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
+++ src/drivers/GDI/Fl_GDI_Graphics_Driver.cxx
@@ -259,8 +259,7 @@ extern flTypeImmReleaseContext flImmReleaseContext;
 void Fl_GDI_Graphics_Driver::set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
 {
   if (!win) return;
-  Fl_Window* tw = win;
-  while (tw->parent()) tw = tw->window(); // find top level window
+  Fl_Window* tw = win->top_window();
 
   if (!tw->shown())
     return;
@@ -269,9 +268,10 @@ void Fl_GDI_Graphics_Driver::set_spot(int font, int size, int X, int Y, int W, i
 
   if (himc) {
     COMPOSITIONFORM cfs;
+    float s = scale();
     cfs.dwStyle = CFS_POINT;
-    cfs.ptCurrentPos.x = X;
-    cfs.ptCurrentPos.y = Y - tw->labelsize();
+    cfs.ptCurrentPos.x = X * s;
+    cfs.ptCurrentPos.y = int(Y * s) - int(tw->labelsize() * s);
     MapWindowPoints(fl_xid(win), fl_xid(tw), &cfs.ptCurrentPos, 1);
     flImmSetCompositionWindow(himc, &cfs);
     flImmReleaseContext(fl_xid(tw), himc);
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.