Loading...
Searching...
No Matches
Window.h
/*
* Copyright (C) 2016-2017 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LOMIRI_WINDOW_H
#define LOMIRI_WINDOW_H
#include <QLoggingCategory>
#include <QObject>
#include <QPoint>
// Lomiri API
#include <lomiri/shell/application/Mir.h>
#include "WindowManagerGlobal.h"
namespace lomiri {
namespace shell {
namespace application {
class MirSurfaceInterface;
}
}
}
Q_DECLARE_LOGGING_CATEGORY(LOMIRI_WINDOW)
class WINDOWMANAGERQML_EXPORT Window : public QObject
{
Q_OBJECT
Q_PROPERTY(QPoint position READ position NOTIFY positionChanged)
Q_PROPERTY(QPoint requestedPosition READ requestedPosition WRITE setRequestedPosition NOTIFY requestedPositionChanged)
Q_PROPERTY(Mir::State state READ state NOTIFY stateChanged)
Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged)
Q_PROPERTY(bool confinesMousePointer READ confinesMousePointer NOTIFY confinesMousePointerChanged)
Q_PROPERTY(int id READ id CONSTANT)
Q_PROPERTY(lomiri::shell::application::MirSurfaceInterface* surface READ surface NOTIFY surfaceChanged)
Q_PROPERTY(bool allowClientResize READ allowClientResize WRITE setAllowClientResize NOTIFY allowClientResizeChanged)
public:
Window(int id, QObject *parent = nullptr);
virtual ~Window();
QPoint position() const;
QPoint requestedPosition() const;
void setRequestedPosition(const QPoint &);
Mir::State state() const;
bool focused() const;
bool confinesMousePointer() const;
int id() const;
lomiri::shell::application::MirSurfaceInterface* surface() const;
void setSurface(lomiri::shell::application::MirSurfaceInterface *surface);
void setFocused(bool value);
bool allowClientResize() const;
void setAllowClientResize(bool);
QString toString() const;
public Q_SLOTS:
void requestState(Mir::State state);
void close();
void activate();
Q_SIGNALS:
void closeRequested();
void emptyWindowActivated();
void positionChanged(QPoint position);
void requestedPositionChanged(QPoint position);
void stateChanged(Mir::State value);
void focusedChanged(bool value);
void confinesMousePointerChanged(bool value);
void surfaceChanged(lomiri::shell::application::MirSurfaceInterface *surface);
void allowClientResizeChanged(bool value);
void liveChanged(bool value);
void focusRequested();
private:
void updatePosition();
void updateState();
void updateFocused();
QPoint m_position;
QPoint m_requestedPosition;
bool m_positionRequested{false};
bool m_focused{false};
int m_id;
Mir::State m_state{Mir::RestoredState};
bool m_stateRequested{false};
lomiri::shell::application::MirSurfaceInterface *m_surface{nullptr};
bool m_allowClientResize{true};
};
QDebug operator<<(QDebug dbg, const Window *window);
Q_DECLARE_METATYPE(Window*)
#endif // LOMIRI_WINDOW_H
Window
A slightly higher concept than MirSurface.
Definition Window.h:48
Window::allowClientResize
bool allowClientResize
Whether to comply to resize requests coming from the client side.
Definition Window.h:99
Window::requestState
void requestState(Mir::State state)
Requests a change to the specified state.
Definition Window.cpp:117
Window::focusRequested
void focusRequested()
Emitted when focus for this window is requested by an external party.
Window::close
void close()
Sends a close request.
Definition Window.cpp:128
Window::surface
lomiri::shell::application::MirSurfaceInterface * surface
Surface backing up this window It might be null if a surface hasn't been created yet (application is ...
Definition Window.h:92
Window::requestedPosition
QPoint requestedPosition
Requested position of the current surface buffer, in pixels.
Definition Window.h:59
Window::confinesMousePointer
bool confinesMousePointer
Whether the surface wants to confine the mouse pointer within its boundaries.
Definition Window.h:78
Window::position
QPoint position
Position of the current surface buffer, in pixels.
Definition Window.h:54
Window::focused
bool focused
Whether the surface is focused.
Definition Window.h:71
Window::activate
void activate()
Focuses and raises the window.
Definition Window.cpp:137
Window::state
Mir::State state
State of the surface.
Definition Window.h:64
lomiri::shell
Definition applicationsfiltermodel.h:23
lomiri
Definition applicationsfiltermodel.h:22