<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
In my trawl through the data model I came across
handle_surface_created() and wondered exactly what problem it
solves.<br>
<br>
I suspect the "scene" rework will offer a better solution, but I'd
like to understand what's going on before proposing anything.<br>
<br>
Firstly, note that <b>this function is not the subject of any tests</b>.
So changes that break the required behaviour will not cause test
failures.<br>
<br>
Now, from mf::SessionMediator::create_surface()<br>
<br>
// TODO: NOTE: We use the ordering here to ensure the
shell acts on the surface after the surface ID is sent over the
wire.<br>
// This guarantees that notifications such as, gained
focus, etc, can be correctly interpreted by the client.<br>
// To achieve this order we rely on done->Run()
sending messages synchronously. As documented in
mfd::SocketMessenger::send.<br>
// this will require additional synchronization if
mfd::SocketMessenger::send changes.<br>
<br>
And the active code is:<br>
<blockquote>void
ms::SessionManager::handle_surface_created(std::shared_ptr<mf::Session>
const& session)<br>
{<br>
auto shell_session =
std::dynamic_pointer_cast<msh::Session>(session);<br>
<br>
set_focus_to(shell_session);<br>
}<br>
</blockquote>
So, it appears to be a mechanism for setting the focus to the
session that owns a surface <i>after</i> the surface data has been
sent to the client. Except that we also call it from mf::SurfaceId
ms::SessionManager::create_surface_for()<br>
<blockquote>// TODO: We use this to work around the lack of a
SessionMediator-like object for internal clients.<br>
// we could have an internal client mediator which acts as a
factory for internal clients, taking responsibility<br>
// for invoking handle_surface_created.<br>
</blockquote>
In any case, the requirement appears to be that to focus on a
session immediately a new surface in the session is known to the
client.<br>
<br>
I assume this is so that input can be routed to the surface before
it is visible? (That surface hasn't yet posted a frame so it is not
available to be rendered.)<br>
</body>
</html>