diff options
author | Bocklage, Jens <Jens_Bocklage@mentor.com> | 2016-11-02 16:23:58 +0100 |
---|---|---|
committer | Bocklage, Jens <Jens_Bocklage@mentor.com> | 2016-11-02 16:23:58 +0100 |
commit | 9ca0a50d021a8d6e12cfb8f04671ba3dd389f92d (patch) | |
tree | c76ff30548eef6c6fdf49449c5917c8d3fab5589 /interfaces | |
parent | ca4026b34ab8cc32dbe49c3a6272aa01733baf12 (diff) |
New layer management in WindowManager. Three layers are created. One for the HomeScreen, one for apps, one for popups.
Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
Diffstat (limited to 'interfaces')
-rw-r--r-- | interfaces/homescreen.xml | 2 | ||||
-rw-r--r-- | interfaces/include/windowmanager.hpp | 36 | ||||
-rw-r--r-- | interfaces/src/windowmanager.cpp | 63 | ||||
-rw-r--r-- | interfaces/windowmanager.xml | 186 |
4 files changed, 222 insertions, 65 deletions
diff --git a/interfaces/homescreen.xml b/interfaces/homescreen.xml index 023f54b..a405555 100644 --- a/interfaces/homescreen.xml +++ b/interfaces/homescreen.xml @@ -17,7 +17,7 @@ org.agl.homescreen: @short_description: A generic interface for the HomeScreen app. - This interface is a collection of methods from drifferent functional areas to control the HomeScreen app. + This interface is a collection of methods from different functional areas to control the HomeScreen app. --> <interface name="org.agl.homescreen"> <!-- diff --git a/interfaces/include/windowmanager.hpp b/interfaces/include/windowmanager.hpp index b587b70..45c7c6e 100644 --- a/interfaces/include/windowmanager.hpp +++ b/interfaces/include/windowmanager.hpp @@ -19,6 +19,12 @@ #include <QtDBus> +#define WINDOWMANAGER_NO_ERROR 0 +#define WINDOWMANAGER_ERROR_ID_ALREADY_DEFINED 1 +#define WINDOWMANAGER_ERROR_NAME_ALREADY_DEFINED 2 +#define WINDOWMANAGER_ERROR_ID_NOT_FOUND 3 +#define WINDOWMANAGER_ERROR_NAME_NOT_FOUND 4 + class SimplePoint { public: @@ -33,27 +39,43 @@ public: }; -class SimpleRect +class LayoutArea { public: - SimpleRect(); - virtual ~SimpleRect(); + LayoutArea(); + virtual ~LayoutArea(); int x; int y; int width; int height; - friend QDBusArgument &operator <<(QDBusArgument &argument, const SimpleRect &mSimpleRect); - friend const QDBusArgument &operator >>(const QDBusArgument &argument, SimpleRect &mSimpleRect); + friend QDBusArgument &operator <<(QDBusArgument &argument, const LayoutArea &mLayoutArea); + friend const QDBusArgument &operator >>(const QDBusArgument &argument, LayoutArea &mLayoutArea); }; +class Layout +{ +public: + Layout(); + Layout(int layoutId, const QString &layoutName, const QList<LayoutArea> &surfaceAreas); + virtual ~Layout(); + + int id; + QString name; + QList<LayoutArea> layoutAreas; + + friend QDBusArgument &operator <<(QDBusArgument &argument, const Layout &mLayout); + friend const QDBusArgument &operator >>(const QDBusArgument &argument, Layout &mLayout); +}; Q_DECLARE_METATYPE(SimplePoint) Q_DECLARE_METATYPE(QList<SimplePoint>) -Q_DECLARE_METATYPE(SimpleRect) -Q_DECLARE_METATYPE(QList<SimpleRect>) +Q_DECLARE_METATYPE(LayoutArea) +Q_DECLARE_METATYPE(QList<LayoutArea>) +Q_DECLARE_METATYPE(Layout) +Q_DECLARE_METATYPE(QList<Layout>) #endif // WINDOWMANAGER_H diff --git a/interfaces/src/windowmanager.cpp b/interfaces/src/windowmanager.cpp index 12f425e..77820ec 100644 --- a/interfaces/src/windowmanager.cpp +++ b/interfaces/src/windowmanager.cpp @@ -25,11 +25,30 @@ SimplePoint::~SimplePoint() } -SimpleRect::SimpleRect() +LayoutArea::LayoutArea() { } -SimpleRect::~SimpleRect() +LayoutArea::~LayoutArea() +{ +} + + +Layout::Layout(): + id(-1), + name("N/A"), + layoutAreas() +{ +} + +Layout::Layout(int layoutId, const QString &layoutName, const QList<LayoutArea> &surfaceAreas): + id(layoutId), + name(layoutName), + layoutAreas(surfaceAreas) +{ +} + +Layout::~Layout() { } @@ -52,26 +71,46 @@ const QDBusArgument &operator >>(const QDBusArgument &argument, SimplePoint &mSi return argument; } -QDBusArgument &operator <<(QDBusArgument &argument, const SimpleRect &mSimpleRect) +QDBusArgument &operator <<(QDBusArgument &argument, const LayoutArea &mLayoutArea) { argument.beginStructure(); - argument << mSimpleRect.x; - argument << mSimpleRect.y; - argument << mSimpleRect.width; - argument << mSimpleRect.height; + argument << mLayoutArea.x; + argument << mLayoutArea.y; + argument << mLayoutArea.width; + argument << mLayoutArea.height; argument.endStructure(); return argument; } -const QDBusArgument &operator >>(const QDBusArgument &argument, SimpleRect &mSimpleRect) +const QDBusArgument &operator >>(const QDBusArgument &argument, LayoutArea &mLayoutArea) { argument.beginStructure(); - argument >> mSimpleRect.x; - argument >> mSimpleRect.y; - argument >> mSimpleRect.width; - argument >> mSimpleRect.height; + argument >> mLayoutArea.x; + argument >> mLayoutArea.y; + argument >> mLayoutArea.width; + argument >> mLayoutArea.height; argument.endStructure(); return argument; } +QDBusArgument &operator <<(QDBusArgument &argument, const Layout &mLayout) +{ + argument.beginStructure(); + argument << mLayout.id; + argument << mLayout.name; + argument << mLayout.layoutAreas; + argument.endStructure(); + + return argument; +} + +const QDBusArgument &operator >>(const QDBusArgument &argument, Layout &mLayout) +{ + argument.beginStructure(); + argument >> mLayout.id; + argument >> mLayout.name; + argument >> mLayout.layoutAreas; + argument.endStructure(); + return argument; +} diff --git a/interfaces/windowmanager.xml b/interfaces/windowmanager.xml index 5aac541..67187ac 100644 --- a/interfaces/windowmanager.xml +++ b/interfaces/windowmanager.xml @@ -13,50 +13,146 @@ See the License for the specific language governing permissions and limitations under the License. --> <node> - <interface name="org.agl.windowmanager"> - <method name="addLayout"> - <arg name="layoutId" type="i" direction="in"/> - <arg name="layoutName" type="s" direction="in"/> - <arg name="isFullScreen" type="b" direction="in"/> - <arg name="associatedFullScreenLayout" type="i" direction="in"/> - <arg name="surfaceAreas" type="a(iiii)" direction="in"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.In4" value="QList<SimpleRect>"/> - <arg name="error" type="i" direction="out"/> - </method> - <method name="getAvailableLayouts"> - <arg name="numberOfAppSurfaces" type="i" direction="in"/> - <arg name="layoutIds" type="ai" direction="out"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<int>"/> - </method> - <method name="isLayoutFullScreen"> - <arg name="layoutId" type="i" direction="in"/> - <arg name="fullScreen" type="b" direction="out"/> - </method> - <method name="getAssociatedFullScreenLayout"> - <arg name="layoutId" type="i" direction="in"/> - <arg name="associatedFullScreenLayout" type="i" direction="out"/> - </method> - <method name="setLayoutById"> - <arg name="layoutId" type="i" direction="in"/> - </method> - <method name="setLayoutByName"> - <arg name="layoutName" type="s" direction="in"/> - </method> - <method name="getLayout"> - <arg name="layoutId" type="i" direction="out"/> - </method> - <method name="setPidToLayoutArea"> - <arg name="pid" type="i" direction="in"/> - <arg name="layoutAreaId" type="i" direction="in"/> - </method> - <method name="getAvailableSurfaces"> - <arg name="surfacesAndPids" type="a(ii)" direction="out"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<SimplePoint>"/> - </method> - <method name="getLayoutName"> - <arg name="layoutId" type="i" direction="in"/> - <arg name="layoutName" type="s" direction="out"/> - </method> - </interface> + <!-- + org.agl.windowmanager: + @short_description: A Layout-based interface for the WindowManager. + + A Layout defines a list of surfaces areas. + --> + <interface name="org.agl.windowmanager"> + <!-- + addLayout: + @layoutId: A unique ID that represents this layout. If the ID is already in use WINDOWMANAGER_ERROR_ID_ALREADY_DEFINED will be returned. + @layoutName: A user readable string for the layout. If the string is already in use WINDOWMANAGER_ERROR_NAME_ALREADY_DEFINED will be returned. + @surfaceAreas: A list of surface areas. + @error: WINDOWMANAGER_NO_ERROR or the first error that occurred. + + Add a layout definition to the WindowManayer layout database. + The layout database is temoprary and not stored persistently. It has to be recreated by the client after + a WindowManager restart. + --> + <method name="addLayout"> + <arg name="layoutId" type="i" direction="in"/> + <arg name="layoutName" type="s" direction="in"/> + <arg name="surfaceAreas" type="a(iiii)" direction="in"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QList<LayoutArea>"/> + <arg name="error" type="i" direction="out"/> + </method> + + <!-- + setLayoutById: + @layoutId: The ID of the layout to activate. + @error: WINDOWMANAGER_NO_ERROR or the first error that occurred. + + Switch to the layout with the given ID. + --> + <method name="setLayoutById"> + <arg name="layoutId" type="i" direction="in"/> + <arg name="error" type="i" direction="out"/> + </method> + <!-- + setLayoutByName: + @layoutName: The name of the layout to activate. + @error: WINDOWMANAGER_NO_ERROR or the first error that occurred. + + Switch to the layout with the given name. + --> + <method name="setLayoutByName"> + <arg name="layoutName" type="s" direction="in"/> + <arg name="error" type="i" direction="out"/> + </method> + + <!-- + getLayoutName: + @layoutId: The ID of the requested layout name. + @layoutName: The name of the layout with the given ID. + + Request the name of the layout with the given ID. This does not set or activate a layout. + It is just returning the name of the given layout. + --> + <method name="getLayoutName"> + <arg name="layoutId" type="i" direction="in"/> + <arg name="layoutName" type="s" direction="out"/> + </method> + + <!-- + layout: + The current active layout with all its information. + --> + <property> + <arg name="layout" type="(isa(iiii))" access="read"/> + <annotation name="org.qtproject.QtDBus.QtTypeName" value="Layout"/> + </property> + <!-- + layoutId: + The current active layout id. This property is redundant, since its info is already available + in the property layout. But this property is more lightweight. + --> + <property name="layoutId" type="i" access="read"/> + <!-- + layoutName: + The name of the current active layout. This property is redundant, since its info is already available + in the property layout. But this property is more lightweight. + --> + <property name="layoutName" type="s" access="read"/> + + <!-- + getAllLayouts: + @layouts: A list of all layouts. + + Returns a list of all layouts that were added to the WindowManager. + --> + <method name="getAllLayouts"> + <arg name="layoutIds" type="a(isa(iiii))" direction="out"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<Layout>"/> + </method> + + <!-- + getAvailableLayouts: + @numberOfAppSurfaces: The ID of the requested layout name. + @layoutIds: A list of layouts that offer the exact requested ammount of surface render areas. + + Returns a list of layouts that offer the exact requested ammount of surface render areas. + If the list is empty, no layout fits the exact ammount. + --> + <method name="getAvailableLayouts"> + <arg name="numberOfAppSurfaces" type="i" direction="in"/> + <arg name="layoutIds" type="ai" direction="out"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<int>"/> + </method> + + <!-- + setSurfaceToLayoutArea: + @surfaceId: The ID of the surface that shall be positioned. + @layoutAreaId: The ID of the layout area where the surface shall be rendered. + @error: WINDOWMANAGER_NO_ERROR or the first error that occurred. + + The surface will be scaled to the size of the layout area. + The surface will be made visible with this call. + --> + <method name="setSurfaceToLayoutArea"> + <arg name="surfaceId" type="i" direction="in"/> + <arg name="layoutAreaId" type="i" direction="in"/> + <arg name="error" type="i" direction="out"/> + </method> + + <!-- + getAvailableSurfaces: + @surfaceIds: A list of all known surfaceIds except for the surfaces created by the Home Screen app. + + If no surfaces are available, the returned list is empty. + --> + <method name="getAvailableSurfaces"> + <arg name="surfaceIds" type="a(i)" direction="out"/> + <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList<int>"/> + </method> + + <!-- + homeScreenPid: + The PID of the Home Screen app. The Home Screen app requires a special handling. + It will always be visible in the background. So it will be placed in a special layer at the lowest z-order. + --> + <property name="homeScreenPid" type="i" access="readwrite"/> + </interface> </node> |