dtappbuilder: set the minimum limit for rows and columns to avoid rollover.
This commit is contained in:
@@ -720,7 +720,7 @@ ui_size_to_row_col(
|
|||||||
XFontStruct *font;
|
XFontStruct *font;
|
||||||
unsigned long charwidth;
|
unsigned long charwidth;
|
||||||
unsigned long lineheight;
|
unsigned long lineheight;
|
||||||
Dimension pane_width, pane_height;
|
int pane_width, pane_height;
|
||||||
|
|
||||||
if (XtIsSubclass(text, dtTermWidgetClass))
|
if (XtIsSubclass(text, dtTermWidgetClass))
|
||||||
XtVaGetValues(text,
|
XtVaGetValues(text,
|
||||||
@@ -776,8 +776,8 @@ ui_size_to_row_col(
|
|||||||
pane_width = width - (vsb_width + spacing) - (2*p_margin_w);
|
pane_width = width - (vsb_width + spacing) - (2*p_margin_w);
|
||||||
pane_height = height - (hsb_height + spacing) - (2*p_margin_h);
|
pane_height = height - (hsb_height + spacing) - (2*p_margin_h);
|
||||||
|
|
||||||
*row_ptr = (int)((pane_height - (2*margin_h))/lineheight);
|
*row_ptr = (int)(max(0, pane_height - 2 * margin_h) / lineheight);
|
||||||
*col_ptr = (int)((pane_width - (2*margin_w))/charwidth);
|
*col_ptr = (int)(max(0, pane_width - 2 * margin_w) / charwidth);
|
||||||
|
|
||||||
/* For some reason, above calculations result in rows being 1 too
|
/* For some reason, above calculations result in rows being 1 too
|
||||||
* large for a scrolled list widget; put in workaround until
|
* large for a scrolled list widget; put in workaround until
|
||||||
|
|||||||
Reference in New Issue
Block a user