Skip to content

Commit 9b8c8ae

Browse files
committed
V2025.6.0
Fixes #76
1 parent 5abd25e commit 9b8c8ae

File tree

6 files changed

+80
-12
lines changed

6 files changed

+80
-12
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 2025.6.0
4+
### Breaking Changes
5+
None
6+
### New APIs
7+
#### App
8+
- Added the ability for `WindowGeometry` to remeber window poisition on Windows
9+
### Fixes
10+
None
11+
312
## 2025.5.3
413
### Breaking Changes
514
#### Localization

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ endif()
2020
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
2121

2222
#libnick Definition
23-
project ("libnick" LANGUAGES C CXX VERSION 2025.5.3 DESCRIPTION "A cross-platform base for native Nickvision applications.")
23+
project ("libnick" LANGUAGES C CXX VERSION 2025.6.0 DESCRIPTION "A cross-platform base for native Nickvision applications.")
2424
include(CMakePackageConfigHelpers)
2525
include(GNUInstallDirs)
2626
include(CTest)

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "libnick"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = "2025.5.3"
51+
PROJECT_NUMBER = "2025.6.0"
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewer a

include/app/windowgeometry.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#ifndef WINDOWGEOMETRY_H
2424
#define WINDOWGEOMETRY_H
2525

26+
#include <boost/json.hpp>
2627
#ifdef _WIN32
2728
#include <windows.h>
2829
#endif
@@ -47,12 +48,22 @@ namespace Nickvision::App
4748
*/
4849
WindowGeometry(long width, long height, bool isMaximized);
4950
#ifdef _WIN32
51+
/**
52+
* @brief Construct a WindowGeometry.
53+
* @param width The width of the window
54+
* @param height The height of the window
55+
* @param isMaximized Whether or not the window is maximized
56+
* @param x The x position of the window
57+
* @param y The y position of the window
58+
*/
59+
WindowGeometry(long width, long height, bool isMaximized, long x, long y);
5060
/**
5161
* @brief Construct a WindowGeometry.
5262
* @param hwnd The window handle to get the geometry from
5363
*/
5464
WindowGeometry(HWND hwnd);
5565
#endif
66+
WindowGeometry(boost::json::object json);
5667
/**
5768
* @brief Gets the width of the window.
5869
* @return The width of the window
@@ -91,12 +102,17 @@ namespace Nickvision::App
91102
*/
92103
bool apply(HWND hwnd) const;
93104
#endif
105+
boost::json::object toJson() const;
94106

95107
private:
96108
long m_width;
97109
long m_height;
98110
bool m_isMaximized;
111+
#ifdef _WIN32
112+
long m_x;
113+
long m_y;
114+
#endif
99115
};
100116
}
101117

102-
#endif //WINDOWGEOMETRY_H
118+
#endif //WINDOWGEOMETRY_H

manual/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66

77
libnick provides Nickvision apps with a common set of cross-platform APIs for managing system and desktop app functionality such as network management, taskbar icons, translations, app updates, and more.
88

9-
## 2025.5.3
9+
## 2025.6.0
1010
### Breaking Changes
11-
#### Localization
12-
- `_f()` and `_fn()` macros now return `std::string` instead of `const char*`
13-
### New APIs
1411
None
12+
### New APIs
13+
#### App
14+
- Added the ability for `WindowGeometry` to remeber window poisition on Windows
1515
### Fixes
16-
#### System
17-
- Fixed `Process::pause()` and `Process::resume()` not working on Windows
16+
None
1817

1918
## Dependencies
2019
The following are a list of dependencies used by libnick.

src/app/windowgeometry.cpp

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,57 @@ namespace Nickvision::App
77
m_height{ 600 },
88
m_isMaximized{ false }
99
{
10-
10+
#ifdef _WIN32
11+
m_x = 10;
12+
m_y = 10;
13+
#endif
1114
}
1215

1316
WindowGeometry::WindowGeometry(long width, long height, bool isMaximized)
1417
: m_width{ width },
1518
m_height{ height },
1619
m_isMaximized{ isMaximized }
1720
{
18-
21+
#ifdef _WIN32
22+
m_x = 10;
23+
m_y = 10;
24+
#endif
1925
}
2026

2127
#ifdef _WIN32
28+
WindowGeometry::WindowGeometry(long width, long height, bool isMaximized, long x, long y)
29+
: m_width{ width },
30+
m_height{ height },
31+
m_isMaximized{ isMaximized },
32+
m_x{ x },
33+
m_y{ y }
34+
{
35+
36+
}
37+
2238
WindowGeometry::WindowGeometry(HWND hwnd)
2339
{
2440
WINDOWPLACEMENT placement;
2541
GetWindowPlacement(hwnd, &placement);
2642
m_width = placement.rcNormalPosition.right - placement.rcNormalPosition.left;
2743
m_height = placement.rcNormalPosition.bottom - placement.rcNormalPosition.top;
2844
m_isMaximized = placement.showCmd == SW_SHOWMAXIMIZED;
45+
m_x = placement.rcNormalPosition.left;
46+
m_y = placement.rcNormalPosition.top;
2947
}
3048
#endif
3149

50+
WindowGeometry::WindowGeometry(boost::json::object json)
51+
: m_width{ json["Width"].is_int64() ? static_cast<long>(json["Width"].as_int64()) : 0 },
52+
m_height{ json["Height"].is_int64() ? static_cast<long>(json["Height"].as_int64()) : 0 },
53+
m_isMaximized{ json["IsMaximized"].is_bool() ? json["IsMaximized"].as_bool() : false }
54+
{
55+
#ifdef _WIN32
56+
m_x = json["X"].is_int64() ? static_cast<long>(json["X"].as_int64()) : 0;
57+
m_y = json["Y"].is_int64() ? static_cast<long>(json["Y"].as_int64()) : 0;
58+
#endif
59+
}
60+
3261
long WindowGeometry::getWidth() const
3362
{
3463
return m_width;
@@ -64,10 +93,25 @@ namespace Nickvision::App
6493
{
6594
WINDOWPLACEMENT placement;
6695
GetWindowPlacement(hwnd, &placement);
96+
placement.rcNormalPosition.left = m_x;
97+
placement.rcNormalPosition.top = m_y;
6798
placement.rcNormalPosition.right = placement.rcNormalPosition.left + m_width;
6899
placement.rcNormalPosition.bottom = placement.rcNormalPosition.top + m_height;
69100
placement.showCmd = m_isMaximized ? SW_SHOWMAXIMIZED : SW_SHOWNORMAL;
70101
return SetWindowPlacement(hwnd, &placement);
71102
}
72103
#endif
73-
}
104+
105+
boost::json::object WindowGeometry::toJson() const
106+
{
107+
boost::json::object json;
108+
json["Width"] = m_width;
109+
json["Height"] = m_height;
110+
json["IsMaximized"] = m_isMaximized;
111+
#ifdef _WIN32
112+
json["X"] = m_x;
113+
json["Y"] = m_y;
114+
#endif
115+
return json;
116+
}
117+
}

0 commit comments

Comments
 (0)