Improve layer- and surface handling
[staging/HomeScreen.git] / WindowManager / src / windowmanager.cpp
1 /*
2  * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include "windowmanager.hpp"
18
19
20 //////////////////////////////////////////
21 // THIS IS STILL UNDER HEAVY DEVELOPMENT!
22 // DO NOT JUDGE THE SOURCE CODE :)
23 //////////////////////////////////////////
24
25 // three layers will be defined. The HomeScreen will be placed
26 // full screen in the background.
27 // On top all applications in one layer.
28 // On top of that, the popup layer.
29 #define WINDOWMANAGER_LAYER_POPUP 100
30 #define WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY 101
31 #define WINDOWMANAGER_LAYER_APPLICATIONS 102
32 #define WINDOWMANAGER_LAYER_HOMESCREEN 103
33
34 #define WINDOWMANAGER_LAYER_NUM 4
35
36 // the HomeScreen app has to have the surface id 1000
37 #define WINDOWMANAGER_HOMESCREEN_MAIN_SURFACE_ID 1000
38
39
40 void* WindowManager::myThis = 0;
41
42 WindowManager::WindowManager(QObject *parent) :
43     QObject(parent),
44     m_layouts(),
45     m_appSurfaces(),
46     mp_layoutAreaToSurfaceIdAssignment(0),
47     m_currentLayout(-1),
48     m_screenId(0), // use screen "0"
49     m_screenWidth(0),
50     m_screenHeight(0)
51 {
52     qDebug("-=[WindowManager]=-");
53 }
54
55 void WindowManager::start()
56 {
57     qDebug("-=[start]=-");
58     mp_layoutAreaToSurfaceIdAssignment = new QMap<int, unsigned int>;
59 #ifdef HAVE_IVI_LAYERMANAGEMENT_API
60     ilmErrorTypes err;
61
62     err = ilm_init();
63     qDebug("ilm_init = %d", err);
64     if(ILM_SUCCESS != err)
65     {
66         qDebug("failed! Exiting!");
67         exit(-1);
68     }
69
70     myThis = this;
71
72     ilm_getScreenResolution(m_screenId, &m_screenWidth, &m_screenHeight);
73
74     createNewLayer(WINDOWMANAGER_LAYER_POPUP);
75     createNewLayer(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY);
76     createNewLayer(WINDOWMANAGER_LAYER_APPLICATIONS);
77     createNewLayer(WINDOWMANAGER_LAYER_HOMESCREEN);
78
79     ilm_registerNotification(WindowManager::notificationFunc_static, this);
80 #endif
81
82     QDBusConnection dbus = QDBusConnection::sessionBus();
83     dbus.registerObject("/windowmanager", this);
84     dbus.registerService("org.agl.windowmanager");
85
86     // publish windowmanager interface
87     mp_windowManagerAdaptor = new WindowmanagerAdaptor((QObject*)this);
88 }
89
90 WindowManager::~WindowManager()
91 {
92     qDebug("-=[~WindowManager]=-");
93     delete mp_windowManagerAdaptor;
94 #ifdef HAVE_IVI_LAYERMANAGEMENT_API
95     ilm_destroy();
96 #endif
97     delete mp_layoutAreaToSurfaceIdAssignment;
98 }
99
100 void WindowManager::dumpScene()
101 {
102     qDebug("\n");
103     qDebug("current layout   : %d", m_currentLayout);
104     qDebug("available layouts: %d", m_layouts.size());
105     QList<Layout>::const_iterator i = m_layouts.begin();
106
107     while (i != m_layouts.constEnd())
108     {
109         qDebug("--[id: %d]--[%s]--", i->id, i->name.toStdString().c_str());
110         qDebug("  %d surface areas", i->layoutAreas.size());
111         for (int j = 0; j < i->layoutAreas.size(); ++j)
112         {
113             qDebug("  -area %d", j);
114             qDebug("    -x     : %d", i->layoutAreas.at(j).x);
115             qDebug("    -y     : %d", i->layoutAreas.at(j).y);
116             qDebug("    -width : %d", i->layoutAreas.at(j).width);
117             qDebug("    -height: %d", i->layoutAreas.at(j).height);
118         }
119
120         ++i;
121     }
122 }
123
124 #ifdef HAVE_IVI_LAYERMANAGEMENT_API
125
126 void WindowManager::createNewLayer(int layerId)
127 {
128     qDebug("-=[createNewLayer]=-");
129     qDebug("  layerId %d", layerId);
130
131     t_ilm_layer newLayerId = layerId;
132     ilm_layerCreateWithDimension(&newLayerId, m_screenWidth, m_screenHeight);
133     ilm_layerSetOpacity(newLayerId, 1.0);
134     ilm_layerSetVisibility(newLayerId, ILM_TRUE);
135     ilm_layerSetSourceRectangle(newLayerId,
136                                     0,
137                                     0,
138                                     m_screenWidth,
139                                     m_screenHeight);
140     ilm_layerSetDestinationRectangle(newLayerId,
141                                     0,
142                                     0,
143                                     m_screenWidth,
144                                     m_screenHeight);
145
146     ilm_commitChanges();
147 }
148
149 void WindowManager::addSurfaceToLayer(int surfaceId, int layerId)
150 {
151     qDebug("-=[addSurfaceToLayer]=-");
152     qDebug("  surfaceId %d", surfaceId);
153     qDebug("  layerId %d", layerId);
154
155     if (layerId == WINDOWMANAGER_LAYER_HOMESCREEN)
156     {
157         struct ilmSurfaceProperties surfaceProperties;
158         ilm_getPropertiesOfSurface(surfaceId, &surfaceProperties);
159
160         // homescreen app always fullscreen in the back
161         ilm_surfaceSetDestinationRectangle(surfaceId, 0, 0, m_screenWidth, m_screenHeight);
162         //ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, m_screenWidth, m_screenHeight);
163         ilm_surfaceSetOpacity(surfaceId, 1.0);
164         ilm_surfaceSetVisibility(surfaceId, ILM_TRUE);
165
166         ilm_layerAddSurface(layerId, surfaceId);
167     }
168
169     if (layerId == WINDOWMANAGER_LAYER_APPLICATIONS)
170     {
171         struct ilmSurfaceProperties surfaceProperties;
172         ilm_getPropertiesOfSurface(surfaceId, &surfaceProperties);
173
174         //ilm_surfaceSetDestinationRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
175         //ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
176         //ilm_surfaceSetOpacity(surfaceId, 0.0);
177         //ilm_surfaceSetVisibility(surfaceId, ILM_FALSE);
178
179         ilm_layerAddSurface(layerId, surfaceId);
180     }
181
182     if (layerId == WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY)
183     {
184         struct ilmSurfaceProperties surfaceProperties;
185         ilm_getPropertiesOfSurface(surfaceId, &surfaceProperties);
186
187         //ilm_surfaceSetDestinationRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
188         //ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
189         //ilm_surfaceSetOpacity(surfaceId, 0.5);
190         //ilm_surfaceSetVisibility(surfaceId, ILM_TRUE);
191
192         ilm_layerAddSurface(layerId, surfaceId);
193     }
194
195     if (layerId == WINDOWMANAGER_LAYER_POPUP)
196     {
197         struct ilmSurfaceProperties surfaceProperties;
198         ilm_getPropertiesOfSurface(surfaceId, &surfaceProperties);
199
200         //ilm_surfaceSetDestinationRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
201         //ilm_surfaceSetSourceRectangle(surfaceId, 0, 0, surfaceProperties.origSourceWidth, surfaceProperties.origSourceHeight);
202         //ilm_surfaceSetOpacity(surfaceId, 0.0);
203         //ilm_surfaceSetVisibility(surfaceId, ILM_FALSE);
204
205         ilm_layerAddSurface(layerId, surfaceId);
206     }
207
208     ilm_commitChanges();
209 }
210
211 #endif
212
213 void WindowManager::updateScreen()
214 {
215     qDebug("-=[updateScreen]=-");
216
217 #ifdef HAVE_IVI_LAYERMANAGEMENT_API
218     if (-1 != m_currentLayout)
219     {
220         // hide all surfaces
221         for (int i = 0; i < m_appSurfaces.size(); ++i)
222         {
223             ilm_layerRemoveSurface(WINDOWMANAGER_LAYER_APPLICATIONS, m_appSurfaces.at(i));
224             //ilm_surfaceSetVisibility(m_appSurfaces.at(i), ILM_FALSE);
225             //ilm_surfaceSetOpacity(m_appSurfaces.at(i), 0.0);
226             ilm_commitChanges();
227         }
228
229         // find the current used layout
230         QList<Layout>::const_iterator ci = m_layouts.begin();
231
232         Layout currentLayout;
233         while (ci != m_layouts.constEnd())
234         {
235             if (ci->id == m_currentLayout)
236             {
237                 currentLayout = *ci;
238             }
239
240             ++ci;
241         }
242
243         qDebug("show %d apps", mp_layoutAreaToSurfaceIdAssignment->size());
244         for (int j = 0; j < mp_layoutAreaToSurfaceIdAssignment->size(); ++j)
245         {
246             int surfaceToShow = mp_layoutAreaToSurfaceIdAssignment->find(j).value();
247             qDebug("  surface no. %d: %d", j, surfaceToShow);
248
249             addSurfaceToLayer(surfaceToShow, WINDOWMANAGER_LAYER_APPLICATIONS);
250
251             ilm_surfaceSetVisibility(surfaceToShow, ILM_TRUE);
252             ilm_surfaceSetOpacity(surfaceToShow, 1.0);
253
254             qDebug("  layout area %d", j);
255             qDebug("    x: %d", currentLayout.layoutAreas[j].x);
256             qDebug("    y: %d", currentLayout.layoutAreas[j].y);
257             qDebug("    w: %d", currentLayout.layoutAreas[j].width);
258             qDebug("    h: %d", currentLayout.layoutAreas[j].height);
259
260             ilm_surfaceSetDestinationRectangle(surfaceToShow,
261                                              currentLayout.layoutAreas[j].x,
262                                              currentLayout.layoutAreas[j].y,
263                                              currentLayout.layoutAreas[j].width,
264                                              currentLayout.layoutAreas[j].height);
265             ilm_commitChanges();
266         }
267     }
268
269     // layer surface render order
270     t_ilm_int length;
271     t_ilm_surface* pArray;
272     ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_HOMESCREEN, &length, &pArray);
273     ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_HOMESCREEN, pArray, length);
274     ilm_commitChanges();
275     ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_APPLICATIONS, &length, &pArray);
276     ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_APPLICATIONS, pArray, length);
277     ilm_commitChanges();
278     ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY, &length, &pArray);
279     ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY, pArray, length);
280     ilm_commitChanges();
281     ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_POPUP, &length, &pArray);
282     ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_POPUP, pArray, length);
283     ilm_commitChanges();
284
285     // display layer render order
286     t_ilm_layer renderOrder[WINDOWMANAGER_LAYER_NUM];
287     renderOrder[0] = WINDOWMANAGER_LAYER_HOMESCREEN;
288     renderOrder[1] = WINDOWMANAGER_LAYER_APPLICATIONS;
289     renderOrder[2] = WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY;
290     renderOrder[3] = WINDOWMANAGER_LAYER_POPUP;
291     ilm_displaySetRenderOrder(0, renderOrder, WINDOWMANAGER_LAYER_NUM);
292     ilm_displaySetRenderOrder(1, renderOrder, WINDOWMANAGER_LAYER_NUM);
293     ilm_commitChanges();
294 #endif
295 }
296
297 #ifdef HAVE_IVI_LAYERMANAGEMENT_API
298 void WindowManager::notificationFunc_non_static(ilmObjectType object,
299                                     t_ilm_uint id,
300                                     t_ilm_bool created)
301 {
302     qDebug("-=[notificationFunc_non_static]=-");
303     qDebug("Notification from weston!");
304     if (ILM_SURFACE == object)
305     {
306         struct ilmSurfaceProperties surfaceProperties;
307
308         if (created)
309         {
310             qDebug("Surface created, ID: %d", id);
311             ilm_getPropertiesOfSurface(id, &surfaceProperties);
312             qDebug("  origSourceWidth : %d", surfaceProperties.origSourceWidth);
313             qDebug("  origSourceHeight: %d", surfaceProperties.origSourceHeight);
314
315             if (WINDOWMANAGER_HOMESCREEN_MAIN_SURFACE_ID == id)
316             {
317                 qDebug("HomeScreen app detected");
318                 addSurfaceToLayer(id, WINDOWMANAGER_LAYER_HOMESCREEN);
319                 updateScreen();
320             }
321             else
322             {
323                 //addSurfaceToLayer(id, WINDOWMANAGER_LAYER_APPLICATIONS);
324
325                 m_appSurfaces.append(id);
326             }
327             ilm_surfaceAddNotification(id, surfaceCallbackFunction_static);
328
329             ilm_commitChanges();
330         }
331         else
332         {
333             qDebug("Surface destroyed, ID: %d", id);
334             m_appSurfaces.removeAt(m_appSurfaces.indexOf(id));
335             ilm_surfaceRemoveNotification(id);
336
337             ilm_commitChanges();
338         }
339     }
340     if (ILM_LAYER == object)
341     {
342         //qDebug("Layer.. we don't care...");
343     }
344 }
345
346 void WindowManager::notificationFunc_static(ilmObjectType object,
347                                             t_ilm_uint id,
348                                             t_ilm_bool created,
349                                             void* user_data)
350 {
351     static_cast<WindowManager*>(WindowManager::myThis)->notificationFunc_non_static(object, id, created);
352 }
353
354 void WindowManager::surfaceCallbackFunction_non_static(t_ilm_surface surface,
355                                     struct ilmSurfaceProperties* surfaceProperties,
356                                     t_ilm_notification_mask mask)
357 {
358     qDebug("-=[surfaceCallbackFunction_non_static]=-");
359     qDebug("surfaceCallbackFunction_non_static changes for surface %d", surface);
360     if (ILM_NOTIFICATION_VISIBILITY & mask)
361     {
362         qDebug("ILM_NOTIFICATION_VISIBILITY");
363         surfaceVisibilityChanged(surface, surfaceProperties->visibility);
364     }
365     if (ILM_NOTIFICATION_OPACITY & mask)
366     {
367         qDebug("ILM_NOTIFICATION_OPACITY");
368     }
369     if (ILM_NOTIFICATION_ORIENTATION & mask)
370     {
371         qDebug("ILM_NOTIFICATION_ORIENTATION");
372     }
373     if (ILM_NOTIFICATION_SOURCE_RECT & mask)
374     {
375         qDebug("ILM_NOTIFICATION_SOURCE_RECT");
376     }
377     if (ILM_NOTIFICATION_DEST_RECT & mask)
378     {
379         qDebug("ILM_NOTIFICATION_DEST_RECT");
380     }
381     if (ILM_NOTIFICATION_CONTENT_AVAILABLE & mask)
382     {
383         qDebug("ILM_NOTIFICATION_CONTENT_AVAILABLE");
384         //updateScreen();
385     }
386     if (ILM_NOTIFICATION_CONTENT_REMOVED & mask)
387     {
388         qDebug("ILM_NOTIFICATION_CONTENT_REMOVED");
389     }
390     if (ILM_NOTIFICATION_CONFIGURED & mask)
391     {
392         qDebug("ILM_NOTIFICATION_CONFIGURED");
393         qDebug("  surfaceProperties %d", surface);
394         qDebug("    surfaceProperties.origSourceWidth: %d", surfaceProperties->origSourceWidth);
395         qDebug("    surfaceProperties.origSourceHeight: %d", surfaceProperties->origSourceHeight);
396
397         ilm_surfaceSetSourceRectangle(surface,
398                                       0,
399                                       0,
400                                       surfaceProperties->origSourceWidth,
401                                       surfaceProperties->origSourceHeight);
402
403         ilm_commitChanges();
404         updateScreen();
405     }
406 }
407
408 void WindowManager::surfaceCallbackFunction_static(t_ilm_surface surface,
409                                     struct ilmSurfaceProperties* surfaceProperties,
410                                     t_ilm_notification_mask mask)
411
412 {
413     static_cast<WindowManager*>(WindowManager::myThis)->surfaceCallbackFunction_non_static(surface, surfaceProperties, mask);
414 }
415 #endif
416
417 int WindowManager::layoutId() const
418 {
419     return m_currentLayout;
420 }
421
422 QString WindowManager::layoutName() const
423 {
424     QList<Layout>::const_iterator i = m_layouts.begin();
425
426     QString result = "not found";
427     while (i != m_layouts.constEnd())
428     {
429         if (i->id == m_currentLayout)
430         {
431             result = i->name;
432         }
433
434         ++i;
435     }
436
437     return result;
438 }
439
440
441 int WindowManager::addLayout(int layoutId, const QString &layoutName, const QList<LayoutArea> &surfaceAreas)
442 {
443     qDebug("-=[addLayout]=-");
444     m_layouts.append(Layout(layoutId, layoutName, surfaceAreas));
445
446     qDebug("addLayout %d %s, size %d",
447            layoutId,
448            layoutName.toStdString().c_str(),
449            surfaceAreas.size());
450
451     dumpScene();
452
453     return WINDOWMANAGER_NO_ERROR;
454 }
455
456 int WindowManager::deleteLayoutById(int layoutId)
457 {
458     qDebug("-=[deleteLayoutById]=-");
459     qDebug("layoutId: %d", layoutId);
460     int result = WINDOWMANAGER_NO_ERROR;
461
462     if (m_currentLayout == layoutId)
463     {
464         result = WINDOWMANAGER_ERROR_ID_IN_USE;
465     }
466     else
467     {
468         QList<Layout>::iterator i = m_layouts.begin();
469         result = WINDOWMANAGER_ERROR_ID_IN_USE;
470         while (i != m_layouts.constEnd())
471         {
472             if (i->id == layoutId)
473             {
474                 m_layouts.erase(i);
475                 result = WINDOWMANAGER_NO_ERROR;
476                 break;
477             }
478
479             ++i;
480         }
481     }
482
483     return result;
484 }
485
486
487 QList<Layout> WindowManager::getAllLayouts()
488 {
489     qDebug("-=[getAllLayouts]=-");
490
491     return m_layouts;
492 }
493
494 QList<int> WindowManager::getAllSurfacesOfProcess(int pid)
495 {
496     QList<int> result;
497 #ifdef HAVE_IVI_LAYERMANAGEMENT_API
498     struct ilmSurfaceProperties surfaceProperties;
499
500     for (int i = 0; i < m_appSurfaces.size(); ++i)
501     {
502         ilm_getPropertiesOfSurface(m_appSurfaces.at(i), &surfaceProperties);
503         if (pid == surfaceProperties.creatorPid)
504         {
505             result.append(m_appSurfaces.at(i));
506         }
507     }
508 #endif
509     return result;
510 }
511
512 QList<int> WindowManager::getAvailableLayouts(int numberOfAppSurfaces)
513 {
514     qDebug("-=[getAvailableLayouts]=-");
515     QList<Layout>::const_iterator i = m_layouts.begin();
516
517     QList<int> result;
518     while (i != m_layouts.constEnd())
519     {
520         if (i->layoutAreas.size() == numberOfAppSurfaces)
521         {
522             result.append(i->id);
523         }
524
525         ++i;
526     }
527
528     return result;
529 }
530
531 QList<int> WindowManager::getAvailableSurfaces()
532 {
533     qDebug("-=[getAvailableSurfaces]=-");
534
535     return m_appSurfaces;
536 }
537
538 QString WindowManager::getLayoutName(int layoutId)
539 {
540     qDebug("-=[getLayoutName]=-");
541     QList<Layout>::const_iterator i = m_layouts.begin();
542
543     QString result = "not found";
544     while (i != m_layouts.constEnd())
545     {
546         if (i->id == layoutId)
547         {
548             result = i->name;
549         }
550
551         ++i;
552     }
553
554     return result;
555 }
556
557 void WindowManager::hideLayer(int layer)
558 {
559     qDebug("-=[hideLayer]=-");
560     qDebug("layer %d", layer);
561
562 #ifdef HAVE_IVI_LAYERMANAGEMENT_API
563     if (0 == layer)
564     {
565         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_POPUP, ILM_FALSE);
566     }
567     if (1 == layer)
568     {
569         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY, ILM_FALSE);
570     }
571     if (2 == layer)
572     {
573         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_APPLICATIONS, ILM_FALSE);
574     }
575     if (3 == layer)
576     {
577         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_HOMESCREEN, ILM_FALSE);
578     }
579     ilm_commitChanges();
580 #endif
581 }
582
583 int WindowManager::setLayoutById(int layoutId)
584 {
585     qDebug("-=[setLayoutById]=-");
586     int result = WINDOWMANAGER_NO_ERROR;
587     m_currentLayout = layoutId;
588
589     mp_layoutAreaToSurfaceIdAssignment->clear();
590
591     dumpScene();
592
593     return result;
594 }
595
596 int WindowManager::setLayoutByName(const QString &layoutName)
597 {
598     qDebug("-=[setLayoutByName]=-");
599     int result = WINDOWMANAGER_NO_ERROR;
600
601     QList<Layout>::const_iterator i = m_layouts.begin();
602
603     while (i != m_layouts.constEnd())
604     {
605         if (i->name == layoutName)
606         {
607             m_currentLayout = i->id;
608
609             mp_layoutAreaToSurfaceIdAssignment->clear();
610
611             dumpScene();
612         }
613
614         ++i;
615     }
616
617     return result;
618 }
619
620 int WindowManager::setSurfaceToLayoutArea(int surfaceId, int layoutAreaId)
621 {
622     qDebug("-=[setSurfaceToLayoutArea]=-");
623     int result = WINDOWMANAGER_NO_ERROR;
624
625     qDebug("surfaceId %d", surfaceId);
626     qDebug("layoutAreaId %d", layoutAreaId);
627     mp_layoutAreaToSurfaceIdAssignment->insert(layoutAreaId, surfaceId);
628
629     updateScreen();
630
631     dumpScene();
632
633     return result;
634 }
635
636 void WindowManager::showLayer(int layer)
637 {
638     qDebug("-=[showLayer]=-");
639     qDebug("layer %d", layer);
640
641 #ifdef HAVE_IVI_LAYERMANAGEMENT_API
642     if (0 == layer)
643     {
644         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_POPUP, ILM_TRUE);
645     }
646     if (1 == layer)
647     {
648         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY, ILM_TRUE);
649     }
650     if (2 == layer)
651     {
652         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_APPLICATIONS, ILM_TRUE);
653     }
654     if (3 == layer)
655     {
656         ilm_layerSetVisibility(WINDOWMANAGER_LAYER_HOMESCREEN, ILM_TRUE);
657     }
658     ilm_commitChanges();
659 #endif
660 }