https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4c4e3d60483e5b54d6e61…
commit 4c4e3d60483e5b54d6e61a2489606b496ee76116
Author:     Bișoc George <fraizeraust99(a)gmail.com>
AuthorDate: Sun Jul 21 16:52:25 2019 +0200
Commit:     Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Jul 21 16:52:25 2019 +0200
    [OSK] Use new coordinates on keyboard layout changing (#1745)
    CORE-16214
---
 base/applications/osk/main.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
diff --git a/base/applications/osk/main.c b/base/applications/osk/main.c
index 4bb7f5010cb..0a3a001fa91 100644
--- a/base/applications/osk/main.c
+++ b/base/applications/osk/main.c
@@ -22,6 +22,7 @@ int OSK_DlgClose(void);
 int OSK_DlgTimer(void);
 BOOL OSK_DlgCommand(WPARAM wCommand, HWND hWndControl);
 BOOL OSK_ReleaseKey(WORD ScanCode);
+VOID OSK_RestoreDlgPlacement(HWND hDlg);
 INT_PTR APIENTRY OSK_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
 LRESULT APIENTRY OSK_ThemeHandler(HWND hDlg, NMCUSTOMDRAW *pNmDraw);
@@ -255,6 +256,18 @@ int OSK_DlgInitDialog(HWND hDlg)
     return TRUE;
 }
+/***********************************************************************
+ *
+ *           OSK_RestoreDlgPlacement
+ *
+ *  Restores the dialog placement
+ */
+VOID OSK_RestoreDlgPlacement(HWND hDlg)
+{
+    LoadDataFromRegistry();
+    SetWindowPos(hDlg, (Globals.bAlwaysOnTop ? HWND_TOPMOST : HWND_NOTOPMOST),
Globals.PosX, Globals.PosY, 0, 0, SWP_NOSIZE);
+}
+
 /***********************************************************************
  *
  *           OSK_DlgClose
@@ -593,6 +606,13 @@ INT_PTR APIENTRY OSK_DlgProc(HWND hDlg, UINT msg, WPARAM wParam,
LPARAM lParam)
                         CheckMenuItem(GetMenu(hDlg), IDM_ENHANCED_KB, MF_BYCOMMAND |
MF_CHECKED);
                         CheckMenuItem(GetMenu(hDlg), IDM_STANDARD_KB, MF_BYCOMMAND |
MF_UNCHECKED);
+                        /*
+                            Before creating the dialog box restore the coordinates. The
user can
+                            move the dialog around before choosing a different dialog
layout therefore
+                            we must create the dialog with the new coordinates.
+                        */
+                        OSK_RestoreDlgPlacement(hDlg);
+
                         /* Finally, display the dialog modal box with the enhanced
keyboard dialog */
                         DialogBoxW(Globals.hInstance,
                                    MAKEINTRESOURCEW(MAIN_DIALOG_ENHANCED_KB),
@@ -619,6 +639,13 @@ INT_PTR APIENTRY OSK_DlgProc(HWND hDlg, UINT msg, WPARAM wParam,
LPARAM lParam)
                         CheckMenuItem(GetMenu(hDlg), IDM_ENHANCED_KB, MF_BYCOMMAND |
MF_UNCHECKED);
                         CheckMenuItem(GetMenu(hDlg), IDM_STANDARD_KB, MF_BYCOMMAND |
MF_CHECKED);
+                        /*
+                            Before creating the dialog box restore the coordinates. The
user can
+                            move the dialog around before choosing a different dialog
layout therefore
+                            we must create the dialog with the new coordinates.
+                        */
+                        OSK_RestoreDlgPlacement(hDlg);
+
                         /* Finally, display the dialog modal box with the standard
keyboard dialog */
                         DialogBoxW(Globals.hInstance,
                                    MAKEINTRESOURCEW(MAIN_DIALOG_STANDARD_KB),