Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: linux-trace-devel@vger.kernel.org
Cc: rostedt@goodmis.org, "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH 2/4] kernel-shark: Have correct screen geometry on high-resolution screens
Date: Wed, 16 Sep 2020 09:50:05 +0300
Message-ID: <20200916065007.9755-2-y.karadz@gmail.com> (raw)
In-Reply-To: <20200916065007.9755-1-y.karadz@gmail.com>

A scale factor (also called "Device Pixel Ratio") is often applied in
the display settings when running on laptops having high-resolution
screens. Take this scale factor into consideration when calculating
the screen size.

Note that the size of some widget is set to be a fractions of the total
size of the screen.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/KsUtils.hpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kernel-shark/src/KsUtils.hpp b/kernel-shark/src/KsUtils.hpp
index 2772b84..a07af1a 100644
--- a/kernel-shark/src/KsUtils.hpp
+++ b/kernel-shark/src/KsUtils.hpp
@@ -25,10 +25,18 @@
 #include "KsPlotTools.hpp"
 
 /** Macro providing the height of the screen in pixels. */
-#define SCREEN_HEIGHT  QGuiApplication::screens()[0]->geometry().height()
+#define SCREEN_HEIGHT \
+	( \
+	QGuiApplication::screens()[0]->geometry().height() / \
+	QApplication::desktop()->devicePixelRatio() \
+	)
 
 /** Macro providing the width of the screen in pixels. */
-#define SCREEN_WIDTH   QGuiApplication::screens()[0]->geometry().width()
+#define SCREEN_WIDTH \
+	( \
+	QGuiApplication::screens()[0]->geometry().width() / \
+	QApplication::desktop()->devicePixelRatio() \
+	)
 
 //! @cond Doxygen_Suppress
 
-- 
2.26.2


  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  6:50 [PATCH 1/4] kernel-shark :Fix all build warnings for gcc 10.2.1 Yordan Karadzhov (VMware)
2020-09-16  6:50 ` Yordan Karadzhov (VMware) [this message]
2020-09-16  6:50 ` [PATCH 3/4] kernel-shark: Check if Qt has been found when building the examples Yordan Karadzhov (VMware)
2020-09-16  6:50 ` [PATCH 4/4] kernel-shark: Fix dependency (symbol resolving) issue Yordan Karadzhov (VMware)
2020-09-29 21:05 ` [PATCH 1/4] kernel-shark :Fix all build warnings for gcc 10.2.1 Steven Rostedt
2020-09-30 13:55   ` Yordan Karadzhov (VMware)
2020-09-30 14:03     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200916065007.9755-2-y.karadz@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git