mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
wayland/inhibit-shortcuts-dialog: Make the dialog ownership clearer
Make it clear that the data object is the owner of the dialog; it creates it, and eventually destroys it. https://bugzilla.gnome.org/show_bug.cgi?id=786385
This commit is contained in:
parent
dceb0f1f1f
commit
c1439e141e
@ -30,6 +30,7 @@ typedef struct _InhibitShortcutsData
|
|||||||
MetaWaylandSurface *surface;
|
MetaWaylandSurface *surface;
|
||||||
MetaWaylandSeat *seat;
|
MetaWaylandSeat *seat;
|
||||||
MetaInhibitShortcutsDialog *dialog;
|
MetaInhibitShortcutsDialog *dialog;
|
||||||
|
gulong response_handler_id;
|
||||||
gboolean has_last_response;
|
gboolean has_last_response;
|
||||||
MetaInhibitShortcutsDialogResponse last_response;
|
MetaInhibitShortcutsDialogResponse last_response;
|
||||||
} InhibitShortcutsData;
|
} InhibitShortcutsData;
|
||||||
@ -50,11 +51,19 @@ surface_inhibit_shortcuts_data_set (MetaWaylandSurface *surface,
|
|||||||
data);
|
data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
surface_inhibit_shortcuts_data_destroy_dialog (InhibitShortcutsData *data)
|
||||||
|
{
|
||||||
|
g_signal_handler_disconnect (data->dialog, data->response_handler_id);
|
||||||
|
meta_inhibit_shortcuts_dialog_hide (data->dialog);
|
||||||
|
g_clear_object (&data->dialog);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
surface_inhibit_shortcuts_data_free (InhibitShortcutsData *data)
|
surface_inhibit_shortcuts_data_free (InhibitShortcutsData *data)
|
||||||
{
|
{
|
||||||
meta_inhibit_shortcuts_dialog_hide (data->dialog);
|
if (data->dialog)
|
||||||
|
surface_inhibit_shortcuts_data_destroy_dialog (data);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,15 +77,6 @@ on_surface_destroyed (MetaWaylandSurface *surface,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
surface_inhibit_shortcuts_dialog_free (gpointer ptr,
|
|
||||||
GClosure *closure)
|
|
||||||
{
|
|
||||||
InhibitShortcutsData *data = ptr;
|
|
||||||
|
|
||||||
meta_wayland_surface_hide_inhibit_shortcuts_dialog (data->surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
inhibit_shortcuts_dialog_response_apply (InhibitShortcutsData *data)
|
inhibit_shortcuts_dialog_response_apply (InhibitShortcutsData *data)
|
||||||
{
|
{
|
||||||
@ -125,11 +125,10 @@ meta_wayland_surface_ensure_inhibit_shortcuts_dialog (MetaWaylandSurface *surfac
|
|||||||
data->surface = surface;
|
data->surface = surface;
|
||||||
data->seat = seat;
|
data->seat = seat;
|
||||||
data->dialog = dialog;
|
data->dialog = dialog;
|
||||||
|
data->response_handler_id =
|
||||||
g_signal_connect_data (dialog, "response",
|
g_signal_connect (dialog, "response",
|
||||||
G_CALLBACK (inhibit_shortcuts_dialog_response_cb),
|
G_CALLBACK (inhibit_shortcuts_dialog_response_cb),
|
||||||
data, surface_inhibit_shortcuts_dialog_free,
|
data);
|
||||||
0);
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user