mirror of
https://github.com/taigrr/wails.git
synced 2026-04-02 05:08:54 -07:00
[windows] Support SetPosition
This commit is contained in:
@@ -714,17 +714,31 @@ void SetColour(struct Application* app, int red, int green, int blue, int alpha)
|
||||
}
|
||||
|
||||
void SetSize(struct Application* app, int width, int height) {
|
||||
// TBD
|
||||
if( app->maxWidth > 0 && width > app->maxWidth ) {
|
||||
width = app->maxWidth;
|
||||
}
|
||||
if ( app->maxHeight > 0 && height > app->maxHeight ) {
|
||||
height = app->maxHeight;
|
||||
}
|
||||
SetWindowPos(app->window, nullptr, 0, 0, width, height, SWP_NOMOVE);
|
||||
}
|
||||
|
||||
void setPosition(struct Application* app, int x, int y) {
|
||||
// TBD
|
||||
HMONITOR currentMonitor = MonitorFromWindow(app->window, MONITOR_DEFAULTTONEAREST);
|
||||
MONITORINFO info = {0};
|
||||
info.cbSize = sizeof(info);
|
||||
GetMonitorInfoA(currentMonitor, &info);
|
||||
RECT workRect = info.rcWork;
|
||||
LONG newX = workRect.left + x;
|
||||
LONG newY = workRect.top + y;
|
||||
|
||||
SetWindowPos(app->window, HWND_TOP, newX, newY, 0, 0, SWP_NOSIZE);
|
||||
}
|
||||
|
||||
void SetPosition(struct Application* app, int x, int y) {
|
||||
// ON_MAIN_THREAD(
|
||||
// setPosition(app, x, y);
|
||||
// );
|
||||
ON_MAIN_THREAD(
|
||||
setPosition(app, x, y);
|
||||
);
|
||||
}
|
||||
|
||||
void Quit(struct Application* app) {
|
||||
@@ -792,9 +806,6 @@ void UnFullscreen(struct Application* app) {
|
||||
);
|
||||
}
|
||||
|
||||
void ToggleFullscreen(struct Application* app) {
|
||||
}
|
||||
|
||||
void DisableFrame(struct Application* app) {
|
||||
app->frame = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user