diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2013-02-12 12:14:22 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2013-02-12 12:14:22 +0100 |
commit | 10820c73365ac3a910907c1284db6b7904a4c81c (patch) | |
tree | f3610bf1c8991caf76afa86d3eea34d6893fd6bb /src | |
parent | 0cb84638dcd8b570a663e56dcf516d6adbe1c076 (diff) | |
download | weechat-10820c73365ac3a910907c1284db6b7904a4c81c.zip |
core: add signal "window_opened" (task #12464)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui-window.c | 151 |
1 files changed, 77 insertions, 74 deletions
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index 4cee77ddb..c3aae7d84 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -588,85 +588,88 @@ gui_window_new (struct t_gui_window *parent_window, struct t_gui_buffer *buffer, ptr_leaf = gui_windows_tree; } - if ((new_window = (malloc (sizeof (*new_window))))) + new_window = (malloc (sizeof (*new_window))); + if (!new_window) + return NULL; + + /* create scroll structure */ + new_window->scroll = malloc (sizeof (*new_window->scroll)); + if (!new_window->scroll) { - /* create scroll structure */ - new_window->scroll = malloc (sizeof (*new_window->scroll)); - if (!new_window->scroll) - { - free (new_window); - return NULL; - } + free (new_window); + return NULL; + } - /* create window objects */ - if (!gui_window_objects_init (new_window)) - { - free (new_window->scroll); - free (new_window); - return NULL; - } + /* create window objects */ + if (!gui_window_objects_init (new_window)) + { + free (new_window->scroll); + free (new_window); + return NULL; + } - /* number */ - new_window->number = (last_gui_window) ? last_gui_window->number + 1 : 1; - - /* position & size */ - new_window->win_x = x; - new_window->win_y = y; - new_window->win_width = width; - new_window->win_height = height; - new_window->win_width_pct = width_pct; - new_window->win_height_pct = height_pct; - - /* chat window */ - new_window->win_chat_x = 0; - new_window->win_chat_y = 0; - new_window->win_chat_width = 0; - new_window->win_chat_height = 0; - new_window->win_chat_cursor_x = 0; - new_window->win_chat_cursor_y = 0; - - /* bar windows */ - new_window->bar_windows = NULL; - new_window->last_bar_window = NULL; - - /* refresh */ - new_window->refresh_needed = 0; - - /* buffer and layout infos */ - new_window->buffer = buffer; - new_window->layout_plugin_name = NULL; - new_window->layout_buffer_name = NULL; - - /* scroll */ - gui_window_scroll_init (new_window->scroll, buffer); - - /* coordinates */ - new_window->coords_size = 0; - new_window->coords = NULL; - new_window->coords_x_message = 0; - - /* tree */ - new_window->ptr_tree = ptr_leaf; - ptr_leaf->window = new_window; - - /* add window to windows queue */ - new_window->prev_window = last_gui_window; - if (gui_windows) - last_gui_window->next_window = new_window; - else - gui_windows = new_window; - last_gui_window = new_window; - new_window->next_window = NULL; + /* number */ + new_window->number = (last_gui_window) ? last_gui_window->number + 1 : 1; + + /* position & size */ + new_window->win_x = x; + new_window->win_y = y; + new_window->win_width = width; + new_window->win_height = height; + new_window->win_width_pct = width_pct; + new_window->win_height_pct = height_pct; + + /* chat window */ + new_window->win_chat_x = 0; + new_window->win_chat_y = 0; + new_window->win_chat_width = 0; + new_window->win_chat_height = 0; + new_window->win_chat_cursor_x = 0; + new_window->win_chat_cursor_y = 0; + + /* bar windows */ + new_window->bar_windows = NULL; + new_window->last_bar_window = NULL; + + /* refresh */ + new_window->refresh_needed = 0; + + /* buffer and layout infos */ + new_window->buffer = buffer; + new_window->layout_plugin_name = NULL; + new_window->layout_buffer_name = NULL; + + /* scroll */ + gui_window_scroll_init (new_window->scroll, buffer); + + /* coordinates */ + new_window->coords_size = 0; + new_window->coords = NULL; + new_window->coords_x_message = 0; + + /* tree */ + new_window->ptr_tree = ptr_leaf; + ptr_leaf->window = new_window; + + /* add window to windows queue */ + new_window->prev_window = last_gui_window; + if (gui_windows) + last_gui_window->next_window = new_window; + else + gui_windows = new_window; + last_gui_window = new_window; + new_window->next_window = NULL; - /* create bar windows */ - for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) - { - if (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) - gui_bar_window_new (ptr_bar, new_window); - } + /* create bar windows */ + for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) + { + if (CONFIG_INTEGER(ptr_bar->options[GUI_BAR_OPTION_TYPE]) != GUI_BAR_TYPE_ROOT) + gui_bar_window_new (ptr_bar, new_window); } - else - return NULL; + + /* send signal */ + hook_signal_send ("window_opened", + WEECHAT_HOOK_SIGNAL_POINTER, new_window); return new_window; } |