1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Merge pull request #516 from srazi/master

Some improvment about `fullscreen`, `blur background` and `add tab button`.
This commit is contained in:
David Rosca 2012-08-20 14:00:13 -07:00
commit 438cd3b18a
5 changed files with 27 additions and 3 deletions

View File

@ -65,6 +65,7 @@ static PtrDwmEnableBlurBehindWindow pDwmEnableBlurBehindWindow = 0;
static PtrDwmExtendFrameIntoClientArea pDwmExtendFrameIntoClientArea = 0;
static PtrDwmGetColorizationColor pDwmGetColorizationColor = 0;
QHash<QWidget *, bool> widgetsBlurState = QHash<QWidget *, bool>();
/*
* Internal helper class that notifies windows if the
@ -169,6 +170,7 @@ bool QtWin::enableBlurBehindWindow(QWidget* widget, bool enable)
if (SUCCEEDED(hr)) {
result = true;
windowNotifier()->addWidget(widget);
widgetsBlurState.insert(widget, true);
}
}
#endif
@ -207,6 +209,7 @@ bool QtWin::extendFrameIntoClientArea(QWidget* widget, int left, int top, int ri
if (SUCCEEDED(hr)) {
result = true;
windowNotifier()->addWidget(widget);
widgetsBlurState.insert(widget, true);
}
widget->setAttribute(Qt::WA_TranslucentBackground, result);
}
@ -257,6 +260,13 @@ bool WindowNotifier::winEvent(MSG* message, long* result)
foreach(QWidget * widget, widgets) {
if (widget) {
widget->setAttribute(Qt::WA_NoSystemBackground, compositionEnabled);
bool isBlur = widgetsBlurState.value(widget, false);
if (compositionEnabled && isBlur)
{
// hack for fixing black background when enabling composition
QtWin::enableBlurBehindWindow(widget, false);
QtWin::extendFrameIntoClientArea(widget);
}
widget->update();
}
}

View File

@ -1454,6 +1454,11 @@ void QupZilla::fullScreen(bool make)
bookmarksToolbar()->hide();
m_navigationBar->hide();
m_tabWidget->getTabBar()->hide();
#ifdef Q_WS_WIN
if (m_usingTransparentBackground) {
QtWin::enableBlurBehindWindow(this, false);
}
#endif
}
else {
setWindowState(windowState() & ~Qt::WindowFullScreen);
@ -1463,6 +1468,11 @@ void QupZilla::fullScreen(bool make)
m_bookmarksToolbar->setVisible(m_bookmarksToolBarVisible);
m_navigationBar->setVisible(m_navigationVisible);
m_tabWidget->showTabBar();
#ifdef Q_WS_WIN
if (m_usingTransparentBackground) {
QtWin::enableBlurBehindWindow(this);
}
#endif
}
m_actionShowFullScreen->setChecked(make);

View File

@ -36,6 +36,8 @@
#include <QHostInfo>
#include <QWebFrame>
bool TabbedWebView::m_navigationVisible = false;
TabbedWebView::TabbedWebView(QupZilla* mainClass, WebTab* webTab)
: WebView(webTab)
, p_QupZilla(mainClass)
@ -43,7 +45,6 @@ TabbedWebView::TabbedWebView(QupZilla* mainClass, WebTab* webTab)
, m_webTab(webTab)
, m_menu(new Menu(this))
, m_mouseTrack(false)
, m_navigationVisible(false)
, m_hasRss(false)
, m_rssChecked(false)
{

View File

@ -98,7 +98,7 @@ private:
Menu* m_menu;
bool m_mouseTrack;
bool m_navigationVisible;
static bool m_navigationVisible;
bool m_hasRss;
bool m_rssChecked;

View File

@ -202,7 +202,10 @@ void TabWidget::moveAddTabButton(int posX)
int posY = (m_tabBar->height() - m_buttonAddTab->height()) / 2;
//RTL Support
if (QApplication::layoutDirection() == Qt::RightToLeft) {
posX = posX - m_buttonAddTab->width();
posX = qMax(posX - m_buttonAddTab->width(), m_buttonListTabs->width());
}
else {
posX = qMin(posX, m_tabBar->width() - m_buttonAddTab->width() - m_buttonListTabs->width());
}
m_buttonAddTab->move(posX, posY);
}