qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: qemu-devel@nongnu.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: Re: [PATCH v3] input: Allow to choose console with qemu_input_is_absolute
Date: Thu, 21 Sep 2023 11:46:36 +0200	[thread overview]
Message-ID: <f1077e85-964a-14c5-eead-c6d3ef2c15ad@linaro.org> (raw)
In-Reply-To: <20230921082936.28100-1-akihiko.odaki@daynix.com>

On 21/9/23 10:29, Akihiko Odaki wrote:
> Although an input is routed depending on the console,
> qemu_input_is_absolute() had no mechanism to specify the console.
> 
> Accept QemuConsole as an argument for qemu_input_is_absolute, and let
> the display know the absolute/relative state for a particular console.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> V2 -> V3: Rebased to commit 55394dcbec8f0c29c30e792c102a0edd50a52bf4
> V1 -> V2: Rebased to commit 79b677d658d3d35e1e776826ac4abb28cdce69b8
> 
>   include/ui/input.h |  2 +-
>   ui/dbus-console.c  |  6 +++---
>   ui/gtk.c           | 12 ++++++------
>   ui/input.c         | 29 +++++++----------------------
>   ui/sdl2.c          | 26 +++++++++++++-------------
>   ui/spice-input.c   |  2 +-
>   ui/vnc.c           |  2 +-
>   ui/cocoa.m         |  2 +-
>   ui/trace-events    |  1 -
>   9 files changed, 33 insertions(+), 49 deletions(-)


> diff --git a/ui/gtk.c b/ui/gtk.c
> index e09f97a86b..40b8d27da5 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -204,7 +204,7 @@ static void gd_update_cursor(VirtualConsole *vc)
>       }
>   
>       window = gtk_widget_get_window(GTK_WIDGET(vc->gfx.drawing_area));
> -    if (s->full_screen || qemu_input_is_absolute() || s->ptr_owner == vc) {
> +    if (s->full_screen || qemu_input_is_absolute(vc->gfx.dcl.con) || s->ptr_owner == vc) {
>           gdk_window_set_cursor(window, s->null_cursor);
>       } else {
>           gdk_window_set_cursor(window, NULL);
> @@ -453,7 +453,7 @@ static void gd_mouse_set(DisplayChangeListener *dcl,
>       gint x_root, y_root;
>   
>       if (!gtk_widget_get_realized(vc->gfx.drawing_area) ||
> -        qemu_input_is_absolute()) {
> +        qemu_input_is_absolute(dcl->con)) {

Maybe vc->gfx.dcl.con instead to match with the other uses in this
file? Anyhow,

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

>           return;
>       }
>   
> @@ -689,7 +689,7 @@ static void gd_mouse_mode_change(Notifier *notify, void *data)
>   
>       s = container_of(notify, GtkDisplayState, mouse_mode_notifier);
>       /* release the grab at switching to absolute mode */
> -    if (qemu_input_is_absolute() && s->ptr_owner) {
> +    if (s->ptr_owner && qemu_input_is_absolute(s->ptr_owner->gfx.dcl.con)) {
>           if (!s->ptr_owner->window) {
>               gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item),
>                                              FALSE);
> @@ -903,7 +903,7 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
>       x = (motion->x - mx) / vc->gfx.scale_x * ws;
>       y = (motion->y - my) / vc->gfx.scale_y * ws;
>   
> -    if (qemu_input_is_absolute()) {
> +    if (qemu_input_is_absolute(vc->gfx.dcl.con)) {
>           if (x < 0 || y < 0 ||
>               x >= surface_width(vc->gfx.ds) ||
>               y >= surface_height(vc->gfx.ds)) {
> @@ -923,7 +923,7 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,
>       s->last_y = y;
>       s->last_set = TRUE;
>   
> -    if (!qemu_input_is_absolute() && s->ptr_owner == vc) {
> +    if (!qemu_input_is_absolute(vc->gfx.dcl.con) && s->ptr_owner == vc) {
>           GdkScreen *screen = gtk_widget_get_screen(vc->gfx.drawing_area);
>           GdkDisplay *dpy = gtk_widget_get_display(widget);
>           GdkWindow *win = gtk_widget_get_window(widget);
> @@ -965,7 +965,7 @@ static gboolean gd_button_event(GtkWidget *widget, GdkEventButton *button,
>   
>       /* implicitly grab the input at the first click in the relative mode */
>       if (button->button == 1 && button->type == GDK_BUTTON_PRESS &&
> -        !qemu_input_is_absolute() && s->ptr_owner != vc) {
> +        !qemu_input_is_absolute(vc->gfx.dcl.con) && s->ptr_owner != vc) {
>           if (!vc->window) {
>               gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item),
>                                              TRUE);



  reply	other threads:[~2023-09-21  9:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21  8:29 [PATCH v3] input: Allow to choose console with qemu_input_is_absolute Akihiko Odaki
2023-09-21  9:46 ` Philippe Mathieu-Daudé [this message]
2023-09-23 11:59 ` 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=f1077e85-964a-14c5-eead-c6d3ef2c15ad@linaro.org \
    --to=philmd@linaro.org \
    --cc=akihiko.odaki@daynix.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).