summaryrefslogtreecommitdiffstats
path: root/ui/gtk.c
Commit message (Collapse)AuthorAgeFilesLines
* gtk: Add handling for the xfree86 keycodesBruce Rogers2014-05-261-1/+35
| | | | | | | | | Currently only evdev keycodes are handled by the gtk-ui. SDL has code to handle both. This patch adds similar processing so that both keycode types will be handled via the gtk-ui. Signed-off-by: Bruce Rogers <brogers@suse.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: enable untabify for gfxGerd Hoffmann2014-05-261-3/+7
| | | | | | | Now we have all grab fixes in place, so we can allow detaching graphic display tabs too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: detached window pointer grabsGerd Hoffmann2014-05-261-3/+21
| | | | | | | Make ungrab hotkey work with detached windows. Enable pointer grabs for detached windows. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: update all windows on mouse mode changesGerd Hoffmann2014-05-261-1/+5
| | | | | | We might have multiple graphic displays now which all need a cursor update. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: fix grab checksGerd Hoffmann2014-05-261-12/+23
| | | | | | Make it handle multiple windows case correctly. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: update gd_update_captionGerd Hoffmann2014-05-261-17/+28
| | | | | | Adapt to recent changes, handle multiple windows. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: skip keyboard grab when hover autograb is activeGerd Hoffmann2014-05-261-1/+3
| | | | | | | It's pointless. With grab on hover enabled the keyboard grab is already active when you press Ctrl-Alt-G ;) Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: keep track of grab ownerGerd Hoffmann2014-05-261-5/+23
| | | | | | Simplifies grab state tracking and makes ungrab more reliable. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: add gd_grab trace eventGerd Hoffmann2014-05-261-0/+4
| | | | | | Input grab code is tricky, add some debug & trouble shooting aid. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: add tab to trace eventsGerd Hoffmann2014-05-261-3/+3
| | | | | | So you can see which of multiple displays (if present) was resized ;) Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: allow moving tabs to windows and back.Gerd Hoffmann2014-05-261-11/+63
| | | | | | | | | | | | "View->Detach tab" will move to tab to a new window. Simply closing the window will move it back into a notebook tab. The label will be permamently stored in VirtualConsole->label, so it can easily be reused to (re-)label tabs and windows. Works for vte tabs only for now. pointer/kbd grab code needs adaptions before we can enable it for gfx tabs too. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: simplify resizeGerd Hoffmann2014-05-261-26/+14
| | | | | | | | Simply ask for a small window size. When the widgets don't fit in gtk will automatically make the window large enougth to make things fit, no need to try (and fail) duplicate that logic in qemu. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: use device type as labelGerd Hoffmann2014-05-261-2/+12
| | | | | | | IMO useful than showing VGA for any graphic device even in case it is something completely different. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: support multiple gfx displaysGerd Hoffmann2014-05-261-37/+43
| | | | | | | | | Each display gets its own tab. Tab switching continues to work like it did, just the hotkeys of the vte consoles changes in case a secondary display is present as it will get ctrl-alt-2 assigned and the vtes are shifted by one. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: move vga state into VirtualGfxConsoleGerd Hoffmann2014-05-261-278/+337
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: VirtualConsole restructionGerd Hoffmann2014-05-261-46/+73
| | | | | | Move all vte-related items into VirtualVteConsole substruct. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: remove page numbering assumtions from the codeGerd Hoffmann2014-05-261-10/+30
| | | | | | Lookup page numbers using gtk_notebook_page_num() instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Add a scrollbar for text consolesCole Robinson2014-05-261-2/+40
| | | | | | | | | Only show the scrollbar if the content doesn't fit on the visible space. [ kraxel: fix box packing ] Signed-off-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: cleanup CONFIG_VTE ifdef a bit.Gerd Hoffmann2014-05-261-19/+26
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: zap vte size requestsGerd Hoffmann2014-05-261-14/+0
| | | | | | | | | | The vte tabs simply get the size of the vga tab then, with whatever cols and lines are fitting in. I find this bahavior more useful than resizing the qemu window all day long. YMMV. Comments are welcome. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: zap scrolled_windowGerd Hoffmann2014-05-261-17/+2
| | | | | | | | The vte widget implements the scrollable interface, placing it into a scrolled window is pointless and creates a bunch of strange effects. Zap it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Fix accelerators being triggered twice with gtk3Cole Robinson2014-04-291-22/+0
| | | | | | | | | | | When keyboard focus is grabbed, current qemu wants to pass every keypress to the VM, unless the user is pressing a UI accelerator. That's exactly how things work without any of the fancy handling. Drop the special handling, which seems to trigger accelerators twice on gtk3. Signed-off-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Fix -serial vcCole Robinson2014-04-291-32/+9
| | | | | | | | | | | | | | | Try kicking off a rhel5 text install over serial, the text menu navigation is all messed up, and some of the kernel boot messages are randomly corrupted. Drop use of a pty and just use vte infrastructure for reading and writing. This fixes the above corruption, and is simpler to boot. (I don't know what was wrong with the original code though. FWIW this is what virt-manager has done for years). Signed-off-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Use ctrl+alt+q for quit acceleratorCole Robinson2014-04-291-1/+2
| | | | | | | | | Using the standard ctrl+q makes it too easy to kill the whole VM. Using ctrl+alt+FOO is consistent with our other accelerators. https://bugzilla.redhat.com/show_bug.cgi?id=1062393 Signed-off-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Remove use of deprecated stock itemsCole Robinson2014-04-291-9/+7
| | | | | | | | | | | | | | | | | | | | Stock items are deprecated. As are ImageMenuItems. Convert everything to text only MenuItems, with the same text content as mentioned in the conversion guide: https://docs.google.com/spreadsheet/pub?key=0AsPAM3pPwxagdGF4THNMMUpjUW5xMXZfdUNzMXhEa2c&output=html gtk2 users lose their menu icons as well, but I don't think that's enough of a problem to warrant keeping around back compat code. Example error: ui/gtk.c:1328:5: error: ‘GtkStock’ is deprecated [-Werror=deprecated-declarations] ui/gtk.c:1335:5: error: ‘gtk_image_menu_item_new_from_stock’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:78): Use 'gtk_menu_item_new' instead [-Werror=deprecated-declarations] s->zoom_out_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_ZOOM_OUT, NULL); Signed-off-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Don't use deprecated vte_terminal_get_adjustmentCole Robinson2014-04-291-0/+4
| | | | | | | | | | | Guard this with a VTE version check, since I'm not sure if this is backwards compatible. ui/gtk.c: In function ‘gd_vc_init’: ui/gtk.c:1176:5: error: ‘vte_terminal_get_adjustment’ is deprecated (declared at /usr/include/vte-2.90/vte/vtedeprecated.h:101) [-Werror=deprecated-declarations] Signed-off-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Don't use deprecated gtk_image_menu_item_new_with_mnemonicCole Robinson2014-04-291-2/+2
| | | | | | | | | | | | | | | | In these cases we weren't using an image in the menu item anyways, so just do as the suggestion says. Should be fine for all qemu supported gtk versions. ui/gtk.c: In function ‘gd_create_menu_machine’: ui/gtk.c:1284:5: error: ‘gtk_image_menu_item_new_with_mnemonic’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:76): Use 'gtk_menu_item_new_with_mnemonic' instead [-Werror=deprecated-declarations] s->reset_item = gtk_image_menu_item_new_with_mnemonic(_("_Reset")); ^ ui/gtk.c:1287:5: error: ‘gtk_image_menu_item_new_with_mnemonic’ is deprecated (declared at /usr/include/gtk-3.0/gtk/deprecated/gtkimagemenuitem.h:76): Use 'gtk_menu_item_new_with_mnemonic' instead [-Werror=deprecated-declarations] s->powerdown_item = gtk_image_menu_item_new_with_mnemonic(_("Power _Down")); Signed-off-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Implement grab-on-click behavior in relative modeTakashi Iwai2014-04-081-2/+17
| | | | | | | | | | | | | | | | | | This patch changes the behavior in the relative mode to be compatible with other UIs, namely, grabbing the input at the first left click. It improves the usability a lot; otherwise you have to press ctl-alt-G or select from menu at each time you want to move the pointer. Also, the input grab is cleared when the current mode is switched to the absolute mode. The automatic reset of the implicit grabbing is needed since the switching to the absolute mode happens always after the click even on Gtk. That is, we cannot check whether the absolute mode is already available at the first click time even though it should have been switched in X11 input driver side. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Remember the last grabbed pointer positionTakashi Iwai2014-04-071-2/+14
| | | | | | | | | | | | | It's pretty annoying that the pointer reappears at a random place once after grabbing and ungrabbing the input. Better to restore to the original position where the pointer was grabbed. Reference: https://bugzilla.novell.com/show_bug.cgi?id=849587 Tested-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com> Tested-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Fix the relative pointer tracking modeTakashi Iwai2014-04-071-9/+9
| | | | | | | | | | | | | | | | | | | | | The relative pointer tracking mode was still buggy even after the previous fix of the motion-notify-event since the events are filtered out when the pointer moves outside the drawing window due to the boundary check for the absolute mode. This patch fixes the issue by moving the unnecessary boundary check into the if block of absolute mode, and keep the coordinate in the relative mode even if it's outside the drawing area. But this makes the coordinate (last_x, last_y) possibly pointing to (-1,-1), introduce a new flag to indicate the last coordinate has been updated. Reference: https://bugzilla.novell.com/show_bug.cgi?id=849587 Tested-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com> Tested-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Use gtk generic event signal instead of motion-notify-eventTakashi Iwai2014-04-071-2/+10
| | | | | | | | | | | | | | | | | The GDK motion-notify-event isn't generated when the pointer goes out of the target window even if the pointer is grabbed, which essentially means to lose the pointer tracking in gtk-ui. Meanwhile the generic "event" signal is sent when the pointer is grabbed, so we can use this and pick the motion notify events manually there instead. Reference: https://bugzilla.novell.com/show_bug.cgi?id=849587 Tested-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com> Tested-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Support GTK without VTEStefan Weil2014-03-261-1/+16
| | | | | | | GTK without VTE is needed for hosts which don't support VTE (for example all variants of MinGW), but it can also be reasonable for other hosts. Signed-off-by: Stefan Weil <sw@weilnetz.de>
* gtk: Don't warp absolute pointerCole Robinson2014-03-171-0/+8
| | | | | | | | | This matches the behavior of SDL, and makes the mouse usable when using -display gtk -vga qxl https://bugzilla.redhat.com/show_bug.cgi?id=1051724 Signed-off-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Fix mouse warping with gtk3Cole Robinson2014-03-171-1/+1
| | | | | | | | | | | | | We were using the wrong coordinates, this fixes things to match the original gtk2 implementation. You can see this error in action by using -vga qxl, however even after this patch the mouse warps in small increments up and to the left, -7x and -3y pixels at a time, until the pointer is warped off the widget. I think it's a qxl bug, but the next patch covers it up. Signed-off-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Allow to activate grab-on-hover from the command lineJan Kiszka2014-03-171-1/+4
| | | | | | | | | | | As long as we have no persistent GTK configuration, this allows to enable the useful grab-on-hover feature already when starting the VM. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> [ kraxel: fix warning with CONFIG_GTK=n ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Add mouse wheel supportJan Kiszka2014-03-121-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>
* input: mouse: switch gtk ui to new coreGerd Hoffmann2014-03-051-39/+19
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* input: keyboard: switch gtk ui to new coreGerd Hoffmann2014-03-051-15/+4
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: Support keyboard translation for hosts running WindowsStefan Weil2014-01-201-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>
* gtk: Replace conditional debug messages by trace methodsStefan Weil2013-12-021-14/+5
| | | | | Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* gtk: Remove unused include statements which are not portableStefan Weil2013-08-271-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>
* gtk: Fix accelerator filteringJan Kiszka2013-07-221-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>
* gtk: add support for surface conversionGerd Hoffmann2013-06-281-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>
* gtk: Fix compiler warning (GTK 3 deprecated function)Stefan Weil2013-06-161-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>
* create qemu_openpty_raw() helper function and move it to a separate fileMichael Tokarev2013-06-141-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>
* gtk: implement -full-screenPeter Wu2013-06-111-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>
* qemu-char: don't issue CHR_EVENT_OPEN in a BHMichael Roth2013-06-101-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>
* gtk: use better iconAnthony Liguori2013-06-101-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>
* gtk: don't use g_object_unref on GdkCursorAnthony Liguori2013-06-031-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)
* gtk: don't resize window when enabling scalingAnthony Liguori2013-06-031-1/+3
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud