summaryrefslogtreecommitdiff
path: root/src/gui/gui-window.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-07-26 18:50:29 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-07-26 18:50:29 +0200
commite0781f0390291e264e6dd9c17beae1342e87f9a2 (patch)
treeaac2f19ab7e527180952db15867d8daaa23c4a91 /src/gui/gui-window.c
parent2fec84314433c2b7152c6c47b1172a621257fe6f (diff)
downloadweechat-e0781f0390291e264e6dd9c17beae1342e87f9a2.zip
core: add mouse support (task #5435), free cursor movement, hook_focus, fix bugs with key "^" (bug #32072, bug #21381), fix bugs with bar windows, completion and /buffer
New features and bugs fixed: - mouse support: new command /mouse, new option weechat.look.mouse, new key context "mouse" - free movement of cursor: new command /cursor, new key context "cursor" - new hook_focus (used by cursor and mouse) - info "cursor_mode" - bugs fixed with key "^" - allow plugin name in /buffer name - fix bugs with bar windows: do not create bar windows for hidden bars - fix completion bug when two words for completion are equal but with different case - automatic scroll direction in /bar scroll (x/y is now optional)
Diffstat (limited to 'src/gui/gui-window.c')
-rw-r--r--src/gui/gui-window.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c
index bb22d1297..34102870e 100644
--- a/src/gui/gui-window.c
+++ b/src/gui/gui-window.c
@@ -70,9 +70,36 @@ struct t_gui_layout_window *gui_window_layout_before_zoom = NULL;
/* layout before zooming on a window */
int gui_window_layout_id_current_window = -1;
/* current window id before zoom */
+int gui_window_cursor_x = 0; /* cursor pos on screen */
+int gui_window_cursor_y = 0; /* cursor pos on screen */
/*
+ * gui_window_search_by_xy: get pointer of window displayed at (x,y)
+ * return NULL if no window is found
+ */
+
+struct t_gui_window *
+gui_window_search_by_xy (int x, int y)
+{
+ struct t_gui_window *ptr_window;
+
+ for (ptr_window = gui_windows; ptr_window;
+ ptr_window = ptr_window->next_window)
+ {
+ if ((x >= ptr_window->win_x) && (y >= ptr_window->win_y)
+ && (x <= ptr_window->win_x + ptr_window->win_width - 1)
+ && (y <= ptr_window->win_y + ptr_window->win_height - 1))
+ {
+ return ptr_window;
+ }
+ }
+
+ /* no window at this location */
+ return NULL;
+}
+
+/*
* gui_window_ask_refresh: set "gui_window_refresh_needed" flag
*/
@@ -1293,8 +1320,8 @@ gui_window_hdata_window_cb (void *data, const char *hdata_name)
HDATA_VAR(struct t_gui_window, win_chat_height, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_chat_cursor_x, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, win_chat_cursor_y, INTEGER, NULL);
- HDATA_VAR(struct t_gui_window, bar_windows, POINTER, NULL);
- HDATA_VAR(struct t_gui_window, last_bar_window, POINTER, NULL);
+ HDATA_VAR(struct t_gui_window, bar_windows, POINTER, "bar_window");
+ HDATA_VAR(struct t_gui_window, last_bar_window, POINTER, "bar_window");
HDATA_VAR(struct t_gui_window, refresh_needed, INTEGER, NULL);
HDATA_VAR(struct t_gui_window, gui_objects, POINTER, NULL);
HDATA_VAR(struct t_gui_window, buffer, POINTER, "buffer");