Skip to content

Commit

Permalink
Move mWlSurface to WaylandEGLWindow
Browse files Browse the repository at this point in the history
Each window should manage its own wl_surface.
  • Loading branch information
benjaminvdh authored and paroj committed Jul 8, 2024
1 parent 2df5025 commit a1eb371
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ namespace Ogre
class _OgrePrivate WaylandEGLSupport : public EGLSupport
{
public:
wl_surface* mWlSurface;
bool mIsExternalDisplay;

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class _OgrePrivate WaylandEGLWindow : public EGLWindow
{
protected:
WaylandEGLSupport* mGLSupport;
wl_surface* mWlSurface;

void initNativeCreatedWindow(const NameValuePairList* miscParams);
void createNativeWindow(uint& width, uint& height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ GLNativeSupport* getGLSupport(int profile) { return new WaylandEGLSupport(profil

WaylandEGLSupport::WaylandEGLSupport(int profile) : EGLSupport(profile)
{
mWlSurface = nullptr;
mIsExternalDisplay = false;
}

Expand Down
15 changes: 8 additions & 7 deletions RenderSystems/GLSupport/src/EGL/Wayland/OgreWaylandEGLWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Ogre
WaylandEGLWindow::WaylandEGLWindow(WaylandEGLSupport* glsupport) : EGLWindow(glsupport)
{
mGLSupport = glsupport;
mWlSurface = nullptr;
mNativeDisplay = nullptr;
}

Expand All @@ -43,10 +44,10 @@ void WaylandEGLWindow::initNativeCreatedWindow(const NameValuePairList* miscPara

if ((opt = miscParams->find("externalWlSurface")) != end)
{
mGLSupport->mWlSurface = (wl_surface*)StringConverter::parseSizeT(opt->second);
mWlSurface = (wl_surface*)StringConverter::parseSizeT(opt->second);
}
}
OgreAssert(mGLSupport->mWlSurface, "externalWlSurface required");
OgreAssert(mWlSurface, "externalWlSurface required");
}

void WaylandEGLWindow::createNativeWindow(uint& width, uint& height)
Expand All @@ -55,7 +56,7 @@ void WaylandEGLWindow::createNativeWindow(uint& width, uint& height)

if (!mWindow)
{
mWindow = wl_egl_window_create(mGLSupport->mWlSurface, width, height);
mWindow = wl_egl_window_create(mWlSurface, width, height);
}

if (mWindow == EGL_NO_SURFACE)
Expand All @@ -68,7 +69,7 @@ void WaylandEGLWindow::createNativeWindow(uint& width, uint& height)
switchFullScreen(true);
}

wl_surface_commit(mGLSupport->mWlSurface);
wl_surface_commit(mWlSurface);
wl_display_dispatch_pending(mNativeDisplay);
wl_display_flush(mNativeDisplay);
}
Expand Down Expand Up @@ -97,8 +98,8 @@ void WaylandEGLWindow::resize(uint width, uint height)
for (auto& it : mViewportList)
it.second->_updateDimensions();

wl_surface_damage(mGLSupport->mWlSurface, 0, 0, mWidth, mHeight);
wl_surface_commit(mGLSupport->mWlSurface);
wl_surface_damage(mWlSurface, 0, 0, mWidth, mHeight);
wl_surface_commit(mWlSurface);
wl_display_dispatch_pending(mNativeDisplay);
wl_display_flush(mNativeDisplay);
}
Expand Down Expand Up @@ -249,7 +250,7 @@ void WaylandEGLWindow::create(const String& name, uint width, uint height, bool
mHeight = height;

finaliseWindow();
wl_surface_commit(mGLSupport->mWlSurface);
wl_surface_commit(mWlSurface);
}

} // namespace Ogre

0 comments on commit a1eb371

Please sign in to comment.