Skip to content

Commit d9423cb

Browse files
use less global variables
1 parent 835a88e commit d9423cb

File tree

2 files changed

+80
-106
lines changed

2 files changed

+80
-106
lines changed

src/ui_sdl.c

Lines changed: 80 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@
1717
#include "ui.h"
1818
#include "ui_inner.h"
1919

20-
#define _KEYBOARD_HEIGHT ( BUTTONS[ LAST_HPKEY ].y + BUTTONS[ LAST_HPKEY ].h )
21-
#define _KEYBOARD_WIDTH ( BUTTONS[ LAST_HPKEY ].x + BUTTONS[ LAST_HPKEY ].w )
20+
#define KEYBOARD_HEIGHT ( BUTTONS[ LAST_HPKEY ].y + BUTTONS[ LAST_HPKEY ].h )
21+
#define KEYBOARD_WIDTH ( BUTTONS[ LAST_HPKEY ].x + BUTTONS[ LAST_HPKEY ].w )
2222

23-
#define _TOP_SKIP 65
24-
#define _SIDE_SKIP 20
25-
#define _BOTTOM_SKIP 25
26-
#define _DISP_KBD_SKIP 65
27-
#define _KBD_UPLINE 25
23+
#define TOP_SKIP 65
24+
#define SIDE_SKIP 20
25+
#define BOTTOM_SKIP 25
26+
#define DISP_KBD_SKIP 65
27+
#define KBD_UPLINE 25
2828

29-
#define _DISPLAY_WIDTH ( 264 + 8 )
30-
#define _DISPLAY_HEIGHT ( 128 + 16 + 8 )
31-
#define _DISPLAY_OFFSET_X ( SIDE_SKIP + ( 286 - DISPLAY_WIDTH ) / 2 )
32-
#define _DISPLAY_OFFSET_Y TOP_SKIP
29+
#define DISPLAY_WIDTH ( 264 + 8 )
30+
#define DISPLAY_HEIGHT ( 128 + 16 + 8 )
31+
#define DISPLAY_OFFSET_X ( SIDE_SKIP + ( 286 - DISPLAY_WIDTH ) / 2 )
32+
#define DISPLAY_OFFSET_Y TOP_SKIP
3333

34-
#define _DISP_FRAME 8
34+
#define DISP_FRAME 8
3535

36-
#define _KEYBOARD_OFFSET_X SIDE_SKIP
37-
#define _KEYBOARD_OFFSET_Y ( TOP_SKIP + DISPLAY_HEIGHT + DISP_KBD_SKIP )
36+
#define KEYBOARD_OFFSET_X SIDE_SKIP
37+
#define KEYBOARD_OFFSET_Y ( TOP_SKIP + DISPLAY_HEIGHT + DISP_KBD_SKIP )
3838

3939
/***********/
4040
/* typedef */
@@ -47,9 +47,7 @@ typedef struct sdl_surfaces_on_off_struct_t {
4747
/*************/
4848
/* variables */
4949
/*************/
50-
// This will take the value of the defines, but can be run-time modified
51-
static unsigned KEYBOARD_HEIGHT, KEYBOARD_WIDTH, TOP_SKIP, SIDE_SKIP, BOTTOM_SKIP, DISP_KBD_SKIP, DISPLAY_WIDTH, DISPLAY_HEIGHT,
52-
DISPLAY_OFFSET_X, DISPLAY_OFFSET_Y, DISP_FRAME, KEYBOARD_OFFSET_X, KEYBOARD_OFFSET_Y, KBD_UPLINE;
50+
static int display_offset_x, display_offset_y;
5351

5452
static unsigned int ARGBColors[ NB_COLORS ];
5553
static sdl_surfaces_on_off_struct_t sdl_buttons[ NB_KEYS ];
@@ -497,9 +495,9 @@ static void _draw_header( void )
497495
// insert the HP Logo
498496
surf = bitmap_to_surface( hp_width, hp_height, hp_bitmap, ARGBColors[ LOGO ], ARGBColors[ LOGO_BACK ] );
499497
if ( opt_gx )
500-
x = DISPLAY_OFFSET_X - 6;
498+
x = display_offset_x - 6;
501499
else
502-
x = DISPLAY_OFFSET_X;
500+
x = display_offset_x;
503501

504502
SDL_Rect srect;
505503
SDL_Rect drect;
@@ -515,18 +513,18 @@ static void _draw_header( void )
515513
SDL_FreeSurface( surf );
516514

517515
if ( !opt_gx ) {
518-
lineColor( sdlwindow, DISPLAY_OFFSET_X, 9, DISPLAY_OFFSET_X + hp_width - 1, 9, bgra2argb( ARGBColors[ FRAME ] ) );
519-
lineColor( sdlwindow, DISPLAY_OFFSET_X - 1, 10, DISPLAY_OFFSET_X - 1, 10 + hp_height - 1, bgra2argb( ARGBColors[ FRAME ] ) );
520-
lineColor( sdlwindow, DISPLAY_OFFSET_X, 10 + hp_height, DISPLAY_OFFSET_X + hp_width - 1, 10 + hp_height,
516+
lineColor( sdlwindow, display_offset_x, 9, display_offset_x + hp_width - 1, 9, bgra2argb( ARGBColors[ FRAME ] ) );
517+
lineColor( sdlwindow, display_offset_x - 1, 10, display_offset_x - 1, 10 + hp_height - 1, bgra2argb( ARGBColors[ FRAME ] ) );
518+
lineColor( sdlwindow, display_offset_x, 10 + hp_height, display_offset_x + hp_width - 1, 10 + hp_height,
521519
bgra2argb( ARGBColors[ FRAME ] ) );
522-
lineColor( sdlwindow, DISPLAY_OFFSET_X + hp_width, 10, DISPLAY_OFFSET_X + hp_width, 10 + hp_height - 1,
520+
lineColor( sdlwindow, display_offset_x + hp_width, 10, display_offset_x + hp_width, 10 + hp_height - 1,
523521
bgra2argb( ARGBColors[ FRAME ] ) );
524522
}
525523

526524
// write the name of it
527525

528526
if ( opt_gx ) {
529-
x = DISPLAY_OFFSET_X + display_width - gx_128K_ram_width + gx_128K_ram_x_hot + 2;
527+
x = display_offset_x + display_width - gx_128K_ram_width + gx_128K_ram_x_hot + 2;
530528
y = 10 + gx_128K_ram_y_hot;
531529

532530
surf = bitmap_to_surface( gx_128K_ram_width, gx_128K_ram_height, gx_128K_ram_bitmap, ARGBColors[ LABEL ], ARGBColors[ DISP_PAD ] );
@@ -541,7 +539,7 @@ static void _draw_header( void )
541539
SDL_BlitSurface( surf, &srect, sdlwindow, &drect );
542540
SDL_FreeSurface( surf );
543541

544-
x = DISPLAY_OFFSET_X + hp_width;
542+
x = display_offset_x + hp_width;
545543
y = hp_height + 8 - hp48gx_height;
546544
surf = bitmap_to_surface( hp48gx_width, hp48gx_height, hp48gx_bitmap, ARGBColors[ LOGO ], ARGBColors[ DISP_PAD ] );
547545
srect.x = 0;
@@ -555,7 +553,7 @@ static void _draw_header( void )
555553
SDL_BlitSurface( surf, &srect, sdlwindow, &drect );
556554
SDL_FreeSurface( surf );
557555

558-
x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width + gx_silver_x_hot + 2;
556+
x = display_offset_x + DISPLAY_WIDTH - gx_128K_ram_width + gx_silver_x_hot + 2;
559557
y = 10 + gx_silver_y_hot;
560558
surf = bitmap_to_surface( gx_silver_width, gx_silver_height, gx_silver_bitmap, ARGBColors[ LOGO ],
561559
0 ); // Background transparent: draw only silver line
@@ -570,7 +568,7 @@ static void _draw_header( void )
570568
SDL_BlitSurface( surf, &srect, sdlwindow, &drect );
571569
SDL_FreeSurface( surf );
572570

573-
x = DISPLAY_OFFSET_X + display_width - gx_128K_ram_width + gx_green_x_hot + 2;
571+
x = display_offset_x + display_width - gx_128K_ram_width + gx_green_x_hot + 2;
574572
y = 10 + gx_green_y_hot;
575573
surf = bitmap_to_surface( gx_green_width, gx_green_height, gx_green_bitmap, ARGBColors[ RIGHT ],
576574
0 ); // Background transparent: draw only green menu
@@ -585,7 +583,7 @@ static void _draw_header( void )
585583
SDL_BlitSurface( surf, &srect, sdlwindow, &drect );
586584
SDL_FreeSurface( surf );
587585
} else {
588-
x = DISPLAY_OFFSET_X;
586+
x = display_offset_x;
589587
y = TOP_SKIP - DISP_FRAME - hp48sx_height - 3;
590588
surf = bitmap_to_surface( hp48sx_width, hp48sx_height, hp48sx_bitmap, ARGBColors[ RIGHT ],
591589
0 ); // Background transparent: draw only green menu
@@ -600,7 +598,7 @@ static void _draw_header( void )
600598
SDL_BlitSurface( surf, &srect, sdlwindow, &drect );
601599
SDL_FreeSurface( surf );
602600

603-
x = DISPLAY_OFFSET_X + display_width - 1 - science_width;
601+
x = display_offset_x + display_width - 1 - science_width;
604602
y = TOP_SKIP - DISP_FRAME - science_height - 4;
605603
surf = bitmap_to_surface( science_width, science_height, science_bitmap, ARGBColors[ RIGHT ],
606604
0 ); // Background transparent: draw only green menu
@@ -975,68 +973,61 @@ static void _draw_keypad( void )
975973

976974
static void _draw_bezel_LCD( void )
977975
{
978-
unsigned int i;
979-
int display_height = DISPLAY_HEIGHT;
980-
int display_width = DISPLAY_WIDTH;
981-
982-
// draw the frame around the display
983-
for ( i = 0; i < DISP_FRAME; i++ ) {
984-
lineColor( sdlwindow, DISPLAY_OFFSET_X - i, DISPLAY_OFFSET_Y + display_height + 2 * i, DISPLAY_OFFSET_X + display_width + i,
985-
DISPLAY_OFFSET_Y + display_height + 2 * i, bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) );
986-
lineColor( sdlwindow, DISPLAY_OFFSET_X - i, DISPLAY_OFFSET_Y + display_height + 2 * i + 1, DISPLAY_OFFSET_X + display_width + i,
987-
DISPLAY_OFFSET_Y + display_height + 2 * i + 1, bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) );
988-
lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + i, DISPLAY_OFFSET_Y - i, DISPLAY_OFFSET_X + display_width + i,
989-
DISPLAY_OFFSET_Y + display_height + 2 * i, bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) );
990-
}
991-
992-
for ( i = 0; i < DISP_FRAME; i++ ) {
993-
lineColor( sdlwindow, DISPLAY_OFFSET_X - i - 1, DISPLAY_OFFSET_Y - i - 1, DISPLAY_OFFSET_X + display_width + i - 1,
994-
DISPLAY_OFFSET_Y - i - 1, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) );
995-
lineColor( sdlwindow, DISPLAY_OFFSET_X - i - 1, DISPLAY_OFFSET_Y - i - 1, DISPLAY_OFFSET_X - i - 1,
996-
DISPLAY_OFFSET_Y + display_height + 2 * i - 1, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) );
976+
for ( int i = 0; i < DISP_FRAME; i++ ) {
977+
lineColor( sdlwindow, display_offset_x - i, display_offset_y + DISPLAY_HEIGHT + 2 * i, display_offset_x + DISPLAY_WIDTH + i,
978+
display_offset_y + DISPLAY_HEIGHT + 2 * i, bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) );
979+
lineColor( sdlwindow, display_offset_x - i, display_offset_y + DISPLAY_HEIGHT + 2 * i + 1, display_offset_x + DISPLAY_WIDTH + i,
980+
display_offset_y + DISPLAY_HEIGHT + 2 * i + 1, bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) );
981+
lineColor( sdlwindow, display_offset_x + DISPLAY_WIDTH + i, display_offset_y - i, display_offset_x + DISPLAY_WIDTH + i,
982+
display_offset_y + DISPLAY_HEIGHT + 2 * i, bgra2argb( ARGBColors[ DISP_PAD_TOP ] ) );
983+
984+
lineColor( sdlwindow, display_offset_x - i - 1, display_offset_y - i - 1, display_offset_x + DISPLAY_WIDTH + i - 1,
985+
display_offset_y - i - 1, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) );
986+
lineColor( sdlwindow, display_offset_x - i - 1, display_offset_y - i - 1, display_offset_x - i - 1,
987+
display_offset_y + DISPLAY_HEIGHT + 2 * i - 1, bgra2argb( ARGBColors[ DISP_PAD_BOT ] ) );
997988
}
998989

999990
// round off corners
1000-
lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, DISPLAY_OFFSET_Y - DISP_FRAME, DISPLAY_OFFSET_X - DISP_FRAME + 3,
1001-
DISPLAY_OFFSET_Y - DISP_FRAME, bgra2argb( ARGBColors[ DISP_PAD ] ) );
1002-
lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, DISPLAY_OFFSET_Y - DISP_FRAME, DISPLAY_OFFSET_X - DISP_FRAME,
1003-
DISPLAY_OFFSET_Y - DISP_FRAME + 3, bgra2argb( ARGBColors[ DISP_PAD ] ) );
1004-
pixelColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME + 1, DISPLAY_OFFSET_Y - DISP_FRAME + 1, bgra2argb( ARGBColors[ DISP_PAD ] ) );
1005-
1006-
lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 4, DISPLAY_OFFSET_Y - DISP_FRAME,
1007-
DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y - DISP_FRAME, bgra2argb( ARGBColors[ DISP_PAD ] ) );
1008-
lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y - DISP_FRAME,
1009-
DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y - DISP_FRAME + 3, bgra2argb( ARGBColors[ DISP_PAD ] ) );
1010-
pixelColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 2, DISPLAY_OFFSET_Y - DISP_FRAME + 1,
991+
lineColor( sdlwindow, display_offset_x - DISP_FRAME, display_offset_y - DISP_FRAME, display_offset_x - DISP_FRAME + 3,
992+
display_offset_y - DISP_FRAME, bgra2argb( ARGBColors[ DISP_PAD ] ) );
993+
lineColor( sdlwindow, display_offset_x - DISP_FRAME, display_offset_y - DISP_FRAME, display_offset_x - DISP_FRAME,
994+
display_offset_y - DISP_FRAME + 3, bgra2argb( ARGBColors[ DISP_PAD ] ) );
995+
pixelColor( sdlwindow, display_offset_x - DISP_FRAME + 1, display_offset_y - DISP_FRAME + 1, bgra2argb( ARGBColors[ DISP_PAD ] ) );
996+
997+
lineColor( sdlwindow, display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 4, display_offset_y - DISP_FRAME,
998+
display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1, display_offset_y - DISP_FRAME, bgra2argb( ARGBColors[ DISP_PAD ] ) );
999+
lineColor( sdlwindow, display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1, display_offset_y - DISP_FRAME,
1000+
display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1, display_offset_y - DISP_FRAME + 3, bgra2argb( ARGBColors[ DISP_PAD ] ) );
1001+
pixelColor( sdlwindow, display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 2, display_offset_y - DISP_FRAME + 1,
10111002
bgra2argb( ARGBColors[ DISP_PAD ] ) );
10121003

1013-
lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 4,
1014-
DISPLAY_OFFSET_X - DISP_FRAME, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1, bgra2argb( ARGBColors[ DISP_PAD ] ) );
1015-
lineColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1,
1016-
DISPLAY_OFFSET_X - DISP_FRAME + 3, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1,
1004+
lineColor( sdlwindow, display_offset_x - DISP_FRAME, display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 4,
1005+
display_offset_x - DISP_FRAME, display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1, bgra2argb( ARGBColors[ DISP_PAD ] ) );
1006+
lineColor( sdlwindow, display_offset_x - DISP_FRAME, display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1,
1007+
display_offset_x - DISP_FRAME + 3, display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1,
10171008
bgra2argb( ARGBColors[ DISP_PAD ] ) );
1018-
pixelColor( sdlwindow, DISPLAY_OFFSET_X - DISP_FRAME + 1, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 2,
1009+
pixelColor( sdlwindow, display_offset_x - DISP_FRAME + 1, display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 2,
10191010
bgra2argb( ARGBColors[ DISP_PAD ] ) );
10201011

1021-
lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 4,
1022-
DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1,
1012+
lineColor( sdlwindow, display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1, display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 4,
1013+
display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1, display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1,
10231014
bgra2argb( ARGBColors[ DISP_PAD ] ) );
1024-
lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 4, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1,
1025-
DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1,
1015+
lineColor( sdlwindow, display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 4, display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1,
1016+
display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 1, display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1,
10261017
bgra2argb( ARGBColors[ DISP_PAD ] ) );
1027-
pixelColor( sdlwindow, DISPLAY_OFFSET_X + display_width + DISP_FRAME - 2, DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 2,
1018+
pixelColor( sdlwindow, display_offset_x + DISPLAY_WIDTH + DISP_FRAME - 2, display_offset_y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 2,
10281019
bgra2argb( ARGBColors[ DISP_PAD ] ) );
10291020

10301021
// simulate rounded lcd corners
10311022

1032-
lineColor( sdlwindow, DISPLAY_OFFSET_X - 1, DISPLAY_OFFSET_Y + 1, DISPLAY_OFFSET_X - 1, DISPLAY_OFFSET_Y + display_height - 2,
1023+
lineColor( sdlwindow, display_offset_x - 1, display_offset_y + 1, display_offset_x - 1, display_offset_y + DISPLAY_HEIGHT - 2,
10331024
bgra2argb( ARGBColors[ LCD ] ) );
1034-
lineColor( sdlwindow, DISPLAY_OFFSET_X + 1, DISPLAY_OFFSET_Y - 1, DISPLAY_OFFSET_X + display_width - 2, DISPLAY_OFFSET_Y - 1,
1025+
lineColor( sdlwindow, display_offset_x + 1, display_offset_y - 1, display_offset_x + DISPLAY_WIDTH - 2, display_offset_y - 1,
10351026
bgra2argb( ARGBColors[ LCD ] ) );
1036-
lineColor( sdlwindow, DISPLAY_OFFSET_X + 1, DISPLAY_OFFSET_Y + display_height, DISPLAY_OFFSET_X + display_width - 2,
1037-
DISPLAY_OFFSET_Y + display_height, bgra2argb( ARGBColors[ LCD ] ) );
1038-
lineColor( sdlwindow, DISPLAY_OFFSET_X + display_width, DISPLAY_OFFSET_Y + 1, DISPLAY_OFFSET_X + display_width,
1039-
DISPLAY_OFFSET_Y + display_height - 2, bgra2argb( ARGBColors[ LCD ] ) );
1027+
lineColor( sdlwindow, display_offset_x + 1, display_offset_y + DISPLAY_HEIGHT, display_offset_x + DISPLAY_WIDTH - 2,
1028+
display_offset_y + DISPLAY_HEIGHT, bgra2argb( ARGBColors[ LCD ] ) );
1029+
lineColor( sdlwindow, display_offset_x + DISPLAY_WIDTH, display_offset_y + 1, display_offset_x + DISPLAY_WIDTH,
1030+
display_offset_y + DISPLAY_HEIGHT - 2, bgra2argb( ARGBColors[ LCD ] ) );
10401031
}
10411032

10421033
static void _draw_background( int width, int height, int w_top, int h_top )
@@ -1058,8 +1049,8 @@ static void _draw_background_LCD( void )
10581049
{
10591050
SDL_Rect rect;
10601051

1061-
rect.x = DISPLAY_OFFSET_X;
1062-
rect.y = DISPLAY_OFFSET_Y;
1052+
rect.x = display_offset_x;
1053+
rect.y = display_offset_y;
10631054
rect.w = DISPLAY_WIDTH;
10641055
rect.h = DISPLAY_HEIGHT;
10651056
SDL_FillRect( sdlwindow, &rect, ARGBColors[ LCD ] );
@@ -1166,8 +1157,8 @@ static void _draw_serial_devices_path( void )
11661157
static void sdl_draw_nibble( int nx, int ny, int val )
11671158
{
11681159
int x, y;
1169-
int xoffset = DISPLAY_OFFSET_X + 5;
1170-
int yoffset = DISPLAY_OFFSET_Y + 20;
1160+
int xoffset = display_offset_x + 5;
1161+
int yoffset = display_offset_y + 20;
11711162

11721163
SDL_LockSurface( sdlwindow );
11731164
unsigned char* buffer = ( unsigned char* )sdlwindow->pixels;
@@ -1396,16 +1387,16 @@ void sdl_draw_annunc( void )
13961387
srect.y = 0;
13971388
srect.w = ann_tbl[ i ].width;
13981389
srect.h = ann_tbl[ i ].height;
1399-
drect.x = DISPLAY_OFFSET_X + ann_tbl[ i ].x;
1400-
drect.y = DISPLAY_OFFSET_Y + ann_tbl[ i ].y;
1390+
drect.x = display_offset_x + ann_tbl[ i ].x;
1391+
drect.y = display_offset_y + ann_tbl[ i ].y;
14011392
drect.w = ann_tbl[ i ].width;
14021393
drect.h = ann_tbl[ i ].height;
14031394

14041395
SDL_BlitSurface( ( annunc_state ) ? sdl_ann_tbl[ i ].surfaceon : sdl_ann_tbl[ i ].surfaceoff, &srect, sdlwindow, &drect );
14051396
}
14061397

14071398
// Always immediately update annunciators
1408-
SDL_UpdateRect( sdlwindow, DISPLAY_OFFSET_X + ann_tbl[ 0 ].x, DISPLAY_OFFSET_Y + ann_tbl[ 0 ].y,
1399+
SDL_UpdateRect( sdlwindow, display_offset_x + ann_tbl[ 0 ].x, display_offset_y + ann_tbl[ 0 ].y,
14091400
ann_tbl[ 5 ].x + ann_tbl[ 5 ].width - ann_tbl[ 0 ].x, ann_tbl[ 5 ].y + ann_tbl[ 5 ].height - ann_tbl[ 0 ].y );
14101401
}
14111402

@@ -1452,31 +1443,17 @@ void init_sdl_ui( int argc, char** argv )
14521443
// On exit: clean SDL
14531444
atexit( SDL_Quit );
14541445

1455-
// Initialize the geometric values
1456-
KEYBOARD_HEIGHT = _KEYBOARD_HEIGHT;
1457-
KEYBOARD_WIDTH = _KEYBOARD_WIDTH;
1458-
TOP_SKIP = _TOP_SKIP;
1459-
SIDE_SKIP = _SIDE_SKIP;
1460-
BOTTOM_SKIP = _BOTTOM_SKIP;
1461-
DISP_KBD_SKIP = _DISP_KBD_SKIP;
1462-
DISPLAY_WIDTH = _DISPLAY_WIDTH;
1463-
DISPLAY_HEIGHT = _DISPLAY_HEIGHT;
1464-
DISPLAY_OFFSET_X = _DISPLAY_OFFSET_X;
1465-
DISPLAY_OFFSET_Y = _DISPLAY_OFFSET_Y;
1466-
DISP_FRAME = _DISP_FRAME;
1467-
KEYBOARD_OFFSET_X = _KEYBOARD_OFFSET_X;
1468-
KEYBOARD_OFFSET_Y = _KEYBOARD_OFFSET_Y;
1469-
KBD_UPLINE = _KBD_UPLINE;
1470-
14711446
unsigned int width, height;
1447+
display_offset_x = DISPLAY_OFFSET_X;
1448+
display_offset_y = DISPLAY_OFFSET_Y;
1449+
width = ( BUTTONS[ LAST_HPKEY ].x + BUTTONS[ LAST_HPKEY ].w ) + 2 * SIDE_SKIP;
1450+
height = display_offset_y + DISPLAY_HEIGHT + DISP_KBD_SKIP + BUTTONS[ LAST_HPKEY ].y + BUTTONS[ LAST_HPKEY ].h + BOTTOM_SKIP;
1451+
14721452
if ( config.hide_chrome ) {
14731453
width = DISPLAY_WIDTH;
14741454
height = DISPLAY_HEIGHT;
1475-
DISPLAY_OFFSET_X = 0;
1476-
DISPLAY_OFFSET_Y = 0;
1477-
} else {
1478-
width = ( BUTTONS[ LAST_HPKEY ].x + BUTTONS[ LAST_HPKEY ].w ) + 2 * SIDE_SKIP;
1479-
height = DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + DISP_KBD_SKIP + BUTTONS[ LAST_HPKEY ].y + BUTTONS[ LAST_HPKEY ].h + BOTTOM_SKIP;
1455+
display_offset_x = 0;
1456+
display_offset_y = 0;
14801457
}
14811458

14821459
uint32_t sdl_window_flags = SDL_SWSURFACE | SDL_RESIZABLE;
@@ -1490,8 +1467,6 @@ void init_sdl_ui( int argc, char** argv )
14901467
exit( 1 );
14911468
}
14921469

1493-
/* BUTTONS = opt_gx ? BUTTONS_gx : BUTTONS_sx; */
1494-
14951470
colors_setup();
14961471

14971472
if ( !config.hide_chrome ) {

src/ui_x11.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2899,7 +2899,6 @@ void x11_get_event( void )
28992899
if ( cm->data.l[ 0 ] == ( long )wm_delete_window )
29002900
please_exit = true;
29012901
if ( cm->data.l[ 0 ] == ( long )wm_save_yourself ) {
2902-
/* save_command_line(); */
29032902
int wm_argc = 0;
29042903
char** wm_argv = ( char** )malloc( ( saved_argc + 5 ) * sizeof( char* ) );
29052904

0 commit comments

Comments
 (0)