1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-23 14:50:35 +03:00

fix previews dialog for wayland

This commit is contained in:
Michail Vourlakos 2018-03-02 21:17:16 +02:00
parent c8b06b6561
commit 9166293348
4 changed files with 57 additions and 70 deletions

View File

@ -61,6 +61,11 @@ bool QuickWindowSystem::compositingActive() const
return m_compositing;
}
bool QuickWindowSystem::isPlatformWayland() const
{
return KWindowSystem::isPlatformWayland();
}
uint QuickWindowSystem::frameworksVersion() const
{
return Plasma::version();

View File

@ -35,6 +35,8 @@ class QuickWindowSystem final : public QObject {
Q_OBJECT
Q_PROPERTY(bool compositingActive READ compositingActive NOTIFY compositingChanged FINAL)
Q_PROPERTY(bool isPlatformWayland READ isPlatformWayland NOTIFY isPlatformWaylandChanged FINAL)
Q_PROPERTY(uint frameworksVersion READ frameworksVersion NOTIFY frameworksVersionChanged)
public:
@ -42,11 +44,14 @@ public:
virtual ~QuickWindowSystem();
bool compositingActive() const;
bool isPlatformWayland() const;
uint frameworksVersion() const;
signals:
void compositingChanged();
void frameworksVersionChanged();
void isPlatformWaylandChanged();
private:
bool m_compositing : 1;

View File

@ -34,13 +34,25 @@ import org.kde.draganddrop 2.0
import org.kde.taskmanager 0.1 as TaskManager
import org.kde.latte 0.1 as Latte
Column {
property var submodelIndex: tasksModel.makeModelIndex(parentIndex, isGroup ? index : -1)
property int flatIndex: isGroup && index != undefined ? index : 0
id: instance
property var submodelIndex: tasksModel.makeModelIndex(parentIndex, isGroup ? itemIndex : -1)
property int flatIndex: isGroup && itemIndex>=0 ? itemIndex : 0
property bool isActive: IsActive ? IsActive : false
property bool isMinimized: IsMinimized ? IsMinimized : false
property int appPid: AppPid ? AppPid : 0
property int itemIndex: index ? index : 0
property int virtualDesktop: VirtualDesktop ? VirtualDesktop : 0
property var activities : Activities ? Activities : []
spacing: units.smallSpacing
property string mprisSourceName: mpris2Source.sourceNameForLauncherUrl(toolTipDelegate.launcherUrl, isGroup ? AppPid : pidParent)
property string mprisSourceName: mpris2Source.sourceNameForLauncherUrl(toolTipDelegate.launcherUrl, isGroup ? appPid : pidParent)
property var playerData: mprisSourceName != "" ? mpris2Source.data[mprisSourceName] : 0
property bool hasPlayer: !!mprisSourceName && !!playerData
property bool playing: hasPlayer && playerData.PlaybackStatus === "Playing"
@ -73,7 +85,7 @@ Column {
//
function containsMouse() {
return area1.containsMouse || area2.containsMouse || area3.containsMouse || area4.containsMouse;
//|| ( area5 && area5.containsMouse) || (area6 && area6.containsMouse) || (area7 && area7.containsMouse);
//|| ( area5 && area5.containsMouse) || (area6 && area6.containsMouse) || (area7 && area7.containsMouse);
}
// launcher icon + text labels + close button
@ -181,7 +193,7 @@ Column {
anchors.fill: parent
anchors.bottomMargin: 2
readonly property bool isMinimized: isGroup ? IsMinimized == true : isMinimizedParent
readonly property bool isMinimized: isGroup ? isMinimized : isMinimizedParent
// TODO: this causes XCB error message when being visible the first time
property int winId: isWin && windows[flatIndex] != undefined ? windows[flatIndex] : 0
@ -195,7 +207,7 @@ Column {
ToolTipWindowMouseArea {
id: area2
anchors.fill: parent
anchors.fill: Latte.WindowSystem.isPlatformWayland ? parent : previewThumb
rootTask: parentTask
modelIndex: submodelIndex
winId: thumbnailSourceItem.winId
@ -219,7 +231,7 @@ Column {
anchors.fill: parent
rootTask: parentTask
modelIndex: submodelIndex
modelIndex: instance.submodelIndex
winId: thumbnailSourceItem.winId
}
}
@ -257,13 +269,13 @@ Column {
// TODO: When could this really be the case? A not-launcher-task always has a window!?
// if there's no window associated with this task, we might still be able to raise the player
// MouseArea {
// id: raisePlayerArea
// anchors.fill: parent
// MouseArea {
// id: raisePlayerArea
// anchors.fill: parent
// visible: !isWin || !windows[0] && canRaise
// onClicked: mpris2Source.raise(mprisSourceName)
// }
// visible: !isWin || !windows[0] && canRaise
// onClicked: mpris2Source.raise(mprisSourceName)
// }
Item {
id: playerControlsFrostedGlass
@ -401,7 +413,7 @@ Column {
height: 2
color: theme.buttonFocusColor
anchors.bottom: parent.bottom
visible: isGroup ? IsActive === true : (parentTask ? parentTask.isActive : false)
visible: isGroup ? isActive : (parentTask ? parentTask.isActive : false)
}
}
@ -411,8 +423,10 @@ Column {
}
var text;
if (isGroup) {
if (model.display == undefined) {
var modelExists = (typeof model !== 'undefined');
if (isGroup && modelExists) {
if (model.display === undefined) {
return "";
}
text = model.display.toString();
@ -454,27 +468,28 @@ Column {
var subTextEntries = [];
var vd = isGroup ? VirtualDesktop : virtualDesktopParent;
var vd = isGroup ? virtualDesktop : virtualDesktopParent;
if (!plasmoid.configuration.showOnlyCurrentDesktop
&& virtualDesktopInfo.numberOfDesktops > 1
&& (isGroup ? IsOnAllVirtualDesktops : isOnAllVirtualDesktopsParent) !== true
&& vd != -1
&& vd != undefined
&& virtualDesktopInfo.desktopNames[vd - 1] != undefined) {
&& virtualDesktopInfo.numberOfDesktops > 1
&& (isGroup ? IsOnAllVirtualDesktops : isOnAllVirtualDesktopsParent) !== true
&& vd != -1
&& vd != undefined
&& virtualDesktopInfo.desktopNames[vd - 1] != undefined) {
subTextEntries.push(i18n("On %1", virtualDesktopInfo.desktopNames[vd - 1]));
}
var act = isGroup ? Activities : activitiesParent;
if (act == undefined) {
var act = isGroup ? activities : activitiesParent;
if (act === undefined) {
return subTextEntries.join("\n");
}
if (act.length == 0 && activityInfo.numberOfRunningActivities > 1) {
subTextEntries.push(i18nc("Which virtual desktop a window is currently on",
"Available on all activities"));
"Available on all activities"));
} else if (act.length > 0) {
var activityNames = [];
var activityNames = [];
for (var i = 0; i < act.length; i++) {
var activity = act[i];
@ -494,11 +509,11 @@ Column {
if (plasmoid.configuration.showOnlyCurrentActivity) {
if (activityNames.length > 0) {
subTextEntries.push(i18nc("Activities a window is currently on (apart from the current one)",
"Also available on %1", activityNames.join(", ")));
"Also available on %1", activityNames.join(", ")));
}
} else if (activityNames.length > 0) {
subTextEntries.push(i18nc("Which activities a window is currently on",
"Available on %1", activityNames.join(", ")));
"Available on %1", activityNames.join(", ")));
}
}

View File

@ -18,51 +18,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
MouseArea {
property var modelIndex
property int winId // FIXME Legacy
property Item thumbnailItem
acceptedButtons: Qt.LeftButton
hoverEnabled: true
enabled: winId != 0
onClicked: {
tasksModel.requestActivate(modelIndex);
windowsPreviewDlg.hide();
//toolTip.hideToolTip();
}
onContainsMouseChanged: {
tooltipContentItem.checkMouseInside();
root.windowsHovered([winId], containsMouse);
}
PlasmaComponents.ToolButton {
anchors {
top: parent.top
topMargin: thumbnailItem ? (thumbnailItem.height - thumbnailItem.paintedHeight) / 2 : 0
right: parent.right
rightMargin: thumbnailItem ? (thumbnailItem.width - thumbnailItem.paintedWidth) / 2 : 0
}
iconSource: "window-close"
visible: parent.containsMouse && winId != 0
tooltip: i18nc("close this window", "Close")
onClicked: tasksModel.requestClose(modelIndex);
}
}*/
import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.latte 0.1 as Latte
MouseArea {
property var modelIndex
property int winId // FIXME Legacy
@ -70,7 +31,8 @@ MouseArea {
acceptedButtons: Qt.LeftButton | Qt.RightButton
hoverEnabled: true
enabled: winId != 0
enabled: Latte.WindowSystem.isPlatformWayland ||
(!Latte.WindowSystem.isPlatformWayland && winId != 0)
onClicked: {
if (mouse.button == Qt.LeftButton) {