summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--doc/de/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/en/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/fr/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/it/autogen/plugin_api/hdata.txt1
-rw-r--r--doc/ja/autogen/plugin_api/hdata.txt1
-rw-r--r--src/gui/gui-bar-window.c33
-rw-r--r--src/gui/gui-bar-window.h2
8 files changed, 37 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a58d48ef8..3d7f57eee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,14 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
-v0.4.0-rc2, 2013-01-11
+v0.4.0-rc2, 2013-01-12
Version 0.4.0 (under dev!)
--------------------------
+* core: fix line returned when clicking on a bar (according to position and
+ filling) (bug #38069)
* core: fix refresh of bars when applying layout (bug #37944, bug #37952)
* core: add buffer pointer in arguments for signals "input_search",
"input_text_changed" and "input_text_cursor_moved"
diff --git a/doc/de/autogen/plugin_api/hdata.txt b/doc/de/autogen/plugin_api/hdata.txt
index 56aba5055..5ae96233b 100644
--- a/doc/de/autogen/plugin_api/hdata.txt
+++ b/doc/de/autogen/plugin_api/hdata.txt
@@ -367,6 +367,7 @@
'items_num_lines' (pointer) +
'items_refresh_needed' (pointer) +
'screen_col_size' (integer) +
+ 'screen_lines' (integer) +
'coords_count' (integer) +
'coords' (pointer) +
'gui_objects' (pointer) +
diff --git a/doc/en/autogen/plugin_api/hdata.txt b/doc/en/autogen/plugin_api/hdata.txt
index 9f161265b..8ce90af62 100644
--- a/doc/en/autogen/plugin_api/hdata.txt
+++ b/doc/en/autogen/plugin_api/hdata.txt
@@ -367,6 +367,7 @@
'items_num_lines' (pointer) +
'items_refresh_needed' (pointer) +
'screen_col_size' (integer) +
+ 'screen_lines' (integer) +
'coords_count' (integer) +
'coords' (pointer) +
'gui_objects' (pointer) +
diff --git a/doc/fr/autogen/plugin_api/hdata.txt b/doc/fr/autogen/plugin_api/hdata.txt
index e03882865..bfd61b683 100644
--- a/doc/fr/autogen/plugin_api/hdata.txt
+++ b/doc/fr/autogen/plugin_api/hdata.txt
@@ -367,6 +367,7 @@
'items_num_lines' (pointer) +
'items_refresh_needed' (pointer) +
'screen_col_size' (integer) +
+ 'screen_lines' (integer) +
'coords_count' (integer) +
'coords' (pointer) +
'gui_objects' (pointer) +
diff --git a/doc/it/autogen/plugin_api/hdata.txt b/doc/it/autogen/plugin_api/hdata.txt
index 2a130e3ba..1b6b1a9c4 100644
--- a/doc/it/autogen/plugin_api/hdata.txt
+++ b/doc/it/autogen/plugin_api/hdata.txt
@@ -367,6 +367,7 @@
'items_num_lines' (pointer) +
'items_refresh_needed' (pointer) +
'screen_col_size' (integer) +
+ 'screen_lines' (integer) +
'coords_count' (integer) +
'coords' (pointer) +
'gui_objects' (pointer) +
diff --git a/doc/ja/autogen/plugin_api/hdata.txt b/doc/ja/autogen/plugin_api/hdata.txt
index 1e36c8260..06a665911 100644
--- a/doc/ja/autogen/plugin_api/hdata.txt
+++ b/doc/ja/autogen/plugin_api/hdata.txt
@@ -367,6 +367,7 @@
'items_num_lines' (pointer) +
'items_refresh_needed' (pointer) +
'screen_col_size' (integer) +
+ 'screen_lines' (integer) +
'coords_count' (integer) +
'coords' (pointer) +
'gui_objects' (pointer) +
diff --git a/src/gui/gui-bar-window.c b/src/gui/gui-bar-window.c
index 712b8f41b..3bbeb88dc 100644
--- a/src/gui/gui-bar-window.c
+++ b/src/gui/gui-bar-window.c
@@ -121,8 +121,8 @@ gui_bar_window_search_by_xy (struct t_gui_window *window, int x, int y,
{
struct t_gui_bar *ptr_bar;
struct t_gui_bar_window *ptr_bar_window;
- int filling, num_cols, column, lines, lines_old, i, j, coord_x, coord_y;
- int item, subitem;
+ int filling, position, num_cols, column, lines, lines_old, i, j;
+ int coord_x, coord_y, item, subitem;
*bar_window = NULL;
*bar_item = NULL;
@@ -162,6 +162,7 @@ gui_bar_window_search_by_xy (struct t_gui_window *window, int x, int y,
if (*bar_window)
{
filling = gui_bar_get_filling ((*bar_window)->bar);
+ position = CONFIG_INTEGER((*bar_window)->bar->options[GUI_BAR_OPTION_POSITION]);
*bar_item_line = y - (*bar_window)->y + (*bar_window)->scroll_y;
*bar_item_col = x - (*bar_window)->x + (*bar_window)->scroll_x;
@@ -169,7 +170,20 @@ gui_bar_window_search_by_xy (struct t_gui_window *window, int x, int y,
if ((filling == GUI_BAR_FILLING_COLUMNS_HORIZONTAL)
&& ((*bar_window)->screen_col_size > 0))
{
- num_cols = (*bar_window)->width / (*bar_window)->screen_col_size;
+ if ((position == GUI_BAR_POSITION_LEFT)
+ || (position == GUI_BAR_POSITION_RIGHT))
+ {
+ /*
+ * when the bar is on left/right, the last space (after last
+ * column) is not displayed, so we add 1 to width for finding
+ * number of columns)
+ */
+ num_cols = ((*bar_window)->width + 1) / (*bar_window)->screen_col_size;
+ }
+ else
+ {
+ num_cols = (*bar_window)->width / (*bar_window)->screen_col_size;
+ }
column = *bar_item_col / (*bar_window)->screen_col_size;
*bar_item_line = (*bar_item_line * num_cols) + column;
*bar_item_col = *bar_item_col - (column * ((*bar_window)->screen_col_size));
@@ -179,7 +193,7 @@ gui_bar_window_search_by_xy (struct t_gui_window *window, int x, int y,
&& ((*bar_window)->screen_col_size > 0))
{
column = *bar_item_col / (*bar_window)->screen_col_size;
- *bar_item_line = (column * ((*bar_window)->height)) + *bar_item_line;
+ *bar_item_line = (column * ((*bar_window)->screen_lines)) + *bar_item_line;
*bar_item_col = *bar_item_col % ((*bar_window)->screen_col_size);
}
@@ -412,6 +426,7 @@ gui_bar_window_content_alloc (struct t_gui_bar_window *bar_window)
bar_window->items_num_lines = NULL;
bar_window->items_refresh_needed = NULL;
bar_window->screen_col_size = 0;
+ bar_window->screen_lines = 0;
bar_window->items_subcount = malloc (bar_window->items_count *
sizeof (*bar_window->items_subcount));
if (!bar_window->items_subcount)
@@ -819,6 +834,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
lines = bar_window->height;
}
bar_window->screen_col_size = max_length_screen + 1;
+ bar_window->screen_lines = lines;
/* build array with pointers to split items */
@@ -1084,6 +1100,7 @@ gui_bar_window_new (struct t_gui_bar *bar, struct t_gui_window *window)
new_bar_window->items_num_lines = NULL;
new_bar_window->items_refresh_needed = NULL;
new_bar_window->screen_col_size = 0;
+ new_bar_window->screen_lines = 0;
new_bar_window->coords_count = 0;
new_bar_window->coords = NULL;
gui_bar_window_objects_init (new_bar_window);
@@ -1424,6 +1441,7 @@ gui_bar_window_hdata_bar_window_cb (void *data, const char *hdata_name)
HDATA_VAR(struct t_gui_bar_window, items_num_lines, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, items_refresh_needed, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, screen_col_size, INTEGER, 0, NULL, NULL);
+ HDATA_VAR(struct t_gui_bar_window, screen_lines, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, coords_count, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, coords, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, gui_objects, POINTER, 0, NULL, NULL);
@@ -1496,6 +1514,8 @@ gui_bar_window_add_to_infolist (struct t_infolist *infolist,
}
if (!infolist_new_var_integer (ptr_item, "screen_col_size", bar_window->screen_col_size))
return 0;
+ if (!infolist_new_var_integer (ptr_item, "screen_lines", bar_window->screen_lines))
+ return 0;
if (!infolist_new_var_pointer (ptr_item, "gui_objects", bar_window->gui_objects))
return 0;
@@ -1550,8 +1570,9 @@ gui_bar_window_print_log (struct t_gui_bar_window *bar_window)
log_printf (" items_content. . . . . . : 0x%lx", bar_window->items_content);
}
}
- log_printf (" screen_col_size. . . . : %d", bar_window->screen_col_size);
- log_printf (" coords_count . . . . . : %d", bar_window->coords_count);
+ log_printf (" screen_col_size. . . . : %d", bar_window->screen_col_size);
+ log_printf (" screen_lines . . . . . : %d", bar_window->screen_lines);
+ log_printf (" coords_count . . . . . : %d", bar_window->coords_count);
for (i = 0; i < bar_window->coords_count; i++)
{
log_printf (" coords[%03d]. . . . . . : item=%d, subitem=%d, "
diff --git a/src/gui/gui-bar-window.h b/src/gui/gui-bar-window.h
index b44f9e185..6e1703440 100644
--- a/src/gui/gui-bar-window.h
+++ b/src/gui/gui-bar-window.h
@@ -49,6 +49,8 @@ struct t_gui_bar_window
int **items_refresh_needed; /* refresh needed for (sub)item? */
int screen_col_size; /* size of columns on screen */
/* (for filling with columns) */
+ int screen_lines; /* number of lines on screen */
+ /* (for filling with columns) */
int coords_count; /* number of coords saved */
struct t_gui_bar_window_coords **coords; /* coords for filling horiz. */
/* (size is 5 * coords_count) */