wayland/inhibit-shortcuts-dialog: Only reuse last reply if there was one

We might have hidden the dialog, without a response. To avoid using the
not answered response, make sure we have actually got one before
reusing.

https://bugzilla.gnome.org/show_bug.cgi?id=786385
This commit is contained in:
Jonas Ådahl 2017-08-19 00:06:22 +08:00
parent 420a712ad5
commit a7915ff8ae

View File

@ -30,6 +30,7 @@ typedef struct _InhibitShortcutsData
MetaWaylandSurface *surface;
MetaWaylandSeat *seat;
MetaInhibitShortcutsDialog *dialog;
gboolean has_last_response;
MetaInhibitShortcutsDialogResponse last_response;
} InhibitShortcutsData;
@ -82,6 +83,7 @@ inhibit_shortcuts_dialog_response_cb (MetaInhibitShortcutsDialog *dialog,
InhibitShortcutsData *data)
{
data->last_response = response;
data->has_last_response = TRUE;
inhibit_shortcuts_dialog_response_apply (data);
meta_wayland_surface_hide_inhibit_shortcuts_dialog (data->surface);
}
@ -136,7 +138,7 @@ meta_wayland_surface_show_inhibit_shortcuts_dialog (MetaWaylandSurface *surface,
g_return_if_fail (META_IS_WAYLAND_SURFACE (surface));
data = surface_inhibit_shortcuts_data_get (surface);
if (data != NULL)
if (data && data->has_last_response)
{
/* The dialog was shown before for this surface but is not showing
* anymore, reuse the last user response.