Skip to content
Draft
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
35 changes: 33 additions & 2 deletions src/surface/surfacewrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@
#include <woutputrenderwindow.h>
#include <wsocket.h>
#include <wxdgpopupsurfaceitem.h>
#include <wxdgtoplevelsurfaceitem.h>

Check warning on line 22 in src/surface/surfacewrapper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wxdgtoplevelsurfaceitem.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <wxwaylandsurface.h>

Check warning on line 23 in src/surface/surfacewrapper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wxwaylandsurface.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <wxwaylandsurfaceitem.h>

Check warning on line 24 in src/surface/surfacewrapper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wxwaylandsurfaceitem.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <wxdgtoplevelsurface.h>

Check warning on line 25 in src/surface/surfacewrapper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wxdgtoplevelsurface.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <qwbuffer.h>

Check warning on line 27 in src/surface/surfacewrapper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <qwbuffer.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <qwlayershellv1.h>

Check warning on line 28 in src/surface/surfacewrapper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <qwlayershellv1.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <qwxdgshell.h>

Check warning on line 29 in src/surface/surfacewrapper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <qwxdgshell.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <QColor>

Check warning on line 31 in src/surface/surfacewrapper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QColor> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QVariant>

Check warning on line 32 in src/surface/surfacewrapper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QVariant> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#define OPEN_ANIMATION 1
#define CLOSE_ANIMATION 2
Expand Down Expand Up @@ -297,6 +299,32 @@
m_surfaceItem->setShellSurface(m_shellSurface);

if (!m_isProxy) {
if (auto toplevelItem = qobject_cast<WXdgToplevelSurfaceItem*>(m_surfaceItem)) {
connect(toplevelItem, &WXdgToplevelSurfaceItem::initialCommitReceived, this, [this] {
auto toplevel = qobject_cast<WXdgToplevelSurface *>(m_shellSurface);
auto handle = toplevel->handle()->handle();
if (handle->requested.maximized) {
toplevel->handle()->set_maximized(true);
resize(maximizedGeometry().size());
m_previousSurfaceState.setValueBypassingBindings(State::Maximized);
m_surfaceState.setValueBypassingBindings(State::Maximized);
setVisibleDecoration(false);
setNoCornerRadius(true);

return;
}
if (handle->requested.fullscreen) {
toplevel->handle()->set_fullscreen(true);
resize(fullscreenGeometry().size());
m_previousSurfaceState.setValueBypassingBindings(State::Fullscreen);
m_surfaceState.setValueBypassingBindings(State::Fullscreen);
setVisibleDecoration(false);
setNoCornerRadius(true);
return;
}

}, Qt::SingleShotConnection);
}
m_shellSurface->safeConnect(&WToplevelSurface::requestMinimize, this, [this]() {
minimize();
});
Expand Down Expand Up @@ -1006,7 +1034,7 @@
targetGeometry = m_tilingGeometry;
}

if (targetGeometry.isValid()) {
if (targetGeometry.isValid() && m_previousSurfaceState.value() != newSurfaceState) {
startStateChangeAnimation(newSurfaceState, targetGeometry);
} else {
if (m_geometryAnimation) {
Expand Down Expand Up @@ -1414,7 +1442,7 @@

void SurfaceWrapper::onAnimationReady()
{
Q_ASSERT(m_pendingState != m_surfaceState);
// Q_ASSERT(m_pendingState != m_surfaceState);
Q_ASSERT(m_pendingGeometry.isValid());

if (!resize(m_pendingGeometry.size(), true)) {
Expand Down Expand Up @@ -1649,6 +1677,7 @@

void SurfaceWrapper::restoreFromMinimized(bool onAnimation)
{
qWarning() << "xyb---state" << m_surfaceState.value();
if (m_surfaceState != State::Minimized && m_hideByshowDesk)
return;
if (!m_hideByshowDesk)
Expand All @@ -1670,6 +1699,8 @@

void SurfaceWrapper::unmaximize()
{

qWarning() << "xyb---unmaximize state:" << m_surfaceState.value();
if (m_surfaceState != State::Maximized)
return;

Expand Down
9 changes: 4 additions & 5 deletions waylib/src/server/qtquick/wxdgtoplevelsurfaceitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ void WXdgToplevelSurfaceItem::onSurfaceCommit()

auto xdg_surface = toplevelSurface()->handle()->handle()->base;
if (xdg_surface->initial_commit) {
/* When an xdg_surface performs an initial commit, the compositor must
* reply with a configure so the client can map the surface.
* configures the xdg_toplevel with 0,0 size to let the client pick the
* dimensions itself. */
toplevelSurface()->handle()->set_size(0, 0);
toplevelSurface()->handle()->set_size(0, 0);
if (!xdg_surface->surface->mapped) {
Q_EMIT initialCommitReceived();
}
}
}

Expand Down
1 change: 1 addition & 0 deletions waylib/src/server/qtquick/wxdgtoplevelsurfaceitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class WAYLIB_SERVER_EXPORT WXdgToplevelSurfaceItem : public WSurfaceItem
Q_SIGNALS:
void minimumSizeChanged();
void maximumSizeChanged();
void initialCommitReceived();

private:
Q_SLOT void onSurfaceCommit() override;
Expand Down
Loading