File indexing completed on 2025-02-16 05:09:08

0001 /****************************************************************************
0002 **
0003 ** Copyright (C) 2020 The Qt Company Ltd.
0004 ** Contact: https://www.qt.io/licensing/
0005 **
0006 ** This file is part of the test suite of the Qt Toolkit.
0007 **
0008 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
0009 ** Commercial License Usage
0010 ** Licensees holding valid commercial Qt licenses may use this file in
0011 ** accordance with the commercial license agreement provided with the
0012 ** Software or, alternatively, in accordance with the terms contained in
0013 ** a written agreement between you and The Qt Company. For licensing terms
0014 ** and conditions see https://www.qt.io/terms-conditions. For further
0015 ** information use the contact form at https://www.qt.io/contact-us.
0016 **
0017 ** GNU General Public License Usage
0018 ** Alternatively, this file may be used under the terms of the GNU
0019 ** General Public License version 3 as published by the Free Software
0020 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
0021 ** included in the packaging of this file. Please review the following
0022 ** information to ensure the GNU General Public License requirements will
0023 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
0024 **
0025 ** $QT_END_LICENSE$
0026 **
0027 ****************************************************************************/
0028 
0029 #include "xdgoutputv1.h"
0030 
0031 namespace MockCompositor
0032 {
0033 int XdgOutputV1::s_nextId = 1;
0034 
0035 void XdgOutputV1::sendLogicalSize(const QSize &size)
0036 {
0037     m_logicalGeometry.setSize(size);
0038     for (auto *resource : resourceMap())
0039         zxdg_output_v1::send_logical_size(resource->handle, size.width(), size.height());
0040 }
0041 
0042 void XdgOutputV1::addResource(wl_client *client, int id, int version)
0043 {
0044     auto *resource = add(client, id, version)->handle;
0045     zxdg_output_v1::send_logical_size(resource, m_logicalGeometry.width(), m_logicalGeometry.height());
0046     send_logical_position(resource, m_logicalGeometry.x(), m_logicalGeometry.y());
0047     if (version >= ZXDG_OUTPUT_V1_NAME_SINCE_VERSION)
0048         send_name(resource, m_name);
0049     if (version >= ZXDG_OUTPUT_V1_DESCRIPTION_SINCE_VERSION)
0050         send_description(resource, m_description);
0051 
0052     if (version < 3) // zxdg_output_v1.done has been deprecated
0053         zxdg_output_v1::send_done(resource);
0054     else {
0055         m_output->sendDone(client);
0056     }
0057 }
0058 
0059 } // namespace MockCompositor