Merge lp:~osomon/oxide/contextmenu-position-physical-pixels into lp:~oxide-developers/oxide/oxide.trunk

Proposed by Olivier Tilloy
Status: Merged
Merged at revision: 1180
Proposed branch: lp:~osomon/oxide/contextmenu-position-physical-pixels
Merge into: lp:~oxide-developers/oxide/oxide.trunk
Diff against target: 24 lines (+6/-1)
1 file modified
qt/core/browser/oxide_qt_web_context_menu.cc (+6/-1)
To merge this branch: bzr merge lp:~osomon/oxide/contextmenu-position-physical-pixels
Reviewer Review Type Date Requested Status
Chris Coulson Pending
Review via email: mp+269640@code.launchpad.net

Commit message

Expose the context menu position in physical pixels.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qt/core/browser/oxide_qt_web_context_menu.cc'
2--- qt/core/browser/oxide_qt_web_context_menu.cc 2015-05-28 23:51:39 +0000
3+++ qt/core/browser/oxide_qt_web_context_menu.cc 2015-08-31 13:45:23 +0000
4@@ -24,6 +24,7 @@
5 #include "base/strings/utf_string_conversions.h"
6
7 #include "qt/core/glue/oxide_qt_web_context_menu_proxy.h"
8+#include "shared/browser/oxide_web_view.h"
9
10 namespace oxide {
11 namespace qt {
12@@ -59,7 +60,11 @@
13 }
14
15 QPoint WebContextMenu::position() const {
16- return QPoint(params_.x, params_.y);
17+ // The position is expressed in device-independent pixels (DIP), it needs to
18+ // be multiplied by the device pixel ratio (DPR) to obtain physical pixels.
19+ oxide::WebView* webview = oxide::WebView::FromWebContents(web_contents());
20+ const float dpr = webview->GetScreenInfo().deviceScaleFactor;
21+ return QPoint(params_.x * dpr, params_.y * dpr);
22 }
23
24 QUrl WebContextMenu::linkUrl() const {

Subscribers

People subscribed via source and target branches