qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 9/9] gtk: suppress accelerators from the File me


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH 9/9] gtk: suppress accelerators from the File menu when grab is active
Date: Fri, 22 Feb 2013 19:23:04 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2013-02-20 14:43, Anthony Liguori wrote:
> If you're full screen, you probably expect Ctrl-Q to go to the guest,
> not the host.  I think restricting certain menus is the right way to
> handle this generally speaking.
> 
> Signed-off-by: Anthony Liguori <address@hidden>
> ---
>  ui/gtk.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/ui/gtk.c b/ui/gtk.c
> index ffa9baa..29156be 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -78,6 +78,8 @@ typedef struct GtkDisplayState
>  
>      GtkWidget *menu_bar;
>  
> +    GtkAccelGroup *accel_group;
> +
>      GtkWidget *file_menu_item;
>      GtkWidget *file_menu;
>      GtkWidget *quit_item;
> @@ -296,6 +298,35 @@ static void gd_mouse_mode_change(Notifier *notify, void 
> *data)
>  
>  /** GTK Events **/
>  
> +static gboolean gd_window_key_event(GtkWidget *widget, GdkEventKey *key, 
> void *opaque)
> +{
> +    GtkDisplayState *s = opaque;
> +    GtkAccelGroupEntry *entries;
> +    guint n_entries = 0;
> +    gboolean propagate_accel = TRUE;
> +    gboolean handled = FALSE;
> +
> +    entries = gtk_accel_group_query(s->accel_group, key->keyval,
> +                                    key->state, &n_entries);

Doesn't work for me, always returns 0 n_entries (ok, beloved old Gnome
2). But this function appears to be for internal use only anyway [1].

Better suggestions? Otherwise I will build up a self-maintained
whitelist that we can check here.

> +    if (n_entries) {
> +        const char *quark = g_quark_to_string(entries[0].accel_path_quark);
> +
> +        if (gd_is_grab_active(s) && strstart(quark, "<QEMU>/File/", NULL)) {

Well, blacklisting was fragile anyway.

Jan

[1] https://mail.gnome.org/archives/commits-list/2012-May/msg07052.html

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux



reply via email to

[Prev in Thread] Current Thread [Next in Thread]