From a044b187b87b7acbb4c7c639fce63bfed7a8c49a Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Sun, 5 Dec 2021 15:16:39 +0900 Subject: [PATCH] gsudo: Icon for panel, fixup overflowing password box --- apps/gsudo.c | 7 +++++-- base/usr/share/icons/48/lock.png | Bin 0 -> 1462 bytes 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 base/usr/share/icons/48/lock.png diff --git a/apps/gsudo.c b/apps/gsudo.c index 41d408dc..a3db53ab 100644 --- a/apps/gsudo.c +++ b/apps/gsudo.c @@ -110,8 +110,11 @@ static void redraw(char * username, char * password, int fails, char * argv[]) { for (unsigned int i = 0; i < strlen(password) && i < 512/4; ++i) { strcat(password_circles, "●"); } + + gfx_context_t * clipped = init_graphics_subregion(myctx, 32, 122, prompt->width - 74, 22); tt_set_size(tt_font_thin, FONT_SIZE_PASSWD); - tt_draw_string(myctx, tt_font_thin, 33, 118 + FONT_SIZE_PASSWD, password_circles, FONT_COLOR); + tt_draw_string(clipped, tt_font_thin, 1, FONT_SIZE_PASSWD - 5, password_circles, FONT_COLOR); + free(clipped); draw_fill(ctx, rgba(0,0,0,200)); draw_sprite(ctx, prompt, (ctx->width - prompt->width) / 2, (ctx->height - prompt->height) / 2); @@ -229,7 +232,7 @@ int main(int argc, char ** argv) { window = yutani_window_create(yctx, width, height); yutani_window_move(yctx, window, 0, 0); - yutani_window_advertise(yctx, window, "gsudo"); + yutani_window_advertise_icon(yctx, window, "gsudo", "lock"); tt_font_thin = tt_font_from_shm("sans-serif"); ctx = init_graphics_yutani_double_buffer(window); diff --git a/base/usr/share/icons/48/lock.png b/base/usr/share/icons/48/lock.png new file mode 100644 index 0000000000000000000000000000000000000000..76c0c679be49f66dd6fa19fb4d20fc7d34516ba0 GIT binary patch literal 1462 zcmV;n1xfmeP)Juz?HDU#UD{6A zI=WuF-gbqwD%hobzV^ zYzE*3uzF#43P2PJ6h#50)Kaag zsu&&~#^B%}pP8BY*y(g0K62zpdO10k1;7}qC4`(;6lHr`TN^}CT#gN5u^2+35JI8Q zuawdkySlpmEY_oF0LGY12)X3*`L_9dzQyl#UB~3)Bx11`rlzKlN~NIdIymQ`l%lGt z3N!Q&pMn^|6Ffh>1Id5l-sm0{6cFyk;A>>0vQ5M5%nuhW5afHKR zgu~&OVHn>Eg7AxJnj?ZB%r2BUCnhGI92y$h+1uN@ud%UlV_RDr+-^6#UN4f#Bosy2 z9t;Lg0(iTqJjDz?cI=oUNz&kf0|x|A6p=_IFg7-Z{{DV#c6RotX__A~#^&;QFvdhd z5Dtl=*wfkBDQ(!W0h*?vudff`aM(B-QE3JAP_JLc?1FhR zXRT%utPW(1IczrD{;gZLLf3VSjEo?g%_5mhp6c%IK4;bEKELl(RXx?$H-8uPcswu+ z1C-L&PM{?xn&on-`&u!c~bf(L9 zxRd}1^QI2`bKa8p-KRczcV~-Xqw#~RH%74j0x5OW!v(HP=he zZCk=slmfpk&9F|M+gnYl_Nria~)dhFU#0|5Bu%k%Ad>#a6wt_QxpbQRHP6n48E6Y&W4w=OsK!+j~G7`=HN z`&%D*#VnC!fEqV&aJP<$L<9g(`!pa~o-d2=eWp0yf&gc~`VkI?1effDOJ23Gbt02; zLXe%Xi=|N*h6!EEVinIItU@K=n!$8rV!lBt zgIq3G5`Z88b~}YA*&r=`C{}N@!)vd`;6VQO{DJ^BYFj+&4^u8Vy1e8Iir&6kQvH8^ zBC7zDTNQwEs{&ANRRGGZ3P8D40Vucf0uYX?@yPh&%CbarngPObHQ$)L0Fi{Y?_%KE zjdDQDX$F43cKZ*AbWgrlm9Wg; QJ^%m!07*qoM6N<$g0eEFG5`Po literal 0 HcmV?d00001