diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2023-02-09 14:06:49 +0200 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2023-03-01 12:38:14 +0200 |
commit | 359a0612e48d7d21d5247199ca57063bd5965f71 (patch) | |
tree | c90fc1f6ea15395d564cc12b6e68d0661a2c6a65 | |
parent | 4af44df30c1784a69b96d310f152133a507bc2e1 (diff) |
protocol: Add set_app_normal request
This request allows transitioning back from other roles like
float/split/fullscreen to regular maximized, normal state.
Bug-AGL: SPEC-4673
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: Id7f04ffee193677621bd32860998457498acc388
-rw-r--r-- | grpc-proxy/agl_shell.proto | 8 | ||||
-rw-r--r-- | grpc-proxy/grpc-async-cb.cpp | 12 | ||||
-rw-r--r-- | grpc-proxy/grpc-async-cb.h | 4 | ||||
-rw-r--r-- | grpc-proxy/shell.cpp | 9 | ||||
-rw-r--r-- | grpc-proxy/shell.h | 1 | ||||
-rw-r--r-- | protocol/agl-shell.xml | 9 | ||||
-rw-r--r-- | src/layout.c | 2 | ||||
-rw-r--r-- | src/shell.c | 52 |
8 files changed, 97 insertions, 0 deletions
diff --git a/grpc-proxy/agl_shell.proto b/grpc-proxy/agl_shell.proto index 8e81750..f8a57d2 100644 --- a/grpc-proxy/agl_shell.proto +++ b/grpc-proxy/agl_shell.proto @@ -10,6 +10,7 @@ service AglShellManagerService { rpc SetAppFloat(FloatRequest) returns (FloatResponse) {} rpc AppStatusState(AppStateRequest) returns (stream AppStateResponse) {} rpc GetOutputs(OutputRequest) returns (ListOutputResponse) {} + rpc SetAppNormal(NormalRequest) returns (NormalResponse) {} } message ActivateRequest { @@ -62,3 +63,10 @@ message OutputResponse { message ListOutputResponse { repeated OutputResponse outputs = 1; }; + +message NormalRequest { + string app_id = 1; +}; + +message NormalResponse { +}; diff --git a/grpc-proxy/grpc-async-cb.cpp b/grpc-proxy/grpc-async-cb.cpp index 3754b3c..f7c114a 100644 --- a/grpc-proxy/grpc-async-cb.cpp +++ b/grpc-proxy/grpc-async-cb.cpp @@ -123,6 +123,18 @@ GrpcServiceImpl::SetAppFloat(grpc::CallbackServerContext *context, } grpc::ServerUnaryReactor * +GrpcServiceImpl::SetAppNormal(grpc::CallbackServerContext *context, + const ::agl_shell_ipc::NormalRequest* request, + ::agl_shell_ipc::NormalResponse* /* response */) +{ + m_aglShell->SetAppNormal(request->app_id()); + + 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, ::agl_shell_ipc::SplitResponse* /*response*/) diff --git a/grpc-proxy/grpc-async-cb.h b/grpc-proxy/grpc-async-cb.h index e6a19a6..214ce12 100644 --- a/grpc-proxy/grpc-async-cb.h +++ b/grpc-proxy/grpc-async-cb.h @@ -84,6 +84,10 @@ public: const ::agl_shell_ipc::OutputRequest* /* request */, ::agl_shell_ipc::ListOutputResponse* response) override; + grpc::ServerUnaryReactor *SetAppNormal(grpc::CallbackServerContext *context, + const ::agl_shell_ipc::NormalRequest* request, + ::agl_shell_ipc::NormalResponse* /*response*/) override; + grpc::ServerWriteReactor< ::agl_shell_ipc::AppStateResponse>* AppStatusState( ::grpc::CallbackServerContext* /*context*/, const ::agl_shell_ipc::AppStateRequest* /*request*/) override; diff --git a/grpc-proxy/shell.cpp b/grpc-proxy/shell.cpp index 83032b1..eb2e08b 100644 --- a/grpc-proxy/shell.cpp +++ b/grpc-proxy/shell.cpp @@ -77,6 +77,15 @@ Shell::SetAppFloat(const std::string &app_id, int32_t x_pos, int32_t y_pos) } void +Shell::SetAppNormal(const std::string &app_id) +{ + struct agl_shell *shell = this->m_shell.get(); + + agl_shell_set_app_normal(shell, app_id.c_str()); + wl_display_flush(m_shell_data->wl_display); +} + +void Shell::SetAppSplit(const std::string &app_id, uint32_t orientation) { (void) app_id; diff --git a/grpc-proxy/shell.h b/grpc-proxy/shell.h index 4059e0b..143599a 100644 --- a/grpc-proxy/shell.h +++ b/grpc-proxy/shell.h @@ -43,4 +43,5 @@ public: void SetAppSplit(const std::string &app_id, uint32_t orientation); void SetAppFloat(const std::string &app_id, int32_t x_pos, int32_t y_pos); + void SetAppNormal(const std::string &app_id); }; diff --git a/protocol/agl-shell.xml b/protocol/agl-shell.xml index 140910c..d01771f 100644 --- a/protocol/agl-shell.xml +++ b/protocol/agl-shell.xml @@ -243,6 +243,15 @@ <arg name="x" type="int" summary="x position"/> <arg name="y" type="int" summary="y position"/> </request> + + <request name="set_app_normal" since="6"> + <description summary="set the window identified by app_id as normally started"> + Returns the application identified by app_id as it was in the normal state. + This is useful to come back from other states to the maximized state, the + normal state applications are started. + </description> + <arg name="app_id" type="string"/> + </request> </interface> <interface name="agl_shell_ext" version="1"> diff --git a/src/layout.c b/src/layout.c index bc489b2..df9184d 100644 --- a/src/layout.c +++ b/src/layout.c @@ -248,6 +248,8 @@ ivi_layout_activate_complete(struct ivi_output *output, weston_view_set_output(view, woutput); + /* drop any previous masks set on this view */ + weston_view_set_mask_infinite(view); if (surf->role != IVI_SURFACE_ROLE_BACKGROUND) weston_view_set_position(view, diff --git a/src/shell.c b/src/shell.c index 4a1a954..fbd1b72 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1483,6 +1483,7 @@ shell_set_app_float(struct wl_client *client, struct wl_resource *shell_res, surf->popup.y = y_pos; surf->popup.bb = bb; + /* change the role */ surf->role = IVI_SURFACE_ROLE_NONE; @@ -1505,6 +1506,56 @@ shell_set_app_float(struct wl_client *client, struct wl_resource *shell_res, } static void +shell_set_app_normal(struct wl_client *client, struct wl_resource *shell_res, + const char *app_id) +{ + struct ivi_compositor *ivi = wl_resource_get_user_data(shell_res); + struct ivi_surface *surf = ivi_find_app(ivi, app_id); + struct weston_output *output = get_focused_output(ivi->compositor); + struct ivi_output *ivi_output; + struct weston_desktop_surface *dsurf; + struct weston_geometry area = {}; + + + if (!surf || (surf && surf->role == IVI_SURFACE_ROLE_DESKTOP)) + return; + + if (!output) + output = get_default_output(ivi->compositor); + + dsurf = surf->dsurface; + ivi_output = to_ivi_output(output); + + weston_layer_entry_remove(&surf->view->layer_link); + weston_view_geometry_dirty(surf->view); + weston_surface_damage(surf->view->surface); + + /* change the role */ + surf->role = IVI_SURFACE_ROLE_NONE; + surf->desktop.pending_output = ivi_output; + + wl_list_remove(&surf->link); + wl_list_init(&surf->link); + + ivi_set_desktop_surface(surf); + + if (ivi_output->area_activation.width || + ivi_output->area_activation.height) + area = ivi_output->area_activation; + else + area = ivi_output->area; + + weston_desktop_surface_set_maximized(dsurf, true); + weston_desktop_surface_set_size(dsurf, area.width, area.height); + + /* add to hidden layer */ + weston_layer_entry_insert(&ivi->hidden.view_list, + &surf->view->layer_link); + weston_compositor_schedule_repaint(ivi->compositor); + +} + +static void shell_desktop_activate_app(struct wl_client *client, struct wl_resource *shell_res, const char *app_id, const char *data, @@ -1587,6 +1638,7 @@ static const struct agl_shell_interface agl_shell_implementation = { .set_activate_region = shell_set_activate_region, .deactivate_app = shell_new_deactivate_app, .set_app_float = shell_set_app_float, + .set_app_normal = shell_set_app_normal, }; static const struct agl_shell_ext_interface agl_shell_ext_implementation = { |