From efc90173b1c2c32d1db598af53e30b6da5a66f88 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 10 Feb 2012 10:27:14 -0500 Subject: [PATCH] display: Add signals for plugins to know when a grab op begins/ends https://bugzilla.gnome.org/show_bug.cgi?id=670658 --- src/core/display.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/core/display.c b/src/core/display.c index 713114a3e..267903c27 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -51,6 +51,8 @@ #include #include #include +#include "mutter-enum-types.h" + #ifdef HAVE_SOLARIS_XINERAMA #include #endif @@ -135,6 +137,8 @@ enum WINDOW_CREATED, WINDOW_DEMANDS_ATTENTION, WINDOW_MARKED_URGENT, + GRAB_OP_BEGIN, + GRAB_OP_END, LAST_SIGNAL }; @@ -258,6 +262,28 @@ meta_display_class_init (MetaDisplayClass *klass) G_TYPE_NONE, 1, META_TYPE_WINDOW); + display_signals[GRAB_OP_BEGIN] = + g_signal_new ("grab-op-begin", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, NULL, + G_TYPE_NONE, 3, + META_TYPE_SCREEN, + META_TYPE_WINDOW, + META_TYPE_GRAB_OP); + + display_signals[GRAB_OP_END] = + g_signal_new ("grab-op-end", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, NULL, + G_TYPE_NONE, 3, + META_TYPE_SCREEN, + META_TYPE_WINDOW, + META_TYPE_GRAB_OP); + g_object_class_install_property (object_class, PROP_FOCUS_WINDOW, g_param_spec_object ("focus-window", @@ -3702,6 +3728,9 @@ meta_display_begin_grab_op (MetaDisplay *display, { meta_window_refresh_resize_popup (display->grab_window); } + + g_signal_emit (display, display_signals[GRAB_OP_BEGIN], 0, + screen, display->grab_window, display->grab_op); return TRUE; } @@ -3716,6 +3745,9 @@ meta_display_end_grab_op (MetaDisplay *display, if (display->grab_op == META_GRAB_OP_NONE) return; + g_signal_emit (display, display_signals[GRAB_OP_END], 0, + display->grab_screen, display->grab_window, display->grab_op); + if (display->grab_window != NULL) display->grab_window->shaken_loose = FALSE;