summaryrefslogtreecommitdiffstats
path: root/src/os_mswin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os_mswin.c')
-rw-r--r--src/os_mswin.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/os_mswin.c b/src/os_mswin.c
index 97803a89df..d199f3e241 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -155,12 +155,7 @@ extern char g_szOrigTitle[];
#ifdef FEAT_GUI
extern HWND s_hwnd;
#else
-# if (defined(FEAT_PRINTER) && !defined(FEAT_POSTSCRIPT)) \
- || defined(FEAT_CLIENTSERVER) \
- || (defined(FEAT_EVAL) && !defined(FEAT_GUI))
-# define HAVE_GETCONSOLEHWND
static HWND s_hwnd = 0; /* console window handle, set by GetConsoleHwnd() */
-# endif
#endif
extern int WSInitialized;
@@ -1537,7 +1532,7 @@ Trace(
#endif //_DEBUG
-#ifdef HAVE_GETCONSOLEHWND
+#if !defined(FEAT_GUI) || defined(PROTO)
# if defined(FEAT_TITLE) && defined(WIN3264)
extern HWND g_hWnd; /* This is in os_win32.c. */
# endif
@@ -1580,6 +1575,32 @@ GetConsoleHwnd(void)
SetConsoleTitle(pszOldWindowTitle);
}
+
+/*
+ * Console implementation of ":winpos".
+ */
+ int
+mch_get_winpos(int *x, int *y)
+{
+ RECT rect;
+
+ GetConsoleHwnd();
+ GetWindowRect(s_hwnd, &rect);
+ *x = rect.left;
+ *y = rect.top;
+ return OK;
+}
+
+/*
+ * Console implementation of ":winpos x y".
+ */
+ void
+mch_set_winpos(int x, int y)
+{
+ GetConsoleHwnd();
+ SetWindowPos(s_hwnd, NULL, x, y, 0, 0,
+ SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
+}
#endif
#if (defined(FEAT_PRINTER) && !defined(FEAT_POSTSCRIPT)) || defined(PROTO)