summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-01-29 22:14:15 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-01-29 22:14:15 +0200
commite0feeab5eb91b556c529d97da89b915ab821e285 (patch)
tree1397a7454321708e05c1de807ce7e28bb144a755
parent31a6a229bd5fdc81f6b9a14a8b5e0daf219e2418 (diff)
Fixed drawing of widget frames
In CertImportWidget at regular-DPI 1.0 scaling, the frames of the certificate and private key labels were drawn incorrectly. Now the non-button LabelWidget relies on Widget to draw the frames.
-rw-r--r--src/ui/labelwidget.c6
-rw-r--r--src/ui/widget.c2
2 files changed, 3 insertions, 5 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c
index bd8b71da..57136509 100644
--- a/src/ui/labelwidget.c
+++ b/src/ui/labelwidget.c
@@ -128,7 +128,7 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int
128 /* Default color state. */ 128 /* Default color state. */
129 *bg = isButton ? uiBackground_ColorId : none_ColorId; 129 *bg = isButton ? uiBackground_ColorId : none_ColorId;
130 *fg = uiText_ColorId; 130 *fg = uiText_ColorId;
131 *frame1 = isButton ? uiEmboss1_ColorId : uiFrame_ColorId; 131 *frame1 = isButton ? uiEmboss1_ColorId : d->widget.frameColor;
132 *frame2 = isButton ? uiEmboss2_ColorId : *frame1; 132 *frame2 = isButton ? uiEmboss2_ColorId : *frame1;
133 if (flags_Widget(w) & disabled_WidgetFlag && isButton) { 133 if (flags_Widget(w) & disabled_WidgetFlag && isButton) {
134 *fg = uiTextDisabled_ColorId; 134 *fg = uiTextDisabled_ColorId;
@@ -207,9 +207,6 @@ static void draw_LabelWidget_(const iLabelWidget *d) {
207 drawLines_Paint(&p, points + 2, 3, frame2); 207 drawLines_Paint(&p, points + 2, 3, frame2);
208 drawLines_Paint(&p, points, 3, frame); 208 drawLines_Paint(&p, points, 3, frame);
209 } 209 }
210 else {
211 drawRect_Paint(&p, frameRect, frame);
212 }
213 } 210 }
214 setClip_Paint(&p, rect); 211 setClip_Paint(&p, rect);
215 if (flags & wrapText_WidgetFlag) { 212 if (flags & wrapText_WidgetFlag) {
@@ -285,6 +282,7 @@ void init_LabelWidget(iLabelWidget *d, const char *label, const char *cmd) {
285 initCStr_String(&d->command, cmd); 282 initCStr_String(&d->command, cmd);
286 } 283 }
287 else { 284 else {
285 setFrameColor_Widget(&d->widget, uiFrame_ColorId);
288 init_String(&d->command); 286 init_String(&d->command);
289 } 287 }
290 d->key = 0; 288 d->key = 0;
diff --git a/src/ui/widget.c b/src/ui/widget.c
index 1d2aecf0..e2d0f922 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -637,7 +637,7 @@ void drawBackground_Widget(const iWidget *d) {
637 if (d->bgColor >= 0) { 637 if (d->bgColor >= 0) {
638 fillRect_Paint(&p, rect, d->bgColor); 638 fillRect_Paint(&p, rect, d->bgColor);
639 } 639 }
640 if (d->frameColor >= 0) { 640 if (d->frameColor >= 0 && ~d->flags & frameless_WidgetFlag) {
641 drawRectThickness_Paint(&p, rect, gap_UI / 4, d->frameColor); 641 drawRectThickness_Paint(&p, rect, gap_UI / 4, d->frameColor);
642 } 642 }
643 } 643 }