From: Dongwon Kim <dongwon.kim@intel.com>
To: qemu-devel@nongnu.org
Cc: "Dongwon Kim" <dongwon.kim@intel.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH] ui/gtk-egl: apply scale factor when calculating window's dimension
Date: Thu, 12 Oct 2023 15:26:43 -0700 [thread overview]
Message-ID: <20231012222643.13996-1-dongwon.kim@intel.com> (raw)
Scale factor needs to be applied when calculating width/height of the
GTK windows.
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
ui/gtk-egl.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index a1060fd80f..45c7544337 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -69,15 +69,16 @@ void gd_egl_draw(VirtualConsole *vc)
#ifdef CONFIG_GBM
QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
#endif
- int ww, wh;
+ int ww, wh, ws;
if (!vc->gfx.gls) {
return;
}
window = gtk_widget_get_window(vc->gfx.drawing_area);
- ww = gdk_window_get_width(window);
- wh = gdk_window_get_height(window);
+ ws = gdk_window_get_scale_factor(window);
+ ww = gdk_window_get_width(window) * ws;
+ wh = gdk_window_get_height(window) * ws;
if (vc->gfx.scanout_mode) {
#ifdef CONFIG_GBM
@@ -312,7 +313,7 @@ void gd_egl_scanout_flush(DisplayChangeListener *dcl,
{
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
GdkWindow *window;
- int ww, wh;
+ int ww, wh, ws;
if (!vc->gfx.scanout_mode) {
return;
@@ -325,8 +326,9 @@ void gd_egl_scanout_flush(DisplayChangeListener *dcl,
vc->gfx.esurface, vc->gfx.ectx);
window = gtk_widget_get_window(vc->gfx.drawing_area);
- ww = gdk_window_get_width(window);
- wh = gdk_window_get_height(window);
+ ws = gdk_window_get_scale_factor(window);
+ ww = gdk_window_get_width(window) * ws;
+ wh = gdk_window_get_height(window) * ws;
egl_fb_setup_default(&vc->gfx.win_fb, ww, wh);
if (vc->gfx.cursor_fb.texture) {
egl_texture_blit(vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.guest_fb,
--
2.20.1
next reply other threads:[~2023-10-12 22:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-12 22:26 Dongwon Kim [this message]
2023-10-16 13:44 ` [PATCH] ui/gtk-egl: apply scale factor when calculating window's dimension Marc-André Lureau
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=20231012222643.13996-1-dongwon.kim@intel.com \
--to=dongwon.kim@intel.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).