Add a confirmation dialog for display changes
Unfortunately, display configuration can and does fail, due to unspecified HW constraints, drivers bugs, unsupported exotic configurations or just bad luck. So when the user makes a change in the control center, show a dialog asking him if it looks OK, and revert back after 20 seconds otherwise. https://bugzilla.gnome.org/show_bug.cgi?id=706208
This commit is contained in:

committed by
Giovanni Campagna

parent
c37c4d8c6d
commit
02224bb5fe
@ -75,6 +75,9 @@ static gboolean gnome_shell_plugin_xevent_filter (MetaPlugin *plugi
|
||||
|
||||
static gboolean gnome_shell_plugin_keybinding_filter (MetaPlugin *plugin,
|
||||
MetaKeyBinding *binding);
|
||||
|
||||
static void gnome_shell_plugin_confirm_display_change (MetaPlugin *plugin);
|
||||
|
||||
static const MetaPluginInfo *gnome_shell_plugin_plugin_info (MetaPlugin *plugin);
|
||||
|
||||
|
||||
@ -132,6 +135,9 @@ gnome_shell_plugin_class_init (GnomeShellPluginClass *klass)
|
||||
|
||||
plugin_class->xevent_filter = gnome_shell_plugin_xevent_filter;
|
||||
plugin_class->keybinding_filter = gnome_shell_plugin_keybinding_filter;
|
||||
|
||||
plugin_class->confirm_display_change = gnome_shell_plugin_confirm_display_change;
|
||||
|
||||
plugin_class->plugin_info = gnome_shell_plugin_plugin_info;
|
||||
}
|
||||
|
||||
@ -399,6 +405,12 @@ gnome_shell_plugin_keybinding_filter (MetaPlugin *plugin,
|
||||
return _shell_wm_filter_keybinding (get_shell_wm (), binding);
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_shell_plugin_confirm_display_change (MetaPlugin *plugin)
|
||||
{
|
||||
_shell_wm_confirm_display_change (get_shell_wm ());
|
||||
}
|
||||
|
||||
static const
|
||||
MetaPluginInfo *gnome_shell_plugin_plugin_info (MetaPlugin *plugin)
|
||||
{
|
||||
|
@ -38,6 +38,8 @@ void _shell_wm_kill_switch_workspace (ShellWM *wm);
|
||||
gboolean _shell_wm_filter_keybinding (ShellWM *wm,
|
||||
MetaKeyBinding *binding);
|
||||
|
||||
void _shell_wm_confirm_display_change (ShellWM *wm);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __SHELL_WM_PRIVATE_H__ */
|
||||
|
@ -27,6 +27,7 @@ enum
|
||||
KILL_SWITCH_WORKSPACE,
|
||||
KILL_WINDOW_EFFECTS,
|
||||
FILTER_KEYBINDING,
|
||||
CONFIRM_DISPLAY_CHANGE,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
@ -124,6 +125,13 @@ shell_wm_class_init (ShellWMClass *klass)
|
||||
g_signal_accumulator_true_handled, NULL, NULL,
|
||||
G_TYPE_BOOLEAN, 1,
|
||||
META_TYPE_KEY_BINDING);
|
||||
shell_wm_signals[CONFIRM_DISPLAY_CHANGE] =
|
||||
g_signal_new ("confirm-display-change",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@ -219,6 +227,20 @@ shell_wm_completed_destroy (ShellWM *wm,
|
||||
meta_plugin_destroy_completed (wm->plugin, actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_wm_complete_display_change:
|
||||
* @wm: the ShellWM
|
||||
* @ok: if the new configuration was OK
|
||||
*
|
||||
* The plugin must call this after the user responded to the confirmation dialog.
|
||||
*/
|
||||
void
|
||||
shell_wm_complete_display_change (ShellWM *wm,
|
||||
gboolean ok)
|
||||
{
|
||||
meta_plugin_complete_display_change (wm->plugin, ok);
|
||||
}
|
||||
|
||||
void
|
||||
_shell_wm_kill_switch_workspace (ShellWM *wm)
|
||||
{
|
||||
@ -287,6 +309,12 @@ _shell_wm_filter_keybinding (ShellWM *wm,
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
_shell_wm_confirm_display_change (ShellWM *wm)
|
||||
{
|
||||
g_signal_emit (wm, shell_wm_signals[CONFIRM_DISPLAY_CHANGE], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* shell_wm_new:
|
||||
* @plugin: the #MetaPlugin
|
||||
|
@ -39,6 +39,9 @@ void shell_wm_completed_destroy (ShellWM *wm,
|
||||
MetaWindowActor *actor);
|
||||
void shell_wm_completed_switch_workspace (ShellWM *wm);
|
||||
|
||||
void shell_wm_complete_display_change (ShellWM *wm,
|
||||
gboolean ok);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __SHELL_WM_H__ */
|
||||
|
Reference in New Issue
Block a user