compositor: add vmethod to override inhibit shortcut dialog

A MetaPlugin implementation of the MetaInhibitShortcutsDialog can be
used in place of the default inhibit shortcut.

https://bugzilla.gnome.org/show_bug.cgi?id=783342
This commit is contained in:
Olivier Fourdan 2017-06-14 11:20:54 +02:00
parent e3f76e9482
commit ce20c964a6
5 changed files with 41 additions and 0 deletions

View File

@ -65,4 +65,7 @@ void meta_compositor_flash_window (MetaCompositor *compositor,
MetaCloseDialog * meta_compositor_create_close_dialog (MetaCompositor *compositor,
MetaWindow *window);
MetaInhibitShortcutsDialog * meta_compositor_create_inhibit_shortcuts_dialog (MetaCompositor *compositor,
MetaWindow *window);
#endif /* META_COMPOSITOR_PRIVATE_H */

View File

@ -1422,3 +1422,11 @@ meta_compositor_create_close_dialog (MetaCompositor *compositor,
return meta_plugin_manager_create_close_dialog (compositor->plugin_mgr,
window);
}
MetaInhibitShortcutsDialog *
meta_compositor_create_inhibit_shortcuts_dialog (MetaCompositor *compositor,
MetaWindow *window)
{
return meta_plugin_manager_create_inhibit_shortcuts_dialog (compositor->plugin_mgr,
window);
}

View File

@ -28,6 +28,7 @@
#include "meta-module.h"
#include "window-private.h"
#include "meta-close-dialog-default-private.h"
#include "meta-inhibit-shortcuts-dialog-default-private.h"
#include <string.h>
#include <stdlib.h>
@ -390,3 +391,16 @@ meta_plugin_manager_create_close_dialog (MetaPluginManager *plugin_mgr,
return meta_close_dialog_default_new (window);
}
MetaInhibitShortcutsDialog *
meta_plugin_manager_create_inhibit_shortcuts_dialog (MetaPluginManager *plugin_mgr,
MetaWindow *window)
{
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
if (klass->create_inhibit_shortcuts_dialog)
return klass->create_inhibit_shortcuts_dialog (plugin, window);
return meta_inhibit_shortcuts_dialog_default_new (window);
}

View File

@ -94,4 +94,8 @@ void meta_plugin_manager_show_window_menu_for_rect (MetaPluginManager *mgr,
MetaCloseDialog * meta_plugin_manager_create_close_dialog (MetaPluginManager *plugin_mgr,
MetaWindow *window);
MetaInhibitShortcutsDialog *
meta_plugin_manager_create_inhibit_shortcuts_dialog (MetaPluginManager *plugin_mgr,
MetaWindow *window);
#endif

View File

@ -27,6 +27,7 @@
#include <meta/compositor-mutter.h>
#include <meta/meta-version.h>
#include <meta/meta-close-dialog.h>
#include <meta/meta-inhibit-shortcuts-dialog.h>
#include <clutter/clutter.h>
#include <X11/extensions/Xfixes.h>
@ -239,6 +240,17 @@ struct _MetaPluginClass
*/
MetaCloseDialog * (* create_close_dialog) (MetaPlugin *plugin,
MetaWindow *window);
/**
* MetaPluginClass::create_inhibit_shortcuts_dialog:
* @plugin: a #MetaPlugin
* @window: a #MetaWindow
*
* Virtual function called to create a "inhibit shortcuts" dialog
* when a client requests compositor shortcuts to be inhibited.
*/
MetaInhibitShortcutsDialog * (* create_inhibit_shortcuts_dialog) (MetaPlugin *plugin,
MetaWindow *window);
};
/**