summaryrefslogtreecommitdiffstats
path: root/sdl.c
Commit message (Collapse)AuthorAgeFilesLines
* use new cursor struct + functions for vmware vga and sdl.Gerd Hoffmann2010-05-241-39/+13
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Do not disable screensaver by defaultJan Kiszka2010-05-241-0/+4
| | | | | | | | | | Unless we are running in full-screen mode, QEMU's SDL window should not disable the host's screensaver. The user can still change this behaviour by setting the environment variable SDL_VIDEO_ALLOW_SCREENSAVER as desired. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Convert atexit users to exit_notifier"Anthony Liguori2010-03-211-3/+2
| | | | | | | | | | | | This reverts commit d7234f4d7e373a708e1df9ab565a71b71b189025. Conflicts: hw/xen_machine_pv.c This should have never been committed. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Convert atexit users to exit_notifierAnthony Liguori2010-03-191-2/+3
| | | | | | | | All of these users have global state so we really don't see a benefit from exit_notifier. However, using exit_notifier means that there's one less justification for having global state in the first place. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: use mouse mode notifierAnthony Liguori2010-03-191-11/+20
| | | | | | | | | | | | | | | Today we poll the mouse mode whenever there is a mouse movement. There is a subtle usability problem with this though. If we're in relative mode and grab is enabled, when we change to absolute mode, we break grab. This gives a user a seamless transition when the new pointer is enabled. But because we poll for mouse change, this grab break won't occur until the user attempts to move the mouse. By using notifiers, the grab break happens as soon as possible. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: improve error message on fatal errorBjørn Mork2010-03-171-1/+2
| | | | | | | | | | | | | | | | | | | The SDL_SetVideoMode() error condition is easily triggered by a user by simply configure a guest with a host unsupported display resolution and attempting to enable fullscreen. Since the error is fatal, adding a bit of debugging help can't harm. Sample output with this change: (qemu) Could not open SDL display (1280x1024x32): No video mode large enough for 1280x1024 The width x height might seem redundant as SDL also provides it in SDL_GetError(), but I believe there are situations where it is useful. I.e. if there is some other SDL error. Anyway, redundant information in fatal error messages has never harmed a single gerbil. Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: improve grab exiting instructionsAnthony Liguori2010-03-081-3/+3
| | | | | | | It might not be obvious what "grab" is. Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix curses interaction with keymapsSamuel Thibault2010-03-061-10/+10
| | | | | | | | | | The combination of keymap support (-k option) and curses is currently very broken. The patch below fixes it by first extending keymap support to interpret the shift, ctrl, altgr and addupper keywords in keymaps, and to fix curses into properly using keymaps. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* remove knowledge of defaultallocator_free_displaysurface from sdl.cPaolo Bonzini2010-02-191-4/+0
| | | | | | | | Let register_displayallocator hand over the old width/height to the new allocator. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* win32/sdl: Fix toggle full screenHerve Poussineau2010-01-261-0/+1
| | | | | | | | | Toggle full screen on Win32/SDL 1.2.13 was broken by commit c18a2c360e3100bbd71162cf922dcd8c429a8b71. Re-add the call to do_sdl_resize() which was removed in this revision Signed-off-by: Herve Poussineau <hpoussin@reactos.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: print the reason why SDL thinks SDL_Init failed before exitingmalc2009-12-301-1/+2
| | | | Signed-off-by: malc <av1474@comtv.ru>
* offer right-ctrl as a grab optionDustin Kirkland2009-10-061-7/+11
| | | | | | | | | | | | | | Add support for -ctrl-grab to use the right-ctrl button to grab/release the mouse in SDL. The multi-button ctrl-alt and ctrl-alt-shift grab buttons present an accessibility problem to users who cannot press more than one button at a time. https://bugs.edge.launchpad.net/ubuntu/+source/qemu-kvm/+bug/237635 Signed-off-by: Dustin Kirkland <kirkland@canonical.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Get rid of _t suffix"Anthony Liguori2009-10-011-1/+1
| | | | | | | | | | | | In the very least, a change like this requires discussion on the list. The naming convention is goofy and it causes a massive merge problem. Something like this _must_ be presented on the list first so people can provide input and cope with it. This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Get rid of _t suffixmalc2009-10-011-1/+1
| | | | | | | Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
* Set SDL icon_title when using `-name XXX` for proper gnome-panel window list ↵Dominic Evans2009-09-261-6/+10
| | | | | | | | | | | | | | integration qemu: improve sdl title information Include the `-name XXX` commandline param in the gnome-panel window list via icon_title. https://bugs.edge.launchpad.net/ubuntu/+source/qemu-kvm/+bug/423076 Signed-off-by: Dominic Evans <oldmanuk@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Allow to unscale the output window with a Ctrl-Alt-u hotkeymalc2009-09-101-0/+6
| | | | Signed-off-by: malc <av1474@comtv.ru>
* sdl.c: support 32 bpp cursorsReimar Döffinger2009-08-231-0/+3
| | | | | | | | | | | | | | Hello, currently when a 32 bpp cursor gets defined the result is all-black in the areas that are not transparent (you'll get a 32 bpp cursor if you use my previous patch to allow vmware_vga to use a 32 bpp framebuffer). This is because the switch in sdl.c lacks a 32 bpp case. The thing I am unsure about though is which byte is the unused one and should be skipped, the first or the last - for the black-and-white cursors I tested it doesn't make a difference... Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de> Signed-off-by: Andrzej Zaborowski <balrogg@gmail.com>
* fix sdl window resizeStefano Stabellini2009-08-101-0/+4
| | | | | | | | | | | Hi all, this patch fixes the sdl window resize event handler so that it doesn't require the emulated graphic card (or console.c) to call qemu_console_resize. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
* Fix Sparse warnings: "Using plain integer as NULL pointer"Blue Swirl2009-07-311-1/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* rename WORDS_BIGENDIAN to HOST_WORDS_BIGENDIANJuan Quintela2009-07-271-2/+2
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl: Fix memory leakageJan Kiszka2009-06-291-18/+21
| | | | | | | | | | Valgrind was so kind to remark that no one bothers to release keycodes after use and that something is fishy about cleaning up the requested keyboard descriptor. With this patch applied, we no longer leak about 12k during startup. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* sdl zoomingStefano Stabellini2009-06-291-16/+62
| | | | | | | | | | | | | Hi all, this patch implements zooming capabilities for the sdl interface. A new sdl_zoom_blit function is added that is able to scale and blit a portion of a surface into another. This way we can enable SDL_RESIZABLE and have a real_screen surface with a different size than the guest surface and let sdl_zoom_blit take care of the problem. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Only shutdown video subsytem in sdl_cleanupmalc2009-05-171-1/+1
| | | | | | | | Depending on the order in which atexit handlers are called SDL might try to join on an audio thread without said thread ever being notified that it must stop, hence QEMU will forever block in pthread_join call. Signed-off-by: malc <av1474@comtv.ru>
* Recognise evdev(xx)_aliases(yy) and xfree86(xx)_aliases(yy) as keymap names.balrog2009-04-131-2/+2
| | | | | | | Newer Xorg use these with non-default kemaps (such as the ThinkPad keymap). git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7097 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix absolute mouse events generated by SDL frontend.balrog2009-03-211-1/+3
| | | | | | | | | In r6839 ("DisplayAllocator interface") the "width" and "height" globals stopped ever being assigned. Note that last time absolute input stopped working was for the same reason. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6875 c046a42c-6fe2-441c-8c8c-71466251a162
* DisplayAllocator interface (Stefano Stabellini)aliguori2009-03-131-13/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hi all, this patch adds a DisplayAllocator interface that allows display frontends (sdl in particular) to provide a preallocated display buffer for the graphical backend to use. Whenever a graphical backend cannot use qemu_create_displaysurface_from because its own internal pixel format cannot be exported directly (text mode or graphical mode with color depth 8 or 24), it creates another display buffer in memory using qemu_create_displaysurface and does the conversion. This new buffer needs to be blitted into the sdl surface buffer every time we need to update portions of the screen. We can avoid this using the DisplayAllocator interace: sdl provides its own implementation of qemu_create_displaysurface, giving back the sdl surface buffer directly (as we used to do before the DisplayState changes). Since the buffer returned by sdl could be in bgr format we need to put back in the handlers of that case. This approach is good if the two following conditions are true: 1) the sdl surface is a software surface that resides in main memory; 2) the host display color depth is either 16 or 32 bpp. If first condition is false we can have bad performances using sdl and vnc together. If the second condition is false performances are certainly not going to improve but they shouldn't get worse either. The first condition is always true, at least on linux/X11 systems; but I believe is true also on other platforms. The second condition is true in the vast majority of the cases. This patch should also have the good side effect of solving the sdl 2D slowness malc was reporting on MacOS, because SDL_BlitSurface is not going to be called anymore when the guest is in text mode or 24bpp. However the root problem is still present so I suspect we may still see some slowness on MacOS when the guest is in 32 or 16 bpp. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6839 c046a42c-6fe2-441c-8c8c-71466251a162
* Remove unnecessary prefix on SDL_syswm.h. This fixes the build for certainaliguori2009-03-081-1/+1
| | | | | | | | | | installs of SDL. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6780 c046a42c-6fe2-441c-8c8c-71466251a162
* Sparse fixes: NULL use, header order, ANSI prototypes, staticblueswir12009-03-071-5/+5
| | | | | | | | | | | | | Fix Sparse warnings: * use NULL instead of plain 0 * rearrange header include order to avoid redefining types accidentally * ANSIfy SLIRP * avoid "restrict" keyword * add static git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6736 c046a42c-6fe2-441c-8c8c-71466251a162
* Refactor keymap code to avoid duplication ("Daniel P. Berrange")aliguori2009-03-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Each of the graphical frontends #include a .c file, for keymap code resulting in duplicated definitions & duplicated compiled code. A couple of small changes allowed this to be sanitized, so instead of doing a #include "keymaps.c", duplicating all code, we can have a shared keymaps.h file, and only compile code once. This allows the next patch to move the VncState struct out into a header file without causing clashing definitions. Makefile | 9 +++++--- b/keymaps.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ curses.c | 3 -- curses_keys.h | 9 +++----- keymaps.c | 45 ++++++++++++++++--------------------------- sdl.c | 3 -- sdl_keysym.h | 7 ++---- vnc.c | 5 +--- vnc_keysym.h | 7 ++---- 9 files changed, 97 insertions(+), 51 deletions(-) Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6721 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix SDL on evdev hosts (Anthony Liguori)aliguori2009-03-031-2/+56
| | | | | | | | | | | This patch corrects SDL support on X11 hosts using evdev. It's losely based on the previous patch by Dustin Kirkland and the evdev support code in gtk-vnc written by Daniel Berrange. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6678 c046a42c-6fe2-441c-8c8c-71466251a162
* toplevel: remove error handling from qemu_malloc() callers (Avi Kivity)aliguori2009-02-051-2/+0
| | | | | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6531 c046a42c-6fe2-441c-8c8c-71466251a162
* Allow usb tablet to be used with vmware-vga hwcursor.balrog2009-01-291-2/+4
| | | | | | | | | Assume that in absolute mode the guest cursor always follows host cursor and there's no need to move host cursor. This avoids a strange feedback loop. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6477 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix absolute mode mice.balrog2009-01-291-1/+3
| | | | | | | | width and height were never set which means that host coordinates were divided by -1 instead of (width - 1) / 0x7fff. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6476 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix SDL slowness.pbrook2009-01-211-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6373 c046a42c-6fe2-441c-8c8c-71466251a162
* Remove real_screen->pixels checksmalc2009-01-211-10/+0
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6372 c046a42c-6fe2-441c-8c8c-71466251a162
* DisplayState interface change (Stefano Stabellini)aliguori2009-01-151-38/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the DisplayState interface adding support for multiple frontends at the same time (sdl and vnc) and implements most of the benefit of the shared_buf patch without the added complexity. Currently DisplayState is managed by sdl (or vnc) and sdl (or vnc) is also responsible for allocating the data and setting the depth. Vga.c (or another backend) will do any necessary conversion. The idea is to change it so that is vga.c (or another backend) together with console.c that fully manage the DisplayState interface allocating data and setting the depth (either 16 or 32 bit, if the guest uses a different resolution or is in text mode, vga.c (or another backend) is in charge of doing the conversion seamlessly). The other idea is that DisplayState supports *multiple* frontends like sdl and vnc; each of them can register some callbacks to be called when a display event occurs. The interesting changes are: - the new structures and related functions in console.h and console.c in particular the following functions are very helpful to manage a DisplaySurface: qemu_create_displaysurface qemu_resize_displaysurface qemu_create_displaysurface_from qemu_free_displaysurface - console_select and qemu_console_resize in console.c this two functions manage multiple consoles on a single host display - moving code around in hw/vga.c as for the shared_buf patch this is necessary to be able to handle a dynamic DisplaySurface bpp - changes to vga_draw_graphic in hw/vga.c this is the place where the DisplaySurface buffer is shared with the videoram, when possible; Compared to the last version the only changes are: - do not remove support to dpy_copy in cirrus_vga - change the name of the displaysurface handling functions Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6336 c046a42c-6fe2-441c-8c8c-71466251a162
* remove bgr (Stefano Stabellini)aliguori2009-01-151-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | Do not handle bgr host displays in the backends. Right now a bgr flag exists so that sdl can set it, if the SDL_Surface is bgr. Afterwards the graphic device (e.g. vga.c) does the needed conversion. With this patch series is sdl that is responsible for rendering the format provided by the graphic device that must provide a DisplaySurface (ds->surface) in 16 or 32 bpp, rgb. Afterwards sdl creates a SDL_Surface from the given DisplaySurface and blits it into the main SDL_Surface using SDL_BlitSurface. Everything is handled by sdl transparently, because SDL_BlitSurface is perfectly capable of handling bgr displays by itself. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6335 c046a42c-6fe2-441c-8c8c-71466251a162
* Handle SDL grabs failing (Mark McLoughlin)aliguori2009-01-151-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a X window is not viewable, XGrabPointer() fails and returns GrabNotViewable. SDL's X backend currently handles this by retrying the grab until the window becomes viewable again. This means e.g. if you Ctrl-Alt-RightArrow to switch workspaces, QEMU tries to grab, SDL blocks because the window isn't viewable and your guest stops executing until you switch back to that workspace again. See this Fedora bug for the gory details: https://bugzilla.redhat.com/480065 Some SDL backends will return SDL_GRAB_OFF from SDL_WM_GrabInput(), so the fix is to make the X backend do this if the grab fails. The only side-effect in QEMU is that if SDL_WM_GrabInput() fails we still change the window title to indicate that it's grabbed, when in fact it's not. This patch fixes that minor issue. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6325 c046a42c-6fe2-441c-8c8c-71466251a162
* add DisplayState->idle (Samuel Thibault)aliguori2008-08-211-0/+2
| | | | | | | | | | | | | | | | | Add idle field to DisplayState struct, so drivers can figure the display is idle and take advantage of that. The xen framebuffer driver will use this to communicate the idle state to the guest, so it knows it can stop doing updates to a virtual display which is invisible anyway. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5056 c046a42c-6fe2-441c-8c8c-71466251a162
* Handle terminating signals (Gerd Hoffmann)aliguori2008-08-211-8/+1
| | | | | | | | | | | | | | | | | | This patch makes qemu handle signals better. It sets the request_shutdown flag, making the main_loop exit and qemu taking the usual exit route, with atexit handlers being called and so on, instead of qemu just being killed by the signal. To avoid calling vm_start() from the signal handler main_loop() got an additional check so qemu_system_shutdown_request() works even when the vm is in stopped state. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5055 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix detection of 15 bit display depthblueswir12008-07-241-0/+11
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4936 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix SDL problems with BGR displays (Avi Kivity)aliguori2008-07-231-1/+1
| | | | | | | | | | | | | revert qemu's sdl.c rev 1.40 this fixes problems with bgr displays. Signed-off-by: Avi Kivity <avi@qumranet.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4925 c046a42c-6fe2-441c-8c8c-71466251a162
* SDL: Fix dead keysaurel322008-04-131-1/+1
| | | | | | | (Samuel Thibault) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4208 c046a42c-6fe2-441c-8c8c-71466251a162
* Slowdown SDL while minimizedaurel322008-03-131-0/+9
| | | | | | | | | | | | When SDL is invisible/minimized, there is no need to keep calling the VGA refresh 33 times per second. This patch reduces in that case the rate to 2 times per second, which should be responsive enough for the un-minimizing event. (Samuel Thibault) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4050 c046a42c-6fe2-441c-8c8c-71466251a162
* SDL mouse events smoothnessaurel322008-03-131-16/+20
| | | | | | | (Samuel Thibault) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4049 c046a42c-6fe2-441c-8c8c-71466251a162
* Let the USB tablet reach the far bottom and right pixelsaurel322008-03-101-2/+2
| | | | | | | (Samuel Thibault) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4036 c046a42c-6fe2-441c-8c8c-71466251a162
* Break up vl.h.pbrook2007-11-171-1/+3
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3674 c046a42c-6fe2-441c-8c8c-71466251a162
* find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in ↵ths2007-09-171-2/+2
| | | | | | the regex. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162
* find -type f | xargs sed -i 's/[\t ]$//g' # on most filesths2007-09-161-7/+7
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
* Add alternate grab key, by Michael Mohr.ths2007-06-211-5/+19
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2990 c046a42c-6fe2-441c-8c8c-71466251a162
OpenPOWER on IntegriCloud