* [PATCH 0/2] Fix trivial errors with highdpi/wayland @ 2021-11-21 6:55 Alexander Orzechowski 2021-11-21 6:55 ` [PATCH 1/2] ui: fix incorrect scaling on highdpi with gtk/opengl Alexander Orzechowski 2021-11-21 6:55 ` [PATCH 2/2] ui: fix incorrect pointer position on highdpi with gtk Alexander Orzechowski 0 siblings, 2 replies; 5+ messages in thread From: Alexander Orzechowski @ 2021-11-21 6:55 UTC (permalink / raw) To: qemu-devel; +Cc: qemu-trivial, Gerd Hoffmann, Alexander Orzechowski Hi, this patch series is ment to fix two problems with highdpi/wayland with gtk that makes the program unusuable. As it stands currently: The virtual machine window will only render in the bottom-left quarter of the screen (with 2x scaling) while using the gtk,gl=on and virtgl backend. This also fixes the --usbdevice tablet option as before if the pointer would click in the incorrect spot of the virtual machine then was expected. Alexander Orzechowski (2): ui: fix incorrect scaling on highdpi with gtk/opengl ui: fix incorrect pointer position on highdpi with gtk ui/gtk-gl-area.c | 7 ++++--- ui/gtk.c | 13 ++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) -- 2.34.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] ui: fix incorrect scaling on highdpi with gtk/opengl 2021-11-21 6:55 [PATCH 0/2] Fix trivial errors with highdpi/wayland Alexander Orzechowski @ 2021-11-21 6:55 ` Alexander Orzechowski 2021-11-22 12:16 ` Philippe Mathieu-Daudé 2021-11-21 6:55 ` [PATCH 2/2] ui: fix incorrect pointer position on highdpi with gtk Alexander Orzechowski 1 sibling, 1 reply; 5+ messages in thread From: Alexander Orzechowski @ 2021-11-21 6:55 UTC (permalink / raw) To: qemu-devel; +Cc: Alexander Orzechowski Signed-off-by: Alexander Orzechowski <orzechowski.alexander@gmail.com> --- ui/gtk-gl-area.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 461da7712f..d3565698ae 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -41,15 +41,16 @@ void gd_gl_area_draw(VirtualConsole *vc) #ifdef CONFIG_GBM QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf; #endif - int ww, wh, y1, y2; + int ww, wh, ws, y1, y2; if (!vc->gfx.gls) { return; } gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area)); - ww = gtk_widget_get_allocated_width(vc->gfx.drawing_area); - wh = gtk_widget_get_allocated_height(vc->gfx.drawing_area); + ws = gdk_window_get_scale_factor (gtk_widget_get_window(vc->gfx.drawing_area)); + ww = gtk_widget_get_allocated_width(vc->gfx.drawing_area) * ws; + wh = gtk_widget_get_allocated_height(vc->gfx.drawing_area) * ws; if (vc->gfx.scanout_mode) { if (!vc->gfx.guest_fb.framebuffer) { -- 2.34.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ui: fix incorrect scaling on highdpi with gtk/opengl 2021-11-21 6:55 ` [PATCH 1/2] ui: fix incorrect scaling on highdpi with gtk/opengl Alexander Orzechowski @ 2021-11-22 12:16 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 5+ messages in thread From: Philippe Mathieu-Daudé @ 2021-11-22 12:16 UTC (permalink / raw) To: Alexander Orzechowski, qemu-devel On 11/21/21 07:55, Alexander Orzechowski wrote: > Signed-off-by: Alexander Orzechowski <orzechowski.alexander@gmail.com> > --- > ui/gtk-gl-area.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] ui: fix incorrect pointer position on highdpi with gtk 2021-11-21 6:55 [PATCH 0/2] Fix trivial errors with highdpi/wayland Alexander Orzechowski 2021-11-21 6:55 ` [PATCH 1/2] ui: fix incorrect scaling on highdpi with gtk/opengl Alexander Orzechowski @ 2021-11-21 6:55 ` Alexander Orzechowski 2021-11-22 12:15 ` Philippe Mathieu-Daudé 1 sibling, 1 reply; 5+ messages in thread From: Alexander Orzechowski @ 2021-11-21 6:55 UTC (permalink / raw) To: qemu-devel; +Cc: Alexander Orzechowski Signed-off-by: Alexander Orzechowski <orzechowski.alexander@gmail.com> --- ui/gtk.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index d2892ea6b4..b2670142b5 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -838,10 +838,11 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion, { VirtualConsole *vc = opaque; GtkDisplayState *s = vc->s; + GdkWindow *window; int x, y; int mx, my; int fbh, fbw; - int ww, wh; + int ww, wh, ws; if (!vc->gfx.ds) { return TRUE; @@ -850,8 +851,10 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion, fbw = surface_width(vc->gfx.ds) * vc->gfx.scale_x; fbh = surface_height(vc->gfx.ds) * vc->gfx.scale_y; - ww = gdk_window_get_width(gtk_widget_get_window(vc->gfx.drawing_area)); - wh = gdk_window_get_height(gtk_widget_get_window(vc->gfx.drawing_area)); + 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); mx = my = 0; if (ww > fbw) { @@ -861,8 +864,8 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion, my = (wh - fbh) / 2; } - x = (motion->x - mx) / vc->gfx.scale_x; - y = (motion->y - my) / vc->gfx.scale_y; + x = (motion->x - mx) / vc->gfx.scale_x * ws; + y = (motion->y - my) / vc->gfx.scale_y * ws; if (qemu_input_is_absolute()) { if (x < 0 || y < 0 || -- 2.34.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] ui: fix incorrect pointer position on highdpi with gtk 2021-11-21 6:55 ` [PATCH 2/2] ui: fix incorrect pointer position on highdpi with gtk Alexander Orzechowski @ 2021-11-22 12:15 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 5+ messages in thread From: Philippe Mathieu-Daudé @ 2021-11-22 12:15 UTC (permalink / raw) To: Alexander Orzechowski, qemu-devel On 11/21/21 07:55, Alexander Orzechowski wrote: > Signed-off-by: Alexander Orzechowski <orzechowski.alexander@gmail.com> > --- > ui/gtk.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/ui/gtk.c b/ui/gtk.c > index d2892ea6b4..b2670142b5 100644 > --- a/ui/gtk.c > +++ b/ui/gtk.c > @@ -838,10 +838,11 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion, > { > VirtualConsole *vc = opaque; > GtkDisplayState *s = vc->s; > + GdkWindow *window; > int x, y; > int mx, my; > int fbh, fbw; > - int ww, wh; > + int ww, wh, ws; > > if (!vc->gfx.ds) { > return TRUE; > @@ -850,8 +851,10 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion, > fbw = surface_width(vc->gfx.ds) * vc->gfx.scale_x; > fbh = surface_height(vc->gfx.ds) * vc->gfx.scale_y; > > - ww = gdk_window_get_width(gtk_widget_get_window(vc->gfx.drawing_area)); > - wh = gdk_window_get_height(gtk_widget_get_window(vc->gfx.drawing_area)); > + 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); Please follow the coding style and remove the extra space. Otherwise LGTM. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-11-22 12:18 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-11-21 6:55 [PATCH 0/2] Fix trivial errors with highdpi/wayland Alexander Orzechowski 2021-11-21 6:55 ` [PATCH 1/2] ui: fix incorrect scaling on highdpi with gtk/opengl Alexander Orzechowski 2021-11-22 12:16 ` Philippe Mathieu-Daudé 2021-11-21 6:55 ` [PATCH 2/2] ui: fix incorrect pointer position on highdpi with gtk Alexander Orzechowski 2021-11-22 12:15 ` Philippe Mathieu-Daudé
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).