/*
* Copyright (C) 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 "maybe_tracepoints.h"
#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&)
{
// TODO support surface modifications
}