summaryrefslogtreecommitdiffstats
path: root/ui/sdl2.c
Commit message (Collapse)AuthorAgeFilesLines
* kbd-state: use state tracker for sdl2Gerd Hoffmann2019-02-051-9/+3Star
| | | | | | | | | | Use the new keyboard state tracked for sdl2. We can drop the modifier state tracking from sdl2. Also keyup code is simpler, the state tracker will take care to not send suspious keyup events to the guest. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20190122092814.14919-4-kraxel@redhat.com
* sdl: add support for high resolution window iconDaniel P. Berrangé2019-01-211-6/+12
| | | | | | | | | | | | | | | | | | | Modern desktop environments can render icons at very large sizes, especially with high DPI screens. Providing a 32x32 pixel bitmap is nowhere near sufficient anymore. When displayed in GNOME shell the QEMU icon looks awful, having been scaled up to at least x4 its base size. This is compounded by the fact that the BMP file doesn't do transparency, so while we've removed white pixels, we still have anti-aliased nearly-white pixels which make the logo look appalling on black backgrounds. Loading a high resolution PNG icon addresses both problems, but requires use of the extra SDL2_image library. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20190110120047.25369-4-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ui: install logo icons to $prefix/share/iconsDaniel P. Berrangé2019-01-211-10/+6Star
| | | | | | | | | | | | | | | | | | | | QEMU currently installs logos to $prefix/share/qemu/ which means no GUI toolkit or applications can find them by default. The accepted standards for desktop applications declare that application logos / icons should be installed under $prefix/share/icons, so use this directory location. Pre-rendered icons are provided at the standard sizes expected for GUI applications, along with the scalable SVG, to ensure maximum portability. The PNGs are rendered from the SVG using inkscape, however, this is not wired up into the default make rules to avoid requiring inkscape as a mandatory tool in build systems / developer workstations. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20190110120047.25369-2-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* SDL: set a hint to not bypass the window compositorSebastian Krzyszkowiak2018-10-291-0/+3
| | | | | | | | | | Without that, window effects in KWin get suspended as soon as any qemu-sdl window becomes visible. While the SDL default makes sense for games, it's not really suitable for QEMU. Signed-off-by: Sebastian Krzyszkowiak <dos@dosowisko.net> Message-id: 20181024143748.4425-1-dos@dosowisko.net Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: show console #0 unconditionallyGerd Hoffmann2018-10-011-1/+2
| | | | | | | | | | Otherwise sdl2 will show no window in case no graphical display device is present. Reproducer: qemu -nodefaults -display sdl -serial vc Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20180912114300.6976-1-kraxel@redhat.com
* ui/sdl2: Fix broken -full-screen CLI optionThomas Huth2018-08-241-5/+4Star
| | | | | | | | | | | We've got to set the gui_fullscreen variable before creating the SDL2 window, otherwise the initial window will not be created in fullscreen mode. Buglink: https://bugs.launchpad.net/bugs/1780812 Signed-off-by: Thomas Huth <thuth@redhat.com> Message-id: 1531161850-6860-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ui/sdl2: Remove the obsolete SDL_INIT_NOPARACHUTE flagThomas Huth2018-08-241-3/+1Star
| | | | | | | | | | | SDL_INIT_NOPARACHUTE is not used in SDL2 anymore, and the define is just a dummy (see https://wiki.libsdl.org/MigrationGuide#Some_general_truths for example). So we can remove it and get rid of the "flags" variable nowadays. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-id: 1533721602-15763-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: add checking for NULLPavel Dovgalyuk2018-06-261-3/+3
| | | | | | | | | | | Sometimes SDL2 console can't be retrieved on events and scon variable becomes NULL. This patch prevents processing of the events when the console is not available. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> Signed-off-by: Maria Klimushenkova <maria.klimushenkova@ispras.ru> Message-id: 20180626064729.18070.47600.stgit@pasha-VirtualBox Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: fix copypaste issuesPavel Dovgalyuk2018-06-261-4/+4
| | | | | | | | | | | This patch fixes text and mouse event processing. These functions used 'key' field of the event instead of appropriate 'text', 'motion', 'button', or 'wheel'. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> Signed-off-by: Maria Klimushenkova <maria.klimushenkova@ispras.ru> Message-id: 20180626064017.17031.47954.stgit@pasha-VirtualBox Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: restore window dimensions by resizeAmadeusz Sławiński2018-06-141-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | instead of destroying and recreating window, fixes segfault caused by handle_keyup trying to access no more existing window when using Ctrl-Alt-U to restore window "un-scaled" dimensions Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff7f92b80 (LWP 3711)] handle_keyup (ev=0x7fffffffd010) at ui/sdl2.c:416 416 scon->ignore_hotkeys = false; (gdb) bt #0 handle_keyup (ev=0x7fffffffd010) at ui/sdl2.c:416 #1 sdl2_poll_events (scon=0x100fee5a8) at ui/sdl2.c:608 #2 0x0000000100585bf2 in dpy_refresh (s=0x101ad3e00) at ui/console.c:1658 #3 gui_update (opaque=0x101ad3e00) at ui/console.c:205 #4 0x0000000100690f2c in timerlist_run_timers (timer_list=0x100ede130) at util/qemu-timer.c:536 #5 0x0000000100691177 in qemu_clock_run_timers (type=QEMU_CLOCK_REALTIME) at util/qemu-timer.c:547 #6 qemu_clock_run_all_timers () at util/qemu-timer.c:674 #7 0x0000000100691651 in main_loop_wait (nonblocking=<optimized out>) at util/main-loop.c:503 #8 0x00000001003d650f in main_loop () at vl.c:1848 #9 0x0000000100289681 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4605 Signed-off-by: Amadeusz Sławiński <amade@asmblr.net> Message-id: 20180613172707.31530-1-amade@asmblr.net Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: move opts assignment into loopGerd Hoffmann2018-05-151-1/+1
| | | | | | | So the opts pointer is set for all sdl2_consoles. Fixes: 844fd50dbbcfc9e401895274bf4fb8da8e8d3f64 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl: Move DisplayOptions global to sdl2_consoleElie Tournier2018-04-271-5/+5
| | | | | | | Suggested-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Elie Tournier <elie.tournier@collabora.com> Message-id: 20180413135842.21325-3-tournier.elie@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl: switch over to new display registryGerd Hoffmann2018-03-051-2/+15
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20180301100547.18962-3-kraxel@redhat.com
* sdl2: fix hotkey keyupGerd Hoffmann2018-02-221-11/+3Star
| | | | | | | | | | | | | | After some hotkey was pressed sdl2 doesn't forward the first modifier keyup event to the guest, resulting in stuck modifier keys. Fix the logic in handle_keyup(). Also gui_key_modifier_pressed doesn't need to be a global variable. Reported-by: Howard Spoelstra <hsp.cat7@gmail.com> Tested-by: Howard Spoelstra <hsp.cat7@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20180220150444.784-1-kraxel@redhat.com
* sdl: use DisplayOptionsGerd Hoffmann2018-02-201-14/+19
| | | | | | | | | Switch sdl ui to use qapi DisplayOptions for configuration. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20180202111022.19269-6-kraxel@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: fix mouse grabGerd Hoffmann2018-02-161-0/+1
| | | | | | | | | When qemu mouse mode changes from relative to absolute we must turn off sdl relative mouse mode too. Fixes: https://bugs.launchpad.net/qemu/+bug/1703795 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20180202120803.11501-1-kraxel@redhat.com>
* sdl: reorganize -no-frame supportGerd Hoffmann2018-01-251-6/+1Star
| | | | | | | | | | | | Drop no_frame flag from sdl_display_init argument list, use a global variable instead. This is temporary until -no-frame support is dropped altogether when we remove sdl1 support. Remove any traces of noframe from sdl2 code. It is just dead code as sdl2 doesn't support the SDL_NOFRAME window flag any more. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20180115154855.30850-3-kraxel@redhat.com
* sdl: use ctrl-alt-g as grab hotkeyGerd Hoffmann2018-01-251-16/+11Star
| | | | | | | Be consistent with gtk and cocoa. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20180115154855.30850-2-kraxel@redhat.com
* sdl2: Ignore UI hotkeys after a focus change when GUI modifier is heldJindrich Makovicka2018-01-121-8/+24
| | | | | | | | | | | | | | | | | | When SDL2 windows change focus while a key is held, the window that receives the focus also receives a new KeyDown event, without an autorepeat flag. This means that if a WM places the qemu console over the main window after Ctrl-Alt-2, the console closes immediately after opening. Then, the main window receives the KeyDown event again and the whole process repeats. This patch makes the SDL2 UI ignore the KeyDown events on a window that just received the focus, if the GUI modifier was held. The ignore flag is reset on a first KeyUp event. This effectively works around the issue above. Signed-off-by: Jindrich Makovicka <makovick@gmail.com> Message-Id: <20171117112258.5888-4-makovick@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2 uses surface relative coordinatesJindrich Makovicka2018-01-121-26/+4Star
| | | | | | | | | | This patch fixes mouse positioning with -device usb-tablet and fullscreen or resized window. Fixes: 46522a82236ea0cf9011b89896d2d8f8ddaf2443 Signed-off-by: Jindrich Makovicka <makovick@gmail.com> Message-Id: <20171117112258.5888-3-makovick@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: Do not hide the cursor on auxilliary windowsJindrich Makovicka2018-01-121-0/+17
| | | | | | Signed-off-by: Jindrich Makovicka <makovick@gmail.com> Message-Id: <20171117112258.5888-2-makovick@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: Fix broken display updating after the window is hiddenJindrich Makovicka2017-11-161-6/+2Star
| | | | | | | | | | | | | | | | | With SDL 2.0.6, calling SDL_ShowWindow during SDL_WINDOWEVENT_HIDDEN blocks all subsequent display updates. Instead of trying to override the change, just update the scon->hidden flag. Signed-off-by: Jindrich Makovicka <makovick@gmail.com> Message-Id: <20171112193032.9724-2-makovick@gmail.com> This is a partial revert of d3f3a0f453ea590be529079ae214c200bb5ecc1a, which in turn is a workaround for a SDL bug. The bug is fixed in 2.0.6, see https://bugzilla.libsdl.org/show_bug.cgi?id=3410 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: Do not leave grab when fullscreenJindrich Makovicka2017-11-161-2/+3
| | | | | | | | | Prevents displaying of a doubled mouse pointer when moving the pointer to the screen edges when fullscreen. Signed-off-by: Jindrich Makovicka <makovick@gmail.com> Message-Id: <20171112193032.9724-8-makovick@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: Fix dead keyboard after fullsceenJindrich Makovicka2017-11-161-0/+1
| | | | | | Signed-off-by: Jindrich Makovicka <makovick@gmail.com> Message-Id: <20171112193032.9724-7-makovick@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: Use the same pointer show/hide logic for absolute and relative modeJindrich Makovicka2017-11-161-11/+13
| | | | | | | | Also use a proper enum parameter for SDL_ShowCursor Signed-off-by: Jindrich Makovicka <makovick@gmail.com> Message-Id: <20171112193032.9724-4-makovick@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: Do not quit the emulator when an auxilliary window is closedJindrich Makovicka2017-11-161-3/+8
| | | | | | Signed-off-by: Jindrich Makovicka <makovick@gmail.com> Message-Id: <20171112193032.9724-3-makovick@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: add assert to make coverity happyGerd Hoffmann2017-06-231-0/+1
| | | | | | | | | There is a loop a few lines up counting consoles and setting sdl2_num_outputs accordingly, so con ptr can't be NULL there. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170621122234.12751-1-kraxel@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* shutdown: Add source information to SHUTDOWN and RESETEric Blake2017-05-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Time to wire up all the call sites that request a shutdown or reset to use the enum added in the previous patch. It would have been less churn to keep the common case with no arguments as meaning guest-triggered, and only modified the host-triggered code paths, via a wrapper function, but then we'd still have to audit that I didn't miss any host-triggered spots; changing the signature forces us to double-check that I correctly categorized all callers. Since command line options can change whether a guest reset request causes an actual reset vs. a shutdown, it's easy to also add the information to reset requests. Signed-off-by: Eric Blake <eblake@redhat.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> [ppc parts] Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> [SPARC part] Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> [s390x parts] Message-Id: <20170515214114.15442-5-eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* ui: Support non-zero minimum values for absolute input axesPhilippe Voinov2017-05-111-2/+2
| | | | | | | | | | This patch refactors ui/input.c to support absolute axis minimum values other than 0. All dependent calls to qemu_input_queue_abs have been updated to explicitly supply 0 as the axis minimum value. Signed-off-by: Philippe Voinov <philippevoinov@gmail.com> Message-id: 20170505133952.29885-1-philippevoinov@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: add scanout_disable supportGerd Hoffmann2017-02-271-0/+1
| | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 1487669841-13668-6-git-send-email-kraxel@redhat.com
* console: rename dpy_gl_scanout to dpy_gl_scanout_textureGerd Hoffmann2017-02-271-1/+1
| | | | | | | | | We'll add a variant which accepts dmabufs soon. Change the name so we can easily disturgish the two variants. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 1487669841-13668-2-git-send-email-kraxel@redhat.com
* sdl2: fix build failure on windowsGerd Hoffmann2017-01-131-0/+6
| | | | | | | | | Cc: Stefan Weil <sw@weilnetz.de> Cc: Samuel Thibault <samuel.thibault@gnu.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Stefan Weil <sw@weilnetz.de> Message-id: 1484295285-8809-1-git-send-email-kraxel@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* sdl2: set window IDSamuel Thibault2017-01-101-0/+7
| | | | | | | | This uses the console API to record the window ID of the SDL2 windows. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Message-id: 20161221003806.22412-4-samuel.thibault@ens-lyon.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: skip init without outputsGerd Hoffmann2016-06-031-0/+3
| | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Tested-by: Cole Robinson <crobinso@redhat.com> Message-id: 1464790116-32405-1-git-send-email-kraxel@redhat.com
* ui: sdl2: Release grab before opening console windowCole Robinson2016-05-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sdl 2.0.4 currently has a bug which causes our UI shortcuts to fire rapidly in succession: https://bugzilla.libsdl.org/show_bug.cgi?id=3287 It's a toss up whether ctrl+alt+f or ctrl+alt+2 will fire an odd or even number of times, thus determining whether the action succeeds or fails. Opening monitor/serial windows is doubly broken, since it will often lock the UI trying to grab the pointer: 0x00007fffef3720a5 in SDL_Delay_REAL () at /lib64/libSDL2-2.0.so.0 0x00007fffef3688ba in X11_SetWindowGrab () at /lib64/libSDL2-2.0.so.0 0x00007fffef2f2da7 in SDL_SendWindowEvent () at /lib64/libSDL2-2.0.so.0 0x00007fffef2f080b in SDL_SetKeyboardFocus () at /lib64/libSDL2-2.0.so.0 0x00007fffef35d784 in X11_DispatchFocusIn.isra.8 () at /lib64/libSDL2-2.0.so.0 0x00007fffef35dbce in X11_DispatchEvent () at /lib64/libSDL2-2.0.so.0 0x00007fffef35ee4a in X11_PumpEvents () at /lib64/libSDL2-2.0.so.0 0x00007fffef2eea6a in SDL_PumpEvents_REAL () at /lib64/libSDL2-2.0.so.0 0x00007fffef2eeab5 in SDL_WaitEventTimeout_REAL () at /lib64/libSDL2-2.0.so.0 0x000055555597eed0 in sdl2_poll_events (scon=0x55555876f928) at ui/sdl2.c:593 We can work around that hang by ungrabbing the pointer before launching a new window. This roughly matches what our sdl1 code does Signed-off-by: Cole Robinson <crobinso@redhat.com> Message-id: 31c9ab6540b031f7a614c59edcecea9877685612.1462557436.git.crobinso@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* qapi: rename input buttonsGerd Hoffmann2016-03-011-2/+2
| | | | | | | | | All lowercase, use-dash instead of CamelCase. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* ui: Clean up includesPeter Maydell2016-02-041-0/+1
| | | | | | | | | | Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-2-git-send-email-peter.maydell@linaro.org
* sdl: shorten the GUI refresh interval when mouse or keyboard is activeJindřich Makovička2016-02-021-0/+23
| | | | | Signed-off-by: Jindřich Makovička <makovick@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2/opengl: add opengl context and scanout supportGerd Hoffmann2016-01-081-0/+7
| | | | | | | This allows virtio-gpu to render in 3d mode. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
* qapi: Change munging of CamelCase enum valuesEric Blake2015-12-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When munging enum values, the fact that we were passing the entire prefix + value through camel_to_upper() meant that enum values spelled with CamelCase could be turned into CAMEL_CASE. However, this provides a potential collision (both OneTwo and One-Two would munge into ONE_TWO) for enum types, when the same two names are valid side-by-side as QAPI member names. By changing the generation of enum constants to always be prefix + '_' + c_name(value, False).upper(), and ensuring that there are no case collisions (in the next patches), we no longer have to worry about names that would be distinct as QAPI members but collide as variant tag names, without having to think about what munging the heuristics in camel_to_upper() will actually perform on an enum value. Making the change will affect enums that did not follow coding conventions, using 'CamelCase' rather than desired 'lower-case'. Thankfully, there are only two culprits: InputButton and ErrorClass. We already tweaked ErrorClass to make it an alias of QapiErrorClass, where only the alias needs changing rather than the whole tree. So the bulk of this change is modifying INPUT_BUTTON_WHEEL_UP to the new INPUT_BUTTON_WHEELUP (and likewise for WHEELDOWN). That part of this commit may later need reverting if we rename the enum constants from 'WheelUp' to 'wheel-up' as part of moving x-input-send-event to a stable interface; but at least we have documentation bread crumbs in place to remind us (commit 513e7cd), and it matches the fact that SDL constants are also spelled SDL_BUTTON_WHEELUP. Suggested by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1447836791-369-27-git-send-email-eblake@redhat.com> [Commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
* qapi: Don't let implicit enum MAX member collideEric Blake2015-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we guarantee the user doesn't have any enum values beginning with a single underscore, we can use that for our own purposes. Renaming ENUM_MAX to ENUM__MAX makes it obvious that the sentinel is generated. This patch was mostly generated by applying a temporary patch: |diff --git a/scripts/qapi.py b/scripts/qapi.py |index e6d014b..b862ec9 100644 |--- a/scripts/qapi.py |+++ b/scripts/qapi.py |@@ -1570,6 +1570,7 @@ const char *const %(c_name)s_lookup[] = { | max_index = c_enum_const(name, 'MAX', prefix) | ret += mcgen(''' | [%(max_index)s] = NULL, |+// %(max_index)s | }; | ''', | max_index=max_index) then running: $ cat qapi-{types,event}.c tests/test-qapi-types.c | sed -n 's,^// \(.*\)MAX,s|\1MAX|\1_MAX|g,p' > list $ git grep -l _MAX | xargs sed -i -f list The only things not generated are the changes in scripts/qapi.py. Rejecting enum members named 'MAX' is now useless, and will be dropped in the next patch. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1447836791-369-23-git-send-email-eblake@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> [Rebased to current master, commit message tweaked] Signed-off-by: Markus Armbruster <armbru@redhat.com>
* sdl2: fix crash in handle_windowevent() when restoring the screen sizeAlberto Garcia2015-06-091-0/+4
| | | | | | | | | | | | | The Ctrl-Alt-u keyboard shortcut restores the screen to its original size. In the SDL2 UI this is done by destroying the window and creating a new one. The old window emits SDL_WINDOWEVENT_HIDDEN when it's destroyed, but trying to call SDL_GetWindowFromID() from that event's window ID returns a null pointer. handle_windowevent() assumes that the pointer is never null so it results in a crash. Cc: qemu-stable@nongnu.org Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: add support for display rendering using opengl.Gerd Hoffmann2015-05-051-7/+58
| | | | | | | | Add new sdl2-gl.c file, with display rendering functions using opengl. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
* sdl2: move SDL_* includes to sdl2.hGerd Hoffmann2015-05-051-6/+0Star
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
* ui/sdl2: Support shared surface for more pixman formatsGerd Hoffmann2015-01-191-6/+7
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: Work around SDL2 SDL_ShowWindow() bugMax Reitz2014-12-171-0/+10
| | | | | | | | | | | | | | | | | | | Apparently it is possible for X to send an event to a hidden SDL2 window, leading to SDL2 believing it is now shown. SDL2 will pass the SDL_WINDOWEVENT_SHOWN message to the application without actually showing the window; the problem is that the next SDL_ShowWindow() will be a no-op because SDL2 assumes the window is already shown. The correct way to react to SDL_WINDOWEVENT_SHOWN would be to clear scon->hidden (analogous for SDL_WINDOWEVENT_HIDDEN). However, due to the window not actually being shown, this will somehow not be correct after all. Therefore, just hide the window on SDL_WINDOWEVENT_SHOWN if it is supposed to be hidden (and analogous for SDL_WINDOWEVENT_HIDDEN). Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: Use correct sdl2_console for window eventsMax Reitz2014-12-171-2/+4
| | | | | | | | | | | | | | SDL_PollEvent() polls events for all windows; therefore, sdl2_poll_events() will poll the events for all windows and not only for the one identified by the given sdl2_console. This should be considered in handle_windowevent(): The window affected by the event is not necessarily the one identified by the sdl2_console object given to sdl2_poll_events(), but the one identified by ev->window.windowID. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl2: move sdl2_2d_refresh to sdl2-2d.cGerd Hoffmann2014-12-171-9/+1Star
| | | | | | | | Now that common event handling code is split off, we can move over sdl_refresh to sdl2-2d.c, and rename it to sdl2_2d_refresh. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
* sdl2: factor out sdl2_poll_eventsGerd Hoffmann2014-12-171-10/+13
| | | | | | | | Create a new function to poll and handle sdl2 events, which is then just called from the refresh timer. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
* sdl2: add+use sdl2_2d_redraw function.Gerd Hoffmann2014-12-171-11/+6Star
| | | | | | | | | | Add a new sdl2_2d_redraw function for a complete screen refresh, so we can stop using graphic_hw_invalidate for that. There is no need to bother console / gfx emulation code if we are just going to re-blit the screen after window resizes. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>