Don't allow resize when maximized, and prepare for potential fullscreen mode
Some checks failed
Build / build-deb (push) Blocked by required conditions
Build / build-appimage (push) Blocked by required conditions
Build / build-android (push) Blocked by required conditions
Build / build-windows (push) Blocked by required conditions
Build / build-gentoo (push) Successful in 1m29s
Build / download-system-deps (push) Successful in 3m46s
Build / get-source-code (push) Has been cancelled
Some checks failed
Build / build-deb (push) Blocked by required conditions
Build / build-appimage (push) Blocked by required conditions
Build / build-android (push) Blocked by required conditions
Build / build-windows (push) Blocked by required conditions
Build / build-gentoo (push) Successful in 1m29s
Build / download-system-deps (push) Successful in 3m46s
Build / get-source-code (push) Has been cancelled
This commit is contained in:
parent
80f29047bd
commit
a2a93558a8
2 changed files with 31 additions and 19 deletions
|
@ -425,6 +425,12 @@ bool RendererBackend::BeginMainMenuBar() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool RendererBackend::is_fullscreen() {
|
||||||
|
return SDL_GetWindowFlags(window) & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
|
}
|
||||||
|
bool RendererBackend::is_maximized() {
|
||||||
|
return SDL_GetWindowFlags(window) & SDL_WINDOW_MAXIMIZED;
|
||||||
|
}
|
||||||
SDL_HitTestResult RendererBackend::HitTest(SDL_Window *window, const SDL_Point *area) {
|
SDL_HitTestResult RendererBackend::HitTest(SDL_Window *window, const SDL_Point *area) {
|
||||||
int w, h;
|
int w, h;
|
||||||
bool rtop, rbottom, rleft, rright;
|
bool rtop, rbottom, rleft, rright;
|
||||||
|
@ -433,6 +439,8 @@ SDL_HitTestResult RendererBackend::HitTest(SDL_Window *window, const SDL_Point *
|
||||||
rleft = area->x <= 4;
|
rleft = area->x <= 4;
|
||||||
rright = area->x >= w-5;
|
rright = area->x >= w-5;
|
||||||
rbottom = area->y >= h-5;
|
rbottom = area->y >= h-5;
|
||||||
|
if (is_fullscreen()) return SDL_HITTEST_NORMAL;
|
||||||
|
if (!is_maximized()) {
|
||||||
if (rtop) {
|
if (rtop) {
|
||||||
if (rright) {
|
if (rright) {
|
||||||
return SDL_HITTEST_RESIZE_TOPRIGHT;
|
return SDL_HITTEST_RESIZE_TOPRIGHT;
|
||||||
|
@ -453,7 +461,9 @@ SDL_HitTestResult RendererBackend::HitTest(SDL_Window *window, const SDL_Point *
|
||||||
return SDL_HITTEST_RESIZE_LEFT;
|
return SDL_HITTEST_RESIZE_LEFT;
|
||||||
} else if (rright) {
|
} else if (rright) {
|
||||||
return SDL_HITTEST_RESIZE_RIGHT;
|
return SDL_HITTEST_RESIZE_RIGHT;
|
||||||
} else if (area->y < (16 * this->scale) && (area->x < menubar_start || (area->x > menubar_end && area->x < title_btn_start))) {
|
}
|
||||||
|
}
|
||||||
|
if (area->y < (16 * this->scale) && (area->x < menubar_start || (area->x > menubar_end && area->x < title_btn_start))) {
|
||||||
return SDL_HITTEST_DRAGGABLE;
|
return SDL_HITTEST_DRAGGABLE;
|
||||||
} else {
|
} else {
|
||||||
return SDL_HITTEST_NORMAL;
|
return SDL_HITTEST_NORMAL;
|
||||||
|
|
|
@ -31,6 +31,8 @@ class RendererBackend {
|
||||||
int menubar_end;
|
int menubar_end;
|
||||||
int title_btn_start;
|
int title_btn_start;
|
||||||
public:
|
public:
|
||||||
|
bool is_fullscreen();
|
||||||
|
bool is_maximized();
|
||||||
int window_border_radius = 8;
|
int window_border_radius = 8;
|
||||||
SDL_HitTestResult HitTest(SDL_Window *window, const SDL_Point *area);
|
SDL_HitTestResult HitTest(SDL_Window *window, const SDL_Point *area);
|
||||||
std::optional<bool> touchScreenModeOverride;
|
std::optional<bool> touchScreenModeOverride;
|
||||||
|
|
Loading…
Reference in a new issue