mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-28 07:14:46 +00:00
separate layer for the keyboard
This commit is contained in:
parent
d941d3ffa3
commit
7b3678e900
2 changed files with 79 additions and 10 deletions
|
|
@ -23,10 +23,10 @@ import QtQml.Models 2.1
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import "WindowManagement.js" as WindowManagement
|
import "WindowManagement.js" as WindowManagement
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
property alias showSplash: splash.visible
|
property alias showSplash: splash.visible
|
||||||
property bool showPanel: true
|
property bool showPanel: true
|
||||||
|
property alias showKeyboard: keyboardLayer.visible
|
||||||
readonly property alias layers: layers
|
readonly property alias layers: layers
|
||||||
readonly property real topBarHeight: units.iconSizes.small
|
readonly property real topBarHeight: units.iconSizes.small
|
||||||
readonly property real bottomBarHeight: units.iconSizes.medium
|
readonly property real bottomBarHeight: units.iconSizes.medium
|
||||||
|
|
@ -69,6 +69,7 @@ Rectangle {
|
||||||
readonly property alias desktop: desktopLayer
|
readonly property alias desktop: desktopLayer
|
||||||
readonly property alias windows: windowsLayer
|
readonly property alias windows: windowsLayer
|
||||||
readonly property alias panel: panelLayer
|
readonly property alias panel: panelLayer
|
||||||
|
readonly property alias keyboard: keyboardLayer
|
||||||
|
|
||||||
id: layers
|
id: layers
|
||||||
}
|
}
|
||||||
|
|
@ -128,12 +129,18 @@ Rectangle {
|
||||||
id: panelLayer
|
id: panelLayer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: showPanel
|
visible: showPanel
|
||||||
z: 4
|
z: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: keyboardLayer
|
||||||
|
anchors.fill: parent
|
||||||
|
z: 5
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: bottomBar
|
id: bottomBar
|
||||||
z: 3
|
z: 4
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,15 @@ function surfaceMapped(surface) {
|
||||||
var firstView = compositor.firstViewOf(surface);
|
var firstView = compositor.firstViewOf(surface);
|
||||||
var isShellWindow =
|
var isShellWindow =
|
||||||
(typeof(firstView.role) != "undefined") ||
|
(typeof(firstView.role) != "undefined") ||
|
||||||
(surface.className == "plasmashell.desktop") ||
|
(surface.className == "plasmashell.desktop");
|
||||||
(surface.className == "maliit-server.desktop");
|
|
||||||
|
|
||||||
// Print some information
|
// Print some information
|
||||||
if (isShellWindow) {
|
if (surface.className == "maliit-server.desktop") {
|
||||||
|
console.debug("Keyboard surface", surface, "mapped");
|
||||||
|
console.debug("\tappId:", surface.className);
|
||||||
|
console.debug("\ttitle:", surface.title);
|
||||||
|
console.debug("\tsize:", surface.size.width + "x" + surface.size.height);
|
||||||
|
} else if (isShellWindow) {
|
||||||
console.debug("Shell surface", surface, "mapped");
|
console.debug("Shell surface", surface, "mapped");
|
||||||
console.debug("\trole:", firstView.role);
|
console.debug("\trole:", firstView.role);
|
||||||
console.debug("\tsize:", surface.size.width + "x" + surface.size.height);
|
console.debug("\tsize:", surface.size.width + "x" + surface.size.height);
|
||||||
|
|
@ -41,9 +45,11 @@ function surfaceMapped(surface) {
|
||||||
console.debug("\tsize:", surface.size.width + "x" + surface.size.height);
|
console.debug("\tsize:", surface.size.width + "x" + surface.size.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (surface.className == "maliit-server.desktop") {
|
||||||
|
mapKeyboardSurface(surface);
|
||||||
// Call a specialized method to deal with application or
|
// Call a specialized method to deal with application or
|
||||||
// shell windows
|
// shell windows
|
||||||
if (isShellWindow)
|
} else if (isShellWindow)
|
||||||
mapShellSurface(surface, firstView);
|
mapShellSurface(surface, firstView);
|
||||||
else
|
else
|
||||||
mapApplicationSurface(surface);
|
mapApplicationSurface(surface);
|
||||||
|
|
@ -54,8 +60,7 @@ function surfaceUnmapped(surface) {
|
||||||
var firstView = compositor.firstViewOf(surface);
|
var firstView = compositor.firstViewOf(surface);
|
||||||
var isShellWindow =
|
var isShellWindow =
|
||||||
(typeof(firstView.role) != "undefined") ||
|
(typeof(firstView.role) != "undefined") ||
|
||||||
(surface.className == "plasmashell.desktop") ||
|
(surface.className == "plasmashell.desktop");
|
||||||
(surface.className == "maliit-server.desktop");
|
|
||||||
|
|
||||||
// Print some information
|
// Print some information
|
||||||
if (typeof(firstView.role) == "undefined") {
|
if (typeof(firstView.role) == "undefined") {
|
||||||
|
|
@ -68,9 +73,12 @@ function surfaceUnmapped(surface) {
|
||||||
console.debug("\ttitle:", surface.title);
|
console.debug("\ttitle:", surface.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Is it maliit?
|
||||||
|
if (surface.className == "maliit-server.desktop") {
|
||||||
|
unmapKeyboardSurface(surface);
|
||||||
// Call a specialized method to deal with application or
|
// Call a specialized method to deal with application or
|
||||||
// shell windows
|
// shell windows
|
||||||
if (isShellWindow)
|
} else if (isShellWindow)
|
||||||
unmapShellSurface(surface);
|
unmapShellSurface(surface);
|
||||||
else
|
else
|
||||||
unmapApplicationSurface(surface);
|
unmapApplicationSurface(surface);
|
||||||
|
|
@ -215,6 +223,52 @@ function mapShellSurface(surface, child) {
|
||||||
surfaceModel.append({"surface": surface, "window": window});
|
surfaceModel.append({"surface": surface, "window": window});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mapKeyboardSurface(surface) {
|
||||||
|
// Just exit if we already created a window representation
|
||||||
|
var i;
|
||||||
|
for (i = 0; i < surfaceModel.count; i++) {
|
||||||
|
var entry = surfaceModel.get(i);
|
||||||
|
|
||||||
|
if (entry.surface === surface) {
|
||||||
|
if (compositorRoot.currentWindow) {
|
||||||
|
compositorRoot.currentWindow.child.height = compositorRoot.layers.windows.height - 500;
|
||||||
|
}
|
||||||
|
compositorRoot.showKeyboard = true;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create surface item
|
||||||
|
var component = Qt.createComponent("ShellWindowWrapper.qml");
|
||||||
|
if (component.status !== Component.Ready) {
|
||||||
|
console.error(component.errorString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Request a view for this output although with phones will
|
||||||
|
// likely have just one output
|
||||||
|
var child = compositor.viewForOutput(surface, _greenisland_output);
|
||||||
|
|
||||||
|
// Create and setup window container
|
||||||
|
var window = component.createObject(compositorRoot.layers.keyboard, {"child": child});
|
||||||
|
window.parent = compositorRoot.layers.keyboard;
|
||||||
|
window.child.parent = window;
|
||||||
|
window.child.touchEventsEnabled = true;
|
||||||
|
window.width = surface.size.width;
|
||||||
|
window.height = surface.size.height;
|
||||||
|
window.y = compositorRoot.layers.keyboard.height - window.height;
|
||||||
|
|
||||||
|
if (compositorRoot.currentWindow) {
|
||||||
|
compositorRoot.currentWindow.child.height = compositorRoot.layers.windows.height - 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add surface to the model
|
||||||
|
surfaceModel.append({"surface": surface, "window": window});
|
||||||
|
compositorRoot.showKeyboard = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unmap surfaces
|
* Unmap surfaces
|
||||||
*/
|
*/
|
||||||
|
|
@ -234,3 +288,11 @@ function unmapShellSurface(surface) {
|
||||||
compositorRoot.showPanel = false;
|
compositorRoot.showPanel = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unmapShellSurface(surface) {
|
||||||
|
if (compositorRoot.currentWindow) {
|
||||||
|
compositorRoot.currentWindow.child.height = compositorRoot.layers.windows.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
compositorRoot.showKeyboard = false;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue