From df40292fa0eec457f47949f9a9f65f4d23430fa6 Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Wed, 24 Jun 2015 15:12:08 +0100 Subject: Hack out MirShell and move functionality to WindowManager --- src/modules/Unity/Application/mirsurfaceitem.cpp | 1 + src/modules/Unity/Application/mirsurfaceitem.h | 4 +- src/modules/Unity/Application/mirsurfacemanager.h | 1 - src/platforms/mirserver/mirserver.cpp | 14 +-- src/platforms/mirserver/mirserver.h | 3 +- src/platforms/mirserver/mirshell.cpp | 118 ++++++---------------- src/platforms/mirserver/mirshell.h | 48 +++++++-- 7 files changed, 79 insertions(+), 110 deletions(-) diff --git a/src/modules/Unity/Application/mirsurfaceitem.cpp b/src/modules/Unity/Application/mirsurfaceitem.cpp index c8d895a..bb2582f 100644 --- a/src/modules/Unity/Application/mirsurfaceitem.cpp +++ b/src/modules/Unity/Application/mirsurfaceitem.cpp @@ -47,6 +47,7 @@ #include #include #include +#include namespace mg = mir::graphics; diff --git a/src/modules/Unity/Application/mirsurfaceitem.h b/src/modules/Unity/Application/mirsurfaceitem.h index fd3ab45..aae1a94 100644 --- a/src/modules/Unity/Application/mirsurfaceitem.h +++ b/src/modules/Unity/Application/mirsurfaceitem.h @@ -33,8 +33,10 @@ #include "session_interface.h" +namespace mir { namespace shell { class Shell; }} + class SurfaceObserver; -class MirShell; +using MirShell = mir::shell::Shell; namespace qtmir { diff --git a/src/modules/Unity/Application/mirsurfacemanager.h b/src/modules/Unity/Application/mirsurfacemanager.h index b9e5533..8f5080a 100644 --- a/src/modules/Unity/Application/mirsurfacemanager.h +++ b/src/modules/Unity/Application/mirsurfacemanager.h @@ -40,7 +40,6 @@ namespace mir { } class MirServer; -class MirShell; namespace qtmir { diff --git a/src/platforms/mirserver/mirserver.cpp b/src/platforms/mirserver/mirserver.cpp index a60fb0d..e90296a 100644 --- a/src/platforms/mirserver/mirserver.cpp +++ b/src/platforms/mirserver/mirserver.cpp @@ -86,17 +86,10 @@ MirServer::MirServer(int argc, char const* argv[], QObject* parent) return std::make_shared(); }); - override_the_shell([this] + override_the_window_manager_builder([this](mir::shell::FocusController* /*focus_controller*/) + -> std::shared_ptr { - auto const shell = std::make_shared( - the_input_targeter(), - the_surface_coordinator(), - the_session_coordinator(), - the_prompt_session_manager(), - the_shell_display_layout()); - - m_shell = shell; - return shell; + return std::make_shared(the_shell_display_layout()); }); set_terminator([&](int) @@ -151,5 +144,6 @@ PromptSessionListener *MirServer::promptSessionListener() MirShell *MirServer::shell() { + std::weak_ptr m_shell = the_shell(); return m_shell.lock().get(); } diff --git a/src/platforms/mirserver/mirserver.h b/src/platforms/mirserver/mirserver.h index b4b8dc2..3956f9c 100644 --- a/src/platforms/mirserver/mirserver.h +++ b/src/platforms/mirserver/mirserver.h @@ -23,7 +23,7 @@ class QtEventFeeder; class SessionListener; class SessionAuthorizer; -class MirShell; +using MirShell = mir::shell::Shell; class PromptSessionListener; // We use virtual inheritance of mir::Server to facilitate derived classes (e.g. testing) @@ -61,7 +61,6 @@ public: private: std::shared_ptr m_qtEventFeeder; - std::weak_ptr m_shell; }; #endif // MIRSERVER_H diff --git a/src/platforms/mirserver/mirshell.cpp b/src/platforms/mirserver/mirshell.cpp index 3b1e9c4..d62c76c 100644 --- a/src/platforms/mirserver/mirshell.cpp +++ b/src/platforms/mirserver/mirshell.cpp @@ -26,131 +26,79 @@ #include namespace ms = mir::scene; -using mir::shell::AbstractShell; -namespace -{ -class NullWindowManager : public mir::shell::WindowManager +QtMirWindowManager::QtMirWindowManager(const std::shared_ptr &displayLayout) : + m_displayLayout{displayLayout} { -public: - void add_session(std::shared_ptr const& session) override; - - void remove_session(std::shared_ptr const& session) override; - - mir::frontend::SurfaceId add_surface( - std::shared_ptr const& session, - ms::SurfaceCreationParameters const& params, - std::function const& session, ms::SurfaceCreationParameters const& params)> const& build) override; - - void remove_surface( - std::shared_ptr const& session, - std::weak_ptr const& surface) override; - - void add_display(mir::geometry::Rectangle const& area) override; - - void remove_display(mir::geometry::Rectangle const& area) override; - - bool handle_keyboard_event(MirKeyboardEvent const* event) override; - - bool handle_touch_event(MirTouchEvent const* event) override; - - bool handle_pointer_event(MirPointerEvent const* event) override; - - int set_surface_attribute( - std::shared_ptr const& session, - std::shared_ptr const& surface, - MirSurfaceAttrib attrib, - int value) override; - - void modify_surface(const std::shared_ptr&, const std::shared_ptr&, const mir::shell::SurfaceSpecification&); -}; + qCDebug(QTMIR_MIR_MESSAGES) << "QtMirWindowManager::QtMirWindowManager"; } +void QtMirWindowManager::add_session(std::shared_ptr const& /*session*/) +{ +} -MirShell::MirShell( - const std::shared_ptr &inputTargeter, - const std::shared_ptr &surfaceCoordinator, - const std::shared_ptr &sessionCoordinator, - const std::shared_ptr &promptSessionManager, - const std::shared_ptr &displayLayout) : - AbstractShell(inputTargeter, surfaceCoordinator, sessionCoordinator, promptSessionManager, - [](mir::shell::FocusController*) { return std::make_shared(); }), - m_displayLayout{displayLayout} +void QtMirWindowManager::remove_session(std::shared_ptr const& /*session*/) { - qCDebug(QTMIR_MIR_MESSAGES) << "MirShell::MirShell"; } -mir::frontend::SurfaceId MirShell::create_surface(const std::shared_ptr &session, const ms::SurfaceCreationParameters &requestParameters) +auto QtMirWindowManager::add_surface( + std::shared_ptr const& session, + ms::SurfaceCreationParameters const& requestParameters, + std::function const& session, ms::SurfaceCreationParameters const& params)> const& build) +-> mir::frontend::SurfaceId { tracepoint(qtmirserver, surfacePlacementStart); - // TODO: Callback unity8 so that it can make a decision on that. - // unity8 must bear in mind that the called function will be on a Mir thread though. - // The QPA shouldn't be deciding for itself on such things. - - ms::SurfaceCreationParameters placedParameters = requestParameters; + // TODO: Callback unity8 so that it can make a decision on that. + // unity8 must bear in mind that the called function will be on a Mir thread though. + // The QPA shouldn't be deciding for itself on such things. - // Just make it fullscreen for now - mir::geometry::Rectangle rect{requestParameters.top_left, requestParameters.size}; - m_displayLayout->size_to_output(rect); - placedParameters.size = rect.size; + ms::SurfaceCreationParameters placedParameters = requestParameters; - qCDebug(QTMIR_MIR_MESSAGES) << "MirShell::create_surface(): size requested (" - << requestParameters.size.width.as_int() << "," << requestParameters.size.height.as_int() << ") and placed (" - << placedParameters.size.width.as_int() << "," << placedParameters.size.height.as_int() << ")"; + // Just make it fullscreen for now + mir::geometry::Rectangle rect{requestParameters.top_left, requestParameters.size}; + m_displayLayout->size_to_output(rect); + placedParameters.size = rect.size; - tracepoint(qtmirserver, surfacePlacementEnd); + qCDebug(QTMIR_MIR_MESSAGES) << "QtMirWindowManager::add_surface(): size requested (" + << requestParameters.size.width.as_int() << "," << requestParameters.size.height.as_int() << ") and placed (" + << placedParameters.size.width.as_int() << "," << placedParameters.size.height.as_int() << ")"; - return AbstractShell::create_surface(session, placedParameters); -} - -void NullWindowManager::add_session(std::shared_ptr const& /*session*/) -{ -} + tracepoint(qtmirserver, surfacePlacementEnd); -void NullWindowManager::remove_session(std::shared_ptr const& /*session*/) -{ -} - -auto NullWindowManager::add_surface( - std::shared_ptr const& session, - ms::SurfaceCreationParameters const& params, - std::function const& session, ms::SurfaceCreationParameters const& params)> const& build) --> mir::frontend::SurfaceId -{ - return build(session, params); + return build(session, placedParameters); } -void NullWindowManager::remove_surface( +void QtMirWindowManager::remove_surface( std::shared_ptr const& /*session*/, std::weak_ptr const& /*surface*/) { } -void NullWindowManager::add_display(mir::geometry::Rectangle const& /*area*/) +void QtMirWindowManager::add_display(mir::geometry::Rectangle const& /*area*/) { } -void NullWindowManager::remove_display(mir::geometry::Rectangle const& /*area*/) +void QtMirWindowManager::remove_display(mir::geometry::Rectangle const& /*area*/) { } -bool NullWindowManager::handle_keyboard_event(MirKeyboardEvent const* /*event*/) +bool QtMirWindowManager::handle_keyboard_event(MirKeyboardEvent const* /*event*/) { return false; } -bool NullWindowManager::handle_touch_event(MirTouchEvent const* /*event*/) +bool QtMirWindowManager::handle_touch_event(MirTouchEvent const* /*event*/) { return false; } -bool NullWindowManager::handle_pointer_event(MirPointerEvent const* /*event*/) +bool QtMirWindowManager::handle_pointer_event(MirPointerEvent const* /*event*/) { return false; } -int NullWindowManager::set_surface_attribute( +int QtMirWindowManager::set_surface_attribute( std::shared_ptr const& /*session*/, std::shared_ptr const& surface, MirSurfaceAttrib attrib, @@ -159,6 +107,6 @@ int NullWindowManager::set_surface_attribute( return surface->configure(attrib, value); } -void NullWindowManager::modify_surface(const std::shared_ptr&, const std::shared_ptr&, const mir::shell::SurfaceSpecification&) +void QtMirWindowManager::modify_surface(const std::shared_ptr&, const std::shared_ptr&, const mir::shell::SurfaceSpecification&) { } diff --git a/src/platforms/mirserver/mirshell.h b/src/platforms/mirserver/mirshell.h index 85c243e..a467bbe 100644 --- a/src/platforms/mirserver/mirshell.h +++ b/src/platforms/mirserver/mirshell.h @@ -17,7 +17,8 @@ #ifndef QPAMIRSERVER_SHELL_H #define QPAMIRSERVER_SHELL_H -#include +#include + #include namespace mir { @@ -26,19 +27,44 @@ namespace mir { } } -class MirShell : public QObject, public mir::shell::AbstractShell +class QtMirWindowManager : public QObject, public mir::shell::WindowManager { - Q_OBJECT +Q_OBJECT public: - MirShell( - const std::shared_ptr &inputTargeter, - const std::shared_ptr &surfaceCoordinator, - const std::shared_ptr &sessionCoordinator, - const std::shared_ptr &promptSessionManager, - const std::shared_ptr &displayLayout); - - virtual mir::frontend::SurfaceId create_surface(const std::shared_ptr& session, const mir::scene::SurfaceCreationParameters ¶ms); + + QtMirWindowManager(const std::shared_ptr &displayLayout); + + void add_session(std::shared_ptr const& session) override; + + void remove_session(std::shared_ptr const& session) override; + + mir::frontend::SurfaceId add_surface( + std::shared_ptr const& session, + mir::scene::SurfaceCreationParameters const& params, + std::function const& session, mir::scene::SurfaceCreationParameters const& params)> const& build) override; + + void remove_surface( + std::shared_ptr const& session, + std::weak_ptr const& surface) override; + + void add_display(mir::geometry::Rectangle const& area) override; + + void remove_display(mir::geometry::Rectangle const& area) override; + + bool handle_keyboard_event(MirKeyboardEvent const* event) override; + + bool handle_touch_event(MirTouchEvent const* event) override; + + bool handle_pointer_event(MirPointerEvent const* event) override; + + int set_surface_attribute( + std::shared_ptr const& session, + std::shared_ptr const& surface, + MirSurfaceAttrib attrib, + int value) override; + + void modify_surface(const std::shared_ptr&, const std::shared_ptr&, const mir::shell::SurfaceSpecification&); private: std::shared_ptr const m_displayLayout; -- cgit v1.2.3 From c73c7a626c1615ecaaff7cf1ab0096a3c87e12e0 Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Wed, 24 Jun 2015 15:18:52 +0100 Subject: Tidy up code --- src/modules/Unity/Application/mirsurfaceitem.cpp | 1 - .../Unity/Application/mirsurfacemanager.cpp | 1 - src/modules/Unity/Application/sessionmanager.cpp | 1 - src/platforms/mirserver/CMakeLists.txt | 2 +- src/platforms/mirserver/mirserver.cpp | 4 +- src/platforms/mirserver/mirshell.cpp | 112 --------------------- src/platforms/mirserver/mirshell.h | 73 -------------- src/platforms/mirserver/mirwindowmanager.cpp | 112 +++++++++++++++++++++ src/platforms/mirserver/mirwindowmanager.h | 73 ++++++++++++++ 9 files changed, 188 insertions(+), 191 deletions(-) delete mode 100644 src/platforms/mirserver/mirshell.cpp delete mode 100644 src/platforms/mirserver/mirshell.h create mode 100644 src/platforms/mirserver/mirwindowmanager.cpp create mode 100644 src/platforms/mirserver/mirwindowmanager.h diff --git a/src/modules/Unity/Application/mirsurfaceitem.cpp b/src/modules/Unity/Application/mirsurfaceitem.cpp index bb2582f..2298f56 100644 --- a/src/modules/Unity/Application/mirsurfaceitem.cpp +++ b/src/modules/Unity/Application/mirsurfaceitem.cpp @@ -23,7 +23,6 @@ #include "mirbuffersgtexture.h" #include "session.h" #include "mirsurfaceitem.h" -#include "mirshell.h" #include "logging.h" #include "ubuntukeyboardinfo.h" diff --git a/src/modules/Unity/Application/mirsurfacemanager.cpp b/src/modules/Unity/Application/mirsurfacemanager.cpp index 183c3a5..5aa3122 100644 --- a/src/modules/Unity/Application/mirsurfacemanager.cpp +++ b/src/modules/Unity/Application/mirsurfacemanager.cpp @@ -31,7 +31,6 @@ #include "nativeinterface.h" #include "mirserver.h" #include "sessionlistener.h" -#include "mirshell.h" #include "logging.h" Q_LOGGING_CATEGORY(QTMIR_SURFACES, "qtmir.surfaces") diff --git a/src/modules/Unity/Application/sessionmanager.cpp b/src/modules/Unity/Application/sessionmanager.cpp index 75c4ba0..9b5e14f 100644 --- a/src/modules/Unity/Application/sessionmanager.cpp +++ b/src/modules/Unity/Application/sessionmanager.cpp @@ -26,7 +26,6 @@ #include "nativeinterface.h" #include "mirserver.h" #include "sessionlistener.h" -#include "mirshell.h" #include "logging.h" #include "promptsessionlistener.h" diff --git a/src/platforms/mirserver/CMakeLists.txt b/src/platforms/mirserver/CMakeLists.txt index 60abe20..2289f58 100644 --- a/src/platforms/mirserver/CMakeLists.txt +++ b/src/platforms/mirserver/CMakeLists.txt @@ -40,7 +40,7 @@ add_definitions(-DBYTE_ORDER=__BYTE_ORDER) set(MIRSERVER_QPA_PLUGIN_SRC ${CMAKE_SOURCE_DIR}/src/common/debughelpers.cpp - mirshell.cpp + mirwindowmanager.cpp qteventfeeder.cpp plugin.cpp qmirserver.cpp diff --git a/src/platforms/mirserver/mirserver.cpp b/src/platforms/mirserver/mirserver.cpp index e90296a..f7bb74a 100644 --- a/src/platforms/mirserver/mirserver.cpp +++ b/src/platforms/mirserver/mirserver.cpp @@ -19,7 +19,7 @@ #include "mirserver.h" // local -#include "mirshell.h" +#include "mirwindowmanager.h" #include "mirglconfig.h" #include "mirserverstatuslistener.h" #include "promptsessionlistener.h" @@ -89,7 +89,7 @@ MirServer::MirServer(int argc, char const* argv[], QObject* parent) override_the_window_manager_builder([this](mir::shell::FocusController* /*focus_controller*/) -> std::shared_ptr { - return std::make_shared(the_shell_display_layout()); + return std::make_shared(the_shell_display_layout()); }); set_terminator([&](int) diff --git a/src/platforms/mirserver/mirshell.cpp b/src/platforms/mirserver/mirshell.cpp deleted file mode 100644 index d62c76c..0000000 --- a/src/platforms/mirserver/mirshell.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright © 2015 Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License version 3, as published by - * the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -#include "mirshell.h" -#include "logging.h" -#include "tracepoints.h" // generated from tracepoints.tp - -#include -#include -#include -#include -#include -#include - -namespace ms = mir::scene; - -QtMirWindowManager::QtMirWindowManager(const std::shared_ptr &displayLayout) : - m_displayLayout{displayLayout} -{ - qCDebug(QTMIR_MIR_MESSAGES) << "QtMirWindowManager::QtMirWindowManager"; -} - -void QtMirWindowManager::add_session(std::shared_ptr const& /*session*/) -{ -} - -void QtMirWindowManager::remove_session(std::shared_ptr const& /*session*/) -{ -} - -auto QtMirWindowManager::add_surface( - std::shared_ptr const& session, - ms::SurfaceCreationParameters const& requestParameters, - std::function const& session, ms::SurfaceCreationParameters const& params)> const& build) --> mir::frontend::SurfaceId -{ - tracepoint(qtmirserver, surfacePlacementStart); - - // TODO: Callback unity8 so that it can make a decision on that. - // unity8 must bear in mind that the called function will be on a Mir thread though. - // The QPA shouldn't be deciding for itself on such things. - - ms::SurfaceCreationParameters placedParameters = requestParameters; - - // Just make it fullscreen for now - mir::geometry::Rectangle rect{requestParameters.top_left, requestParameters.size}; - m_displayLayout->size_to_output(rect); - placedParameters.size = rect.size; - - qCDebug(QTMIR_MIR_MESSAGES) << "QtMirWindowManager::add_surface(): size requested (" - << requestParameters.size.width.as_int() << "," << requestParameters.size.height.as_int() << ") and placed (" - << placedParameters.size.width.as_int() << "," << placedParameters.size.height.as_int() << ")"; - - tracepoint(qtmirserver, surfacePlacementEnd); - - return build(session, placedParameters); -} - -void QtMirWindowManager::remove_surface( - std::shared_ptr const& /*session*/, - std::weak_ptr const& /*surface*/) -{ -} - -void QtMirWindowManager::add_display(mir::geometry::Rectangle const& /*area*/) -{ -} - -void QtMirWindowManager::remove_display(mir::geometry::Rectangle const& /*area*/) -{ -} - -bool QtMirWindowManager::handle_keyboard_event(MirKeyboardEvent const* /*event*/) -{ - return false; -} - -bool QtMirWindowManager::handle_touch_event(MirTouchEvent const* /*event*/) -{ - return false; -} - -bool QtMirWindowManager::handle_pointer_event(MirPointerEvent const* /*event*/) -{ - return false; -} - -int QtMirWindowManager::set_surface_attribute( - std::shared_ptr const& /*session*/, - std::shared_ptr const& surface, - MirSurfaceAttrib attrib, - int value) -{ - return surface->configure(attrib, value); -} - -void QtMirWindowManager::modify_surface(const std::shared_ptr&, const std::shared_ptr&, const mir::shell::SurfaceSpecification&) -{ -} diff --git a/src/platforms/mirserver/mirshell.h b/src/platforms/mirserver/mirshell.h deleted file mode 100644 index a467bbe..0000000 --- a/src/platforms/mirserver/mirshell.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright © 2015 Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License version 3, as published by - * the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, - * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -#ifndef QPAMIRSERVER_SHELL_H -#define QPAMIRSERVER_SHELL_H - -#include - -#include - -namespace mir { - namespace shell { - class DisplayLayout; - } -} - -class QtMirWindowManager : public QObject, public mir::shell::WindowManager -{ -Q_OBJECT - -public: - - QtMirWindowManager(const std::shared_ptr &displayLayout); - - void add_session(std::shared_ptr const& session) override; - - void remove_session(std::shared_ptr const& session) override; - - mir::frontend::SurfaceId add_surface( - std::shared_ptr const& session, - mir::scene::SurfaceCreationParameters const& params, - std::function const& session, mir::scene::SurfaceCreationParameters const& params)> const& build) override; - - void remove_surface( - std::shared_ptr const& session, - std::weak_ptr const& surface) override; - - void add_display(mir::geometry::Rectangle const& area) override; - - void remove_display(mir::geometry::Rectangle const& area) override; - - bool handle_keyboard_event(MirKeyboardEvent const* event) override; - - bool handle_touch_event(MirTouchEvent const* event) override; - - bool handle_pointer_event(MirPointerEvent const* event) override; - - int set_surface_attribute( - std::shared_ptr const& session, - std::shared_ptr const& surface, - MirSurfaceAttrib attrib, - int value) override; - - void modify_surface(const std::shared_ptr&, const std::shared_ptr&, const mir::shell::SurfaceSpecification&); - -private: - std::shared_ptr const m_displayLayout; -}; - -#endif /* QPAMIRSERVER_SHELL_H */ diff --git a/src/platforms/mirserver/mirwindowmanager.cpp b/src/platforms/mirserver/mirwindowmanager.cpp new file mode 100644 index 0000000..a7bf2bc --- /dev/null +++ b/src/platforms/mirserver/mirwindowmanager.cpp @@ -0,0 +1,112 @@ +/* + * Copyright © 2015 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License version 3, as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, + * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +#include "mirwindowmanager.h" +#include "logging.h" +#include "tracepoints.h" // generated from tracepoints.tp + +#include +#include +#include +#include +#include +#include + +namespace ms = mir::scene; + +MirWindowManager::MirWindowManager(const std::shared_ptr &displayLayout) : + m_displayLayout{displayLayout} +{ + qCDebug(QTMIR_MIR_MESSAGES) << "MirWindowManager::MirWindowManager"; +} + +void MirWindowManager::add_session(std::shared_ptr const& /*session*/) +{ +} + +void MirWindowManager::remove_session(std::shared_ptr const& /*session*/) +{ +} + +auto MirWindowManager::add_surface( + std::shared_ptr const& session, + ms::SurfaceCreationParameters const& requestParameters, + std::function const& session, ms::SurfaceCreationParameters const& params)> const& build) +-> mir::frontend::SurfaceId +{ + tracepoint(qtmirserver, surfacePlacementStart); + + // TODO: Callback unity8 so that it can make a decision on that. + // unity8 must bear in mind that the called function will be on a Mir thread though. + // The QPA shouldn't be deciding for itself on such things. + + ms::SurfaceCreationParameters placedParameters = requestParameters; + + // Just make it fullscreen for now + mir::geometry::Rectangle rect{requestParameters.top_left, requestParameters.size}; + m_displayLayout->size_to_output(rect); + placedParameters.size = rect.size; + + qCDebug(QTMIR_MIR_MESSAGES) << "MirWindowManager::add_surface(): size requested (" + << requestParameters.size.width.as_int() << "," << requestParameters.size.height.as_int() << ") and placed (" + << placedParameters.size.width.as_int() << "," << placedParameters.size.height.as_int() << ")"; + + tracepoint(qtmirserver, surfacePlacementEnd); + + return build(session, placedParameters); +} + +void MirWindowManager::remove_surface( + std::shared_ptr const& /*session*/, + std::weak_ptr const& /*surface*/) +{ +} + +void MirWindowManager::add_display(mir::geometry::Rectangle const& /*area*/) +{ +} + +void MirWindowManager::remove_display(mir::geometry::Rectangle const& /*area*/) +{ +} + +bool MirWindowManager::handle_keyboard_event(MirKeyboardEvent const* /*event*/) +{ + return false; +} + +bool MirWindowManager::handle_touch_event(MirTouchEvent const* /*event*/) +{ + return false; +} + +bool MirWindowManager::handle_pointer_event(MirPointerEvent const* /*event*/) +{ + return false; +} + +int MirWindowManager::set_surface_attribute( + std::shared_ptr const& /*session*/, + std::shared_ptr const& surface, + MirSurfaceAttrib attrib, + int value) +{ + return surface->configure(attrib, value); +} + +void MirWindowManager::modify_surface(const std::shared_ptr&, const std::shared_ptr&, const mir::shell::SurfaceSpecification&) +{ +} diff --git a/src/platforms/mirserver/mirwindowmanager.h b/src/platforms/mirserver/mirwindowmanager.h new file mode 100644 index 0000000..3cf719d --- /dev/null +++ b/src/platforms/mirserver/mirwindowmanager.h @@ -0,0 +1,73 @@ +/* + * Copyright © 2015 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License version 3, as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, + * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +#ifndef QPAMIRSERVER_WINDOW_MANAGER_H +#define QPAMIRSERVER_WINDOW_MANAGER_H + +#include + +#include + +namespace mir { + namespace shell { + class DisplayLayout; + } +} + +class MirWindowManager : public QObject, public mir::shell::WindowManager +{ +Q_OBJECT + +public: + + MirWindowManager(const std::shared_ptr &displayLayout); + + void add_session(std::shared_ptr const& session) override; + + void remove_session(std::shared_ptr const& session) override; + + mir::frontend::SurfaceId add_surface( + std::shared_ptr const& session, + mir::scene::SurfaceCreationParameters const& params, + std::function const& session, mir::scene::SurfaceCreationParameters const& params)> const& build) override; + + void remove_surface( + std::shared_ptr const& session, + std::weak_ptr const& surface) override; + + void add_display(mir::geometry::Rectangle const& area) override; + + void remove_display(mir::geometry::Rectangle const& area) override; + + bool handle_keyboard_event(MirKeyboardEvent const* event) override; + + bool handle_touch_event(MirTouchEvent const* event) override; + + bool handle_pointer_event(MirPointerEvent const* event) override; + + int set_surface_attribute( + std::shared_ptr const& session, + std::shared_ptr const& surface, + MirSurfaceAttrib attrib, + int value) override; + + void modify_surface(const std::shared_ptr&, const std::shared_ptr&, const mir::shell::SurfaceSpecification&); + +private: + std::shared_ptr const m_displayLayout; +}; + +#endif /* QPAMIRSERVER_WINDOW_MANAGER_H */ -- cgit v1.2.3 From 6b69c97293bee4165e76c5a78e6e2c6cb20091b9 Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Wed, 24 Jun 2015 16:02:47 +0100 Subject: Unused header --- src/platforms/mirserver/mirwindowmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/mirserver/mirwindowmanager.cpp b/src/platforms/mirserver/mirwindowmanager.cpp index a7bf2bc..cae66d4 100644 --- a/src/platforms/mirserver/mirwindowmanager.cpp +++ b/src/platforms/mirserver/mirwindowmanager.cpp @@ -23,7 +23,6 @@ #include #include #include -#include namespace ms = mir::scene; @@ -109,4 +108,5 @@ int MirWindowManager::set_surface_attribute( void MirWindowManager::modify_surface(const std::shared_ptr&, const std::shared_ptr&, const mir::shell::SurfaceSpecification&) { + // TODO support surface modifications } -- cgit v1.2.3 From 5ba555df32d5397fed6391b4b857e608081c5b34 Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Wed, 29 Jul 2015 17:19:25 +0100 Subject: Revert unwanted layout change --- src/platforms/mirserver/mirwindowmanager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/mirserver/mirwindowmanager.h b/src/platforms/mirserver/mirwindowmanager.h index 3cf719d..0ec1839 100644 --- a/src/platforms/mirserver/mirwindowmanager.h +++ b/src/platforms/mirserver/mirwindowmanager.h @@ -29,7 +29,7 @@ namespace mir { class MirWindowManager : public QObject, public mir::shell::WindowManager { -Q_OBJECT + Q_OBJECT public: -- cgit v1.2.3