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

Bring back fullscreen hint #436

Open
wants to merge 2 commits into
base: xenial
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions src/app/webbrowser/Browser.qml
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,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 @@ -1013,17 +1013,19 @@ Common.BrowserView {
}
height: units.gu(2)

enabled: !browser.wide && (recentView.state == "") &&
enabled: (!browser.wide || (browser.currentWebview && browser.currentWebview.isFullScreen))
&& (recentView.state == "") &&
browser.currentWebview &&
(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 @@ -1317,6 +1319,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 @@ -1864,6 +1867,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
47 changes: 29 additions & 18 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
bottom: parent.bottom
bottomMargin : 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,9 +258,18 @@ Component {
Label {
color: theme.palette.normal.background
font.weight: Font.Light
anchors.centerIn: parent
text: bottomEdgeHandle.enabled
? i18n.tr("Swipe Up To Exit Full Screen")
fontSizeMode: Text.HorizontalFit
minimumPixelSize: Label.XSmall
textSize: Label.Large
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors {
fill: parent
leftMargin: units.gu(2)
rightMargin: units.gu(2)
}
text: bottomEdgeHandle.enabled && !internal.hasKeyboard
? i18n.tr("Swipe From The Bottom Edge To Exit Full Screen")
: i18n.tr("Press ESC To Exit Full Screen")
}

Expand All @@ -267,15 +281,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