#199, QQuickWindowSystem replacement of WindowSystem

pull/1/head
Johan Smith Agudelo Rodriguez 8 years ago
parent 75d4b71216
commit ef7caa72e2

@ -134,7 +134,7 @@ Item{
function slotMustBeHide() {
// console.log("hide....");
if(!dock.visibility.blockHiding && !dock.visibility.containsMouse && windowSystem.compositingActive) {
if(!dock.visibility.blockHiding && !dock.visibility.containsMouse && Latte.WindowSystem.compositingActive) {
slidingAnimationAutoHiddenOut.init();
}
}
@ -149,7 +149,7 @@ Item{
var localY = 0;
normalState = ((root.animationsNeedBothAxis === 0) && (root.animationsNeedLength === 0))
|| !windowSystem.compositingActive
|| !Latte.WindowSystem.compositingActive
|| (dock.visibility.isHidden && !dock.visibility.containsMouse && root.animationsNeedThickness == 0);
// debug maskArea criteria
@ -183,11 +183,11 @@ Item{
tempThickness = thicknessNormal;
if (root.animationsNeedThickness > 0) {
tempThickness = windowSystem.compositingActive ? thicknessMidOriginal : thicknessNormalOriginal;
tempThickness = Latte.WindowSystem.compositingActive ? thicknessMidOriginal : thicknessNormalOriginal;
}
if (dock.visibility.isHidden && !slidingAnimationAutoHiddenOut.running ) {
tempThickness = windowSystem.compositingActive ? thicknessAutoHidden : thicknessNormalOriginal;
tempThickness = Latte.WindowSystem.compositingActive ? thicknessAutoHidden : thicknessNormalOriginal;
}
//configure x,y based on plasmoid position and root.panelAlignment(Alignment)
@ -241,14 +241,14 @@ Item{
tempThickness = root.editMode ? editModeThickness : thicknessNormalOriginal;
if (dock.visibility.isHidden && !slidingAnimationAutoHiddenOut.running ) {
tempThickness = windowSystem.compositingActive ? thicknessAutoHidden : thicknessNormalOriginal;
tempThickness = Latte.WindowSystem.compositingActive ? thicknessAutoHidden : thicknessNormalOriginal;
} else if (root.animationsNeedThickness > 0) {
tempThickness = thicknessMidOriginal;
}
} else{
//use all thickness space
if (dock.visibility.isHidden && !slidingAnimationAutoHiddenOut.running ) {
tempThickness = windowSystem.compositingActive ? thicknessAutoHidden : thicknessNormalOriginal;
tempThickness = Latte.WindowSystem.compositingActive ? thicknessAutoHidden : thicknessNormalOriginal;
} else {
tempThickness = thicknessZoomOriginal;
}

@ -106,7 +106,7 @@ DragDrop.DropArea {
( plasmoid.configuration.panelPosition === Latte.Dock.Justify ?
Latte.Dock.Center : plasmoid.configuration.panelPosition )
property real zoomFactor: (windowSystem.compositingActive && durationTime>0) ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1
property real zoomFactor: (Latte.WindowSystem.compositingActive && durationTime>0) ? ( 1 + (plasmoid.configuration.zoomLevel / 20) ) : 1
readonly property string plasmoidName: "org.kde.latte.plasmoid"
@ -154,7 +154,7 @@ DragDrop.DropArea {
layoutsContainer.height + 0.5*iconMargin : mainLayout.height + iconMargin) :
Screen.height //on unlocked state use the maximum*/
Plasmoid.backgroundHints: windowSystem.compositingActive ? PlasmaCore.Types.NoBackground : PlasmaCore.Types.DefaultBackground
Plasmoid.backgroundHints: Latte.WindowSystem.compositingActive ? PlasmaCore.Types.NoBackground : PlasmaCore.Types.DefaultBackground
//// BEGIN properties in functions
property int noApplets: {
@ -1049,14 +1049,16 @@ DragDrop.DropArea {
////BEGIN interfaces
Latte.WindowSystem {
id:windowSystem
onCompositingActiveChanged:{
Connections {
target: Latte.WindowSystem
onCompositingActiveChanged: {
visibilityManager.updateMaskArea();
}
}
////END interfaces
///////////////BEGIN components
@ -1095,7 +1097,7 @@ DragDrop.DropArea {
// FIX IT && TEST IT: it is crashing Plasma with two Now Docks one of which has only
// task manager (small)
//active: root.useThemePanel
active: windowSystem.compositingActive
active: Latte.WindowSystem.compositingActive
sourceComponent: PanelBox{}
}
@ -1165,14 +1167,14 @@ DragDrop.DropArea {
x: {
if ( dock && (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isHorizontal
&& !root.editMode && windowSystem.compositingActive && !root.drawShadowsExternal ){
&& !root.editMode && Latte.WindowSystem.compositingActive && !root.drawShadowsExternal ){
return ((dock.width/2) - (root.maxLength/2))
} else {
if ((visibilityManager.inSlidingIn || visibilityManager.inSlidingOut) && root.isVertical){
return;
}
if (dock.visibility.isHidden && windowSystem.compositingActive && root.isVertical) {
if (dock.visibility.isHidden && Latte.WindowSystem.compositingActive && root.isVertical) {
return visibilityManager.slidingOutToPos;
} else {
return 0;
@ -1182,14 +1184,14 @@ DragDrop.DropArea {
y: {
if ( dock && (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && root.isVertical
&& !root.editMode && windowSystem.compositingActive && !root.drawShadowsExternal ) {
&& !root.editMode && Latte.WindowSystem.compositingActive && !root.drawShadowsExternal ) {
return ((dock.height/2) - (root.maxLength/2));
} else {
if ((visibilityManager.inSlidingIn || visibilityManager.inSlidingOut) && root.isHorizontal){
return;
}
if (dock.visibility.isHidden && windowSystem.compositingActive && root.isHorizontal) {
if (dock.visibility.isHidden && Latte.WindowSystem.compositingActive && root.isHorizontal) {
return visibilityManager.slidingOutToPos;
} else {
return 0;
@ -1420,7 +1422,7 @@ DragDrop.DropArea {
///this is an approach to try to solve #132 issue///
Loader{
anchors.fill: parent
active: dock & !drawShadowsExternal && windowSystem.compositingActive
active: dock & !drawShadowsExternal && Latte.WindowSystem.compositingActive
z: 1000
sourceComponent: Item{

@ -1,6 +1,6 @@
set(lattedock_SRCS
lattedockplugin.cpp
windowsystem.cpp
quickwindowsystem.cpp
dock.cpp
iconitem.cpp
)

@ -19,16 +19,16 @@
*/
#include "lattedockplugin.h"
#include "windowsystem.h"
#include "quickwindowsystem.h"
#include "dock.h"
#include "iconitem.h"
#include <qqml.h>
#include <QtQml>
void LatteDockPlugin::registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.kde.latte"));
qmlRegisterUncreatableType<Latte::Dock>(uri, 0, 1, "Dock", "Latte Dock Types uncreatable");
qmlRegisterType<Latte::WindowSystem>(uri, 0, 1, "WindowSystem");
qmlRegisterType<Latte::IconItem>(uri, 0, 1, "IconItem");
qmlRegisterSingletonType<Latte::QuickWindowSystem>(uri, 0, 1, "WindowSystem", &Latte::windowsystem_qobject_singletontype_provider);
}

@ -18,55 +18,41 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "windowsystem.h"
#include "quickwindowsystem.h"
#include <QDebug>
#include <KWindowSystem>
namespace Latte {
WindowSystem::WindowSystem(QObject *parent) :
QuickWindowSystem::QuickWindowSystem(QObject *parent) :
QObject(parent)
{
if (KWindowSystem::isPlatformWayland()) {
//! TODO: Wayland compositing active
} else {
compositingChangedProxy(KWindowSystem::self()->compositingActive());
connect(KWindowSystem::self(), &KWindowSystem::compositingChanged
, this, &WindowSystem::compositingChangedProxy);
}
}
WindowSystem::~WindowSystem()
{
}
, this, [&](bool enabled){
if (m_compositing == enabled)
return;
WindowSystem &WindowSystem::self()
{
static WindowSystem ws;
return ws;
}
m_compositing = enabled;
emit compositingChanged();
});
bool WindowSystem::compositingActive() const
{
return m_compositing;
m_compositing = KWindowSystem::compositingActive();
}
}
void WindowSystem::skipTaskBar(const QDialog &dialog) const
QuickWindowSystem::~QuickWindowSystem()
{
if (KWindowSystem::isPlatformWayland()) {
//! TODO: Wayland skip task bar
} else {
KWindowSystem::setState(dialog.winId(), NET::SkipTaskbar);
}
qDebug() << staticMetaObject.className() << "destructed";
}
void WindowSystem::compositingChangedProxy(bool enable)
bool QuickWindowSystem::compositingActive() const
{
if (m_compositing == enable)
return;
m_compositing = enable;
emit compositingChanged();
return m_compositing;
}
} //end of namespace

@ -18,38 +18,46 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WINDOWSYSTEM_H
#define WINDOWSYSTEM_H
#ifndef QUICKWINDOWSYSTEM_H
#define QUICKWINDOWSYSTEM_H
#include <QObject>
#include <QDialog>
#include <QQmlEngine>
#include <QJSEngine>
namespace Latte {
class WindowSystem : public QObject {
/**
* @brief The QuickWindowSystem class,
* is a tiny class that provide basic information of WindowSystem
*/
class QuickWindowSystem final : public QObject {
Q_OBJECT
Q_PROPERTY(bool compositingActive READ compositingActive NOTIFY compositingChanged)
Q_PROPERTY(bool compositingActive READ compositingActive NOTIFY compositingChanged FINAL)
public:
explicit WindowSystem(QObject *parent = nullptr);
~WindowSystem();
static WindowSystem &self();
explicit QuickWindowSystem(QObject *parent = nullptr);
virtual ~QuickWindowSystem();
bool compositingActive() const;
void skipTaskBar(const QDialog &dialog) const;
signals:
void compositingChanged();
private slots:
void compositingChangedProxy(bool state);
private:
bool m_compositing{false};
bool m_compositing : 1;
};
}//LatteDock namespace
static QObject *windowsystem_qobject_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
Q_UNUSED(scriptEngine)
// NOTE: QML engine is the owner of this resource
return new QuickWindowSystem;
}
}
#endif
#endif // QUICKWINDOWSYSTEM_H

@ -28,6 +28,7 @@ import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.private.taskmanager 0.1 as TaskManagerApplet
import org.kde.latte 0.1 as Latte
MouseArea{
id: mainItemContainer
@ -634,7 +635,7 @@ MouseArea{
////window previews/////////
if (isWindow) {
if(containsMouse && root.showPreviews && windowSystem.compositingActive){
if(containsMouse && root.showPreviews && Latte.WindowSystem.compositingActive){
hoveredTimerObj = hoveredTimerComponent.createObject(mainItemContainer);
// preparePreviewWindow();
}
@ -649,7 +650,7 @@ MouseArea{
onPressed: {
//console.log("Pressed Task Delegate..");
if (windowSystem.compositingActive) {
if (Latte.WindowSystem.compositingActive) {
windowsPreviewDlg.hide(2);
}
@ -703,7 +704,7 @@ MouseArea{
}
else{
if (model.IsGroupParent) {
if (windowSystem.compositingActive) {
if (Latte.WindowSystem.compositingActive) {
root.presentWindows(model.LegacyWinIdList);
} else {
if ((windowsPreviewDlg.visualParent === mainItemContainer)&&(windowsPreviewDlg.visible)) {
@ -969,7 +970,7 @@ MouseArea{
///item's added Animation
SequentialAnimation{
id:showWindowAnimation
property int speed: windowSystem.compositingActive ? root.durationTime* (1.2*units.longDuration) : 0
property int speed: Latte.WindowSystem.compositingActive ? root.durationTime* (1.2*units.longDuration) : 0
property bool animationSent: false
ScriptAction{

@ -704,7 +704,7 @@ Item{
}
function removeTask(){
if(!centralItem.toBeDestroyed && plasmoid.configuration.showShadows && windowSystem.compositingActive){
if(!centralItem.toBeDestroyed && plasmoid.configuration.showShadows && Latte.WindowSystem.compositingActive){
removingAnimation.init();
}
}

@ -218,9 +218,6 @@ Item {
}
////BEGIN interfaces
Latte.WindowSystem{
id:windowSystem
}
PlasmaCore.Dialog{
id: windowsPreviewDlg

Loading…
Cancel
Save