summaryrefslogtreecommitdiff
path: root/ui/gtk.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-12gtk: Add mouse wheel supportJan Kiszka1-0/+23
Hook into scroll-event to properly forward mouse wheel movements to the guest, just like we already do in SDL. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-05input: mouse: switch gtk ui to new coreGerd Hoffmann1-39/+19
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-05input: keyboard: switch gtk ui to new coreGerd Hoffmann1-15/+4
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-01-20gtk: Support keyboard translation for hosts running WindowsStefan Weil1-3/+15
GTK uses different hardware keycodes on Windows hosts, so some special handling is needed to get the QEMU keycode. Signed-off-by: Stefan Weil <sw@weilnetz.de>
2013-12-02gtk: Replace conditional debug messages by trace methodsStefan Weil1-14/+5
Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-08-27gtk: Remove unused include statements which are not portableStefan Weil1-4/+0
These include files don't exist for MinGW and are not needed for Linux (and hopefully for other hosts as well), so remove them. Signed-off-by: Stefan Weil <sw@weilnetz.de>
2013-07-22gtk: Fix accelerator filteringJan Kiszka1-21/+18
This is in fact very simply: When the input in grabbed, everything should be exclusively passed to the guest - except it has our magic CTRL-ALT modifier set. Then let GTK filter out those accels that are in use. When checking the modifier state, we just need to filter out NUM and CAPS lock. Note: Filtering based on hard-coded modifiers breaks overriding accelerators. Needs to be fixed at a later point. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-28gtk: add support for surface conversionGerd Hoffmann1-23/+40
Also use CAIRO_FORMAT_RGB24 unconditionally. DisplaySurfaces will never ever see 8bpp surfaces. And using CAIRO_FORMAT_RGB16_565 for the 16bpp case doesn't seem to be a good idea too. <quote src="/usr/include/cairo/cairo.h"> * @CAIRO_FORMAT_RGB16_565: This format value is deprecated. It has * never been properly implemented in cairo and should not be used * by applications. (since 1.2) </quote> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1372150134-8590-1-git-send-email-kraxel@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-16gtk: Fix compiler warning (GTK 3 deprecated function)Stefan Weil1-0/+4
With GTK 3, the function gdk_cursor_unref is deprecated: qemu/ui/gtk.c: In function ‘gd_cursor_define’: qemu/ui/gtk.c:380:5: error: ‘gdk_cursor_unref’ is deprecated (declared at /usr/include/gtk-3.0/gdk/gdkcursor.h:233): Use 'g_object_unref' instead [-Werror=deprecated-declarations] Fix the gcc compiler warning by using conditional compilation. Signed-off-by: Stefan Weil <sw@weilnetz.de> Message-id: 1371391987-10795-1-git-send-email-sw@weilnetz.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-14create qemu_openpty_raw() helper function and move it to a separate fileMichael Tokarev1-9/+3
In two places qemu uses openpty() which is very system-dependent, and in both places the pty is switched to raw mode as well. Make a wrapper function which does both steps, and move all the system-dependent complexity into a separate file, together with static/local implementations of openpty() and cfmakeraw() from qemu-char.c. It is in a separate file, not part of oslib-posix.c, because openpty() often resides in -lutil which is not linked to every program qemu builds. This change removes #including of <pty.h>, <termios.h> and other rather specific system headers out of qemu-common.h, which isn't a place for such specific headers really. This version has been verified to build correctly on Linux, OpenBSD, FreeBSD and OpenIndiana. On the latter it lets qemu to be built with gtk gui which were not possible there due to missing openpty() and cfmakeraw(). Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Tested-by: Andreas Färber <andreas.faerber@web.de>
2013-06-11gtk: implement -full-screenPeter Wu1-1/+5
Aiming for GTK as replacement for SDL, a feature like -full-screen should also be implemented. Bringing the window into full-screen mode is done by activating the "Fullscreen" menu item. This is done after showing the windows to make the cursor and menu hidden. v2: drop -no-frame implementation, use booleans instead of ints and ensure consistency between ui state and menu. Signed-off-by: Peter Wu <lekensteyn@gmail.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-06-10qemu-char: don't issue CHR_EVENT_OPEN in a BHMichael Roth1-0/+2
When CHR_EVENT_OPENED was initially added, it was CHR_EVENT_RESET, and it was issued as a bottom-half: 86e94dea5b740dad65446c857f6959eae43e0ba6 Which we basically used to print out a greeting/prompt for the monitor. AFAICT the only reason this was ever done in a BH was because in some cases we'd modify the chr_write handler for a new chardev backend *after* the site where we issued the reset (see: 86e94d:qemu_chr_open_stdio()) At some point this event was renamed to CHR_EVENT_OPENED, and we've maintained the use of this BH ever since. However, due to 9f939df955a4152aad69a19a77e0898631bb2c18, we schedule the BH via g_idle_add(), which is causing events to sometimes be delivered after we've already begun processing data from backends, leading to: known bugs: QMP: session negotation resets with OPENED event, in some cases this is causing new sessions to get sporadically reset potential bugs: hw/usb/redirect.c: can_read handler checks for dev->parser != NULL, which may be true if CLOSED BH has not been executed yet. In the past, OPENED quiesced outstanding CLOSED events prior to us reading client data. If it's delayed, our check may allow reads to occur even though we haven't processed the OPENED event yet, and when we do finally get the OPENED event, our state may get reset. qtest.c: can begin session before OPENED event is processed, leading to a spurious reset of the system and irq_levels gdbstub.c: may start a gdb session prior to the machine being paused To fix these, let's just drop the BH. Since the initial reasoning for using it still applies to an extent, work around that by deferring the delivery of CHR_EVENT_OPENED until after the chardevs have been fully initialized, toward the end of qmp_chardev_add() (or some cases, qemu_chr_new_from_opts()). This defers delivery long enough that we can be assured a CharDriverState is fully initialized before CHR_EVENT_OPENED is sent. Also, rather than requiring each chardev to do an explicit open, do it automatically, and allow the small few who don't desire such behavior to suppress the OPENED-on-init behavior by setting a 'explicit_be_open' flag. We additionally add missing OPENED events for stdio backends on w32, which were previously not being issued, causing us to not recieve the banner and initial prompts for qmp/hmp. Reported-by: Stefan Priebe <s.priebe@profihost.ag> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Message-id: 1370636393-21044-1-git-send-email-mdroth@linux.vnet.ibm.com Cc: qemu-stable@nongnu.org Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-10gtk: use better iconAnthony Liguori1-1/+1
The current icon looks pretty terrible rendered in Gnome. This switches to a transparent SVG which looks much nicer. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-03gtk: don't use g_object_unref on GdkCursorAnthony Liguori1-1/+1
It's not a GObject. Cc: Gerd Hoffman <kraxel@redhat.com> Reported-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- v1 -> v2 - Fix summary to agree with code (Peter)
2013-06-03gtk: don't resize window when enabling scalingAnthony Liguori1-1/+3
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-14portability: pty.h is glibc-specificPaolo Bonzini1-1/+0
This should fix building the GTK+ front-end on BSDs. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1368533121-30796-1-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-13ui/gtk.c: do not use gdk_display_warp_pointer when GTK ver >3.0Igor Mitsyanko1-0/+19
Commit 9697f5d2d38e5dd1e64e8e0d64436e6d44e7b1fe "gtk: custom cursor support" introduced unconditional usage of gdk_display_warp_pointer(). This function is marked as deprecated since GTK-3.0, and triggers warning (error with -Werror) during compilation. Conditionally change gdk_display_warp_pointer() method usage to gdk_device_warp usage, as suggested by compiler. Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com> Message-id: 1368197985-44608-1-git-send-email-i.mitsyanko@gmail.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-26gtk: refactor menu creationAnthony Liguori1-37/+56
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-25console: zap ds arg from register_displaychangelistenerGerd Hoffmann1-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>
2013-04-23ui/gtk: Use gtk_widget_get_window() to support both gtk2 and gtk3Ozan Çağlayan1-2/+2
This fixes build with gtk+-3.0. Signed-off-by: Ozan Çağlayan <ozancag@gmail.com> Message-id: 1366711402-1750-1-git-send-email-ozancag@gmail.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-17Fix warnings suppressors to honor --disable-werrorMarkus Armbruster1-1/+2
Replace #pragma GCC diagnostic ignored FOO [Troublesome code...] #pragma GCC diagnostic error FOO by #pragma GCC diagnostic push #pragma GCC diagnostic ignored FOO [Troublesome code...] #pragma GCC diagnostic pop Broken in commit 3f4349d, commit 092bb30, and commit c95e308. Signed-off-by: Markus Armbruster <armbru@redhat.com> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1366113066-1340-1-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-16gtk: custom cursor supportGerd Hoffmann1-0/+33
Makes gtk ui play nicely with qxl (and vmware_svga) as you can actually see your pointer now ;) Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-16console: allow pinning displaychangelisteners to consolesGerd Hoffmann1-1/+2
DisplayChangeListener gets a new QemuConsole field, which can be set to non-NULL before registering. This will pin the QemuConsole, so that particular DisplayChangeListener will not follow console switches. spice+gtk (which don't support text console input anyway) are switched over to be pinned to console 0, which usually is the graphical display. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-16console: rename vga_hw_*, add QemuConsole paramGerd Hoffmann1-1/+1
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>
2013-04-15sysemu: avoid proliferation of include/ subdirectoriesPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2013-04-02ui/gtk: Set QEMU window iconStefan Weil1-0/+13
The QEMU icon which is already used for SDL is now also loaded by GTK. Signed-off-by: Stefan Weil <sw@weilnetz.de> Message-id: 1364653300-26813-1-git-send-email-sw@weilnetz.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-02gtk: make more messages translatableAurelien Jarno1-2/+2
Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1364836326-8707-2-git-send-email-aurelien@aurel32.net Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-27qemu-char: Rename qemu_chr_generic_open to qemu_chr_be_generic_openHans de Goede1-1/+1
To better reflect that it is for handling a backend being opened. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Message-id: 1364292483-16564-3-git-send-email-hdegoede@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-25gtk: Release modifier when graphic console loses keyboard focusJan Kiszka1-2/+51
This solves, e.g., sticky ALT when selecting a GTK menu, switching to a different window or selecting a different virtual console. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Message-id: 514F417A.6010908@web.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-03-18console: zap displaystate from dcl callbacksGerd Hoffmann1-4/+2
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>
2013-03-18gtk: stop using DisplayStateGerd Hoffmann1-60/+80
Rework DisplayStateListener callbacks to not use the DisplayState any more. Factor out the window size handling to a separate function, so the zoom callbacks can call that directly instead of abusing the gd_switch DisplayStateListener callback for that. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-03-18console: rework DisplaySurface handling [dcl/ui side]Gerd Hoffmann1-7/+8
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>
2013-03-18console: kill DisplayState->opaqueGerd Hoffmann1-3/+2
It's broken by design. There can be multiple DisplayChangeListener instances, so they simply can't store state in the (single) DisplayState struct. Try 'qemu -display gtk -vnc :0', watch it crash & burn. With DisplayChangeListenerOps having a more sane interface now we can simply use the DisplayChangeListener pointer to get access to our private data instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-03-18console: fix displaychangelisteners interfaceGerd Hoffmann1-11/+19
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>
2013-03-13chardev: add vc support to qapiGerd Hoffmann1-1/+1
This patch adds 'vc' support to qapi and also switches over the vc chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-02-26Add compat for GDK_KEY_XXX symbolsDaniel P. Berrange1-0/+9
The GDK_KEY_XXX symbols are new in GTK3 and only the most recent GTK2 releases. Most versions of GTK2 have simply used GDK_XXX Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-14-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-26Add compat macro for gtk_widget_get_realizedDaniel P. Berrange1-0/+5
The gtk_widget_get_realized method only arrived in GTK 2.20, so defined a compat macro for earlier GTK Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-13-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-26Replace expose-event handler with draw handler in GTK3Daniel P. Berrange1-0/+7
In GTK3 the 'expose-event' signal has been replaced by a new 'draw' signal. The only difference is that the latter will pre-create the cairo drawing context & set the clip mask. Since the drawing code is already structured in a nice way, we can just wire up the 'gd_draw_event' method to the 'draw' signal in GTK3 Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-10-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-26Conditionalize use of gtk_widget_size_requestDaniel P. Berrange1-0/+4
The gtk_widget_size_request method has been replaced by the gtk_widget_get_preferred_size method in GTK3. Conditionally call the new method in GTK3 Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-9-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-26Conditionalize use of gdk_display_warp_pointerDaniel P. Berrange1-1/+6
In GTK3 the gdk_display_warp_pointer method is deprecated. Instead we should use gdk_device_warp on the GdkDevice instead associated with the event being processed. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-8-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-26Replace gtk_menu_append with gtk_menu_shell_appendDaniel P. Berrange1-20/+20
The gtk_menu_append method has long been deprecated in favour of the gtk_menu_shell_append method. The former is now entirely gone in GTK3, so switch all code to the latter which works on both GTK2 and GTK3 Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-7-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-26Remove use of GtkVBox in GTK3Daniel P. Berrange1-0/+4
The GtkVBox class is deprecated, in favour of just using the GtkBox class directly. Eventually even GtkBox will be deprecated in favour of GtkGrid, but that is a bigger fix which can wait. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-6-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-26Conditionalize use of gdk_pointer_grab / gdk_pointer_ungrabDaniel P. Berrange1-11/+65
On GTK3 there is support for multiple pointer devices, so rather than using gdk_pointer_grab / gdk_pointer_ungrab we should iterate over all devices, grabbing each one in turn Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-5-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-26Conditionalize use of gdk_keyboard_grab / gdk_keyboard_ungrabDaniel P. Berrange1-1/+40
On GTK3 there is support for multiple keyboard devices, so rather than using gdk_keyboard_grab / gdk_keyboard_ungrab we should iterate over all devices, grabbing each one in turn Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-4-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-26Remove use of gdk_drawable_get_{screen, display}Daniel P. Berrange1-3/+2
The gdk_drawable_get_screen and gdk_drawable_get_display methods don't exist in GDK3. Fortunately, even on GTK2 they are not required - we can call the equivalent gtk_widget_get_screen/gtk_widget_get_display methods which have existed since GTK 2.2 Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-3-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-26Add compat for gdk_drawable_get_size on GTK3Daniel P. Berrange1-0/+10
GTK3 lacks the gdk_drawable_get_size method, so we create a stub impl which gets the get_width/get_height mehtods instead Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1361805646-6425-2-git-send-email-berrange@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-22gtk: Rename File to Machine menu and add pause, reset and power down itemsJan Kiszka1-12/+68
This adds basic guest control commands to the "Machine" menu - a nice added-value for the GTK UI. We use "pause" as the term for stopping the machine here. So reword also the related caption tag. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-22ui/gtk: Use menu item from stock for full screenStefan Weil1-2/+3
This reduces the required translations and gives a nicer menu with an icon. The full screen menu item is no longer a check menu item. A checked item is not visible in full screen mode, so it is not needed for this special menu item. Signed-off-by: Stefan Weil <sw@weilnetz.de> Message-id: 1361561614-11180-1-git-send-email-sw@weilnetz.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-22ui/gtk: Support versions of VTE before 0.26Stefan Weil1-1/+6
This is needed for current Debian stable (Squeeze). VTE versions before 0.26 did not support VtePty. Lower the version requirement and use alternate code which works for Debian. Signed-off-by: Stefan Weil <sw@weilnetz.de> Message-id: 1361560199-28906-1-git-send-email-sw@weilnetz.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-22Reenable -Wstrict-prototypesKevin Wolf1-1/+11
One part of this patch reverts commit 22bc9a46, which disabled the warning. The rest of it deals with the warning by adding a #pragma for newer gcc and by disabling -Werror for compilers that can't deal with the #pragma. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1361563731-13307-1-git-send-email-kwolf@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>