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

Pass INVALID_ID to auto-generate layer ID #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions plugins/hmi-controller/layercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,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 +615,21 @@ 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;
bool result = createLayer(layerId /*by reference*/);

printf("pid is %d and layerId was set to %d\n",pid, layerId);
printf("createLayer returned result %d\n", (int)result);

// 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