From ec688535558c31989e7da221b858328b2e0766c8 Mon Sep 17 00:00:00 2001 From: "Bocklage, Jens" Date: Thu, 3 Nov 2016 20:23:10 +0100 Subject: [PATCH] New concept of dynamically placing surfaces in static defined layout areas. This is useful if an application wants to render more than one surface. By default, one surface is placed in one layout render area. With the new homescreen.xml introspection, apps can place their surfaces as they wish (limited to the boundries of the assigned layou render area!). The functionality is not fully implemented, but the shared lib already provides the interface. Signed-off-by: Bocklage, Jens --- HomeScreen/src/homescreencontrolinterface.cpp | 18 ++++++-- HomeScreen/src/homescreencontrolinterface.h | 11 +++-- HomeScreen/src/layouthandler.cpp | 9 +++- HomeScreen/src/layouthandler.h | 4 +- HomeScreen/src/main.cpp | 2 +- HomeScreen/src/mainwindow.cpp | 5 ++- HomeScreenAppFrameworkBinderTizen/src/main.cpp | 2 +- HomeScreenSimulator/resources/mainwindow.ui | 18 -------- HomeScreenSimulator/src/main.cpp | 2 +- HomeScreenSimulator/src/mainwindow.cpp | 5 --- HomeScreenSimulator/src/mainwindow.h | 2 - InputEventManager/src/main.cpp | 2 +- SampleAppTimeDate/src/main.cpp | 2 +- SampleHomeScreenInterfaceApp/src/main.cpp | 12 +++++ SampleHomeScreenInterfaceApp/src/sampleclass.cpp | 15 ++++++- SampleHomeScreenInterfaceApp/src/sampleclass.hpp | 4 +- WindowManager/src/main.cpp | 2 +- interfaces/homescreen.xml | 43 +++++++++++++++++- libhomescreen/include/libhomescreen.hpp | 12 ++++- libhomescreen/src/libhomescreen.cpp | 57 ++++++++++++++++++++++-- 20 files changed, 177 insertions(+), 50 deletions(-) diff --git a/HomeScreen/src/homescreencontrolinterface.cpp b/HomeScreen/src/homescreencontrolinterface.cpp index 057e742..bc66e53 100644 --- a/HomeScreen/src/homescreencontrolinterface.cpp +++ b/HomeScreen/src/homescreencontrolinterface.cpp @@ -24,6 +24,12 @@ HomeScreenControlInterface::~HomeScreenControlInterface() delete mp_homeScreenAdaptor; } +QRect HomeScreenControlInterface::getLayoutRenderAreaForSurfaceId(int surfaceId) +{ + qDebug("getLayoutRenderAreaForSurfaceId %d", surfaceId); + return newRequestGetLayoutRenderAreaForSurfaceId(surfaceId); +} + void HomeScreenControlInterface::hardKeyPressed(int key) { int pid = -1; @@ -42,8 +48,14 @@ void HomeScreenControlInterface::hardKeyPressed(int key) } } -void HomeScreenControlInterface::toggleFullScreen() +void HomeScreenControlInterface::renderSurfaceToArea(int surfaceId, const QRect &renderArea) +{ + qDebug("requestSurfaceIdToFullScreen %d", surfaceId); + newRequestRenderSurfaceToArea(surfaceId, renderArea); +} + +void HomeScreenControlInterface::requestSurfaceIdToFullScreen(int surfaceId) { - qDebug("toggleFullScreen"); - newRequestsToggleFullscreen(); + qDebug("requestSurfaceIdToFullScreen %d", surfaceId); + newRequestSurfaceIdToFullScreen(surfaceId); } diff --git a/HomeScreen/src/homescreencontrolinterface.h b/HomeScreen/src/homescreencontrolinterface.h index e341758..3203088 100644 --- a/HomeScreen/src/homescreencontrolinterface.h +++ b/HomeScreen/src/homescreencontrolinterface.h @@ -14,16 +14,19 @@ public: explicit HomeScreenControlInterface(QObject *parent = 0); ~HomeScreenControlInterface(); -signals: - signals: void newRequestsToBeVisibleApp(int pid); - void newRequestsToggleFullscreen(); + + QRect newRequestGetLayoutRenderAreaForSurfaceId(int surfaceId); + void newRequestRenderSurfaceToArea(int surfaceId, const QRect &renderArea); + void newRequestSurfaceIdToFullScreen(int surfaceId); //from homescreen_adapter.h public Q_SLOTS: // METHODS + QRect getLayoutRenderAreaForSurfaceId(int surfaceId); void hardKeyPressed(int key); - void toggleFullScreen(); + void renderSurfaceToArea(int surfaceId, const QRect &renderArea); + void requestSurfaceIdToFullScreen(int surfaceId); private: HomescreenAdaptor *mp_homeScreenAdaptor; diff --git a/HomeScreen/src/layouthandler.cpp b/HomeScreen/src/layouthandler.cpp index 3bfe533..0dac24f 100644 --- a/HomeScreen/src/layouthandler.cpp +++ b/HomeScreen/src/layouthandler.cpp @@ -169,9 +169,14 @@ void LayoutHandler::makeMeVisible(int surfaceId) } } -void LayoutHandler::toggleFullscreen() +void LayoutHandler::requestRenderSurfaceToArea(int surfaceId, const QRect &renderArea) { - qDebug("toggleFullscreen"); + qDebug("requestRenderSurfaceToArea %d %d,%d,%d,%d", surfaceId, renderArea.x(), renderArea.y(), renderArea.width(), renderArea.height()); +} + +void LayoutHandler::requestSurfaceIdToFullScreen(int surfaceId) +{ + qDebug("requestSurfaceIdToFullScreen %d", surfaceId); } void LayoutHandler::setLayoutByName(QString layoutName) diff --git a/HomeScreen/src/layouthandler.h b/HomeScreen/src/layouthandler.h index 5763d44..ee400b7 100644 --- a/HomeScreen/src/layouthandler.h +++ b/HomeScreen/src/layouthandler.h @@ -18,7 +18,9 @@ signals: public slots: void makeMeVisible(int surfaceId); - void toggleFullscreen(); + + void requestRenderSurfaceToArea(int surfaceId, const QRect &renderArea); + void requestSurfaceIdToFullScreen(int surfaceId); void setLayoutByName(QString layoutName); private: diff --git a/HomeScreen/src/main.cpp b/HomeScreen/src/main.cpp index a623fff..f1f5a22 100644 --- a/HomeScreen/src/main.cpp +++ b/HomeScreen/src/main.cpp @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("HomeScreen"); - QCoreApplication::setApplicationVersion("0.3.4"); + QCoreApplication::setApplicationVersion("0.4.0"); qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); diff --git a/HomeScreen/src/mainwindow.cpp b/HomeScreen/src/mainwindow.cpp index c15cca5..f8dfe89 100644 --- a/HomeScreen/src/mainwindow.cpp +++ b/HomeScreen/src/mainwindow.cpp @@ -89,6 +89,7 @@ MainWindow::MainWindow(QWidget *parent) : QObject::connect(mp_applauncherwidget, SIGNAL(newRequestsToBeVisibleApp(int)), mp_layoutHandler, SLOT(makeMeVisible(int))); + // apply color scheme updateColorScheme(); @@ -100,7 +101,9 @@ MainWindow::MainWindow(QWidget *parent) : mp_homeScreenControlInterface = new HomeScreenControlInterface(this); QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestsToBeVisibleApp(int)), mp_layoutHandler, SLOT(makeMeVisible(int))); - QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestsToggleFullscreen()), mp_layoutHandler, SLOT(toggleFullscreen())); + QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestSurfaceIdToFullScreen(int)), mp_layoutHandler, SLOT(requestSurfaceIdToFullScreen(int))); + QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestRenderSurfaceToArea(int, QRect)), mp_layoutHandler, SLOT(requestRenderSurfaceToArea(int,QRect))); + QObject::connect(mp_homeScreenControlInterface, SIGNAL(newRequestSurfaceIdToFullScreen(int)), mp_layoutHandler, SLOT(requestSurfaceIdToFullScreen(int))); QObject::connect(mp_popupWidget, SIGNAL(comboBoxResult(QString)), mp_layoutHandler, SLOT(setLayoutByName(QString))); } diff --git a/HomeScreenAppFrameworkBinderTizen/src/main.cpp b/HomeScreenAppFrameworkBinderTizen/src/main.cpp index f1e1af1..8a3c11c 100644 --- a/HomeScreenAppFrameworkBinderTizen/src/main.cpp +++ b/HomeScreenAppFrameworkBinderTizen/src/main.cpp @@ -27,7 +27,7 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("HomeScreenAppFrameworkBinderTizen"); - QCoreApplication::setApplicationVersion("0.3.0"); + QCoreApplication::setApplicationVersion("0.4.0"); qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); diff --git a/HomeScreenSimulator/resources/mainwindow.ui b/HomeScreenSimulator/resources/mainwindow.ui index dcdf2e7..4f7ccf8 100644 --- a/HomeScreenSimulator/resources/mainwindow.ui +++ b/HomeScreenSimulator/resources/mainwindow.ui @@ -214,24 +214,6 @@ - - - FullScreen - - - - - 80 - 50 - 161 - 27 - - - - Toggle full screen - - - Future features diff --git a/HomeScreenSimulator/src/main.cpp b/HomeScreenSimulator/src/main.cpp index c4d794c..101eedc 100644 --- a/HomeScreenSimulator/src/main.cpp +++ b/HomeScreenSimulator/src/main.cpp @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("HomeScreenSimulator"); - QCoreApplication::setApplicationVersion("0.3.1"); + QCoreApplication::setApplicationVersion("0.4.0"); qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); diff --git a/HomeScreenSimulator/src/mainwindow.cpp b/HomeScreenSimulator/src/mainwindow.cpp index 272adfc..6c0dc2f 100644 --- a/HomeScreenSimulator/src/mainwindow.cpp +++ b/HomeScreenSimulator/src/mainwindow.cpp @@ -177,8 +177,3 @@ void MainWindow::on_checkBox_ObjectDetected_clicked() { mp_dBusProximityProxy->setObjectDetected(Qt::Checked == mp_ui->checkBox_ObjectDetected->checkState()); } - -void MainWindow::on_pushButton_ToggleFullScreen_clicked() -{ - mp_dBusHomeScreenProxy->toggleFullScreen(); -} diff --git a/HomeScreenSimulator/src/mainwindow.h b/HomeScreenSimulator/src/mainwindow.h index ca368f0..3b1855c 100644 --- a/HomeScreenSimulator/src/mainwindow.h +++ b/HomeScreenSimulator/src/mainwindow.h @@ -63,8 +63,6 @@ private slots: void on_checkBox_ObjectDetected_clicked(); - void on_pushButton_ToggleFullScreen_clicked(); - private: Ui::MainWindow *mp_ui; DaynightmodeAdaptor *mp_dBusDayNightModeAdapter; diff --git a/InputEventManager/src/main.cpp b/InputEventManager/src/main.cpp index 03270db..b609693 100644 --- a/InputEventManager/src/main.cpp +++ b/InputEventManager/src/main.cpp @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("InputEventManager"); - QCoreApplication::setApplicationVersion("0.3.0"); + QCoreApplication::setApplicationVersion("0.4.0"); qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); diff --git a/SampleAppTimeDate/src/main.cpp b/SampleAppTimeDate/src/main.cpp index 7cd51c0..cb23e80 100644 --- a/SampleAppTimeDate/src/main.cpp +++ b/SampleAppTimeDate/src/main.cpp @@ -9,7 +9,7 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("SampleAppTimeDate"); - QCoreApplication::setApplicationVersion("0.3.0"); + QCoreApplication::setApplicationVersion("0.4.0"); qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); diff --git a/SampleHomeScreenInterfaceApp/src/main.cpp b/SampleHomeScreenInterfaceApp/src/main.cpp index 1e83d80..b9b3efa 100644 --- a/SampleHomeScreenInterfaceApp/src/main.cpp +++ b/SampleHomeScreenInterfaceApp/src/main.cpp @@ -6,13 +6,25 @@ using namespace std; int main() { cout << "SampleHomeScreenInterfaceApp" << endl; + cout << "v0.4.0" << endl; SampleClass *sampleClass = new SampleClass(); + //sRectangle test = sampleClass->getLayoutRenderAreaForSurfaceId(1); + sampleClass->hardKeyPressed(100); sampleClass->hardKeyPressed(101); sampleClass->hardKeyPressed(102); + /*sRectangle renderArea; + renderArea.x = 0; + renderArea.y = 1; + renderArea.width = 12; + renderArea.height = 13; + sampleClass->renderSurfaceToArea(1, renderArea);*/ + + //sampleClass->requestSurfaceIdToFullScreen(1); + delete sampleClass; return 0; diff --git a/SampleHomeScreenInterfaceApp/src/sampleclass.cpp b/SampleHomeScreenInterfaceApp/src/sampleclass.cpp index 0d373d1..6a46f2b 100644 --- a/SampleHomeScreenInterfaceApp/src/sampleclass.cpp +++ b/SampleHomeScreenInterfaceApp/src/sampleclass.cpp @@ -11,12 +11,23 @@ SampleClass::~SampleClass() delete mp_libHomeScreen; } + +sRectangle SampleClass::getLayoutRenderAreaForSurfaceId(int surfaceId) +{ + mp_libHomeScreen->getLayoutRenderAreaForSurfaceId(surfaceId); +} + void SampleClass::hardKeyPressed(int key) { mp_libHomeScreen->hardKeyPressed(key); } -void SampleClass::toggleFullScreen() +void SampleClass::renderSurfaceToArea(int surfaceId, const sRectangle &renderArea) +{ + mp_libHomeScreen->renderSurfaceToArea(surfaceId, renderArea); +} + +void SampleClass::requestSurfaceIdToFullScreen(int surfaceId) { - mp_libHomeScreen->toggleFullScreen(); + mp_libHomeScreen->requestSurfaceIdToFullScreen(surfaceId); } diff --git a/SampleHomeScreenInterfaceApp/src/sampleclass.hpp b/SampleHomeScreenInterfaceApp/src/sampleclass.hpp index aa5f376..acffcf6 100644 --- a/SampleHomeScreenInterfaceApp/src/sampleclass.hpp +++ b/SampleHomeScreenInterfaceApp/src/sampleclass.hpp @@ -9,8 +9,10 @@ public: SampleClass(); ~SampleClass(); + sRectangle getLayoutRenderAreaForSurfaceId(int surfaceId); void hardKeyPressed(int key); - void toggleFullScreen(); + void renderSurfaceToArea(int surfaceId, const sRectangle &renderArea); + void requestSurfaceIdToFullScreen(int surfaceId); private: LibHomeScreen *mp_libHomeScreen; diff --git a/WindowManager/src/main.cpp b/WindowManager/src/main.cpp index 455361c..c0d6d69 100644 --- a/WindowManager/src/main.cpp +++ b/WindowManager/src/main.cpp @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("WindowManager"); - QCoreApplication::setApplicationVersion("0.3.1"); + QCoreApplication::setApplicationVersion("0.4.0"); qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); diff --git a/interfaces/homescreen.xml b/interfaces/homescreen.xml index a405555..b317306 100644 --- a/interfaces/homescreen.xml +++ b/interfaces/homescreen.xml @@ -29,7 +29,48 @@ - + + + + + + + + + + + + + + + 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 @@ -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); } } -- 2.16.6