After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 169463 - GtkCellRenderText wrong focus height with selection=none and activatable cells
GtkCellRenderText wrong focus height with selection=none and activatable cells
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
2.6.x
Other All
: Normal major
: Small fix
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks:
 
 
Reported: 2005-03-07 07:47 UTC by Stefan Sauer (gstreamer, gtkdoc dev)
Modified: 2005-06-19 12:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testcase that shows wronge focus drawing (2.87 KB, text/x-csrc)
2005-04-11 07:56 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
Details

Description Stefan Sauer (gstreamer, gtkdoc dev) 2005-03-07 07:47:18 UTC
I have a GtkTreeView that I have set to 'fixed-height-mode'. I need that as I
need to know they height of all rows.
All cells are displayed by GtkCellRendererText.
I have set the 'height' property of one cell to a 'big' value (e.g. the first
column) to make to top and bottom line of the square focus mark visible in the
remaining columns.
Problem is, I don't really know the height. 
I guess something is reporting back the wrong height.
Comment 1 Stefan Sauer (gstreamer, gtkdoc dev) 2005-03-17 16:41:28 UTC
I've tried to trace this down further.
I use gtk_cell_renderer_text_set_fixed_height_from_font(renderer,1);
When looking into gtkcellrenderertext::get_size()
the height is calculated by:
2*ypad+
row*PANGO_PIXELS(row_height)

to me this misses some padding for the focus rectangle.
Is there a standard of how the focus is drawn (size and appearance)?

I've not yet found out who is handling that. The only parent class is
GtkCellRenderer().
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2005-04-11 07:56:10 UTC
Created attachment 45123 [details]
testcase that shows wronge focus drawing

build with:

gcc -Wall -g `pkg-config gtk+-2.0 --cflags --libs` treeview.c -o treeview
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2005-04-11 10:34:53 UTC
I've now added some output to gtktreeviewcolumn.c. The problem is at the end of 
gtk_tree_view_column_cell_process_action();

if (action == CELL_ACTION_FOCUS)
  {
    if (min_x >= max_x || min_y >= max_y)
      {
	*focus_rectangle = *cell_area;
	/* don't change the focus_rectangle, just draw it nicely inside
	 * the cell area */
      }
    else
      {
	focus_rectangle->x = min_x - focus_line_width;
	focus_rectangle->y = min_y - focus_line_width;
	focus_rectangle->width = (max_x - min_x) + 2 * focus_line_width;
	focus_rectangle->height = (max_y - min_y) + 2 * focus_line_width;
      }
  }

always using 
*focus_rectangle = *cell_area;
fixes the behaviour for me and also resolves :
http://bugzilla.gnome.org/show_bug.cgi?id=169464

Further this would allow to skip all the calculations above. Am I overseeing
something?

Comment 4 Matthias Clasen 2005-05-17 19:44:10 UTC
While I agree that the cell focus drawing may need improvements, always drawing
the focus around the whole cell is likely not the right solution. 

It is intentional that we draw the focus rectangle over the neighbouring rows,
IIRC my discussions with jrb correctly.
Comment 5 Kristian Rietveld 2005-06-19 12:46:25 UTC
We did not take the focus-line-width into account in validate_row(). Also, we
didn't take the focus-line-width into account when calculating the cell_area y
and height in gtk_tree_view_column_cell_process_action(). Both have been fixed
on CVS HEAD, so your issue should have been resolved.