RWindow::IsVisible
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 1m23s
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 1m23s
This commit is contained in:
@@ -172,6 +172,12 @@ public:
|
||||
[[nodiscard]] IPair GetMouseCoordinates() const;
|
||||
[[nodiscard]] int GetMouseWheelPersistent() const { return currentMouse.Wheel; }
|
||||
[[nodiscard]] bool IsOpen() const { return open; }
|
||||
|
||||
|
||||
/// Returns whether the window is currently visible to the user.
|
||||
// TODO On Linux, Some desktop environments don't always do this when switching workspaces.
|
||||
[[nodiscard]] bool IsVisible() const;
|
||||
|
||||
[[nodiscard]] bool IsClosing() const { return closing; }
|
||||
/// Returns whether the window currently has mouse and/or keyboard focus.
|
||||
[[nodiscard]] bool IsFocused() const;
|
||||
|
@@ -143,7 +143,7 @@ bool OpenGLWindow::Open() {
|
||||
XFree(vi);
|
||||
|
||||
XSelectInput(platform->display, platform->window, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
|
||||
PointerMotionHintMask | FocusChangeMask | StructureNotifyMask | SubstructureRedirectMask | SubstructureNotifyMask | CWColormap );
|
||||
PointerMotionHintMask | FocusChangeMask | StructureNotifyMask | SubstructureRedirectMask | SubstructureNotifyMask | VisibilityChangeMask | CWColormap );
|
||||
|
||||
XMapWindow(platform->display, platform->window);
|
||||
XStoreName(platform->display, platform->window, title.c_str());
|
||||
|
@@ -211,7 +211,7 @@ bool VulkanWindow::Open() {
|
||||
|
||||
|
||||
XSelectInput(platform->display, platform->window, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
|
||||
PointerMotionHintMask | FocusChangeMask | StructureNotifyMask | SubstructureRedirectMask | SubstructureNotifyMask | CWColormap );
|
||||
PointerMotionHintMask | FocusChangeMask | StructureNotifyMask | SubstructureRedirectMask | SubstructureNotifyMask | VisibilityChangeMask | CWColormap );
|
||||
XMapWindow(platform->display, platform->window);
|
||||
XStoreName(platform->display, platform->window, title.c_str());
|
||||
|
||||
|
@@ -21,6 +21,7 @@ public:
|
||||
XSizeHints hints;
|
||||
Cursor invisible_cursor = 0;
|
||||
XWMHints* wm_hints = nullptr;
|
||||
bool window_visible = true;
|
||||
};
|
||||
|
||||
|
||||
@@ -188,7 +189,8 @@ void RWindow::PollEvents() {
|
||||
if (platform->xev.type == ClientMessage)
|
||||
Logger::Info(std::format("Event '{}'", "ClientMessage"));
|
||||
|
||||
if (platform->xev.xclient.message_type == XInternAtom(platform->display, "WM_PROTOCOLS", False) && static_cast<Atom>(platform->xev.xclient.data.l[0]) == platform->wmDeleteWindow) {
|
||||
if (platform->xev.xclient.message_type == XInternAtom(platform->display, "WM_PROTOCOLS", False) &&
|
||||
static_cast<Atom>(platform->xev.xclient.data.l[0]) == platform->wmDeleteWindow) {
|
||||
Close();
|
||||
}
|
||||
|
||||
@@ -206,7 +208,7 @@ void RWindow::PollEvents() {
|
||||
|
||||
// Get the position of the renderable area relative to the rest of the window.
|
||||
XGetWindowAttributes(platform->display, platform->window, &platform->windowAttributes);
|
||||
render_area_position = { platform->windowAttributes.x, platform->windowAttributes.y };
|
||||
render_area_position = {platform->windowAttributes.x, platform->windowAttributes.y};
|
||||
processFocusIn();
|
||||
focused = true;
|
||||
}
|
||||
@@ -257,8 +259,7 @@ void RWindow::PollEvents() {
|
||||
processMouseWheel(-1);
|
||||
} else if (platform->xev.xbutton.button == 5) {
|
||||
processMouseWheel(1);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
MouseButton button = GetMouseButtonFromXButton(platform->xev.xbutton.button);
|
||||
|
||||
Logger::Debug(std::format("Event: MouseButtonPress {}", button.Mnemonic));
|
||||
@@ -267,37 +268,42 @@ void RWindow::PollEvents() {
|
||||
}
|
||||
}
|
||||
|
||||
if (platform->xev.type == Expose)
|
||||
{
|
||||
if (platform->xev.type == Expose) {
|
||||
Logger::Debug(std::format("Event '{}'", "Expose"));
|
||||
}
|
||||
|
||||
// NOTE: This event is functionally useless, as it only informs of the very beginning and end of a mouse movement.
|
||||
if (platform->xev.type == MotionNotify)
|
||||
{
|
||||
if (platform->xev.type == MotionNotify) {
|
||||
Logger::Debug(std::format("Event '{}'", "MotionNotify"));
|
||||
}
|
||||
|
||||
if (platform->xev.type == ConfigureNotify) {
|
||||
if (this->width != platform->xev.xconfigurerequest.width || this->height != platform->xev.xconfigurerequest.height) {
|
||||
if (this->width != platform->xev.xconfigurerequest.width ||
|
||||
this->height != platform->xev.xconfigurerequest.height) {
|
||||
Logger::Debug(std::format("Event '{}'", "ResizeRequest"));
|
||||
|
||||
this->width = platform->xev.xconfigurerequest.width;
|
||||
this->height = platform->xev.xconfigurerequest.height;
|
||||
|
||||
auto eventData = WindowResizeRequestEvent();
|
||||
eventData.Size = { platform->xev.xconfigurerequest.width, platform->xev.xconfigurerequest.height };
|
||||
eventData.Size = {platform->xev.xconfigurerequest.width, platform->xev.xconfigurerequest.height};
|
||||
lastKnownWindowSize = eventData.Size;
|
||||
|
||||
OnResizeRequest(eventData);
|
||||
OnResizeRequestEvent(eventData);
|
||||
}
|
||||
|
||||
//Window Moved.
|
||||
if (position.x != platform->xev.xconfigurerequest.x || position.y != platform->xev.xconfigurerequest.y)
|
||||
position = { platform->xev.xconfigurerequest.x, platform->xev.xconfigurerequest.y };
|
||||
position = {platform->xev.xconfigurerequest.x, platform->xev.xconfigurerequest.y};
|
||||
}
|
||||
|
||||
if (platform->xev.type == VisibilityNotify) {
|
||||
if (platform->xev.xvisibility.state == VisibilityFullyObscured)
|
||||
platform->window_visible = false;
|
||||
else if (platform->xev.xvisibility.state == VisibilityUnobscured ||
|
||||
platform->xev.xvisibility.state == VisibilityPartiallyObscured)
|
||||
platform->window_visible = true;
|
||||
}
|
||||
}
|
||||
previousKeyboard = currentKeyboard;
|
||||
previousMouse.Buttons = currentMouse.Buttons;
|
||||
@@ -334,6 +340,10 @@ IPair RWindow::GetAccurateMouseCoordinates() const {
|
||||
return {};
|
||||
}
|
||||
|
||||
bool RWindow::IsVisible() const {
|
||||
return platform->window_visible;
|
||||
}
|
||||
|
||||
|
||||
IPair RWindow::GetSize() const {
|
||||
return { this->width, this->height};
|
||||
|
Reference in New Issue
Block a user