Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates > by-pkgid > f171b9b27b527f95603e88add5c7e1b6 > files > 125

qtwayland5-doc-5.12.6-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>compositor.h Example File | Qt Wayland Compositor 5.12.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtwaylandcompositor-index.html">Qt Wayland Compositor</a></td><td ><a href="qtwaylandcompositor-qwindow-compositor-example.html">Qt Wayland Compositor Examples - QWindow Compositor</a></td><td >compositor.h Example File</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtwaylandcompositor-index.html">Qt 5.12.6 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">compositor.h Example File</h1>
<span class="subtitle">qwindow-compositor/compositor.h</span>
<!-- $$$qwindow-compositor/compositor.h-description -->
<div class="descr"> <a name="details"></a>
<pre class="cpp">

  <span class="comment">/****************************************************************************
  **
  ** Copyright (C) 2017 The Qt Company Ltd.
  ** Contact: https://www.qt.io/licensing/
  **
  ** This file is part of the examples of the Qt Wayland module
  **
  ** $QT_BEGIN_LICENSE:BSD$
  ** Commercial License Usage
  ** Licensees holding valid commercial Qt licenses may use this file in
  ** accordance with the commercial license agreement provided with the
  ** Software or, alternatively, in accordance with the terms contained in
  ** a written agreement between you and The Qt Company. For licensing terms
  ** and conditions see https://www.qt.io/terms-conditions. For further
  ** information use the contact form at https://www.qt.io/contact-us.
  **
  ** BSD License Usage
  ** Alternatively, you may use this file under the terms of the BSD license
  ** as follows:
  **
  ** &quot;Redistribution and use in source and binary forms, with or without
  ** modification, are permitted provided that the following conditions are
  ** met:
  **   * Redistributions of source code must retain the above copyright
  **     notice, this list of conditions and the following disclaimer.
  **   * Redistributions in binary form must reproduce the above copyright
  **     notice, this list of conditions and the following disclaimer in
  **     the documentation and/or other materials provided with the
  **     distribution.
  **   * Neither the name of The Qt Company Ltd nor the names of its
  **     contributors may be used to endorse or promote products derived
  **     from this software without specific prior written permission.
  **
  **
  ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  ** &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&quot;
  **
  ** $QT_END_LICENSE$
  **
  ****************************************************************************/</span>

  <span class="preprocessor">#ifndef WINDOWCOMPOSITOR_H</span>
  <span class="preprocessor">#define WINDOWCOMPOSITOR_H</span>

  <span class="preprocessor">#include &lt;QtWaylandCompositor/QWaylandCompositor&gt;</span>
  <span class="preprocessor">#include &lt;QtWaylandCompositor/QWaylandSurface&gt;</span>
  <span class="preprocessor">#include &lt;QtWaylandCompositor/QWaylandView&gt;</span>
  <span class="preprocessor">#include &lt;QtWaylandCompositor/QWaylandWlShellSurface&gt;</span>
  <span class="preprocessor">#include &lt;QtWaylandCompositor/QWaylandXdgSurfaceV5&gt;</span>
  <span class="preprocessor">#include &lt;QTimer&gt;</span>
  <span class="preprocessor">#include &lt;QOpenGLTextureBlitter&gt;</span>

  <span class="keyword">class</span> <span class="type"><a href="qwaylandwlshell.html">QWaylandWlShell</a></span>;
  <span class="keyword">class</span> <span class="type"><a href="qwaylandwlshellsurface.html">QWaylandWlShellSurface</a></span>;
  <span class="keyword">class</span> QWaylandXdgShellV5;
  <span class="keyword">class</span> <span class="type">QOpenGLTexture</span>;
  <span class="keyword">class</span> Compositor;

  <span class="keyword">class</span> View : <span class="keyword">public</span> <span class="type"><a href="qwaylandview.html">QWaylandView</a></span>
  {
      Q_OBJECT
  <span class="keyword">public</span>:
      View(Compositor <span class="operator">*</span>compositor);
      <span class="type">QOpenGLTexture</span> <span class="operator">*</span>getTexture();
      <span class="type">QOpenGLTextureBlitter</span><span class="operator">::</span>Origin textureOrigin() <span class="keyword">const</span>;
      <span class="type">QPointF</span> position() <span class="keyword">const</span> { <span class="keyword">return</span> m_position; }
      <span class="type">void</span> setPosition(<span class="keyword">const</span> <span class="type">QPointF</span> <span class="operator">&amp;</span>pos) { m_position <span class="operator">=</span> pos; }
      <span class="type">QSize</span> size() <span class="keyword">const</span>;
      bool isCursor() <span class="keyword">const</span>;
      bool hasShell() <span class="keyword">const</span> { <span class="keyword">return</span> m_wlShellSurface; }
      <span class="type">void</span> setParentView(View <span class="operator">*</span>parent) { m_parentView <span class="operator">=</span> parent; }
      View <span class="operator">*</span>parentView() <span class="keyword">const</span> { <span class="keyword">return</span> m_parentView; }
      <span class="type">QPointF</span> parentPosition() <span class="keyword">const</span> { <span class="keyword">return</span> m_parentView <span class="operator">?</span> (m_parentView<span class="operator">-</span><span class="operator">&gt;</span>position() <span class="operator">+</span> m_parentView<span class="operator">-</span><span class="operator">&gt;</span>parentPosition()) : <span class="type">QPointF</span>(); }
      <span class="type">QSize</span> windowSize() { <span class="keyword">return</span> m_xdgSurface <span class="operator">?</span> m_xdgSurface<span class="operator">-</span><span class="operator">&gt;</span>windowGeometry()<span class="operator">.</span>size() :  surface() <span class="operator">?</span> surface()<span class="operator">-</span><span class="operator">&gt;</span>size() : m_size; }
      <span class="type">QPoint</span> offset() <span class="keyword">const</span> { <span class="keyword">return</span> m_offset; }

      <span class="type">qreal</span> animationFactor() <span class="keyword">const</span> {<span class="keyword">return</span> m_animationFactor; }
      <span class="type">void</span> setAnimationFactor(<span class="type">qreal</span> f) {m_animationFactor <span class="operator">=</span> f; }

  <span class="keyword">signals</span>:
      <span class="type">void</span> animationDone();

  <span class="keyword">protected</span>:
      <span class="type">void</span> timerEvent(<span class="type">QTimerEvent</span> <span class="operator">*</span>event) override;

  <span class="keyword">private</span>:
      <span class="keyword">friend</span> <span class="keyword">class</span> Compositor;
      Compositor <span class="operator">*</span>m_compositor <span class="operator">=</span> nullptr;
      GLenum m_textureTarget <span class="operator">=</span> GL_TEXTURE_2D;
      <span class="type">QOpenGLTexture</span> <span class="operator">*</span>m_texture <span class="operator">=</span> nullptr;
      <span class="type">QOpenGLTextureBlitter</span><span class="operator">::</span>Origin m_origin;
      <span class="type">QPointF</span> m_position;
      <span class="type">QSize</span> m_size;
      <span class="type"><a href="qwaylandwlshellsurface.html">QWaylandWlShellSurface</a></span> <span class="operator">*</span>m_wlShellSurface <span class="operator">=</span> nullptr;
      QWaylandXdgSurfaceV5 <span class="operator">*</span>m_xdgSurface <span class="operator">=</span> nullptr;
      QWaylandXdgPopupV5 <span class="operator">*</span>m_xdgPopup <span class="operator">=</span> nullptr;
      View <span class="operator">*</span>m_parentView <span class="operator">=</span> nullptr;
      <span class="type">QPoint</span> m_offset;
      <span class="type">qreal</span> m_animationFactor <span class="operator">=</span> <span class="number">1.0</span>;
      <span class="type">QBasicTimer</span> m_animationTimer;
      bool m_animationCountUp;

  <span class="keyword">public</span> <span class="keyword">slots</span>:
      <span class="type">void</span> onXdgSetMaximized();
      <span class="type">void</span> onXdgUnsetMaximized();
      <span class="type">void</span> onXdgSetFullscreen(<span class="type"><a href="qwaylandoutput.html">QWaylandOutput</a></span> <span class="operator">*</span>output);
      <span class="type">void</span> onXdgUnsetFullscreen();
      <span class="type">void</span> onOffsetForNextFrame(<span class="keyword">const</span> <span class="type">QPoint</span> <span class="operator">&amp;</span>offset);

      <span class="type">void</span> startAnimation(bool countUp);
      <span class="type">void</span> cancelAnimation();
  };

  <span class="keyword">class</span> Compositor : <span class="keyword">public</span> <span class="type"><a href="qwaylandcompositor.html">QWaylandCompositor</a></span>
  {
      Q_OBJECT
  <span class="keyword">public</span>:
      Compositor(<span class="type">QWindow</span> <span class="operator">*</span>window);
      <span class="operator">~</span>Compositor() override;
      <span class="type">void</span> create() override;

      <span class="type">void</span> startRender();
      <span class="type">void</span> endRender();

      <span class="type">QList</span><span class="operator">&lt;</span>View<span class="operator">*</span><span class="operator">&gt;</span> views() <span class="keyword">const</span> { <span class="keyword">return</span> m_views; }
      <span class="type">void</span> raise(View <span class="operator">*</span>view);

      <span class="type">void</span> handleMouseEvent(<span class="type"><a href="qwaylandview.html">QWaylandView</a></span> <span class="operator">*</span>target<span class="operator">,</span> <span class="type">QMouseEvent</span> <span class="operator">*</span>me);
      <span class="type">void</span> handleResize(View <span class="operator">*</span>target<span class="operator">,</span> <span class="keyword">const</span> <span class="type">QSize</span> <span class="operator">&amp;</span>initialSize<span class="operator">,</span> <span class="keyword">const</span> <span class="type">QPoint</span> <span class="operator">&amp;</span>delta<span class="operator">,</span> <span class="type">int</span> edge);
      <span class="type">void</span> handleDrag(View <span class="operator">*</span>target<span class="operator">,</span> <span class="type">QMouseEvent</span> <span class="operator">*</span>me);

      <span class="type"><a href="qwaylandclient.html">QWaylandClient</a></span> <span class="operator">*</span>popupClient() <span class="keyword">const</span>;
      <span class="type">void</span> closePopups();
  <span class="keyword">protected</span>:
      <span class="type">void</span> adjustCursorSurface(<span class="type"><a href="qwaylandsurface.html">QWaylandSurface</a></span> <span class="operator">*</span>surface<span class="operator">,</span> <span class="type">int</span> hotspotX<span class="operator">,</span> <span class="type">int</span> hotspotY);

  <span class="keyword">signals</span>:
      <span class="type">void</span> startMove();
      <span class="type">void</span> startResize(<span class="type">int</span> edge<span class="operator">,</span> bool anchored);
      <span class="type">void</span> dragStarted(View <span class="operator">*</span>dragIcon);
      <span class="type">void</span> frameOffset(<span class="keyword">const</span> <span class="type">QPoint</span> <span class="operator">&amp;</span>offset);

  <span class="keyword">public</span> <span class="keyword">slots</span>:
      <span class="type">void</span> triggerRender();

  <span class="keyword">private</span> <span class="keyword">slots</span>:
      <span class="type">void</span> surfaceHasContentChanged();
      <span class="type">void</span> surfaceDestroyed();
      <span class="type">void</span> viewSurfaceDestroyed();
      <span class="type">void</span> onStartMove();
      <span class="type">void</span> onWlStartResize(<span class="type"><a href="qwaylandseat.html">QWaylandSeat</a></span> <span class="operator">*</span>seat<span class="operator">,</span> <span class="type"><a href="qwaylandwlshellsurface.html">QWaylandWlShellSurface</a></span><span class="operator">::</span>ResizeEdge edges);
      <span class="type">void</span> onXdgStartResize(<span class="type"><a href="qwaylandseat.html">QWaylandSeat</a></span> <span class="operator">*</span>seat<span class="operator">,</span> QWaylandXdgSurfaceV5<span class="operator">::</span>ResizeEdge edges);

      <span class="type">void</span> startDrag();

      <span class="type">void</span> onSurfaceCreated(<span class="type"><a href="qwaylandsurface.html">QWaylandSurface</a></span> <span class="operator">*</span>surface);
      <span class="type">void</span> onWlShellSurfaceCreated(<span class="type"><a href="qwaylandwlshellsurface.html">QWaylandWlShellSurface</a></span> <span class="operator">*</span>wlShellSurface);
      <span class="type">void</span> onXdgSurfaceCreated(QWaylandXdgSurfaceV5 <span class="operator">*</span>xdgSurface);
      <span class="type">void</span> onXdgPopupRequested(<span class="type"><a href="qwaylandsurface.html">QWaylandSurface</a></span> <span class="operator">*</span>surface<span class="operator">,</span> <span class="type"><a href="qwaylandsurface.html">QWaylandSurface</a></span> <span class="operator">*</span>parent<span class="operator">,</span> <span class="type"><a href="qwaylandseat.html">QWaylandSeat</a></span> <span class="operator">*</span>seat<span class="operator">,</span>
                               <span class="keyword">const</span> <span class="type">QPoint</span> <span class="operator">&amp;</span>position<span class="operator">,</span> <span class="keyword">const</span> <span class="type">QWaylandResource</span> <span class="operator">&amp;</span>resource);
      <span class="type">void</span> onSetTransient(<span class="type"><a href="qwaylandsurface.html">QWaylandSurface</a></span> <span class="operator">*</span>parentSurface<span class="operator">,</span> <span class="keyword">const</span> <span class="type">QPoint</span> <span class="operator">&amp;</span>relativeToParent<span class="operator">,</span> bool inactive);
      <span class="type">void</span> onSetPopup(<span class="type"><a href="qwaylandseat.html">QWaylandSeat</a></span> <span class="operator">*</span>seat<span class="operator">,</span> <span class="type"><a href="qwaylandsurface.html">QWaylandSurface</a></span> <span class="operator">*</span>parent<span class="operator">,</span> <span class="keyword">const</span> <span class="type">QPoint</span> <span class="operator">&amp;</span>relativeToParent);

      <span class="type">void</span> onSubsurfaceChanged(<span class="type"><a href="qwaylandsurface.html">QWaylandSurface</a></span> <span class="operator">*</span>child<span class="operator">,</span> <span class="type"><a href="qwaylandsurface.html">QWaylandSurface</a></span> <span class="operator">*</span>parent);
      <span class="type">void</span> onSubsurfacePositionChanged(<span class="keyword">const</span> <span class="type">QPoint</span> <span class="operator">&amp;</span>position);

      <span class="type">void</span> updateCursor();
      <span class="type">void</span> viewAnimationDone();
  <span class="keyword">private</span>:
      View <span class="operator">*</span>findView(<span class="keyword">const</span> <span class="type"><a href="qwaylandsurface.html">QWaylandSurface</a></span> <span class="operator">*</span>s) <span class="keyword">const</span>;
      <span class="type">QWindow</span> <span class="operator">*</span>m_window <span class="operator">=</span> nullptr;
      <span class="type">QList</span><span class="operator">&lt;</span>View<span class="operator">*</span><span class="operator">&gt;</span> m_views;
      <span class="type"><a href="qwaylandwlshell.html">QWaylandWlShell</a></span> <span class="operator">*</span>m_wlShell <span class="operator">=</span> nullptr;
      QWaylandXdgShellV5 <span class="operator">*</span>m_xdgShell <span class="operator">=</span> nullptr;
      <span class="type"><a href="qwaylandview.html">QWaylandView</a></span> m_cursorView;
      <span class="type">int</span> m_cursorHotspotX;
      <span class="type">int</span> m_cursorHotspotY;
  };


  <span class="preprocessor">#endif // WINDOWCOMPOSITOR_H</span>

</pre>
</div>
<!-- @@@qwindow-compositor/compositor.h -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>