2* Copyright (C) 2016 Canonical Ltd.
4* This program is free software; you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation; version 3.
8* This program is distributed in the hope that it will be useful,
9* but WITHOUT ANY WARRANTY; without even the implied warranty of
10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11* GNU General Public License for more details.
13* You should have received a copy of the GNU General Public License
14* along with this program. If not, see <http://www.gnu.org/licenses/>.
18import Lomiri.Components 1.3
19import WindowManager 1.0
29 property int screenIndex: -1
30 property bool primary: {
31 if (loader.sourceComponent == disabledScreenComponent)
34 // If this is the only screen then it's the primary one
35 if (Screens.count === 1)
38 const thisFormFactor = screenWindow.screen.formFactor;
40 // Tablet & phone devices can only have 2 screens at max
41 if (Screens.count === 2) {
42 const internalFormFactor = Screens.get(0).formFactor;
44 if (thisFormFactor === internalFormFactor === Screen.Tablet)
47 if (internalFormFactor === Screen.Phone && thisFormFactor !== Screen.Phone)
50 if (internalFormFactor === Screen.Phone && thisFormFactor === Screen.Phone)
54 return (Screens.count >= 1 && screenIndex === 0);
59 width: screenWindow.width
60 height: screenWindow.height
63 if (Screens.count > 1 && screenWindow.screen.formFactor === Screen.Phone) {
64 return disabledScreenComponent;
66 return shellComponent;
73 implicitWidth: screenWindow.width
74 implicitHeight: screenWindow.height
75 screen: screenWindow.screen
79 overrideName: Screens.count > 1 ? "desktop" : false
85 id: disabledScreenComponent
86 DisabledScreenNotice {
87 screen: screenWindow.screen
88 oskEnabled: Screens.count > 1