1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=2:tabstop=2:
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #include "WaylandSurfaceLock.h"
10 # include "WaylandSurface.h"
12 #include "MozContainer.h"
13 #include "WidgetUtilsGtk.h"
15 namespace mozilla::widget
{
17 WaylandSurfaceLock::WaylandSurfaceLock(RefPtr
<WaylandSurface
> aWaylandSurface
,
20 mWaylandSurface
= std::move(aWaylandSurface
);
21 mForceCommit
= aForceCommit
;
22 if (GdkIsWaylandDisplay()) {
23 MOZ_DIAGNOSTIC_ASSERT(mWaylandSurface
);
24 // mSurface can be nullptr if we lock hidden MozContainer and
25 // that's correct, MozContainer is still locked.
26 mSurface
= mWaylandSurface
->Lock(this);
31 WaylandSurfaceLock::~WaylandSurfaceLock() {
33 if (GdkIsWaylandDisplay()) {
34 mWaylandSurface
->Commit(this, mForceCommit
,
35 /* flush display */ false);
36 mWaylandSurface
->Unlock(&mSurface
, this);
41 WaylandSurface
* WaylandSurfaceLock::GetWaylandSurface() {
43 return mWaylandSurface
.get();
49 } // namespace mozilla::widget