Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Commit

Permalink
bring back fullscreen hint
Browse files Browse the repository at this point in the history
  • Loading branch information
kugiigi committed Dec 30, 2020
1 parent ac00e62 commit ac57330
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 23 deletions.
28 changes: 21 additions & 7 deletions src/app/webbrowser/Browser.qml
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ Common.BrowserView {
objectName: "recentView"

anchors.fill: parent
visible: bottomEdgeHandle.dragging || tabslist.animating || (state == "shown")
visible: ((browser.currentWebview && !browser.currentWebview.isFullScreen) && bottomEdgeHandle.dragging) || tabslist.animating || (state == "shown")
onVisibleChanged: {
if (visible) {

Expand Down Expand Up @@ -967,12 +967,13 @@ Common.BrowserView {
(Screen.orientation == Screen.primaryOrientation)

onDraggingChanged: {
if (dragging) {
if (browser.thisWindow) {
browser.thisWindow.setFullscreen(false)
}
} else {
if (stage == 1) {
if (!dragging) {
if (browser.currentWebview && browser.currentWebview.isFullScreen) {
if (browser.thisWindow) {
browser.thisWindow.setFullscreen(false)
browser.currentWebview.fullScreenCancelled()
}
} else if (stage == 1) {
if (tabsModel.count > 1) {
tabslist.selectAndAnimateTab(1)
} else {
Expand Down Expand Up @@ -1266,6 +1267,7 @@ Common.BrowserView {
}

readonly property bool hasMouse: (miceModel.count + touchPadModel.count) > 0
readonly property bool hasKeyboard: keyboardModel.count > 0
readonly property bool hasTouchScreen: touchScreenModel.count > 0

// Ref: https://code.google.com/p/chromium/codesearch#chromium/src/components/ui/zoom/page_zoom_constants.cc
Expand Down Expand Up @@ -1755,6 +1757,18 @@ Common.BrowserView {
onActivated: currentWebview.zoomController.resetSaveFit()
}

// Escape: Exit webview fullscreen
Shortcut {
sequence: "Esc"
enabled: currentWebview && currentWebview.isFullScreen
onActivated: {
if (currentWebview.isFullScreen) {
thisWindow.setFullscreen(false)
currentWebview.fullScreenCancelled()
}
}
}

Loader {
id: contentHandlerLoader
source: "../ContentHandler.qml"
Expand Down
35 changes: 19 additions & 16 deletions src/app/webbrowser/TabComponent.qml
Original file line number Diff line number Diff line change
Expand Up @@ -209,21 +209,26 @@ Component {
error.onCancelled.connect(webviewimpl.resetCertificateError)
}
}
//onFullscreenChanged: {
// if (fullscreen) {
// fullscreenExitHintComponent.createObject(webviewimpl)
// }
//}
*/

onIsFullScreenChanged: {
if (isFullScreen) {
fullscreenExitHintComponent.createObject(webviewimpl)
}
}

Component {
id: fullscreenExitHintComponent

Rectangle {
id: fullscreenExitHint
objectName: "fullscreenExitHint"

anchors.centerIn: parent
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.top
topMargin : units.gu(5)
}
height: units.gu(6)
width: Math.min(units.gu(50), parent.width - units.gu(12))
radius: units.gu(1)
Expand Down Expand Up @@ -253,8 +258,9 @@ Component {
Label {
color: theme.palette.normal.background
font.weight: Font.Light
textSize: Label.Large
anchors.centerIn: parent
text: bottomEdgeHandle.enabled
text: bottomEdgeHandle.enabled && !internal.hasKeyboard
? i18n.tr("Swipe Up To Exit Full Screen")
: i18n.tr("Press ESC To Exit Full Screen")
}
Expand All @@ -267,15 +273,12 @@ Component {

Connections {
target: webviewimpl
// onFullscreenChanged: {
// if (!webviewimpl.fullscreen) {
// fullscreenExitHint.destroy()
// }
// }
onIsFullScreenChanged: {
if (!target.isFullScreen) {
fullscreenExitHint.destroy()
}
}
}

Component.onCompleted: bottomEdgeHint.forceShow = true
Component.onDestruction: bottomEdgeHint.forceShow = false
}
}
}
Expand Down

0 comments on commit ac57330

Please sign in to comment.