compositor: Expose MetaPlugin vmethod to create a MetaCloseDialog

So the actual close dialog can be overridden by MetaPlugin implementations.

https://bugzilla.gnome.org/show_bug.cgi?id=711619
This commit is contained in:
Carlos Garnacho 2017-01-26 19:48:52 +01:00
parent 020e0bb2ac
commit 68a9675d42
5 changed files with 38 additions and 0 deletions

View File

@ -62,4 +62,7 @@ gint64 meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
void meta_compositor_flash_window (MetaCompositor *compositor, void meta_compositor_flash_window (MetaCompositor *compositor,
MetaWindow *window); MetaWindow *window);
MetaCloseDialog * meta_compositor_create_close_dialog (MetaCompositor *compositor,
MetaWindow *window);
#endif /* META_COMPOSITOR_PRIVATE_H */ #endif /* META_COMPOSITOR_PRIVATE_H */

View File

@ -1414,3 +1414,11 @@ meta_compositor_show_window_menu_for_rect (MetaCompositor *compositor,
{ {
meta_plugin_manager_show_window_menu_for_rect (compositor->plugin_mgr, window, menu, rect); meta_plugin_manager_show_window_menu_for_rect (compositor->plugin_mgr, window, menu, rect);
} }
MetaCloseDialog *
meta_compositor_create_close_dialog (MetaCompositor *compositor,
MetaWindow *window)
{
return meta_plugin_manager_create_close_dialog (compositor->plugin_mgr,
window);
}

View File

@ -27,6 +27,7 @@
#include <meta/workspace.h> #include <meta/workspace.h>
#include "meta-module.h" #include "meta-module.h"
#include "window-private.h" #include "window-private.h"
#include "meta-close-dialog-default-private.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -376,3 +377,16 @@ meta_plugin_manager_show_window_menu_for_rect (MetaPluginManager *plugin_mgr,
if (klass->show_window_menu_for_rect) if (klass->show_window_menu_for_rect)
klass->show_window_menu_for_rect (plugin, window, menu, rect); klass->show_window_menu_for_rect (plugin, window, menu, rect);
} }
MetaCloseDialog *
meta_plugin_manager_create_close_dialog (MetaPluginManager *plugin_mgr,
MetaWindow *window)
{
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
if (klass->create_close_dialog)
return klass->create_close_dialog (plugin, window);
return meta_close_dialog_default_new (window);
}

View File

@ -91,5 +91,7 @@ void meta_plugin_manager_show_window_menu_for_rect (MetaPluginManager *mgr,
MetaWindowMenuType menu, MetaWindowMenuType menu,
MetaRectangle *rect); MetaRectangle *rect);
MetaCloseDialog * meta_plugin_manager_create_close_dialog (MetaPluginManager *plugin_mgr,
MetaWindow *window);
#endif #endif

View File

@ -26,6 +26,7 @@
#include <meta/compositor.h> #include <meta/compositor.h>
#include <meta/compositor-mutter.h> #include <meta/compositor-mutter.h>
#include <meta/meta-version.h> #include <meta/meta-version.h>
#include <meta/meta-close-dialog.h>
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include <X11/extensions/Xfixes.h> #include <X11/extensions/Xfixes.h>
@ -228,6 +229,16 @@ struct _MetaPluginClass
*/ */
const MetaPluginInfo * (*plugin_info) (MetaPlugin *plugin); const MetaPluginInfo * (*plugin_info) (MetaPlugin *plugin);
/**
* MetaPluginClass::create_close_dialog:
* @plugin: a #MetaPlugin
* @window: a #MetaWindow
*
* Virtual function called to create a "force quit" dialog
* on non-responsive clients.
*/
MetaCloseDialog * (* create_close_dialog) (MetaPlugin *plugin,
MetaWindow *window);
}; };
/** /**