mirror of
https://github.com/brl/mutter.git
synced 2025-03-25 04:33:52 +00:00
core: Add meta_close_dialog_focus() vmethod
This is used to request key focus on the close dialog whenever a window that is frozen would receive key focus. Also, ensure that the dialog gets focus when first shown if the window was meant to receive input. https://bugzilla.gnome.org/show_bug.cgi?id=762083
This commit is contained in:
parent
2d8d9dea97
commit
408292959e
@ -66,6 +66,11 @@ meta_window_set_alive (MetaWindow *window,
|
|||||||
{
|
{
|
||||||
meta_window_ensure_close_dialog (window);
|
meta_window_ensure_close_dialog (window);
|
||||||
meta_close_dialog_show (window->close_dialog);
|
meta_close_dialog_show (window->close_dialog);
|
||||||
|
|
||||||
|
if (window->display &&
|
||||||
|
window->display->event_route == META_EVENT_ROUTE_NORMAL &&
|
||||||
|
window == window->display->focus_window)
|
||||||
|
meta_close_dialog_focus (window->close_dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,3 +121,22 @@ meta_close_dialog_is_visible (MetaCloseDialog *dialog)
|
|||||||
{
|
{
|
||||||
return GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (dialog), quark_visible));
|
return GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (dialog), quark_visible));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* meta_close_dialog_focus:
|
||||||
|
* @dialog: a #MetaCloseDialog
|
||||||
|
*
|
||||||
|
* Call whenever @dialog should receive keyboard focus,
|
||||||
|
* usually when the window would.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
meta_close_dialog_focus (MetaCloseDialog *dialog)
|
||||||
|
{
|
||||||
|
MetaCloseDialogInterface *iface;
|
||||||
|
|
||||||
|
g_return_if_fail (META_IS_CLOSE_DIALOG (dialog));
|
||||||
|
|
||||||
|
iface = META_CLOSE_DIALOG_GET_IFACE (dialog);
|
||||||
|
if (iface->focus)
|
||||||
|
iface->focus (dialog);
|
||||||
|
}
|
||||||
|
@ -4369,6 +4369,10 @@ meta_window_focus (MetaWindow *window,
|
|||||||
clutter_stage_set_key_focus (stage, NULL);
|
clutter_stage_set_key_focus (stage, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (window->close_dialog &&
|
||||||
|
meta_close_dialog_is_visible (window->close_dialog))
|
||||||
|
meta_close_dialog_focus (window->close_dialog);
|
||||||
|
|
||||||
if (window->wm_state_demands_attention)
|
if (window->wm_state_demands_attention)
|
||||||
meta_window_unset_demands_attention(window);
|
meta_window_unset_demands_attention(window);
|
||||||
|
|
||||||
|
@ -42,10 +42,12 @@ struct _MetaCloseDialogInterface
|
|||||||
|
|
||||||
void (* show) (MetaCloseDialog *dialog);
|
void (* show) (MetaCloseDialog *dialog);
|
||||||
void (* hide) (MetaCloseDialog *dialog);
|
void (* hide) (MetaCloseDialog *dialog);
|
||||||
|
void (* focus) (MetaCloseDialog *dialog);
|
||||||
};
|
};
|
||||||
|
|
||||||
void meta_close_dialog_show (MetaCloseDialog *dialog);
|
void meta_close_dialog_show (MetaCloseDialog *dialog);
|
||||||
void meta_close_dialog_hide (MetaCloseDialog *dialog);
|
void meta_close_dialog_hide (MetaCloseDialog *dialog);
|
||||||
|
void meta_close_dialog_focus (MetaCloseDialog *dialog);
|
||||||
gboolean meta_close_dialog_is_visible (MetaCloseDialog *dialog);
|
gboolean meta_close_dialog_is_visible (MetaCloseDialog *dialog);
|
||||||
|
|
||||||
void meta_close_dialog_response (MetaCloseDialog *dialog,
|
void meta_close_dialog_response (MetaCloseDialog *dialog,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user