Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
ldd build/src/plugin/datareftool.xpl

build-win:
runs-on: windows-latest
runs-on: windows-2019
steps:
- name: Install dependencies
run: vcpkg install libpng:x64-windows-static
Expand Down
14 changes: 14 additions & 0 deletions lib/lb_xplane_ui/window11.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ class Window11Base {
}

// Centered on main screen
#ifdef XPLM300
void setWindowCentered() {
int screen_left, screen_top, screen_right, screen_bottom;
XPLMGetScreenBoundsGlobal(&screen_left, &screen_top, &screen_right, &screen_bottom);
int screen_width = screen_right - screen_left;
int screen_height = screen_top - screen_bottom;
int left = screen_left + screen_width / 2 - getWidth() / 2;
int right = left + getWidth();
int bottom = screen_bottom + screen_height / 2 - getHeight() / 2;
int top = bottom + getHeight();
setWindowBounds(Rect{left, top, right, bottom});
}
#else
void setWindowCentered() {
int screen_width, screen_height;
XPLMGetScreenSize(&screen_width, &screen_height);
Expand All @@ -138,6 +151,7 @@ class Window11Base {
int bottom = screen_height / 2 - getHeight() / 2;
setWindowBounds(Rect{left, top, right, bottom});
}
#endif

void setWindowResizeLimits([[maybe_unused]] int min_width, [[maybe_unused]] int min_height, [[maybe_unused]] int max_width, [[maybe_unused]] int max_height) {
#ifdef XPLM300
Expand Down