summaryrefslogtreecommitdiff
path: root/include/m_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/m_utils.h')
-rw-r--r--include/m_utils.h54
1 files changed, 16 insertions, 38 deletions
diff --git a/include/m_utils.h b/include/m_utils.h
index 9d9d689e3a..72508724ee 100644
--- a/include/m_utils.h
+++ b/include/m_utils.h
@@ -207,25 +207,14 @@ EXTERN_C MIR_CORE_DLL(int) WindowList_BroadcastAsync(MWindowList hList, UINT mes
// lParam = not used
#define HLK_SETDISABLECOLOUR (WM_USER+102) // added in 0.3.1
-/***************************** Window Position Saving ***************************/
+/////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////// Window Position Saving ////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
-// saves the position of a window in the database v0.1.1.0+
-// wParam = 0
-// lParam = (LPARAM)(SAVEWINDOWPOS*)&swp
+// saves the position of a window in the database
// returns 0 on success, nonzero on failure
-typedef struct {
- HWND hwnd;
- MCONTACT hContact;
- const char *szModule; //module name to store the setting in
- const char *szNamePrefix; //text to prefix on "x", "width", etc, to form setting names
-} SAVEWINDOWPOS;
-#define MS_UTILS_SAVEWINDOWPOSITION "Utils/SaveWindowPos"
-__forceinline INT_PTR Utils_SaveWindowPosition(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix) {
- SAVEWINDOWPOS swp;
- swp.hwnd = hwnd; swp.hContact = hContact; swp.szModule = szModule; swp.szNamePrefix = szNamePrefix;
- return CallService(MS_UTILS_SAVEWINDOWPOSITION, 0, (LPARAM)&swp);
-}
+
+EXTERN_C MIR_CORE_DLL(int) Utils_SaveWindowPosition(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix);
/////////////////////////////////////////////////////////////////////////////////////////
// restores the position of a window from the database v0.1.1.0+
@@ -240,32 +229,21 @@ __forceinline INT_PTR Utils_SaveWindowPosition(HWND hwnd, MCONTACT hContact, con
#define RWPF_NOMOVE 2 //don't use stored position
#define RWPF_NOACTIVATE 4 //show but don't activate v0.3.3.0+
#define RWPF_HIDDEN 8 //make it hidden
-#define MS_UTILS_RESTOREWINDOWPOSITION "Utils/RestoreWindowPos"
-__forceinline INT_PTR Utils_RestoreWindowPositionEx(HWND hwnd, int flags, MCONTACT hContact, const char *szModule, const char *szNamePrefix) {
- SAVEWINDOWPOS swp;
- swp.hwnd = hwnd; swp.hContact = hContact; swp.szModule = szModule; swp.szNamePrefix = szNamePrefix;
- return CallService(MS_UTILS_RESTOREWINDOWPOSITION, flags, (LPARAM)&swp);
-}
-__forceinline INT_PTR Utils_RestoreWindowPosition(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix) {
- return Utils_RestoreWindowPositionEx(hwnd, 0, hContact, szModule, szNamePrefix);
-}
-__forceinline INT_PTR Utils_RestoreWindowPositionNoSize(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix) {
- return Utils_RestoreWindowPositionEx(hwnd, RWPF_NOSIZE, hContact, szModule, szNamePrefix);
+
+EXTERN_C MIR_CORE_DLL(int) Utils_RestoreWindowPosition(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix, int flags = 0);
+
+__forceinline int Utils_RestoreWindowPositionNoSize(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix)
+{ return Utils_RestoreWindowPosition(hwnd, hContact, szModule, szNamePrefix, RWPF_NOSIZE);
}
-__forceinline INT_PTR Utils_RestoreWindowPositionNoMove(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix) {
- return Utils_RestoreWindowPositionEx(hwnd, RWPF_NOMOVE, hContact, szModule, szNamePrefix);
+__forceinline int Utils_RestoreWindowPositionNoMove(HWND hwnd, MCONTACT hContact, const char *szModule, const char *szNamePrefix)
+{ return Utils_RestoreWindowPosition(hwnd, hContact, szModule, szNamePrefix, RWPF_NOMOVE);
}
/////////////////////////////////////////////////////////////////////////////////////////
-// Moves a RECT inside screen if it is outside.It works with multiple monitors v0.9.0.4+
-// wParam = RECT *
-// lParam = 0
-// returns <0 on error, 0 if not changed the rect, 1 if changed the rect
-
-#define MS_UTILS_ASSERTINSIDESCREEN "Utils/AssertInsideScreen"
-__forceinline INT_PTR Utils_AssertInsideScreen(RECT *rc) {
- return CallService(MS_UTILS_ASSERTINSIDESCREEN, (WPARAM)rc, 0);
-}
+// Moves a RECT inside screen if it is outside. It works with multiple monitors
+// returns < 0 on error, 0 if not changed the rect, 1 if changed the rect
+
+EXTERN_C MIR_CORE_DLL(int) Utils_AssertInsideScreen(RECT *rc);
/************************ Colour Picker Control (0.1.2.1+) **********************/