summaryrefslogtreecommitdiffstats
path: root/ui/sdl.c
Commit message (Collapse)AuthorAgeFilesLines
* qapi: rename input buttonsGerd Hoffmann2019-11-291-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 Maydell2019-11-291-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čka2019-11-291-0/+22
| | | | | Signed-off-by: Jindřich Makovička <makovick@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* qapi: Change munging of CamelCase enum valuesEric Blake2019-11-291-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 Blake2019-11-291-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>
* ui: Use g_new() & friends where that makes obvious senseMarkus Armbruster2015-11-061-1/+1
| | | | | | | | | | | | | | g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. This commit only touches allocations with size arguments of the form sizeof(T). Same Coccinelle semantic patch as in commit b45c03f. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* sdl2: add support for display rendering using opengl.Gerd Hoffmann2015-05-051-0/+10
| | | | | | | | 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>
* sdl: Fix crash when calling sdl_switch() with NULL surfaceBenjamin Herrenschmidt2015-03-121-1/+2
| | | | | | | This happens for example when doing ctrl-alt-u and segfaults Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl: Refresh debug statementsBenjamin Herrenschmidt2015-03-121-2/+22
| | | | | | | | Put them under a #define similar to the VGA model and make them actually compile. Add a couple too. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ui/sdl: Support shared surface for more pixman formatsBenjamin Herrenschmidt2015-01-191-6/+20
| | | | | | | | | | | At least all the ones I've tested. We make the assumption that SDL is going to be better at conversion than we are. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [ kraxel: minor format tweaks ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl: move version logic from source code to makefileGerd Hoffmann2014-12-161-3/+0
| | | | | | | | Compile sdl.c / sdl2.c depending on CONFIG_SDLABI instead of compiling both and have version #ifdefs in the source code. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
* console: stop using PixelFormatGerd Hoffmann2014-09-051-2/+3
| | | | | | | | | | | | | | | | | With this patch the qemu console core stops using PixelFormat and pixman format codes side-by-side, pixman format code is the primary way to specify the DisplaySurface format: * DisplaySurface stops carrying a PixelFormat field. * qemu_create_displaysurface_from() expects a pixman format now. Functions to convert PixelFormat to pixman_format_code_t (and back) exist for those who still use PixelFormat. As PixelFormat allows easy access to masks and shifts it will probably continue to exist. [ xenfb added by Benjamin Herrenschmidt ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* input: sdl: fix guest_cursor logic.Gerd Hoffmann2014-03-101-7/+11
| | | | | | | Unbreaks relative mouse mode with SDL. Reported-by: Gabriel L. Somlo <gsomlo@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ui/sdl2 : initial port to SDL 2.0 (v2.0)Dave Airlie2014-03-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've ported the SDL1.2 code over, and rewritten it to use the SDL2 interface. The biggest changes were in the input handling, where SDL2 has done a major overhaul, and I've had to include a generated translation file to get from SDL2 codes back to qemu compatible ones. I'm still not sure how the keyboard layout code works in qemu, so there may be further work if someone can point me a test case that works with SDL1.2 and doesn't with SDL2. Some SDL env vars we used to set are no longer used by SDL2, Windows, OSX support is untested, I don't think we can link to SDL1.2 and SDL2 at the same time, so I felt using --with-sdlabi=2.0 to select the new code should be fine, like how gtk does it. v1.1: fix keys in text console v1.2: fix shutdown, cleanups a bit of code, support ARGB cursor v2.0: merge the SDL multihead patch into this, g_new the number of consoles needed, wrap DCL inside per-console structure. Signed-off-by: Dave Airlie <airlied@redhat.com> Fixes & improvements by kraxel: * baum build fix * remove text console logic * adapt to new input core * codestyle fixups Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* input: mouse: switch sdl ui to new coreGerd Hoffmann2014-03-051-45/+39
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* input: keyboard: switch sdl ui to new coreGerd Hoffmann2014-03-051-18/+9
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl: Reverse support for video mode settingLei Li2013-11-061-4/+19
| | | | | | | | | | | | | Currently, If the setting of video mode failed, qemu will exit. It should go back to the previous setting if the new screen resolution failed. This patch fixes LP#1216368, add support to revert to existing surface for the failure of video mode setting. Reported-by: Sascha Krissler <sascha@srlabs.de> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1378285636-7091-1-git-send-email-lilei@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
* console: zap ds arg from register_displaychangelistenerGerd Hoffmann2013-04-251-1/+1
| | | | | | | We don't have multiple DisplayStates any more, so passing it in as argument is not needed. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: add qemu_console_is_*Gerd Hoffmann2013-04-161-12/+12
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: gui timer fixesGerd Hoffmann2013-04-161-5/+5
| | | | | | | | | Make gui update rate adaption code in gui_update() actually work. Sprinkle in a tracepoint so you can see the code at work. Remove the update rate adaption code in vnc and make vnc simply use the generic bits instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: rename vga_hw_*, add QemuConsole paramGerd Hoffmann2013-04-161-9/+9
| | | | | | | | | | | | Add QemuConsole parameter to vga_hw_*, so the interface allows to update non-active consoles (the actual code can't handle this yet, see next patch). Passing NULL is allowed and updates the active console, like the functions do today. While touching all vga_hw_* calls anyway rename that to the functions to hardware-neutral graphics_hw_* Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: zap displaystate from dcl callbacksGerd Hoffmann2013-03-181-8/+3
| | | | | | | Now that nobody depends on DisplayState in DisplayChangeListener callbacks any more we can remove the parameter from all callbacks. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl: stop using DisplayStateGerd Hoffmann2013-03-181-41/+51
| | | | | | | Rework DisplayStateListener callbacks to not use the DisplayState any more. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: rework DisplaySurface handling [dcl/ui side]Gerd Hoffmann2013-03-181-5/+5
| | | | | | | | Replace the dpy_gfx_resize and dpy_gfx_setdata DisplayChangeListener callbacks with a dpy_gfx_switch callback which notifies the ui code when the framebuffer backing storage changes. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl: drop dead codeGerd Hoffmann2013-03-181-5/+0
| | | | | | | DisplayAllocator removal (commit 187cd1d9f30d13f0d0ef682e4d91cfa3e4cbd472) made this a nop. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: fix displaychangelisteners interfaceGerd Hoffmann2013-03-181-15/+29
| | | | | | | | Split callbacks into separate Ops struct. Pass DisplayChangeListener pointer as first argument to all callbacks. Uninline a bunch of display functions and move them from console.h to console.c Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* softmmu: move include files to include/sysemu/Paolo Bonzini2012-12-191-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* ui: move files to ui/ and include/ui/Paolo Bonzini2012-12-191-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* console: remove DisplayAllocatorGerd Hoffmann2012-11-011-111/+6
| | | | | | Causes [temporary] preformance regression with 24bpp vga modes @ sdl. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: remove dpy_gfx_fillGerd Hoffmann2012-11-011-7/+0
| | | | | | Unused code. 'nuff said. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: untangle gfx & txt updatesGerd Hoffmann2012-11-011-6/+6
| | | | | | | | | | | | | | | | Stop abusing displaysurface fields for text mode displays. (bpp = 0, width = cols, height = lines). Add flags to displaystate indicating whenever text mode display (curses) or gfx mode displays (sdl, vnc, ...) are present. Add separate displaychangelistener callbacks for text / gfx mode resize & updates. This allows to enable gfx and txt diplays at the same time and also paves the way for more cleanups in the future. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: move set_mouse + cursor_define callbacksGerd Hoffmann2012-11-011-4/+4
| | | | | | | When adding DisplayChangeListeners the set_mouse and cursor_define callbacks have been left in DisplayState for some reason. Fix it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl: remove NULL check, g_malloc0 can't failAlon Levy2012-02-271-4/+0
| | | | | Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl: Limit sdl_grab_end in handle_activation to Windows hostsJan Kiszka2012-02-011-0/+4
| | | | | | | | | | | | | | There are scenarios on Linux with some SDL versions where handle_activation is continuous invoked with state = SDL_APPINPUTFOCUS and gain = 0 while we grabbed the input. This causes a ping-pong when we grab the input after an absolute mouse entered the window. As this sdl_grab_end was once introduced to work around a Windows-only issue (0294ffb9c8), limit it to that platform. CC: Erik Rull <erik.rull@rdsoftware.de> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Grab input on end of non-absolute mouse clickJan Kiszka2012-02-011-2/+1
| | | | | | | | | | | By grabbing the input already on button down, we leave the button in that state for the host GUI. Thus it takes another click after releasing the input again to synchronize the mouse button state. Avoid this by grabbing on button up. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Handle SDL grabs failing (Mark McLoughlin)"Jan Kiszka2012-02-011-6/+3
| | | | | | | | | | | | | | | | This reverts commit 6bb816031f8bc0aafc3476e6dfa4293ee3a5f106. SDL_WM_GrabInput does not reliably bail out if grabbing is impossible. So if we get here, we already lost and will block. But this can no longer happen due to the check in sdl_grab_start. So this patch became obsolete. Conflicts: sdl.c Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Fix block prevention of SDL_WM_GrabInputJan Kiszka2012-02-011-12/+14
| | | | | | | | | Consistently check for SDL_APPINPUTFOCUS before trying to grab the input focus. Just checking for SDL_APPACTIVE doesn't work. Moving the check to sdl_grab_start allows for some consolidation. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Do not grab mouse on mode switch while in backgroundJan Kiszka2012-02-011-14/+16
| | | | | | | | | When the mouse mode changes to absolute while the SDL windows is not in focus, refrain from grabbing the input. It would steal from some other window. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Drop the vm_running global variableLuiz Capitulino2011-09-151-3/+3
| | | | | | Use runstate_is_running() instead, which is introduced by this commit. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* sdl: Don't release input on mouse mode change in full-screen modeJan Kiszka2011-08-221-1/+3
| | | | | | | | | While in full-screen mode, the input focus naturally belongs to the SDL window. Avoid dropping it when switching from absolute to relative mouse mode. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-10/+10
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Refactor sdl_send_mouse_eventJan Kiszka2011-08-051-11/+11
| | | | | | | | Replace width/height globals with the identical values from real_screen, refactor the function according to our coding style. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Factor out event handlers from sdl_refreshJan Kiszka2011-08-051-205/+271
| | | | | | | No functional changes. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Add zoom hot keysJan Kiszka2011-08-051-0/+13
| | | | | | | | | | Allow to enlarge or shrink the screen via CTRL-ALT-+/-. In contrast to scaling the window, these controls always preserve the aspect ratio of the current console. CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Dynamically grab input in absolute mouse modeJan Kiszka2011-08-051-6/+37
| | | | | | | | | | | | Not grabbing the input means that special keys like ALT+TAB are still handled by the host. Improve the usability by grabbing input once the mouse is inside the guest screen, provided the SDL window has the input focus. Release it again when the mouse is moved to any border. Also grab the input when we gain the input focus and the mouse is within the screen limits. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Fix cursor handling when switching consoles in absolute mouse modeJan Kiszka2011-08-051-3/+10
| | | | | | | | Restore the cursor when switching from graphic to text console while the mouse is in absolute mode. Disable it again when returning. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Never release input while in full screen modeJan Kiszka2011-08-051-3/+4
| | | | | | | | It's confusing to suddenly find two mice in full screen mode when switching consoles or accidentally hitting the grab hot keys. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Consistently avoid grabbing input for text consolesJan Kiszka2011-08-051-3/+6
| | | | | | | | | There were some preexisting bits that released the input when switching to text console. This patch spreads this logic consistently and also avoids grabbing the input while a text console is active. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Initialize gui_fullscreen earlier during setupJan Kiszka2011-08-051-4/+5
| | | | | | | | This ensures that we actually enter full screen on startup when e.g. '-vga none -full-screen' was specified. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Drop bogus gui_fullscreen_initial_grabJan Kiszka2011-08-051-3/+1
| | | | | | | | There must be no difference between initial -full-screen and switching to this mode via the hot key. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud