fpaquet / gtksheet

A spreadsheet widget for Gtk+
http://fpaquet.github.io/gtksheet/
Other
27 stars 9 forks source link

suppress pixman_region32_init_rect warnings (issue 15) #21

Closed wmclaugh closed 4 years ago

wmclaugh commented 4 years ago

This patch removes the warning messages: BUG In pixman_region32_init_rect: Invalid rectangle passed Set a breakpoint on '_pixman_log_error' to debug

which appear in the 4.3.3 release of gtksheet. The warnings occur when _gtk_sheet_row_buttons_size_allocate or _gtk_sheet_column_buttons_size_allocate are called where the calculations of width/height result in a negative value. The invalid (negative) width/height results in an invalid rectangle.

It appears that gtksheet initializes the sheet to:

sheet->sheet_window_width = 0;
sheet->sheet_window_height = 0;
sheet->column_title_area.height = _gtk_sheet_row_default_height(GTK_WIDGET(sheet));
sheet->row_title_area.width = GTK_SHEET_COLUMN_DEFAULT_WIDTH;

and then in the button allocations in gtksheet.c/gtksheetcolumn.c subtracts the title_area.width/height from the sheet_window_width/height, the subtraction results in a negative value.

This patch prevents the negative width/height so the warning does not appear. It does not address why the initial values can result in a negative width/height.