rpc AppStatusState(AppStateRequest) returns (stream AppStateResponse) {}
rpc GetOutputs(OutputRequest) returns (ListOutputResponse) {}
rpc SetAppNormal(NormalRequest) returns (NormalResponse) {}
+ rpc SetAppOnOutput(AppOnOutputRequest) returns (AppOnOutputResponse) {}
}
message ActivateRequest {
message FullscreenResponse {
};
+
+message AppOnOutputRequest {
+ string app_id = 1;
+ string output = 2;
+};
+
+message AppOnOutputResponse {
+};
return reactor;
}
+grpc::ServerUnaryReactor *
+GrpcServiceImpl::SetAppOnOutput(grpc::CallbackServerContext *context,
+ const ::agl_shell_ipc::AppOnOutputRequest* request,
+ ::agl_shell_ipc::AppOnOutputResponse* /* response */)
+{
+ m_aglShell->SetAppOnOutput(request->app_id(), request->output());
+
+ grpc::ServerUnaryReactor* reactor = context->DefaultReactor();
+ reactor->Finish(grpc::Status::OK);
+ return reactor;
+}
+
grpc::ServerUnaryReactor *
GrpcServiceImpl::SetAppSplit(grpc::CallbackServerContext *context,
const ::agl_shell_ipc::SplitRequest* request,
const ::agl_shell_ipc::FullscreenRequest* request,
::agl_shell_ipc::FullscreenResponse* /*response*/) override;
+ grpc::ServerUnaryReactor *SetAppOnOutput(grpc::CallbackServerContext *context,
+ const ::agl_shell_ipc::AppOnOutputRequest* request,
+ ::agl_shell_ipc::AppOnOutputResponse* /*response*/) override;
+
grpc::ServerWriteReactor< ::agl_shell_ipc::AppStateResponse>* AppStatusState(
::grpc::CallbackServerContext* /*context*/,
const ::agl_shell_ipc::AppStateRequest* /*request*/) override;
}
}
+static void
+agl_shell_app_on_output(void *data, struct agl_shell *agl_shell,
+ const char *app_id, const char *output_name)
+{
+ (void) agl_shell;
+ (void) output_name;
+ (void) data;
+ (void) app_id;
+
+ LOG("got app_on_output event app_id %s on output\n", app_id, output_name);
+}
+
+
static const struct agl_shell_listener shell_listener = {
- agl_shell_bound_ok,
- agl_shell_bound_fail,
- agl_shell_app_state,
+ agl_shell_bound_ok,
+ agl_shell_bound_fail,
+ agl_shell_app_state,
+ agl_shell_app_on_output,
};
static const struct agl_shell_listener shell_listener_init = {
- agl_shell_bound_ok_init,
- agl_shell_bound_fail_init,
- nullptr,
+ agl_shell_bound_ok_init,
+ agl_shell_bound_fail_init,
+ nullptr,
+ nullptr,
};
static void
sh->shell =
static_cast<struct agl_shell *>(wl_registry_bind(reg, id,
&agl_shell_interface,
- std::min(static_cast<uint32_t>(7), version)));
+ std::min(static_cast<uint32_t>(8), version)));
agl_shell_add_listener(sh->shell, &shell_listener, data);
sh->version = version;
} else if (strcmp(interface, "wl_output") == 0) {
sh->shell =
static_cast<struct agl_shell *>(wl_registry_bind(reg, id,
&agl_shell_interface,
- std::min(static_cast<uint32_t>(7), version)));
+ std::min(static_cast<uint32_t>(8), version)));
agl_shell_add_listener(sh->shell, &shell_listener_init, data);
sh->version = version;
}
#include <queue>
#include "main-grpc.h"
+#include "log.h"
#include "shell.h"
void
wl_display_flush(m_shell_data->wl_display);
}
+void
+Shell::SetAppOnOutput(const std::string &app_id, const std::string &output)
+{
+ struct window_output *woutput, *w_output;
+ struct agl_shell *shell = this->m_shell.get();
+
+ woutput = nullptr;
+ w_output = nullptr;
+
+ wl_list_for_each(woutput, &m_shell_data->output_list, link) {
+ if (woutput->name && !strcmp(woutput->name, output.c_str())) {
+ w_output = woutput;
+ break;
+ }
+ }
+
+ if (!w_output) {
+ LOG("Could not found output '%s' to set the application\n");
+ return;
+ }
+
+ agl_shell_set_app_output(shell, app_id.c_str(), w_output->output);
+ wl_display_flush(m_shell_data->wl_display);
+}
+
void
Shell::SetAppSplit(const std::string &app_id, uint32_t orientation)
{
int32_t x_pos, int32_t y_pos);
void SetAppNormal(const std::string &app_id);
void SetAppFullscreen(const std::string &app_id);
+ void SetAppOnOutput(const std::string &app_id, const std::string &output);
};
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
- <interface name="agl_shell" version="7">
+ <interface name="agl_shell" version="8">
<description summary="user interface for Automotive Grade Linux platform">
Starting with version 2 of the protocol, the client is required to wait
for the 'bound_ok' or 'bound_fail' events in order to proceed further.
</description>
<arg name="app_id" type="string"/>
</request>
+
+ <request name="set_app_output" since="8">
+ <description summary="Assign an application to a particular output">
+ This would allow the compositor to place an application on a particular
+ output, if that output is indeed available. This can happen before
+ application is started which would make the application start on that
+ particular output. If the application is already started it would
+ move the application to that output.
+
+ There's no persistence of this request, once the application terminated
+ you'll need to issue this request again for that particular app_id.
+
+ See xdg_toplevel.set_app_id from the xdg-shell protocol for a
+ description of app_id.
+ </description>
+ <arg name="app_id" type="string"/>
+ <arg name="output" type="object" interface="wl_output"/>
+ </request>
+
+ <event name="app_on_output" since="8">
+ <description summary="Event sent as a reponse to set_app_output">
+ Clients can use this event to be notified when an application
+ wants to be displayed on a certain output. This event is sent in
+ response to the set_app_output request.
+
+ See xdg_toplevel.set_app_id from the xdg-shell protocol for a
+ description of app_id.
+ </description>
+ <arg name="app_id" type="string"/>
+ <arg name="output_name" type="string"/>
+ </event>
</interface>
<interface name="agl_shell_ext" version="1">
}
}
+void
+shell_send_app_on_output(struct ivi_compositor *ivi, const char *app_id,
+ const char *output_name)
+{
+ if (app_id && wl_resource_get_version(ivi->shell_client.resource) >=
+ AGL_SHELL_APP_ON_OUTPUT_SINCE_VERSION) {
+
+ agl_shell_send_app_on_output(ivi->shell_client.resource,
+ app_id, output_name);
+
+ if (ivi->shell_client.resource_ext)
+ agl_shell_send_app_on_output(ivi->shell_client.resource_ext,
+ app_id, output_name);
+ }
+}
+
static void
shell_ready(struct wl_client *client, struct wl_resource *shell_res)
{
ioutput->area_activation = area;
}
+static void
+shell_set_app_output(struct wl_client *client, struct wl_resource *res,
+ const char *app_id, struct wl_resource *output)
+{
+ struct ivi_compositor *ivi = wl_resource_get_user_data(res);
+ struct weston_head *head = weston_head_from_resource(output);
+ struct weston_output *woutput = weston_head_get_output(head);
+ struct ivi_output *ioutput = to_ivi_output(woutput);
+ struct ivi_surface *surf = ivi_find_app(ivi, app_id);
+
+ if (!app_id || !ioutput)
+ return;
+
+ if (!surf || (surf && surf->role != IVI_SURFACE_ROLE_REMOTE)) {
+ ivi_set_pending_desktop_surface_remote(ioutput, app_id);
+ shell_send_app_on_output(ivi, app_id, woutput->name);
+ return;
+ }
+}
+
static void
shell_ext_destroy(struct wl_client *client, struct wl_resource *res)
{
.set_app_float = shell_set_app_float,
.set_app_normal = shell_set_app_normal,
.set_app_fullscreen = shell_set_app_fullscreen,
+ .set_app_output = shell_set_app_output,
};
static const struct agl_shell_ext_interface agl_shell_ext_implementation = {
ivi_shell_create_global(struct ivi_compositor *ivi)
{
ivi->agl_shell = wl_global_create(ivi->compositor->wl_display,
- &agl_shell_interface, 7,
+ &agl_shell_interface, 8,
ivi, bind_agl_shell);
if (!ivi->agl_shell) {
weston_log("Failed to create wayland global.\n");