summaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2023-11-27 16:37:09 +0200
committerMarius Vlad <marius.vlad@collabora.com>2023-12-05 17:55:55 +0200
commita7b8d60c62554b4571e0155ce44794b123cf1c09 (patch)
tree59f32bfe79e716b7862482d82cc5228cf2e768b3 /app/main.cpp
parent5be991ce27c966a4d87a6b0cc8bdbbd46e18c427 (diff)
app: Fix resizing to window/float and set it up if user requests it
Make use of the gRPC API and allow the user to start the camera as floating/dialog type of window. This has the side effect requiring an initial resize values. We didn't need to do that because we always had to be resized to a maximum but now we need to have an initial value as well. Bug-AGL: SPEC-4987 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I3df8f0887425d461b6d812a429da6ce10fa1e00d
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/main.cpp b/app/main.cpp
index bc2bb26..bc7155a 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -16,6 +16,7 @@
#include "utils.h"
#include "xdg-shell-client-protocol.h"
+#include "AglShellGrpcClient.h"
#include <gst/gst.h>
@@ -216,6 +217,7 @@ create_shm_buffer(struct display *display, struct buffer *buffer,
buffer->height = height;
fprintf(stdout, "Created shm buffer with width %d, height %d\n", width, height);
+
return 0;
}
@@ -571,6 +573,8 @@ create_window(struct display *display, int width, int height, const char *app_id
window->display = display;
window->width = width;
window->height = height;
+ window->init_width = width;
+ window->init_height = height;
window->surface = wl_compositor_create_surface(display->wl_compositor);
if (display->wm_base) {
@@ -756,6 +760,13 @@ int main(int argc, char* argv[])
struct window* window;
const char* app_id = "camera-gstreamer";
+ // for starting the application from the beginning, with a diffrent
+ // role we need to handle that creating the main window
+ if (argc >= 2 && strcmp(argv[1], "float") == 0) {
+ GrpcClient *client = new GrpcClient();
+ client->SetAppFloat(std::string(app_id), 30, 400);
+ }
+
sa.sa_sigaction = signal_int;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESETHAND | SA_SIGINFO;