summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2012-01-28 17:18:15 +0100
committerSebastien Helleu <flashcode@flashtux.org>2012-01-28 17:18:15 +0100
commit8ea2b93a28fb8d8eabd99fd849b4c5a3f7e164e8 (patch)
treee0204e069387e456059cda8ae2c0ab5fca29f97c /src
parent3ecd3d7a26fec260a4ca0655690057873b780c80 (diff)
downloadweechat-8ea2b93a28fb8d8eabd99fd849b4c5a3f7e164e8.zip
core: add signal "window_switch"
Diffstat (limited to 'src')
-rw-r--r--src/gui/curses/gui-curses-window.c3
-rw-r--r--src/gui/gtk/gui-gtk-window.c5
-rw-r--r--src/gui/gui-window.c10
3 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index 60dea1bda..b708dc4dd 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -1178,6 +1178,9 @@ gui_window_switch (struct t_gui_window *window)
old_window->refresh_needed = 1;
gui_input_move_to_buffer (old_window->buffer, window->buffer);
+
+ hook_signal_send ("window_switch",
+ WEECHAT_HOOK_SIGNAL_POINTER, gui_current_window);
}
/*
diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c
index 933982d5b..48eaa7695 100644
--- a/src/gui/gtk/gui-gtk-window.c
+++ b/src/gui/gtk/gui-gtk-window.c
@@ -30,7 +30,9 @@
#include "../../core/weechat.h"
#include "../../core/wee-config.h"
+#include "../../core/wee-hook.h"
#include "../../core/wee-log.h"
+#include "../../plugins/plugin.h"
#include "../gui-window.h"
#include "../gui-bar.h"
#include "../gui-buffer.h"
@@ -185,6 +187,9 @@ gui_window_switch (struct t_gui_window *window)
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer, 1);
gui_window_redraw_buffer (gui_current_window->buffer);
+
+ hook_signal_send ("window_switch",
+ WEECHAT_HOOK_SIGNAL_POINTER, window);
}
/*
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index d7bfdd0dc..921d4708e 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -889,9 +889,11 @@ gui_window_coords_alloc (struct t_gui_window *window)
void
gui_window_free (struct t_gui_window *window)
{
- struct t_gui_window *ptr_win;
+ struct t_gui_window *ptr_win, *old_current_window;
int i;
+ old_current_window = gui_current_window;
+
hook_signal_send ("window_closing", WEECHAT_HOOK_SIGNAL_POINTER, window);
if (window->buffer)
@@ -946,6 +948,12 @@ gui_window_free (struct t_gui_window *window)
hook_signal_send ("window_closed", WEECHAT_HOOK_SIGNAL_POINTER, window);
free (window);
+
+ if (gui_current_window != old_current_window)
+ {
+ hook_signal_send ("window_switch",
+ WEECHAT_HOOK_SIGNAL_POINTER, gui_current_window);
+ }
}
/*