From: Alexander Orzechowski <orzechowski.alexander@gmail.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: qemu trivial <qemu-trivial@nongnu.org>, QEMU <qemu-devel@nongnu.org>
Subject: Re: [PATCH 2/4] ui: Remove unnecessary checks
Date: Tue, 21 Dec 2021 03:26:52 -0500 [thread overview]
Message-ID: <b8300a7d-dffe-c600-1b36-62d7ae2b2699@gmail.com> (raw)
In-Reply-To: <CAJ+F1CL4LxdbCOzt+uFTw_ggxQ+forzd7chDQRw8DMsc9EMamA@mail.gmail.com>
On 12/21/21 02:40, Marc-André Lureau wrote:
> Hi
>
> On Sun, Dec 19, 2021 at 6:32 AM Alexander Orzechowski
> <orzechowski.alexander@gmail.com> wrote:
>
> These conditionals should never be false as scale_x and scale_y should
> scale the fbw and fbh variables such that the ww and wh variables
> always
> have a greater magnitude.
>
> Signed-off-by: Alexander Orzechowski <orzechowski.alexander@gmail.com>
>
>
> I don't understand how you reached that conclusion.
>
> scale_x/scale_y can have various values, from 0.25 manually, or pretty
> much anything in freescale.
>
> Just adding a breakpoint/debug there and you can see they can be false.
>
> ---
> ui/gtk.c | 27 ++++++---------------------
> 1 file changed, 6 insertions(+), 21 deletions(-)
>
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 824334ff3d..f2d74b253d 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -416,13 +416,8 @@ static void gd_update(DisplayChangeListener *dcl,
> ww = gtk_widget_get_allocated_width(vc->gfx.drawing_area);
> wh = gtk_widget_get_allocated_height(vc->gfx.drawing_area);
>
> - mx = my = 0;
> - if (ww > fbw) {
> - mx = (ww - fbw) / 2;
> - }
> - if (wh > fbh) {
> - my = (wh - fbh) / 2;
> - }
> + mx = (ww - fbw) / 2;
> + my = (wh - fbh) / 2;
>
> gtk_widget_queue_draw_area(vc->gfx.drawing_area,
> mx + x1, my + y1, (x2 - x1), (y2 -
> y1));
> @@ -801,13 +796,8 @@ static gboolean gd_draw_event(GtkWidget
> *widget, cairo_t *cr, void *opaque)
> fbw *= vc->gfx.scale_x;
> fbh *= vc->gfx.scale_y;
>
> - mx = my = 0;
> - if (ww > fbw) {
> - mx = (ww - fbw) / 2;
> - }
> - if (wh > fbh) {
> - my = (wh - fbh) / 2;
> - }
> + mx = (ww - fbw) / 2;
> + my = (wh - fbh) / 2;
>
> cairo_rectangle(cr, 0, 0, ww, wh);
>
> @@ -850,13 +840,8 @@ static gboolean gd_motion_event(GtkWidget
> *widget, GdkEventMotion *motion,
> ws = gdk_window_get_scale_factor(
> gtk_widget_get_window(vc->gfx.drawing_area));
>
> - mx = my = 0;
> - if (ww > fbw) {
> - mx = (ww - fbw) / 2;
> - }
> - if (wh > fbh) {
> - my = (wh - fbh) / 2;
> - }
> + mx = (ww - fbw) / 2;
> + my = (wh - fbh) / 2;
>
> x = (motion->x - mx) / vc->gfx.scale_x * ws;
> y = (motion->y - my) / vc->gfx.scale_y * ws;
> --
> 2.34.1
>
>
>
>
> --
> Marc-André Lureau
Thanks for the thorough review. I didn't realize you could set the scale
manually, but
it was under my impression that qemu would set the GDK_HINT_MIN_SIZE
property[1]
to try to disallow the user from resizing the window any smaller than
the size of the
virtual console. Qemu provides no mechanism to change the translation of
the virtual
console within the window in this case where the window is smaller than
the virtual
console would normally allow, I consider this invalid state. The mx and
my variables
are only used to translate the virtual console within its render
surface. Thus, if qemu
were to enter this "invalid" state as I've called it, the view would
show the middle of
the virtual console and obscure the edges. Without this patch it would
show the top
left, obscuring the bottom right. I am happy to drop this patch for v2.
Please let me
know your thoughts.
[1]: See ui/gtk.c line 279 with the patches applied.
--
Alexander Orzechowski
next prev parent reply other threads:[~2021-12-21 8:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-19 2:30 [PATCH 0/4] UI fixups Alexander Orzechowski
2021-12-19 2:30 ` [PATCH 1/4] ui: Use allocated size instead of window size Alexander Orzechowski
2021-12-21 7:27 ` Marc-André Lureau
2021-12-19 2:30 ` [PATCH 2/4] ui: Remove unnecessary checks Alexander Orzechowski
2021-12-21 7:40 ` Marc-André Lureau
2021-12-21 8:26 ` Alexander Orzechowski [this message]
2021-12-19 2:30 ` [PATCH 3/4] ui: Revert: "fix incorrect pointer position on highdpi with gtk" Alexander Orzechowski
2021-12-19 2:30 ` [PATCH 4/4] ui: Fix gtk/gl when the scaled virtual console does not fit the window Alexander Orzechowski
2021-12-21 7:48 ` Marc-André Lureau
2021-12-21 8:07 ` Alexander Orzechowski
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=b8300a7d-dffe-c600-1b36-62d7ae2b2699@gmail.com \
--to=orzechowski.alexander@gmail.com \
--cc=marcandre.lureau@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).