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