aboutsummaryrefslogtreecommitdiff
path: root/ui
AgeCommit message (Collapse)AuthorFilesLines
2024-07-22ui/vdagent: send caps on fe_openMarc-André Lureau1-2/+4
The spice-vdagentd doesn't send capabilities again on host/client disconnect (but when the session agent connects and sends a GUEST_XORG_RESOLUTION message) When the dbus client disconnects, vdagent_disconnect() is called to reset the agent state. Capabilities must be negotiated again on reconnection. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20240717171541.201525-5-marcandre.lureau@redhat.com>
2024-07-22ui/vdagent: notify clipboard peers of serial resetMarc-André Lureau3-0/+5
Since we reset the serial counters, peers should also be reset to be sync. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20240717171541.201525-4-marcandre.lureau@redhat.com>
2024-07-22ui/vdagent: improve vdagent_fe_open() traceMarc-André Lureau2-2/+3
Place the trace when the function enters, with arg value. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20240717171541.201525-3-marcandre.lureau@redhat.com>
2024-07-22ui: add more tracing for dbusMarc-André Lureau2-0/+6
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20240717171541.201525-2-marcandre.lureau@redhat.com>
2024-07-22Cursor: 8 -> 1 bit alpha downsampling improvementPhil Dennis-Jordan1-1/+1
Mouse cursors with 8 bit alpha were downsampled to 1-bit opacity maps by turning alpha values of 255 into 1 and everything else into 0. This means that mostly-opaque pixels ended up completely invisible. This patch changes the behaviour so that only pixels with less than 50% alpha (0-127) are treated as transparent when converted to 1-bit alpha. This greatly improves the subjective appearance of anti-aliased mouse cursors, such as those used by macOS, when using a front-end UI without support for alpha-blended cursors, such as some VNC clients. Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20240624101040.82726-1-phil@philjordan.eu>
2024-07-22vnc: increase max display sizeGerd Hoffmann1-2/+2
It's 2024. 4k display resolutions are a thing these days. Raise width and height limits of the qemu vnc server. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1596 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240530111029.1726329-1-kraxel@redhat.com>
2024-07-16ui/console: Remove dpy_cursor_define_supported()Akihiko Odaki1-13/+0
Remove dpy_cursor_define_supported() as it brings no benefit today and it has a few inherent problems. All graphical displays except egl-headless support cursor composition without DMA-BUF, and egl-headless is meant to be used in conjunction with another graphical display, so dpy_cursor_define_supported() always returns true and meaningless. Even if we add a new display without cursor composition in the future, dpy_cursor_define_supported() will be problematic as a cursor display fix for it because some display devices like virtio-gpu cannot tell the lack of cursor composition capability to the guest and are unable to utilize the value the function returns. Therefore, all non-headless graphical displays must actually implement cursor composition for correct cursor display. Another problem with dpy_cursor_define_supported() is that it returns true even if only some of the display listeners support cursor composition, which is wrong unless all display listeners that lack cursor composition is headless. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-ID: <20240715-cursor-v3-4-afa5b9492dbf@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-07-16ui/cocoa: Add cursor compositionAkihiko Odaki1-0/+99
Add accelerated cursor composition to ui/cocoa. This does not only improve performance for display devices that exposes the capability to the guest according to dpy_cursor_define_supported(), but fixes the cursor display for devices that unconditionally expects the availability of the capability (e.g., virtio-gpu). The common pattern to implement accelerated cursor composition is to replace the cursor and warp it so that the replaced cursor is shown at the correct position on the guest display for relative pointer devices. Unfortunately, ui/cocoa cannot do the same because warping the cursor position interfers with the mouse input so it uses CALayer instead; although it is not specialized for cursor composition, it still can compose images with hardware acceleration. Co-authored-by: Phil Dennis-Jordan <phil@philjordan.eu> Tested-by: Phil Dennis-Jordan <phil@philjordan.eu> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-ID: <20240715-cursor-v3-3-afa5b9492dbf@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-07-16ui/console: Convert mouse visibility parameter into boolAkihiko Odaki6-12/+14
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Phil Dennis-Jordan <phil@philjordan.eu> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240715-cursor-v3-2-afa5b9492dbf@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-07-16ui/cocoa: Release CGColorSpaceAkihiko Odaki1-1/+4
CGImageCreate | Apple Developer Documentation https://developer.apple.com/documentation/coregraphics/1455149-cgimagecreate > The color space is retained; on return, you may safely release it. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Phil Dennis-Jordan <phil@philjordan.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240715-cursor-v3-1-afa5b9492dbf@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-07-03Revert "meson: Propagate gnutls dependency"Akihiko Odaki1-1/+1
This reverts commit 3eacf70bb5a83e4775ad8003cbca63a40f70c8c2. It was only needed because of duplicate objects caused by declare_dependency(link_whole: ...), and can be dropped now that meson.build specifies objects and dependencies separately for the internal dependencies. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-ID: <20240524-objects-v1-2-07cbbe96166b@daynix.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-06-19ui+display: rename is_buffer_shared() -> surface_is_allocated()Gerd Hoffmann1-1/+2
Boolean return value is reversed, to align with QEMU_ALLOCATED_FLAG, so all callers must be adapted. Also rename share_surface variable in vga_draw_graphic() to reduce confusion. No functional change. Suggested-by: Marc-André Lureau <marcandre.lureau@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Paul Durrant <paul@xen.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20240605131444.797896-4-kraxel@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-06-19ui+display: rename is_placeholder() -> surface_is_placeholder()Gerd Hoffmann3-3/+3
No functional change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240605131444.797896-3-kraxel@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-06-19ui/cocoa: Use qemu_add_mouse_change_notifierAkihiko Odaki1-24/+38
This eliminates the polling in cocoa_refresh and implements the propagation of the mouse mode change from absolute to relative. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu> Tested-by: Phil Dennis-Jordan <phil@philjordan.eu> Message-ID: <20240322-mouse-v1-1-0b7d4d9bdfbf@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-05-25meson: remove unnecessary dependencyPaolo Bonzini1-3/+2
The dbus_display1_dep is not really used since all occurrences also request gio independently. Just list the generated sources and drop dbus_display1_dep. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-05-17ui/console: Only declare variable fence_fd when CONFIG_GBM is definedCédric Le Goater1-1/+1
This to avoid a build breakage : ../ui/gtk-egl.c: In function ‘gd_egl_draw’: ../ui/gtk-egl.c:73:9: error: unused variable ‘fence_fd’ [-Werror=unused-variable] 73 | int fence_fd; | ^~~~~~~~ Fixes: fa6426805b12 ("ui/console: Use qemu_dmabuf_set_..() helpers instead") Cc: Dongwon Kim <dongwon.kim@intel.com> Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240515100520.574383-1-clg@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-05-14ui/sdl2: Allow host to power down screenBernhard Beschow1-0/+1
By default, SDL disables the screen saver which prevents the host from powering down the screen even if the screen is locked. This results in draining the battery needlessly when the host isn't connected to a wall charger. Fix that by enabling the screen saver. Signed-off-by: Bernhard Beschow <shentey@gmail.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20240512095945.1879-1-shentey@gmail.com>
2024-05-14ui/gtk: Fix mouse/motion event scaling issue with GTK display backendhikalium1-5/+13
Remove gtk_widget_get_scale_factor() usage from the calculation of the motion events in the GTK backend to make it work correctly on environments that have `gtk_widget_get_scale_factor() != 1`. This scale factor usage had been introduced in the commit f14aab420c and at that time the window size was used for calculating the things and it was working correctly. However, in the commit 2f31663ed4 the logic switched to use the widget size instead of window size and because of the change the usage of scale factor becomes invalid (since widgets use `vc->gfx.scale_{x, y}` for scaling). Tested on Crostini on ChromeOS (15823.51.0) with an external display. Fixes: 2f31663ed4 ("ui/gtk: use widget size for cursor motion event") Fixes: f14aab420c ("ui: fix incorrect pointer position on highdpi with gtk") Signed-off-by: hikalium <hikalium@hikalium.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20240512111435.30121-3-hikalium@hikalium.com>
2024-05-14ui/gtk: Add gd_motion_event trace eventhikalium2-0/+3
Add gd_motion_event trace event for making it easy to debug gd_motion_event related issues. Signed-off-by: hikalium <hikalium@hikalium.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20240512111435.30121-2-hikalium@hikalium.com>
2024-05-14ui/console: move QemuDmaBuf struct def to dmabuf.cDongwon Kim1-0/+19
To complete privatizing process of QemuDmaBuf, QemuDmaBuf struct def is moved to dmabuf.c Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20240508175403.3399895-7-dongwon.kim@intel.com>
2024-05-14ui/console: Use qemu_dmabuf_new() and free() helpers insteadDongwon Kim1-16/+12
This commit introduces utility functions for the creation and deallocation of QemuDmaBuf instances. Additionally, it updates all relevant sections of the codebase to utilize these new utility functions. v7: remove prefix, "dpy_gl_" from all helpers qemu_dmabuf_free() returns without doing anything if input is null (Daniel P. Berrangé <berrange@redhat.com>) call G_DEFINE_AUTOPTR_CLEANUP_FUNC for qemu_dmabuf_free() (Daniel P. Berrangé <berrange@redhat.com>) v8: Introduction of helpers was removed as those were already added by the previous commit v9: set dmabuf->allow_fences to 'true' when dmabuf is created in virtio_gpu_create_dmabuf()/virtio-gpu-udmabuf.c removed unnecessary spaces were accidently added in the patch, 'ui/console: Use qemu_dmabuf_new() a...' v11: Calling qemu_dmabuf_close was removed as closing dmabuf->fd will be done in qemu_dmabuf_free anyway. (Daniel P. Berrangé <berrange@redhat.com>) v12: --- Calling qemu_dmabuf_close separately as qemu_dmabuf_free doesn't do it. --- 'dmabuf' is now allocated space so it should be freed at the end of dbus_scanout_texture v13: --- Immediately free dmabuf after it is released to prevent possible leaking of the ptr (Marc-André Lureau <marcandre.lureau@redhat.com>) --- Use g_autoptr macro to define *dmabuf for auto clean up instead of calling qemu_dmabuf_free (Marc-André Lureau <marcandre.lureau@redhat.com>) v14: --- (vhost-user-gpu) Change qemu_dmabuf_free back to g_clear_pointer as it was done because of some misunderstanding (v13). --- (vhost-user-gpu) g->dmabuf[m->scanout_id] needs to be set to NULL to prevent freed dmabuf to be accessed again in case if(fd==-1)break; happens (before new dmabuf is allocated). Otherwise, it would cause invalid memory access when the same function is executed. Also NULL check should be done before qemu_dmabuf_close (it asserts dmabuf!=NULL.). (Marc-André Lureau <marcandre.lureau@redhat.com>) Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20240508175403.3399895-6-dongwon.kim@intel.com>
2024-05-14ui/console: Use qemu_dmabuf_set_..() helpers insteadDongwon Kim4-14/+16
This commit updates all occurrences where these fields were set directly have been updated to utilize helper functions. v7: removed prefix, "dpy_gl_" from all helpers v8: Introduction of helpers was removed as those were already added by the previous commit Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20240508175403.3399895-5-dongwon.kim@intel.com>
2024-05-14ui/console: Use qemu_dmabuf_get_..() helpers insteadDongwon Kim9-99/+168
This commit updates all instances where fields within the QemuDmaBuf struct are directly accessed, replacing them with calls to these new helper functions. v6: fix typos in helper names in ui/spice-display.c v7: removed prefix, "dpy_gl_" from all helpers v8: Introduction of helpers was removed as those were already added by the previous commit v11: -- Use new qemu_dmabuf_close() instead of close(qemu_dmabuf_get_fd()). (Daniel P. Berrangé <berrange@redhat.com>) -- Use new qemu_dmabuf_dup_fd() instead of dup(qemu_dmabuf_get_fd()). (Daniel P. Berrangé <berrange@redhat.com>) Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20240508175403.3399895-4-dongwon.kim@intel.com>
2024-05-14ui/console: new dmabuf.h and dmabuf.c for QemuDmaBuf struct and helpersDongwon Kim2-0/+211
New header and source files are added for containing QemuDmaBuf struct definition and newly introduced helpers for creating/freeing the struct and accessing its data. v10: Change the license type for both dmabuf.h and dmabuf.c from MIT to GPL to be in line with QEMU's default license v11: -- Added new helpers, qemu_dmabuf_close for closing dmabuf->fd, qemu_dmabuf_dup_fd for duplicating dmabuf->fd (Daniel P. Berrangé <berrange@redhat.com>) -- Let qemu_dmabuf_fee to call qemu_dmabuf_close before freeing the struct to make sure fd is closed. (Daniel P. Berrangé <berrange@redhat.com>) v12: Not closing fd in qemu_dmabuf_free because there are cases fd should still be available even after the struct is destroyed (e.g. virtio-gpu: res->dmabuf_fd). Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20240508175403.3399895-3-dongwon.kim@intel.com>
2024-05-14ui/gtk: Check if fence_fd is equal to or greater than 0Dongwon Kim3-6/+8
'fence_fd' needs to be validated always before being referenced And the passing condition should include '== 0' as 0 is a valid value for the file descriptor. Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Cc: Daniel P. Berrangé <berrange@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Message-Id: <20240508175403.3399895-2-dongwon.kim@intel.com>
2024-05-14ui/gtk: Draw guest frame at refresh cycleDongwon Kim2-0/+2
Draw routine needs to be manually invoked in the next refresh if there is a scanout blob from the guest. This is to prevent a situation where there is a scheduled draw event but it won't happen bacause the window is currently in inactive state (minimized or tabified). If draw is not done for a long time, gl_block timeout and/or fence timeout (on the guest) will happen eventually. v2: Use gd_gl_area_draw(vc) in gtk-gl-area.c Suggested-by: Vivek Kasireddy <vivek.kasireddy@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20240426225059.3871283-1-dongwon.kim@intel.com>
2024-05-14Allow UNIX socket option for VNC websocketSergii Zasenko1-5/+0
- Remove unix socket option limitation for VNC websocket - Reflect websocket option changes in documentation Signed-off-by: Sergii Zasenko <sergii@zasenko.name> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230724100353.16628-1-sergii@zasenko.name>
2024-05-03ui/cocoa.m: Drop old macOS-10.12-and-earlier compat ifdefsPeter Maydell1-13/+0
We only support the most recent two versions of macOS (currently macOS 13 Ventura and macOS 14 Sonoma), and our ui/cocoa.m code already assumes at least macOS 12 Monterey or better, because it uses NSScreen safeAreaInsets, which is 12.0-or-newer. Remove the ifdefs that were providing backwards compatibility for building on 10.12 and earlier versions. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20240502142904.62644-1-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-26ui/cocoa: Use NSTrackingInVisibleRectAkihiko Odaki1-34/+14
I observed [NSTrackingArea rect] becomes de-synchronized with the view frame with some unknown condition, and fails to track mouse movement on some area of the view. Specify NSTrackingInVisibleRect option to let Cocoa automatically update NSTrackingArea, which also saves code for synchronization. Fixes: 91aa508d0274 ("ui/cocoa: Let the platform toggle fullscreen") Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240323-fixes-v2-3-18651a2b0394@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-26ui/cocoa: Resize window after toggling zoom-to-fitAkihiko Odaki1-0/+1
Resize the window so that the content will fit without zooming. Fixes: 91aa508d0274 ("ui/cocoa: Let the platform toggle fullscreen") Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240323-fixes-v2-2-18651a2b0394@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-26ui/cocoa: Fix aspect ratioAkihiko Odaki1-1/+40
[NSWindow setContentAspectRatio:] does not trigger window resize itself, so the wrong aspect ratio will persist if nothing resizes the window. Call [NSWindow setContentSize:] in such a case. Fixes: 91aa508d0274 ("ui/cocoa: Let the platform toggle fullscreen") Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240323-fixes-v2-1-18651a2b0394@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-20ui: compile dbus-display1.c with -fPIC as necessaryMarc-André Lureau1-2/+1
Building dbus-display1.c explicitly as a static library drops -fPIC by default, which may not be correct if it ends up linked to a shared library. Let the target decide how to build the unit, with or without -fPIC. This makes commit 186acfbaf7 ("tests/qtest: Depend on dbus_display1_dep") no longer relevant, as dbus-display1.c will be recompiled. Fixes: c172136ea33 ("meson: ensure dbus-display generated code is built before other units") Reported-by: Olaf Hering <olaf@aepfle.de> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-03-20ui/curses: Do not use console_select()Akihiko Odaki5-125/+51
ui/curses is the only user of console_select(). Move the implementation to ui/curses. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20240319-console-v2-4-3fd6feef321a@daynix.com>
2024-03-20ui/cocoa: Do not use console_select()Akihiko Odaki1-11/+26
ui/cocoa needs to update the UI info and reset the keyboard state tracker when switching the console, or the new console will see the stale UI info or keyboard state. Previously, updating the UI info was done with cocoa_switch(), but it is meant to be called when the surface is being replaced, and may be called even when not switching the console. ui/cocoa never reset the keyboard state, which resulted in stuck keys. Add ui/cocoa's own implementation of console_select(), which updates the UI info and resets the keyboard state tracker. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20240319-console-v2-3-3fd6feef321a@daynix.com>
2024-03-20ui/vnc: Do not use console_select()Akihiko Odaki3-5/+27
console_select() is shared by other displays and a console_select() call from one of them triggers console switching also in ui/curses, circumventing key state reinitialization that needs to be performed in preparation and resulting in stuck keys. Use its internal state to track the current active console to prevent such a surprise console switch. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20240319-console-v2-2-3fd6feef321a@daynix.com>
2024-03-20ui/vc: Do not inherit the size of active consoleAkihiko Odaki1-2/+2
A chardev-vc used to inherit the size of a graphic console when its size not explicitly specified, but it often did not make sense. If a chardev-vc is instantiated during the startup, the active graphic console has no content at the time, so it will have the size of graphic console placeholder, which contains no useful information. It's better to have the standard size of text console instead. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20240319-console-v2-1-3fd6feef321a@daynix.com>
2024-03-12ui/dbus: filter out pending messages when scanoutMarc-André Lureau2-0/+41
The "Listener" connection, being private and under the control of the qemu display, allows for the optimization of discarding pending intermediary messages when queuing a new scanout. This ensures that the client receives only the latest scanout update, improving communication efficiency. While the current implementation does not provide a mechanism for clients who may wish to receive all updates, making this behavior optional could be considered in the future. For now, adopting this new default behavior accelerates the communication process without a guarantee of delivering all updates. The filter is removed when the connection is dropped. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-03-12ui/dbus: factor out sending a scanoutMarc-André Lureau1-18/+17
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2024-03-12ui/vnc: Respect bound consoleAkihiko Odaki1-29/+30
ui/vnc may have a bound console so pass it to qemu_console_is_graphic() and qemu_text_console_put_keysym(). Fixes: 1d0d59fe2919 ("vnc: allow binding servers to qemu consoles") Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20231211-vnc-v1-1-a3551d284809@daynix.com>
2024-03-05ui/cocoa: Remove stretch_video flagAkihiko Odaki1-13/+6
Evaluate [normalWindow styleMask] & NSWindowStyleMaskResizable instead. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Rene Engel <ReneEngel80@emailn.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240224-cocoa-v12-10-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-05ui/cocoa: Call console_select() with the BQLAkihiko Odaki1-1/+3
[-QemuCocoaView displayConsole:] can be called anytime so explicitly take the BQL before it calls console_select(). Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Rene Engel <ReneEngel80@emailn.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240224-cocoa-v12-9-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-05ui/cocoa: Make window resizableAkihiko Odaki1-0/+3
The window will be resizable when zoom-to-fit is on. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Rene Engel <ReneEngel80@emailn.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240224-cocoa-v12-8-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-05ui/cocoa: Remove normalWindowAkihiko Odaki1-16/+17
QemuCocoaView used to have fullScreenWindow but now it's gone, so we do no longer have to call the window specifically "normalWindow". Instead, refer to it with [-QemuCocoaView window]. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Rene Engel <ReneEngel80@emailn.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240224-cocoa-v12-7-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-05ui/cocoa: Let the platform toggle fullscreenAkihiko Odaki1-227/+181
It allows making the window full screen by clicking full screen button provided by the platform (the left-top green button) and save some code. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Rene Engel <ReneEngel80@emailn.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240224-cocoa-v12-6-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-05ui/cocoa: Fix pause label coordinatesAkihiko Odaki1-2/+2
A subview is positioned in the superview so the superview's frame should be used instead of one of the window to determine the coordinates. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Rene Engel <ReneEngel80@emailn.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240224-cocoa-v12-5-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-05ui/cocoa: Scale with NSView instead of Core GraphicsAkihiko Odaki1-14/+10
Core Graphics is not accelerated and slow. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Rene Engel <ReneEngel80@emailn.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240224-cocoa-v12-4-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-05ui/cocoa: Release specific mouse buttonsAkihiko Odaki1-21/+15
ui/cocoa used to release all mouse buttons when it sees NSEventTypeLeftMouseUp, NSEventTypeRightMouseUp, or NSEventTypeOtherMouseUp, but it can instead release specific one according to the delivered event. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Rene Engel <ReneEngel80@emailn.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240224-cocoa-v12-3-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-05ui/cocoa: Immediately call [-QemuCocoaView handleMouseEvent:buttons:]Akihiko Odaki1-57/+30
Instead of using mouse_event variable to tell to handle a mouse event later, immediately call [-QemuCocoaView handleMouseEvent:buttons:]. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Rene Engel <ReneEngel80@emailn.de> Message-ID: <20240224-cocoa-v12-2-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-05ui/cocoa: Split [-QemuCocoaView handleEventLocked:]Akihiko Odaki1-33/+49
Currently [-QemuCocoaView handleEventLocked:] parses the passed event, stores operations to be done to variables, and perform them according to the variables. This construct will be cluttered with variables and hard to read when we need more different operations for different events. Split the methods so that we can call appropriate methods depending on events instead of relying on variables. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Tested-by: Rene Engel <ReneEngel80@emailn.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20240224-cocoa-v12-1-e89f70bdda71@daynix.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-05ui/cocoa: Fix window clipping on macOS 14David Parsons1-0/+7
macOS Sonoma changes the NSView.clipsToBounds to false by default where it was true in earlier version of macOS. This causes the window contents to be occluded by the frame at the top of the window. This fixes the issue by conditionally compiling the clipping on Sonoma to true. NSView only exposes the clipToBounds in macOS 14 and so has to be fixed via conditional compilation. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1994 Signed-off-by: David Parsons <dave@daveparsons.net> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-ID: <20240224140620.39200-1-dave@daveparsons.net> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>