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 <Jens_Bocklage@mentor.com>
delete mp_homeScreenAdaptor;
}
+QRect HomeScreenControlInterface::getLayoutRenderAreaForSurfaceId(int surfaceId)
+{
+ qDebug("getLayoutRenderAreaForSurfaceId %d", surfaceId);
+ return newRequestGetLayoutRenderAreaForSurfaceId(surfaceId);
+}
+
void HomeScreenControlInterface::hardKeyPressed(int key)
{
int pid = -1;
}
}
-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);
}
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;
}
}
-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)
public slots:
void makeMeVisible(int surfaceId);
- void toggleFullscreen();
+
+ void requestRenderSurfaceToArea(int surfaceId, const QRect &renderArea);
+ void requestSurfaceIdToFullScreen(int surfaceId);
void setLayoutByName(QString layoutName);
private:
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());
QObject::connect(mp_applauncherwidget, SIGNAL(newRequestsToBeVisibleApp(int)), mp_layoutHandler, SLOT(makeMeVisible(int)));
+
// apply color scheme
updateColorScheme();
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)));
}
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());
</property>
</widget>
</widget>
- <widget class="QWidget" name="tab_FullScreen">
- <attribute name="title">
- <string>FullScreen</string>
- </attribute>
- <widget class="QPushButton" name="pushButton_ToggleFullScreen">
- <property name="geometry">
- <rect>
- <x>80</x>
- <y>50</y>
- <width>161</width>
- <height>27</height>
- </rect>
- </property>
- <property name="text">
- <string>Toggle full screen</string>
- </property>
- </widget>
- </widget>
<widget class="QWidget" name="tab_FutureFeatures">
<attribute name="title">
<string>Future features</string>
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());
{
mp_dBusProximityProxy->setObjectDetected(Qt::Checked == mp_ui->checkBox_ObjectDetected->checkState());
}
-
-void MainWindow::on_pushButton_ToggleFullScreen_clicked()
-{
- mp_dBusHomeScreenProxy->toggleFullScreen();
-}
void on_checkBox_ObjectDetected_clicked();
- void on_pushButton_ToggleFullScreen_clicked();
-
private:
Ui::MainWindow *mp_ui;
DaynightmodeAdaptor *mp_dBusDayNightModeAdapter;
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());
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());
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;
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);
}
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;
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());
<method name="hardKeyPressed">
<arg name="key" type="i" direction="in"/>
</method>
- <method name="toggleFullScreen">
+ <!--
+ requestSurfaceIdToFullScreen:
+ @surfaceId: The surface that request to be shown fullscreen.
+
+ This allows an application to set a surface to full screen.
+ -->
+ <method name="requestSurfaceIdToFullScreen">
+ <arg name="surfaceId" type="i" direction="in"/>
+ </method>
+ <!--
+ getLayoutRenderAreaForSurfaceId:
+ @surfaceId: The surface that is requested.
+ @renderArea: The layout render area in which the given surface is located.
+
+ Before an application uses renderSurfaceToArea to render a surface into an area inside a layout area,
+ this method should be used to get the dimension of the layout area, in which the surface
+ currently is positioned.
+ -->
+ <method name="getLayoutRenderAreaForSurfaceId">
+ <arg name="surfaceId" type="i" direction="in"/>
+ <arg name="renderArea" type="(iiii)" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QRect"/>
+ </method>
+ <!--
+ renderSurfaceToArea:
+ @surfaceId: The surface that is requested.
+ @renderArea: The render area inside the current layout area.
+
+ This is a special case. In the normal use case, one layout area is always filled completely
+ with one surface. By using this function, an app can request to position a surface in the
+ layout area.
+ Example:
+ If the layout area is 500x500 pixel in size, the normal use case qould be, that a surface
+ is positioned at x=0, y=0 with a width and a size of 500. With this function, an application can position surfaces
+ free in this area.
+ E.g.: Position surface 101 at x=10, y=30, width=300, height=100 and
+ surface 104 at x=100, y=130, width=30, height=10
+ -->
+ <method name="renderSurfaceToArea">
+ <arg name="surfaceId" type="i" direction="in"/>
+ <arg name="renderArea" type="(iiii)" direction="in"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QRect"/>
</method>
</interface>
</node>
struct _LibHomeScreenHomescreen;
typedef struct _LibHomeScreenHomescreen LibHomeScreenHomescreen;
+typedef struct
+{
+ int x;
+ int y;
+ int width;
+ int height;
+} sRectangle;
+
class LibHomeScreen
{
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;
+extern "C" {
#include "homescreen.h" // generated from xml
+}
#include "include/libhomescreen.hpp"
#include <stdio.h>
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;
}
}
-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);
}
}