265
x: priv.focusedAppDelegate ? priv.focusedAppDelegate.x + units.gu(3) : (normalZ - 1) * units.gu(3)
266
y: priv.focusedAppDelegate ? priv.focusedAppDelegate.y + units.gu(3) : normalZ * units.gu(3)
266
x: requestedX // may be overridden in some states. Do not directly write to this.
267
y: requestedY // may be overridden in some states. Do not directly write to this.
268
property real requestedX: priv.focusedAppDelegate ? priv.focusedAppDelegate.x + units.gu(3) : (normalZ - 1) * units.gu(3)
269
property real requestedY: priv.focusedAppDelegate ? priv.focusedAppDelegate.y + units.gu(3) : normalZ * units.gu(3)
274
value: appDelegate.requestedY -
275
Math.min(appDelegate.requestedY - PanelState.panelHeight,
276
Math.max(0, UbuntuKeyboardInfo.height - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
277
when: root.oskEnabled && appDelegate.focus && appDelegate.state == "normal"
278
&& SurfaceManager.inputMethodSurface
279
&& SurfaceManager.inputMethodSurface.state != Mir.HiddenState
280
&& SurfaceManager.inputMethodSurface.state != Mir.MinimizedState
268
284
width: decoratedWindow.width
269
285
height: decoratedWindow.height
289
onShellOrientationAngleChanged: {
290
// at this point decoratedWindow.surfaceOrientationAngle is the old shellOrientationAngle
291
if (application && application.rotatesWindowContents) {
292
if (state == "normal") {
293
var angleDiff = decoratedWindow.surfaceOrientationAngle - shellOrientationAngle;
294
angleDiff = (360 + angleDiff) % 360;
295
if (angleDiff === 90 || angleDiff === 270) {
296
var aux = decoratedWindow.requestedHeight;
297
decoratedWindow.requestedHeight = decoratedWindow.requestedWidth + decoratedWindow.visibleDecorationHeight;
298
decoratedWindow.requestedWidth = aux - decoratedWindow.visibleDecorationHeight;
301
decoratedWindow.surfaceOrientationAngle = shellOrientationAngle;
303
decoratedWindow.surfaceOrientationAngle = 0;
308
readonly property alias application: decoratedWindow.application
309
readonly property alias minimumWidth: decoratedWindow.minimumWidth
310
readonly property alias minimumHeight: decoratedWindow.minimumHeight
311
readonly property alias maximumWidth: decoratedWindow.maximumWidth
312
readonly property alias maximumHeight: decoratedWindow.maximumHeight
313
readonly property alias widthIncrement: decoratedWindow.widthIncrement
314
readonly property alias heightIncrement: decoratedWindow.heightIncrement
270
315
property int requestedWidth: -1
271
316
property int requestedHeight: -1
272
property alias minimumWidth: decoratedWindow.minimumWidth
273
property alias minimumHeight: decoratedWindow.minimumHeight
274
property alias maximumWidth: decoratedWindow.maximumWidth
275
property alias maximumHeight: decoratedWindow.maximumHeight
276
property alias widthIncrement: decoratedWindow.widthIncrement
277
property alias heightIncrement: decoratedWindow.heightIncrement
280
id: appDelegatePrivate
281
property bool maximized: false
282
property bool maximizedLeft: false
283
property bool maximizedRight: false
284
property bool minimized: false
286
readonly property alias maximized: appDelegatePrivate.maximized
287
readonly property alias maximizedLeft: appDelegatePrivate.maximizedLeft
288
readonly property alias maximizedRight: appDelegatePrivate.maximizedRight
289
readonly property alias minimized: appDelegatePrivate.minimized
318
readonly property bool maximized: windowState & WindowStateStorage.WindowStateMaximized
319
readonly property bool maximizedLeft: windowState & WindowStateStorage.WindowStateMaximizedLeft
320
readonly property bool maximizedRight: windowState & WindowStateStorage.WindowStateMaximizedRight
321
readonly property bool maximizedHorizontally: windowState & WindowStateStorage.WindowStateMaximizedHorizontally
322
readonly property bool maximizedVertically: windowState & WindowStateStorage.WindowStateMaximizedVertically
323
readonly property bool minimized: windowState & WindowStateStorage.WindowStateMinimized
290
324
readonly property alias fullscreen: decoratedWindow.fullscreen
292
readonly property var application: model.application
326
property int windowState: WindowStateStorage.WindowStateNormal
293
327
property bool animationsEnabled: true
294
328
property alias title: decoratedWindow.title
295
329
readonly property string appName: model.application ? model.application.name : ""
387
428
function maximize(animated) {
388
429
animationsEnabled = (animated === undefined) || animated;
389
appDelegatePrivate.minimized = false;
390
appDelegatePrivate.maximized = true;
391
appDelegatePrivate.maximizedLeft = false;
392
appDelegatePrivate.maximizedRight = false;
394
function maximizeLeft() {
395
appDelegatePrivate.minimized = false;
396
appDelegatePrivate.maximized = false;
397
appDelegatePrivate.maximizedLeft = true;
398
appDelegatePrivate.maximizedRight = false;
400
function maximizeRight() {
401
appDelegatePrivate.minimized = false;
402
appDelegatePrivate.maximized = false;
403
appDelegatePrivate.maximizedLeft = false;
404
appDelegatePrivate.maximizedRight = true;
430
windowState = WindowStateStorage.WindowStateMaximized;
432
function maximizeLeft(animated) {
433
animationsEnabled = (animated === undefined) || animated;
434
windowState = WindowStateStorage.WindowStateMaximizedLeft;
436
function maximizeRight(animated) {
437
animationsEnabled = (animated === undefined) || animated;
438
windowState = WindowStateStorage.WindowStateMaximizedRight;
440
function maximizeHorizontally(animated) {
441
animationsEnabled = (animated === undefined) || animated;
442
windowState = WindowStateStorage.WindowStateMaximizedHorizontally;
444
function maximizeVertically(animated) {
445
animationsEnabled = (animated === undefined) || animated;
446
windowState = WindowStateStorage.WindowStateMaximizedVertically;
406
448
function minimize(animated) {
407
449
animationsEnabled = (animated === undefined) || animated;
408
appDelegatePrivate.minimized = true;
450
windowState |= WindowStateStorage.WindowStateMinimized; // add the minimized bit
410
452
function restoreFromMaximized(animated) {
411
453
animationsEnabled = (animated === undefined) || animated;
412
appDelegatePrivate.minimized = false;
413
appDelegatePrivate.maximized = false;
414
appDelegatePrivate.maximizedLeft = false;
415
appDelegatePrivate.maximizedRight = false;
454
windowState = WindowStateStorage.WindowStateNormal;
417
456
function restore(animated) {
418
457
animationsEnabled = (animated === undefined) || animated;
419
appDelegatePrivate.minimized = false;
458
windowState &= ~WindowStateStorage.WindowStateMinimized; // clear the minimized bit
422
461
else if (maximizedLeft)
424
463
else if (maximizedRight)
465
else if (maximizedHorizontally)
466
maximizeHorizontally();
467
else if (maximizedVertically)
468
maximizeVertically();
445
488
name: "fullscreen"; when: decoratedWindow.fullscreen && !appDelegate.minimized
446
489
PropertyChanges {
447
490
target: appDelegate;
449
y: -PanelState.panelHeight
491
x: rotation == 0 ? 0 : (parent.width - width) / 2 + (shellOrientationAngle == 90 ? -PanelState.panelHeight : PanelState.panelHeight)
492
y: rotation == 0 ? -PanelState.panelHeight : (parent.height - height) / 2
450
493
requestedWidth: appContainer.width;
451
494
requestedHeight: appContainer.height;
456
when: !appDelegate.maximized && !appDelegate.minimized
457
&& !appDelegate.maximizedLeft && !appDelegate.maximizedRight
499
when: appDelegate.windowState == WindowStateStorage.WindowStateNormal
458
500
PropertyChanges {
459
501
target: appDelegate;
460
502
visuallyMinimized: false;
607
669
surface: model.surface
608
670
active: appDelegate.focus
672
maximizeButtonShown: (maximumWidth == 0 || maximumWidth >= appContainer.width) &&
673
(maximumHeight == 0 || maximumHeight >= appContainer.height)
674
overlayShown: touchControls.overlayShown
611
676
requestedWidth: appDelegate.requestedWidth
612
677
requestedHeight: appDelegate.requestedHeight
614
onClose: { appDelegate.close(); }
615
onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
616
? appDelegate.restoreFromMaximized() : appDelegate.maximize()
617
onMinimize: appDelegate.minimize()
679
onCloseClicked: { appDelegate.close(); }
680
onMaximizeClicked: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
681
|| appDelegate.maximizedHorizontally || appDelegate.maximizedVertically
682
? appDelegate.restoreFromMaximized() : appDelegate.maximize()
683
onMaximizeHorizontallyClicked: appDelegate.maximizedHorizontally ? appDelegate.restoreFromMaximized() : appDelegate.maximizeHorizontally()
684
onMaximizeVerticallyClicked: appDelegate.maximizedVertically ? appDelegate.restoreFromMaximized() : appDelegate.maximizeVertically()
685
onMinimizeClicked: appDelegate.minimize()
618
686
onDecorationPressed: { appDelegate.focus = true; }
689
WindowControlsOverlay {
691
anchors.fill: appDelegate
621
695
WindowedFullscreenPolicy {
622
696
id: fullscreenPolicy