protocol: Add set_app_normal request 65/28465/3
authorMarius Vlad <marius.vlad@collabora.com>
Thu, 9 Feb 2023 12:06:49 +0000 (14:06 +0200)
committerMarius Vlad <marius.vlad@collabora.com>
Wed, 1 Mar 2023 10:38:14 +0000 (12:38 +0200)
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

grpc-proxy/agl_shell.proto
grpc-proxy/grpc-async-cb.cpp
grpc-proxy/grpc-async-cb.h
grpc-proxy/shell.cpp
grpc-proxy/shell.h
protocol/agl-shell.xml
src/layout.c
src/shell.c

index 8e81750..f8a57d2 100644 (file)
@@ -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 {
+};
index 3754b3c..f7c114a 100644 (file)
@@ -122,6 +122,18 @@ GrpcServiceImpl::SetAppFloat(grpc::CallbackServerContext *context,
        return reactor;
 }
 
+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,
index e6a19a6..214ce12 100644 (file)
@@ -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;
index 83032b1..eb2e08b 100644 (file)
@@ -76,6 +76,15 @@ Shell::SetAppFloat(const std::string &app_id, int32_t x_pos, int32_t y_pos)
        wl_display_flush(m_shell_data->wl_display);
 }
 
+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)
 {
index 4059e0b..143599a 100644 (file)
@@ -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);
 };
index 140910c..d01771f 100644 (file)
       <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">
index bc489b2..df9184d 100644 (file)
@@ -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,
index 4a1a954..fbd1b72 100644 (file)
@@ -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;
 
@@ -1504,6 +1505,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,
@@ -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 = {