Skip to content

Commit

Permalink
fixes to the surface move item and app not being visible when launched
Browse files Browse the repository at this point in the history
  • Loading branch information
Camilo Higuita committed Oct 17, 2024
1 parent 52dff25 commit b932384
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 95 deletions.
1 change: 0 additions & 1 deletion caskcore/plugin/src/controls/Dashboard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Item

property alias topPanel: _topPanel


Rectangle
{
id: _rec
Expand Down
1 change: 0 additions & 1 deletion src/code/controllers/xdgwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ void XdgWindow::setUpToplevelConnections()
connect(m_toplevel, &QWaylandXdgToplevel::unsetFullscreen, this, &AbstractWindow::unsetFullscreen);
connect(m_toplevel, &QWaylandXdgToplevel::setFullscreen, this, &AbstractWindow::setFullscreen);


connect(m_toplevel, &QWaylandXdgToplevel::maximizedChanged, this, &AbstractWindow::maximizedChanged);
connect(m_toplevel, &QWaylandXdgToplevel::fullscreenChanged, this, &AbstractWindow::fullscreenChanged);
}
Expand Down
12 changes: 6 additions & 6 deletions src/code/controllers/xdgwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class XdgWindow : public AbstractWindow
bool maximized() const override final;
bool fullscreen() const override final;

QString title() const override final;
QString appId() const override final;
QString iconName() const override final;
QString appName() const override final;
QWaylandXdgSurface *xdgSurface() const;

public Q_SLOTS:
void setShellSurface(QWaylandShellSurface * shellSurface);
void setToplevel(QWaylandXdgToplevel *toplevel);
Expand All @@ -55,11 +61,5 @@ public Q_SLOTS:
void waylandSurfaceChanged();
void xdgSurfaceChanged();
// AbstractWindow interface
public:
QString title() const override final;
QString appId() const override final;
QString iconName() const override final;
QString appName() const override final;
QWaylandXdgSurface *xdgSurface() const;
};

2 changes: 1 addition & 1 deletion src/qml/CaskScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ WaylandOutput
property bool showDesktop : true

sizeFollowsWindow: true
availableGeometry : _cask.availableGeometry
availableGeometry : _swipeView.currentItem.availableGeometry

// scaleFactor: Cask.MauiMan.screen.scaleFactor
// transform: switch(control.orientation)
Expand Down
37 changes: 16 additions & 21 deletions src/qml/chrome/Chrome.qml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ Cask.StackableItem
property rect previousRect
property rect oldPos : Qt.rect(0, 0, rootChrome.width * 0.6, rootChrome.height*0.6)

x: surfaceItem.moveItem.x - surfaceItem.output.geometry.x
y: surfaceItem.moveItem.y - surfaceItem.output.geometry.y
x: surfaceItem.moveItem.x
y: surfaceItem.moveItem.y

// Binding on x
// {
Expand Down Expand Up @@ -273,18 +273,17 @@ Cask.StackableItem
if(win.formFactor === Cask.MauiMan.Desktop)
{
rootChrome.shellSurface.toplevel.sendConfigure(Qt.size(previousRect.width, previousRect.height), [3,4])
rootChrome.x = previousRect.x
rootChrome.y = previousRect.y
rootChrome.moveItem.x = previousRect.x
rootChrome.moveItem.y = previousRect.y
}else
{
previousRect = Qt.rect(rootChrome.x, rootChrome.y, rootChrome.width, rootChrome.height)
rootChrome.x = 0
rootChrome.y = 0
rootChrome.moveItem.x = 0
rootChrome.moveItem.y = 0
}
}
}


Connections
{
target: rootChrome.window
Expand All @@ -307,8 +306,8 @@ Cask.StackableItem

function onUnsetMinimized()
{
rootChrome.visible = true;
surfaceItem.forceActiveFocus();
rootChrome.visible = true
surfaceItem.forceActiveFocus()
window.activate()
}

Expand All @@ -321,11 +320,11 @@ Cask.StackableItem
oldPos.width = rootChrome.width
oldPos.height = rootChrome.height

rootChrome.x = 0
rootChrome.y = 0
// rootChrome.x = 0
// rootChrome.y = 0

rootChrome.moveItem.x = rootChrome.x
rootChrome.moveItem.y = rootChrome.y
// rootChrome.moveItem.x = 0
// rootChrome.moveItem.y = 0

toplevel.sendMaximized(Qt.size(rootChrome.parent.width, rootChrome.parent.height - rootChrome.titlebarHeight))
}
Expand All @@ -337,18 +336,13 @@ Cask.StackableItem
{
oldPos = Qt.rect(0, 0, rootChrome.width * 0.6, rootChrome.height*0.6)
}

rootChrome.x = oldPos.x
rootChrome.y = oldPos.y

rootChrome.moveItem.x = rootChrome.x
rootChrome.moveItem.y = rootChrome.y
toplevel.sendUnmaximized(Qt.size(oldPos.width, oldPos.height))

rootChrome.x = Qt.binding(()=> {return rootChrome.moveItem.x})
rootChrome.y = Qt.binding(()=> {return rootChrome.moveItem.y})

toplevel.sendUnmaximized(Qt.size(oldPos.width, oldPos.height))

rootChrome.moveItem.x = oldPos.x
rootChrome.moveItem.y = oldPos.y
}

// function onSetFullscreen()
Expand Down Expand Up @@ -399,6 +393,7 @@ Cask.StackableItem
{
rootChrome.window.chrome = rootChrome
surfaceItem.forceActiveFocus()
rootChrome.visible = true
}

Rectangle
Expand Down
58 changes: 28 additions & 30 deletions src/qml/chrome/TitleBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,42 @@ Control

implicitHeight: _content.implicitHeight + topPadding + bottomPadding

padding: 0
padding: Maui.Style.space.small
background: null

// font.bold: true

hoverEnabled: !Maui.Handy.isMobile

contentItem: MouseArea
contentItem: Item
{
id: _content
implicitHeight: _layout.implicitHeight
implicitHeight: _layout.implicitHeight

DragHandler
{
id: titlebarDrag
grabPermissions: TapHandler.CanTakeOverFromAnything
target: rootChrome.moveItem
yAxis.maximum: rootChrome.parent.height
yAxis.minimum: 0
cursorShape: Qt.ClosedHandCursor
onActiveChanged:
{
if(toplevel.maximized)
{
rootChrome. window.unmaximize()
}

if(!rootChrome.activated)
{
rootChrome.window.activate()
}
}
}

onPressed:
TapHandler
{
rootChrome.window.activate()
mouse.accepted= false
onTapped: rootChrome.window.activate()
}

HoverHandler
Expand All @@ -44,7 +64,7 @@ Control

Label
{
opacity: control.hovered ? 1 : 0
// opacity: control.hovered ? 1 : 0
Layout.fillWidth: true
text: rootChrome.title
horizontalAlignment: Qt.AlignLeft
Expand All @@ -60,28 +80,6 @@ Control
maximized: rootChrome.toplevel.maximized
}
}

DragHandler
{
id: titlebarDrag
grabPermissions: PointerHandler.TakeOverForbidden
target: rootChrome
yAxis.maximum: rootChrome.parent.height
yAxis.minimum: 0
cursorShape: Qt.ClosedHandCursor
onActiveChanged:
{
if(toplevel.maximized)
{
window.unmaximize()
}

if(!rootChrome.activated)
{
rootChrome.window.activate()
}
}
}
}

function performActiveWindowAction(type)
Expand Down
2 changes: 1 addition & 1 deletion src/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ WaylandCompositor
target: defaultSeat
function onCursorSurfaceRequest()
{
console.log("CURSOR SURFACE REQUEST", hotspotX, hotspotY, surface.cursorSurface, surface.hasContent, surface.inhibitsIdle)
console.log("CURSOR SURFACE REQUEST"/*,hotspotX, hotspotY, surface.cursorSurface, surface.hasContent, surface.inhibitsIdle*/)
}

function onKeyboardFocusChanged()
Expand Down
65 changes: 31 additions & 34 deletions src/qml/shell/zpaces/Zpace.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ Pane
property alias backgroundFillMode : _img.fillMode
property alias backgroundVisible: _backgroundOverlay.visible

readonly property rect availableGeometry : Qt.rect(0, 0, width, height)

topPadding: cask.topPanel.height
bottomPadding: formFactor === Cask.MauiMan.Desktop ? dock.height : 0
leftPadding: 0
rightPadding: 0

// clip: false

Component.onCompleted:
{
control.zpace.control = control.container
Expand Down Expand Up @@ -124,6 +124,7 @@ Pane

contentItem : Item
{
id: _container
data: Repeater
{
id: _repeater
Expand All @@ -145,28 +146,24 @@ Pane
scale: isMobile ? 1 : _swipeView.scale


moveItem: Item
moveItem: Rectangle
{
color: "pink"
Text {
anchors.bottom: parent.bottom

text: parent.x + " - " + parent.y
color: "white"
}
opacity: 0.2
objectName: "moveItem"
property bool moving: false
parent: control
parent: _container
x: 0
y: 0

height: _chromeDelegate.height
width: _chromeDelegate.width

// Binding on x
// {
// value: rootChrome.x
// restoreMode: Binding.RestoreBindingOrValue
// }

// Binding on y
// {

// value: rootChrome.y
// restoreMode: Binding.RestoreBindingOrValue
// }
}
}
}
Expand All @@ -193,22 +190,22 @@ Pane
}
}

// Label
// {
// anchors.centerIn: parent
// color: "pink"
// font.bold: true
// text:
// {
// var res = ""
// for(var i = 0; i< _content.children.length; i++)
// {
// res+= _content.children[i]+ " / " + _content.children[i].objectName+"\n"
// }

// return res
// }
// }
// Label
// {
// anchors.centerIn: parent
// color: "pink"
// font.bold: true
// text:
// {
// var res = ""
// for(var i = 0; i< _content.children.length; i++)
// {
// res+= _content.children[i]+ " / " + _content.children[i].objectName+"\n"
// }

// return res
// }
// }

Maui.ContextualMenu
{
Expand All @@ -232,7 +229,7 @@ Pane
MenuItem
{
text: i18n("About")
icon.name: "documentinfo"
icon.name: "documentinfo"
onTriggered: Cask.MauiMan.invokeManager("about")
}
}
Expand Down

0 comments on commit b932384

Please sign in to comment.