[ui_x11.c] draw keypad in one loop

This commit is contained in:
Gwenhael Le Moine 2024-05-16 16:34:50 +02:00
parent 45f37f9d9e
commit 976ec1f1cb
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -1208,10 +1208,7 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, x11_keypad_t* k
for ( i = FIRST_HPKEY; i <= LAST_HPKEY; i++ ) { for ( i = FIRST_HPKEY; i <= LAST_HPKEY; i++ ) {
CreateButton( i, offset_x, offset_y, f_small, f_med, f_big ); CreateButton( i, offset_x, offset_y, f_small, f_med, f_big );
if ( i < HPKEY_MTH ) pixel = ( i < HPKEY_MTH ) ? COLOR( DISP_PAD ) : COLOR( PAD );
pixel = COLOR( DISP_PAD );
else
pixel = COLOR( PAD );
if ( buttons[ i ].letter != ( char* )0 ) { if ( buttons[ i ].letter != ( char* )0 ) {
XSetBackground( dpy, gc, pixel ); XSetBackground( dpy, gc, pixel );
@ -1227,16 +1224,10 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, x11_keypad_t* k
DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].letter, 1 ); DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].letter, 1 );
} }
}
XFreeFont( dpy, f_big ); /*
XFreeFont( dpy, f_med ); * draw the bottom labels
XFreeFont( dpy, f_small ); */
/*
* draw the bottom labels
*/
for ( i = FIRST_HPKEY; i <= LAST_HPKEY; i++ ) {
if ( buttons[ i ].sub != ( char* )0 ) { if ( buttons[ i ].sub != ( char* )0 ) {
XSetBackground( dpy, gc, pixel ); XSetBackground( dpy, gc, pixel );
XSetForeground( dpy, gc, COLOR( WHITE ) ); XSetForeground( dpy, gc, COLOR( WHITE ) );
@ -1246,12 +1237,10 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, x11_keypad_t* k
DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].sub, strlen( buttons[ i ].sub ) ); DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].sub, strlen( buttons[ i ].sub ) );
} }
}
/* /*
* draw the left labels * draw the left labels
*/ */
for ( i = FIRST_HPKEY; i <= LAST_HPKEY; i++ ) {
if ( buttons[ i ].left != ( char* )0 ) { if ( buttons[ i ].left != ( char* )0 ) {
if ( buttons[ i ].is_menu ) { if ( buttons[ i ].is_menu ) {
/* /*
@ -1319,14 +1308,10 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, x11_keypad_t* k
DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].left, strlen( buttons[ i ].left ) ); DrawSmallString( dpy, keypad->pixmap, gc, x, y, buttons[ i ].left, strlen( buttons[ i ].left ) );
} }
} }
}
/*
* draw the right labels
*/
for ( i = FIRST_HPKEY; i <= LAST_HPKEY; i++ ) {
pixel = ( i < HPKEY_MTH ) ? COLOR( DISP_PAD ) : COLOR( PAD );
/*
* draw the right labels
*/
if ( buttons[ i ].right != ( char* )0 ) { if ( buttons[ i ].right != ( char* )0 ) {
if ( buttons[ i ].is_menu ) { if ( buttons[ i ].is_menu ) {
/* /*
@ -1396,6 +1381,10 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x, x11_keypad_t* k
} }
} }
XFreeFont( dpy, f_big );
XFreeFont( dpy, f_med );
XFreeFont( dpy, f_small );
/* /*
* at last draw the v--- LAST ---v thing * at last draw the v--- LAST ---v thing
*/ */