Merge commit '991d522c57' into gzdoom_merge

This commit is contained in:
Mari the Deer 2025-09-24 19:42:37 +02:00
commit 2c3d46075d
4 changed files with 24 additions and 14 deletions

View file

@ -258,8 +258,6 @@ void WaylandDisplayBackend::ConnectDeviceEvents()
xkb_state_key_get_utf8(m_KeyboardState, key + 8, buf, sizeof(buf));
OnKeyboardCharEvent(buf, state);
//m_DataDevice.set_selection(m_DataSource, m_KeyboardSerial);
};
m_waylandPointer.on_enter() = [this](uint32_t serial, wayland::surface_t surfaceEntered, double surfaceX, double surfaceY) {
@ -274,6 +272,8 @@ void WaylandDisplayBackend::ConnectDeviceEvents()
if (win->GetWindowSurface() == surfaceEntered)
{
m_MouseFocusWindow = win;
ShowCursor(!m_MouseFocusWindow->m_LockedPointer);
break;
}
}
}
@ -486,13 +486,18 @@ void WaylandDisplayBackend::OnMouseLeaveEvent()
{
m_MouseFocusWindow->windowHost->OnWindowMouseLeave();
//m_MouseFocusWindow = nullptr; // Borks up the menus
ShowCursor(!m_MouseFocusWindow->m_LockedPointer);
}
}
void WaylandDisplayBackend::OnMousePressEvent(InputKey button)
{
if (m_MouseFocusWindow)
{
m_MouseFocusWindow->windowHost->OnWindowMouseDown(m_MouseFocusWindow->m_SurfaceMousePos, button);
ShowCursor(m_MouseFocusWindow->m_LockedPointer);
}
}
void WaylandDisplayBackend::OnMouseReleaseEvent(InputKey button)

View file

@ -126,6 +126,7 @@ public:
wayland::data_device_manager_t m_DataDeviceManager;
wayland::xdg_wm_base_t m_XDGWMBase;
wayland::zwp_pointer_constraints_v1_t m_PointerConstraints;
// TODO: XDG_Activation seems to be for activating OTHER XDG_Toplevels. Do we need this?
wayland::xdg_activation_v1_t m_XDGActivation;
wayland::zxdg_decoration_manager_v1_t m_XDGDecorationManager;
wayland::fractional_scale_manager_v1_t m_FractionalScaleManager;

View file

@ -31,6 +31,14 @@ WaylandDisplayWindow::WaylandDisplayWindow(WaylandDisplayBackend* backend, Displ
m_XDGSurface.ack_configure(serial);
};
m_WindowActivationToken = backend->m_XDGActivation.get_activation_token();
m_WindowActivationToken.on_done() = [&](const std::string& newActivationToken)
{
m_ActivationTokenString = newActivationToken;
};
m_WindowActivationToken.set_surface(m_AppSurface);
if (popupWindow)
{
InitializePopup();
@ -97,6 +105,8 @@ void WaylandDisplayWindow::InitializePopup()
wayland::xdg_positioner_t popupPositioner = backend->m_XDGWMBase.create_positioner();
// TODO: We gotta figure out a way to make positioner actually position the menu
// Maybe somehow get the clicked menu's rectangle relative to the window's surface?
popupPositioner.set_anchor(wayland::xdg_positioner_anchor::bottom);
popupPositioner.set_anchor_rect(0, 0, 1, 30);
popupPositioner.set_size(1, 1);
@ -212,19 +222,10 @@ void WaylandDisplayWindow::Hide()
void WaylandDisplayWindow::Activate()
{
// To do: this needs to be in the backend instance if all windows share the activation token
wayland::xdg_activation_token_v1_t xdgActivationToken = backend->m_XDGActivation.get_activation_token();
m_WindowActivationToken.set_serial(backend->GetKeyboardSerial(), backend->m_waylandSeat);
m_WindowActivationToken.commit(); // This will set our token string
std::string tokenString;
xdgActivationToken.on_done() = [&tokenString] (std::string obtainedString) {
tokenString = obtainedString;
};
xdgActivationToken.set_surface(m_AppSurface);
xdgActivationToken.commit(); // This will set our token string
backend->m_XDGActivation.activate(tokenString, m_AppSurface);
backend->m_XDGActivation.activate(m_ActivationTokenString, m_AppSurface);
backend->m_FocusWindow = this;
backend->m_MouseFocusWindow = this;
windowHost->OnWindowActivated();

View file

@ -192,6 +192,9 @@ private:
std::vector<std::shared_ptr<SharedMemHelper>> appIconSharedMems;
std::vector<wayland::buffer_t> appIconBuffers;
wayland::xdg_activation_token_v1_t m_WindowActivationToken;
std::string m_ActivationTokenString;
bool isFullscreen = false;
// Helper functions