Skip to content

Commit

Permalink
Handle fractional scaling in browser panels
Browse files Browse the repository at this point in the history
  • Loading branch information
WizardCM committed Nov 30, 2020
1 parent 35b26e9 commit 7143a01
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions panel/browser-panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ CefRefPtr<CefCookieManager> QCefRequestContextHandler::GetCookieManager()
}
#endif

#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
#define SUPPORTS_FRACTIONAL_SCALING
#endif

class CookieCheck : public CefCookieVisitor {
public:
QCefCookieManager::cookie_exists_cb callback;
Expand Down Expand Up @@ -227,7 +231,11 @@ void QCefWidgetInternal::Init()

QSize size = this->size();
#ifdef _WIN32
#ifdef SUPPORTS_FRACTIONAL_SCALING
size *= devicePixelRatioF();
#elif
size *= devicePixelRatio();
#endif
RECT rc = {0, 0, size.width(), size.height()};
windowInfo.SetAsChild((HWND)id, rc);
#elif __APPLE__
Expand Down Expand Up @@ -263,7 +271,11 @@ void QCefWidgetInternal::resizeEvent(QResizeEvent *event)
void QCefWidgetInternal::Resize()
{
#ifdef _WIN32
#ifdef SUPPORTS_FRACTIONAL_SCALING
QSize size = this->size() * devicePixelRatioF();
#elif
QSize size = this->size() * devicePixelRatio();
#endif

QueueCEFTask([this, size]() {
if (!cefBrowser)
Expand Down

0 comments on commit 7143a01

Please sign in to comment.