From 68a9675d42efd54bb4f4c0f5fd8da6ed60712afc Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 26 Jan 2017 19:48:52 +0100 Subject: [PATCH] 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 --- src/compositor/compositor-private.h | 3 +++ src/compositor/compositor.c | 8 ++++++++ src/compositor/meta-plugin-manager.c | 14 ++++++++++++++ src/compositor/meta-plugin-manager.h | 2 ++ src/meta/meta-plugin.h | 11 +++++++++++ 5 files changed, 38 insertions(+) diff --git a/src/compositor/compositor-private.h b/src/compositor/compositor-private.h index 4629fa5ff..1112da8cf 100644 --- a/src/compositor/compositor-private.h +++ b/src/compositor/compositor-private.h @@ -62,4 +62,7 @@ gint64 meta_compositor_monotonic_time_to_server_time (MetaDisplay *display, void meta_compositor_flash_window (MetaCompositor *compositor, MetaWindow *window); +MetaCloseDialog * meta_compositor_create_close_dialog (MetaCompositor *compositor, + MetaWindow *window); + #endif /* META_COMPOSITOR_PRIVATE_H */ diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index 9a69c66c5..a4fd235c4 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -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); } + +MetaCloseDialog * +meta_compositor_create_close_dialog (MetaCompositor *compositor, + MetaWindow *window) +{ + return meta_plugin_manager_create_close_dialog (compositor->plugin_mgr, + window); +} diff --git a/src/compositor/meta-plugin-manager.c b/src/compositor/meta-plugin-manager.c index 1a1b000cf..bcbf6827a 100644 --- a/src/compositor/meta-plugin-manager.c +++ b/src/compositor/meta-plugin-manager.c @@ -27,6 +27,7 @@ #include #include "meta-module.h" #include "window-private.h" +#include "meta-close-dialog-default-private.h" #include #include @@ -376,3 +377,16 @@ meta_plugin_manager_show_window_menu_for_rect (MetaPluginManager *plugin_mgr, if (klass->show_window_menu_for_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); +} diff --git a/src/compositor/meta-plugin-manager.h b/src/compositor/meta-plugin-manager.h index ff0b97652..f202945a0 100644 --- a/src/compositor/meta-plugin-manager.h +++ b/src/compositor/meta-plugin-manager.h @@ -91,5 +91,7 @@ void meta_plugin_manager_show_window_menu_for_rect (MetaPluginManager *mgr, MetaWindowMenuType menu, MetaRectangle *rect); +MetaCloseDialog * meta_plugin_manager_create_close_dialog (MetaPluginManager *plugin_mgr, + MetaWindow *window); #endif diff --git a/src/meta/meta-plugin.h b/src/meta/meta-plugin.h index 4f8136d63..85a738f09 100644 --- a/src/meta/meta-plugin.h +++ b/src/meta/meta-plugin.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -228,6 +229,16 @@ struct _MetaPluginClass */ 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); }; /**