Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Commit

Permalink
hmicontroller: Pass INVALID_ID to auto-generate layer ID
Browse files Browse the repository at this point in the history
A layer ID of zero is not correct.  I am guessing that the previous
intention was to use zero to generate an automatic ID, and the ILM
documentation incorrectly said that it would (upstream bug [LM-6]).
INVALID_ID should be passed instead, to get a generated ID.

The parameter to helper function createLayer() must now be passed by
reference so that the member variable m_backgroundSurfaceId can be
assigned the right value. The layer ID used to be constant (zero) and
therefore this was not the case before.

[GDP-778] wayland-ivi-extension layer id integration issues from P-0.1
          and P-1.0 upgrade

[LM-6] Documentation for ilm_layerCreateWithDimension() is wrong
       regarding creating new ID automatically?

Signed-off-by: Gunnar Andersson <[email protected]>
  • Loading branch information
Gunnar Andersson committed Apr 13, 2018
1 parent 95aadfb commit ed77306
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
4 changes: 3 additions & 1 deletion plugins/hmi-controller/hmicontroller.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "hmicontroller.h"
#include <ilm/ilm_types.h>

#include <QProcess>

Expand All @@ -15,7 +16,8 @@ HMIController::HMIController(QObject *parent) :
m_lucFile("lastUserContext")
{
m_layerController.setLauncherPid(getpid());
m_layerController.setBackgroundSurfaceId(0); //TODO test more
// NOTE: INVALID_ID will be changed by ILM to a auto-generated ID
m_layerController.setBackgroundSurfaceId(INVALID_ID);

connect(&m_layerController, &LayerController::currentAppIDChanged,
this, &HMIController::appIsDisplayedChanged);
Expand Down
22 changes: 19 additions & 3 deletions plugins/hmi-controller/layercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ LayerController::LayerController(AppManager &appManager) :
m_appWidth(0),
m_appHeight(0),
m_launcherPid(0),
m_backgroundSurfaceId(0),
// INVALID_ID can be passed to automatically generate layer ID, but
// this member is also redefined by the main program through a call to
// setBackgroundSurfaceId(). This might still need some cleanup.
// Since any other number is valid, it should likely be initialized to
// INVALID_ID regardless.
m_backgroundSurfaceId(INVALID_ID),
m_currentLayer(0),
m_launcherOnTop(true)
{
Expand Down Expand Up @@ -359,7 +364,7 @@ void LayerController::setLayerVisible(unsigned int layerId)
ilm_commitChanges();
}

bool LayerController::createLayer(unsigned int layerId)
bool LayerController::createLayer(unsigned int &layerId)
{
ilmErrorTypes callResult = ILM_FAILED;
callResult = ilm_layerCreateWithDimension(&layerId, m_screenWidth, m_screenHeight);
Expand Down Expand Up @@ -615,7 +620,18 @@ void LayerController::addAppProcess(const AppManager::AppInfo app, const pid_t p
pinfo.surfaceList = {};

// Create layer for new app
createLayer(pid);

// We need a new variable because gcc is picky with having a true lvalue
// for the non-const pass by reference, and not pid which is an rvalue.
// (createLayer will modify the input variable to the layer ID that was
// actually chosen. In this case it should be always what we asked
// for, but it can be dynamic in other cases)
unsigned int layerId = pid;
createLayer(layerId //by reference);

// FIXME: This could use an assert(layerId == pid) and also error
// checking (createLayer should return true).
// but this is a quick fix - changing as little as possible.

m_processMap[pid]= pinfo;
}
2 changes: 1 addition & 1 deletion plugins/hmi-controller/layercontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class LayerController : public QObject
void setSurfaceVisible(unsigned int surfaceId);
void setLayerVisible(unsigned int layerId);

bool createLayer(unsigned int layerId);
bool createLayer(unsigned int &layerId);
bool destroyLayer(unsigned int layerId);
void focusOnLayer(unsigned int layerId);

Expand Down

0 comments on commit ed77306

Please sign in to comment.