aboutsummaryrefslogtreecommitdiffstats
path: root/libhomescreen
diff options
context:
space:
mode:
Diffstat (limited to 'libhomescreen')
-rw-r--r--libhomescreen/include/libhomescreen.hpp12
-rw-r--r--libhomescreen/src/libhomescreen.cpp57
2 files changed, 65 insertions, 4 deletions
diff --git a/libhomescreen/include/libhomescreen.hpp b/libhomescreen/include/libhomescreen.hpp
index f92e190..db6ca2d 100644
--- a/libhomescreen/include/libhomescreen.hpp
+++ b/libhomescreen/include/libhomescreen.hpp
@@ -5,6 +5,14 @@
struct _LibHomeScreenHomescreen;
typedef struct _LibHomeScreenHomescreen LibHomeScreenHomescreen;
+typedef struct
+{
+ int x;
+ int y;
+ int width;
+ int height;
+} sRectangle;
+
class LibHomeScreen
{
public:
@@ -12,8 +20,10 @@ public:
~LibHomeScreen();
// these are representing the D-Bus methods:
+ sRectangle getLayoutRenderAreaForSurfaceId(int surfaceId);
void hardKeyPressed(int key);
- void toggleFullScreen();
+ void renderSurfaceToArea(int surfaceId, const sRectangle &renderArea);
+ void requestSurfaceIdToFullScreen(int surfaceId);
private:
LibHomeScreenHomescreen *mp_libHomeScreenHomescreen_Proxy;
diff --git a/libhomescreen/src/libhomescreen.cpp b/libhomescreen/src/libhomescreen.cpp
index 978a42c..39af1c3 100644
--- a/libhomescreen/src/libhomescreen.cpp
+++ b/libhomescreen/src/libhomescreen.cpp
@@ -1,4 +1,6 @@
+extern "C" {
#include "homescreen.h" // generated from xml
+}
#include "include/libhomescreen.hpp"
#include <stdio.h>
@@ -27,6 +29,30 @@ LibHomeScreen::~LibHomeScreen()
g_object_unref(mp_libHomeScreenHomescreen_Proxy);
}
+sRectangle LibHomeScreen::getLayoutRenderAreaForSurfaceId(int surfaceId)
+{
+ sRectangle result;
+ GError *err = NULL;
+
+ GVariant *out_renderArea;
+
+ lib_home_screen_homescreen_call_get_layout_render_area_for_surface_id_sync(
+ mp_libHomeScreenHomescreen_Proxy,
+ surfaceId,
+ &out_renderArea,
+ NULL,
+ &err);
+
+ if (NULL != err)
+ {
+ fprintf(stderr, "Unable to call getLayoutRenderAreaForSurfaceId: %s\n", err->message);
+ }
+
+ g_variant_get(out_renderArea, "(iiii)", result.x, result.y, result.width, result.height);
+
+ return result;
+}
+
void LibHomeScreen::hardKeyPressed(int key)
{
GError *err = NULL;
@@ -43,17 +69,42 @@ void LibHomeScreen::hardKeyPressed(int key)
}
}
-void LibHomeScreen::toggleFullScreen()
+void LibHomeScreen::renderSurfaceToArea(int surfaceId, const sRectangle &renderArea)
+{
+ GError *err = NULL;
+
+ GVariant *variant;
+ GVariantBuilder *builder;
+ builder = g_variant_builder_new(G_VARIANT_TYPE("(iiii)"));
+ g_variant_builder_add(builder, "(iiii)", renderArea.x, renderArea.y, renderArea.width, renderArea.height);
+ variant = g_variant_new("(iiii)", builder);
+ g_variant_builder_unref(builder);
+
+ lib_home_screen_homescreen_call_render_surface_to_area_sync(
+ mp_libHomeScreenHomescreen_Proxy,
+ surfaceId,
+ variant,
+ NULL,
+ &err);
+
+ if (NULL != err)
+ {
+ fprintf(stderr, "Unable to call renderSurfaceToArea: %s\n", err->message);
+ }
+}
+
+void LibHomeScreen::requestSurfaceIdToFullScreen(int surfaceId)
{
GError *err = NULL;
- lib_home_screen_homescreen_call_toggle_full_screen_sync(
+ lib_home_screen_homescreen_call_request_surface_id_to_full_screen_sync(
mp_libHomeScreenHomescreen_Proxy,
+ surfaceId,
NULL,
&err);
if (NULL != err)
{
- fprintf(stderr, "Unable to call toggleFullScreen: %s\n", err->message);
+ fprintf(stderr, "Unable to call requestSurfaceIdToFullScreen: %s\n", err->message);
}
}