Skip to content

Commit

Permalink
Follow-up to [5f739d2253]: Inconsistency in whether widgets allow neg…
Browse files Browse the repository at this point in the history
…ative borderwidths.

Allow negative values for -padx/-pady for windows embedded in text
  • Loading branch information
jan.nijtmans committed Feb 21, 2025
1 parent 51d7bcd commit 78c9b63
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions generic/tkTextWind.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,19 +991,11 @@ EmbWinLayoutProc(
} else {
if (ewPtr->body.ew.padXObj) {
Tk_GetPixelsFromObj(NULL, textPtr->tkwin, ewPtr->body.ew.padXObj, &padX);
if (padX < 0) {
Tcl_DecrRefCount(ewPtr->body.ew.padXObj);
ewPtr->body.ew.padXObj = Tcl_NewIntObj(0);
Tcl_IncrRefCount(ewPtr->body.ew.padXObj);
}

}
if (ewPtr->body.ew.padYObj) {
Tk_GetPixelsFromObj(NULL, textPtr->tkwin, ewPtr->body.ew.padYObj, &padY);
if (padY < 0) {
Tcl_DecrRefCount(ewPtr->body.ew.padYObj);
ewPtr->body.ew.padYObj = Tcl_NewIntObj(0);
Tcl_IncrRefCount(ewPtr->body.ew.padYObj);
}

}
width = Tk_ReqWidth(ewPtr->body.ew.tkwin) + 2 * padX;
height = Tk_ReqHeight(ewPtr->body.ew.tkwin) + 2 * padY;
Expand Down Expand Up @@ -1271,19 +1263,9 @@ EmbWinBboxProc(
}
if (ewPtr->body.ew.padXObj) {
Tk_GetPixelsFromObj(NULL, textPtr->tkwin, ewPtr->body.ew.padXObj, &padX);
if (padX < 0) {
Tcl_DecrRefCount(ewPtr->body.ew.padXObj);
ewPtr->body.ew.padXObj = Tcl_NewIntObj(0);
Tcl_IncrRefCount(ewPtr->body.ew.padXObj);
}
}
if (ewPtr->body.ew.padYObj) {
Tk_GetPixelsFromObj(NULL, textPtr->tkwin, ewPtr->body.ew.padYObj, &padY);
if (padY < 0) {
Tcl_DecrRefCount(ewPtr->body.ew.padYObj);
ewPtr->body.ew.padYObj = Tcl_NewIntObj(0);
Tcl_IncrRefCount(ewPtr->body.ew.padYObj);
}
}
*xPtr = chunkPtr->x + padX;
if (ewPtr->body.ew.stretch) {
Expand Down

0 comments on commit 78c9b63

Please sign in to comment.