diff options
author | kraxel <kraxel> | 2008-09-26 15:31:25 +0000 |
---|---|---|
committer | kraxel <kraxel> | 2008-09-26 15:31:25 +0000 |
commit | 268ba0c905c9aa4af1b4a805805447ac8df931a9 (patch) | |
tree | 960a6a4ba0a7c3cb92367e1cfd39e27614e333e1 | |
parent | ebe77c45fa12da6537b4bb903226ced6b7a63288 (diff) | |
download | qemu-gtk-268ba0c905c9aa4af1b4a805805447ac8df931a9.tar.gz |
- add input menu.
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | monitor.c | 5 | ||||
-rw-r--r-- | qemu-gtk.c | 51 | ||||
-rw-r--r-- | qemu-gtk.h | 3 |
4 files changed, 59 insertions, 2 deletions
@@ -1 +1 @@ -0.2 +0.3 @@ -177,7 +177,10 @@ close: vte_terminal_feed(VTE_TERMINAL(win->monitor.vte), "\r\n=== CLOSED ===", 16); close(win->monitor.handle); win->monitor.handle = -1; -// gtk_widget_destroy(win->toplevel); + if (win->quit_on_shutdown) + gtk_widget_destroy(win->toplevel); + else + update_status(win); return FALSE; } @@ -9,6 +9,7 @@ #include <gdk/gdk.h> #include <gdk/gdkx.h> +#include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> #include <vte/vte.h> #include <vncdisplay.h> @@ -105,6 +106,34 @@ static void menu_cb_scale_display(GtkToggleAction *action, gpointer userdata) vnc_display_set_scaling(VNC_DISPLAY(win->vnc), active); } +static void menu_cb_grab_mouse(GtkToggleAction *action, gpointer userdata) +{ + struct qemu_window *win = userdata; + gboolean active; + + active = gtk_toggle_action_get_active(action); + vnc_display_set_pointer_grab(VNC_DISPLAY(win->vnc), active); +} + +static void menu_cb_grab_kbd(GtkToggleAction *action, gpointer userdata) +{ + struct qemu_window *win = userdata; + gboolean active; + + active = gtk_toggle_action_get_active(action); + vnc_display_set_keyboard_grab(VNC_DISPLAY(win->vnc), active); +} + +static void menu_cb_send_ctrlaltdel(GtkToggleAction *action, gpointer userdata) +{ + struct qemu_window *win = userdata; + guint keys[] = { GDK_Control_L, GDK_Alt_L, GDK_Delete }; + + vnc_display_send_keys_ex(VNC_DISPLAY(win->vnc), + keys, sizeof (keys) / sizeof (keys[0]), + VNC_DISPLAY_KEY_EVENT_CLICK); +} + static void menu_cb_about(GtkAction *action, gpointer userdata) { static char *comments = "gtk ui for qemu"; @@ -393,6 +422,9 @@ static const GtkActionEntry entries[] = { .name = "ViewMenu", .label = "_View", },{ + .name = "InputMenu", + .label = "_Input", + },{ .name = "VMMenu", .label = "_VM", },{ @@ -407,6 +439,11 @@ static const GtkActionEntry entries[] = { .callback = G_CALLBACK(menu_cb_close), },{ + .name = "SendCtrlAltDel", + .label = "Send Ctrl-Alt-Del", + .callback = G_CALLBACK(menu_cb_send_ctrlaltdel), + + },{ .name = "MonitorStop", .stock_id = GTK_STOCK_MEDIA_PAUSE, .label = "_Pause", @@ -449,6 +486,14 @@ static const GtkToggleActionEntry tentries[] = { .label = "_Fullscreen", .accelerator = "F11", .callback = G_CALLBACK(menu_cb_fullscreen), + },{ + .name = "GrabMouse", + .label = "Enable _mouse grab", + .callback = G_CALLBACK(menu_cb_grab_mouse), + },{ + .name = "GrabKbd", + .label = "Enable _keyboard grab", + .callback = G_CALLBACK(menu_cb_grab_kbd), } }; @@ -462,6 +507,12 @@ static char ui_xml[] = " <menuitem action='ScaleDisplay'/>" " <menuitem action='FullScreen'/>" " </menu>" +" <menu action='InputMenu'>" +" <menuitem action='GrabMouse'/>" +" <menuitem action='GrabKbd'/>" +" <separator/>" +" <menuitem action='SendCtrlAltDel'/>" +" </menu>" " <menu action='VMMenu'>" " <menuitem action='MonitorStop'/>" " <menuitem action='MonitorCont'/>" @@ -59,6 +59,9 @@ struct qemu_window { /* vm info */ char version[32]; char name[128]; + + /* options */ + int quit_on_shutdown; }; /* qemu-gtk.c */ |