everybody HAVE_XSHM; deduplicate colors_sx/gx

This commit is contained in:
Gwenhael Le Moine 2023-05-03 16:09:50 +02:00
parent af52793518
commit c69b172736
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
6 changed files with 454 additions and 395 deletions

View file

@ -270,10 +270,8 @@ void do_shutdown( void ) {
device.display_touched = 0;
update_display();
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
if ( disp.display_update )
refresh_display();
#endif
#endif
}
@ -300,10 +298,8 @@ void do_shutdown( void ) {
got_alarm = 0;
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
if ( disp.display_update )
refresh_display();
#endif
#endif
ticks = get_t1_t2();

View file

@ -529,10 +529,8 @@ static void do_load( int argc, char** argv ) {
init_display();
update_display();
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
if ( disp.display_update )
refresh_display();
#endif
#endif
} else {
printf( "Loading emulator-state from files failed.\n" );
@ -1177,10 +1175,8 @@ int debug( void ) {
device.display_touched = 0;
update_display();
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
if ( disp.display_update )
refresh_display();
#endif
#endif
}

View file

@ -2379,10 +2379,8 @@ inline void schedule( void ) {
got_alarm = 0;
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
if ( disp.display_update )
refresh_display();
#endif
#endif
get_ui_event();

View file

@ -56,7 +56,7 @@ void init_nibble_maps( void ) {
nibble_maps[ i ] =
XCreateBitmapFromData( dpy, disp.win, ( char* )nibbles[ i ], 8, 2 );
}
#ifdef HAVE_XSHM
if ( shm_flag ) {
if ( disp.disp_image->bitmap_bit_order == MSBFirst ) {
nibble_bits[ 0x0 ] = 0x00; /* ---- */
@ -94,10 +94,10 @@ void init_nibble_maps( void ) {
nibble_bits[ 0xf ] = 0xff; /* **** */
}
}
#endif
}
#endif
#if defined( GUI_IS_SDL1 )
#elif defined( GUI_IS_SDL1 )
ann_struct_t ann_tbl[] = {
{ ANN_LEFT, 16, 4, ann_left_width, ann_left_height, ann_left_bits },
{ ANN_RIGHT, 61, 4, ann_right_width, ann_right_height, ann_right_bits },
@ -205,11 +205,9 @@ void update_display( void ) {
static int old_offset = -1;
static int old_lines = -1;
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
int addr_pad;
int val, line_pad, line_length;
word_20 data_addr, data_addr_2;
#endif
#endif
if ( !disp.mapped ) {
@ -221,7 +219,6 @@ void update_display( void ) {
if ( display.on ) {
addr = display.disp_start;
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
if ( shm_flag ) {
data_addr = 0;
data_addr_2 = disp.disp_image->bytes_per_line;
@ -242,7 +239,6 @@ void update_display( void ) {
}
disp.display_update |= UPDATE_DISP;
} else {
#endif
#endif
if ( display.offset != old_offset ) {
memset(
@ -265,14 +261,11 @@ void update_display( void ) {
addr += display.nibs_per_line;
}
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
}
#endif
#endif
if ( i < DISP_ROWS ) {
addr = display.menu_start;
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
if ( shm_flag ) {
data_addr = 0;
data_addr_2 = disp.menu_image->bytes_per_line;
@ -291,21 +284,17 @@ void update_display( void ) {
}
disp.display_update |= UPDATE_MENU;
} else {
#endif
#endif
for ( ; i < DISP_ROWS; i++ ) {
draw_row( addr, i );
addr += NIBBLES_PER_ROW;
}
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
}
#endif
#endif
}
} else {
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
if ( shm_flag ) {
memset( disp.disp_image->data, 0,
( size_t )( disp.disp_image->bytes_per_line *
@ -315,7 +304,6 @@ void update_display( void ) {
disp.menu_image->height ) );
disp.display_update = UPDATE_DISP | UPDATE_MENU;
} else {
#endif
#endif
memset( disp_buf, 0xf0, sizeof( disp_buf ) );
for ( i = 0; i < 64; i++ ) {
@ -324,9 +312,7 @@ void update_display( void ) {
}
}
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
}
#endif
#endif
}
}
@ -343,9 +329,7 @@ void redraw_display( void ) {
void disp_draw_nibble( word_20 addr, word_4 val ) {
long offset;
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
int shm_addr;
#endif
#endif
int x, y;
@ -358,7 +342,6 @@ void disp_draw_nibble( word_20 addr, word_4 val ) {
if ( y < 0 || y > 63 )
return;
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
if ( shm_flag ) {
shm_addr = ( 2 * y * disp.disp_image->bytes_per_line ) + x;
disp.disp_image->data[ shm_addr ] = nibble_bits[ val ];
@ -367,20 +350,16 @@ void disp_draw_nibble( word_20 addr, word_4 val ) {
nibble_bits[ val ];
disp.display_update |= UPDATE_DISP;
} else {
#endif
#endif
if ( val != disp_buf[ y ][ x ] ) {
disp_buf[ y ][ x ] = val;
draw_nibble( x, y, val );
}
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
}
#endif
#endif
} else {
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
if ( shm_flag ) {
shm_addr = x;
for ( y = 0; y < display.lines; y++ ) {
@ -391,7 +370,6 @@ void disp_draw_nibble( word_20 addr, word_4 val ) {
}
disp.display_update |= UPDATE_DISP;
} else {
#endif
#endif
for ( y = 0; y < display.lines; y++ ) {
if ( val != disp_buf[ y ][ x ] ) {
@ -400,9 +378,7 @@ void disp_draw_nibble( word_20 addr, word_4 val ) {
}
}
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
}
#endif
#endif
}
}
@ -410,15 +386,12 @@ void disp_draw_nibble( word_20 addr, word_4 val ) {
void menu_draw_nibble( word_20 addr, word_4 val ) {
long offset;
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
int shm_addr;
#endif
#endif
int x, y;
offset = ( addr - display.menu_start );
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
if ( shm_flag ) {
shm_addr =
2 * ( offset / NIBBLES_PER_ROW ) * disp.menu_image->bytes_per_line +
@ -428,7 +401,6 @@ void menu_draw_nibble( word_20 addr, word_4 val ) {
nibble_bits[ val ];
disp.display_update |= UPDATE_MENU;
} else {
#endif
#endif
x = offset % NIBBLES_PER_ROW;
y = display.lines + ( offset / NIBBLES_PER_ROW ) + 1;
@ -437,10 +409,8 @@ void menu_draw_nibble( word_20 addr, word_4 val ) {
draw_nibble( x, y, val );
}
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
}
#endif
#endif
}
#if defined( GUI_IS_X11 )

788
src/x48.c
View file

@ -51,11 +51,9 @@ static char* defaults[] = {
"*disassemblerMnemonics: class",
0 };
#ifdef HAVE_XSHM
extern int XShmQueryExtension( Display* );
extern int XShmGetEventBase( Display* );
static int CompletionType = -1;
#endif
extern int saved_argc;
extern char** saved_argv;
@ -71,6 +69,9 @@ Window iconW = 0;
disp_t disp;
keypad_t keypad;
color_t* colors;
#if defined( GUI_IS_X11 )
Atom wm_delete_window, wm_save_yourself, wm_protocols;
Atom ol_decor_del, ol_decor_icon_name;
@ -81,21 +82,15 @@ Pixmap icon_text_pix;
Pixmap icon_disp_pix;
static int last_icon_state = -1;
#ifdef HAVE_XSHM
int shm_flag;
int xerror_flag;
#endif
int dynamic_color;
int direct_color;
int does_backing_store;
int color_mode;
int icon_color_mode;
#endif
#if defined( GUI_IS_SDL1 )
keypad_t keypad;
color_t* colors;
#elif defined( GUI_IS_SDL1 )
// This will take the value of the defines, but can be run-time modified
unsigned KEYBOARD_HEIGHT, KEYBOARD_WIDTH, TOP_SKIP, SIDE_SKIP, BOTTOM_SKIP,
DISP_KBD_SKIP, DISPLAY_WIDTH, DISPLAY_HEIGHT, DISPLAY_OFFSET_X,
@ -103,267 +98,451 @@ unsigned KEYBOARD_HEIGHT, KEYBOARD_WIDTH, TOP_SKIP, SIDE_SKIP, BOTTOM_SKIP,
KBD_UPLINE;
#endif
color_t colors_sx[] = { { "white",
255,
255,
255
#if defined( GUI_IS_X11 )
typedef struct keypad_t {
unsigned int width;
unsigned int height;
Pixmap pixmap;
} keypad_t;
,
255,
255,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "left",
255,
166,
0
#if defined( GUI_IS_X11 )
,
255,
230,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "right",
0,
210,
255
#if defined( GUI_IS_X11 )
,
255,
169,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "but_top",
109,
93,
93
#if defined( GUI_IS_X11 )
,
0,
91,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "button",
90,
77,
77
#if defined( GUI_IS_X11 )
,
0,
81,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "but_bot",
76,
65,
65
#if defined( GUI_IS_X11 )
,
0,
69,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "lcd_col",
202,
221,
92
#if defined( GUI_IS_X11 )
,
255,
205,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "pix_col",
0,
0,
128
#if defined( GUI_IS_X11 )
,
0,
20,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "pad_top",
109,
78,
78
#if defined( GUI_IS_X11 )
,
0,
88,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "pad",
90,
64,
64
#if defined( GUI_IS_X11 )
,
0,
73,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "pad_bot",
76,
54,
54
#if defined( GUI_IS_X11 )
,
0,
60,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "disp_pad_top",
155,
118,
84
#if defined( GUI_IS_X11 )
,
0,
124,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "disp_pad",
124,
94,
67
#if defined( GUI_IS_X11 )
,
0,
99,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "disp_pad_bot",
100,
75,
53
#if defined( GUI_IS_X11 )
,
0,
79,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "logo",
204,
169,
107
#if defined( GUI_IS_X11 )
,
255,
172,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "logo_back",
64,
64,
64
#if defined( GUI_IS_X11 )
,
0,
65,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "label",
202,
184,
144
#if defined( GUI_IS_X11 )
,
255,
185,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "frame",
0,
0,
0
#if defined( GUI_IS_X11 )
,
255,
0,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "underlay",
60,
42,
42
#if defined( GUI_IS_X11 )
,
0,
48,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "black",
0,
0,
0
#if defined( GUI_IS_X11 )
,
0,
0,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ 0 } };
keypad_t keypad;
color_t* colors;
color_t colors_gx[] = { { "white",
255,
255,
255
#if defined( GUI_IS_X11 )
,
255,
255,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "left",
255,
186,
255
#if defined( GUI_IS_X11 )
,
255,
220,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "right",
0,
255,
204
#if defined( GUI_IS_X11 )
,
255,
169,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "but_top",
104,
104,
104
#if defined( GUI_IS_X11 )
,
0,
104,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "button",
88,
88,
88
#if defined( GUI_IS_X11 )
,
0,
88,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "but_bot",
74,
74,
74
#if defined( GUI_IS_X11 )
,
0,
74,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "lcd_col",
202,
221,
92
#if defined( GUI_IS_X11 )
,
255,
205,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "pix_col",
0,
0,
128
#if defined( GUI_IS_X11 )
,
0,
20,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "pad_top",
88,
88,
88
#if defined( GUI_IS_X11 )
,
0,
88,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "pad",
74,
74,
74
#if defined( GUI_IS_X11 )
,
0,
74,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "pad_bot",
64,
64,
64
#if defined( GUI_IS_X11 )
,
0,
64,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "disp_pad_top",
128,
128,
138
#if defined( GUI_IS_X11 )
,
0,
128,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "disp_pad",
104,
104,
110
#if defined( GUI_IS_X11 )
,
0,
104,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "disp_pad_bot",
84,
84,
90
#if defined( GUI_IS_X11 )
,
0,
84,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "logo",
176,
176,
184
#if defined( GUI_IS_X11 )
,
255,
176,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "logo_back",
104,
104,
110
#if defined( GUI_IS_X11 )
,
0,
104,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "label",
240,
240,
240
#if defined( GUI_IS_X11 )
,
255,
240,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "frame",
0,
0,
0
#if defined( GUI_IS_X11 )
,
255,
0,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "underlay",
104,
104,
110
#if defined( GUI_IS_X11 )
,
0,
104,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ "black",
0,
0,
0
#if defined( GUI_IS_X11 )
,
0,
0,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 }
#endif
},
{ 0 } };
color_t colors_sx[] = {
{ "white",
255,
255,
255,
255,
255,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "left",
255,
166,
0,
255,
230,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "right",
0,
210,
255,
255,
169,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "but_top",
109,
93,
93,
0,
91,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "button",
90,
77,
77,
0,
81,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "but_bot",
76,
65,
65,
0,
69,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "lcd_col",
202,
221,
92,
255,
205,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "pix_col",
0,
0,
128,
0,
20,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "pad_top",
109,
78,
78,
0,
88,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "pad", 90, 64, 64, 0, 73, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "pad_bot",
76,
54,
54,
0,
60,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "disp_pad_top",
155,
118,
84,
0,
124,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "disp_pad",
124,
94,
67,
0,
99,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "disp_pad_bot",
100,
75,
53,
0,
79,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "logo",
204,
169,
107,
255,
172,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "logo_back",
64,
64,
64,
0,
65,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "label",
202,
184,
144,
255,
185,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "frame", 0, 0, 0, 255, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "underlay",
60,
42,
42,
0,
48,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "black", 0, 0, 0, 0, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ 0 } };
color_t colors_gx[] = {
{ "white",
255,
255,
255,
255,
255,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "left",
255,
186,
255,
255,
220,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "right",
0,
255,
204,
255,
169,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "but_top",
104,
104,
104,
0,
104,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "button",
88,
88,
88,
0,
88,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "but_bot",
74,
74,
74,
0,
74,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "lcd_col",
202,
221,
92,
255,
205,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "pix_col",
0,
0,
128,
0,
20,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "pad_top",
88,
88,
88,
0,
88,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "pad", 74, 74, 74, 0, 74, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "pad_bot",
64,
64,
64,
0,
64,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "disp_pad_top",
128,
128,
138,
0,
128,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "disp_pad",
104,
104,
110,
0,
104,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "disp_pad_bot",
84,
84,
90,
0,
84,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "logo",
176,
176,
184,
255,
176,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "logo_back",
104,
104,
110,
0,
104,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "label",
240,
240,
240,
255,
240,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "frame", 0, 0, 0, 255, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "underlay",
104,
104,
110,
0,
104,
{ 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ "black", 0, 0, 0, 0, 0, { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 } },
{ 0 } };
#elif defined( GUI_IS_SDL1 )
#if defined( GUI_IS_SDL1 )
// Control how the screen update is performed: at regular intervals (delayed)
// or immediatly Note: this is only for the LCD. The annunciators and the
@ -372,50 +551,6 @@ color_t colors_gx[] = {
// Interval in millisecond between screen updates
#define DISPUPDATEINTERVAL 200
color_t colors_sx[] = { { "white", 255, 255, 255 },
{ "left", 255, 166, 0 },
{ "right", 0, 210, 255 },
{ "but_top", 109, 93, 93 },
{ "button", 90, 77, 770 },
{ "but_bot", 76, 65, 65 },
{ "lcd_col", 202, 221, 92 },
{ "pix_col", 0, 0, 128 },
{ "pad_top", 109, 78, 78 },
{ "pad", 90, 64, 64 },
{ "pad_bot", 76, 54, 54 },
{ "disp_pad_top", 155, 118, 84 },
{ "disp_pad", 124, 94, 67 },
{ "disp_pad_bot", 100, 75, 53 },
{ "logo", 204, 169, 107 },
{ "logo_back", 64, 64, 64 },
{ "label", 202, 184, 144 },
{ "frame", 0, 0, 0 },
{ "underlay", 60, 42, 42 },
{ "black", 0, 0, 0 },
{ 0 } };
color_t colors_gx[] = { { "white", 255, 255, 255 },
{ "left", 255, 186, 255 },
{ "right", 0, 255, 204 },
{ "but_top", 104, 104, 104 },
{ "button", 88, 88, 88 },
{ "but_bot", 74, 74, 74 },
{ "lcd_col", 202, 221, 92 },
{ "pix_col", 0, 0, 128 },
{ "pad_top", 88, 88, 88 },
{ "pad", 74, 74, 74 },
{ "pad_bot", 64, 64, 64 },
{ "disp_pad_top", 128, 128, 138 },
{ "disp_pad", 104, 104, 110 },
{ "disp_pad_bot", 84, 84, 90 },
{ "logo", 176, 176, 184 },
{ "logo_back", 104, 104, 110 },
{ "label", 240, 240, 240 },
{ "frame", 0, 0, 0 },
{ "underlay", 104, 104, 110 },
{ "black", 0, 0, 0 },
{ 0 } };
unsigned int ARGBColors[ BLACK + 1 ];
#endif
@ -1173,12 +1308,8 @@ void adjust_contrast( int contrast ) {
colors[ PIXEL ].b = b;
AllocColors();
XSetForeground( dpy, disp.gc, COLOR( PIXEL ) );
#ifdef HAVE_XSHM
disp.display_update = UPDATE_DISP | UPDATE_MENU;
refresh_display();
#else
redraw_display();
#endif
redraw_annunc();
last_icon_state = -1;
refresh_icon();
@ -1193,12 +1324,8 @@ void adjust_contrast( int contrast ) {
} else {
XFreeColors( dpy, cmap, &old, 1, 0 );
XSetForeground( dpy, disp.gc, COLOR( PIXEL ) );
#ifdef HAVE_XSHM
disp.display_update = UPDATE_DISP | UPDATE_MENU;
refresh_display();
#else
redraw_display();
#endif
redraw_annunc();
last_icon_state = -1;
refresh_icon();
@ -1408,7 +1535,6 @@ int InitDisplay( int argc, char** argv ) {
*/
does_backing_store = XDoesBackingStore( XScreenOfDisplay( dpy, screen ) );
#ifdef HAVE_XSHM
/*
* Try to use XShm-Extension
*/
@ -1422,13 +1548,6 @@ int InitDisplay( int argc, char** argv ) {
}
if ( shm_flag )
fprintf( stderr, "%s: using XShm extension.\n", progname );
#else
if ( useXShm ) {
if ( !quiet )
fprintf( stderr, "%s: not compiled to use XShm extension.\n",
progname );
}
#endif
return 0;
}
@ -2800,13 +2919,11 @@ void DrawIcon( void ) {
hp48_icon_height, 0, 0 );
}
#ifdef HAVE_XSHM
int handle_xerror( Display* the_dpy, XErrorEvent* eev ) {
xerror_flag = 1;
return 0;
}
#endif
void CreateDispWindow( void ) {
XSetWindowAttributes xswa;
@ -2843,7 +2960,6 @@ void CreateDispWindow( void ) {
XSetForeground( dpy, disp.gc, COLOR( PIXEL ) );
#ifdef HAVE_XSHM
disp.display_update = UPDATE_DISP | UPDATE_MENU;
xerror_flag = 0;
@ -2993,15 +3109,12 @@ shm_error:
XFlush( dpy );
if ( !shm_flag ) {
#endif
rect.x = 5;
rect.y = 0;
rect.width = 262;
rect.height = disp.h;
XSetClipRectangles( dpy, disp.gc, 0, 0, &rect, 1, Unsorted );
#ifdef HAVE_XSHM
}
#endif
}
int CreateWindows( int argc, char** argv ) {
@ -3313,12 +3426,10 @@ int CreateWindows( int argc, char** argv ) {
DrawButtons();
DrawIcon();
#ifdef HAVE_XSHM
if ( shm_flag ) {
XSetForeground( dpy, disp.gc, COLOR( PIXEL ) );
XFillRectangle( dpy, disp.win, disp.gc, 5, 20, 262, 128 );
}
#endif
return 0;
}
@ -3433,7 +3544,6 @@ int key_event( int b, XEvent* xev ) {
return 0;
}
#ifdef HAVE_XSHM
void refresh_display( void ) {
if ( shm_flag ) {
if ( disp.display_update & UPDATE_DISP ) {
@ -3449,10 +3559,8 @@ void refresh_display( void ) {
disp.display_update = 0;
}
}
#endif
void DrawDisp( void ) {
#ifdef HAVE_XSHM
if ( shm_flag ) {
XShmPutImage( dpy, disp.win, disp.gc, disp.disp_image, disp.offset, 0,
5, 20, 262, ( unsigned int )( disp.lines + 2 ), 0 );
@ -3463,11 +3571,9 @@ void DrawDisp( void ) {
}
disp.display_update = 0;
} else {
#endif
redraw_display();
#ifdef HAVE_XSHM
}
#endif
redraw_annunc();
}

View file

@ -6,11 +6,9 @@
#include <X11/Xresource.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#ifdef HAVE_XSHM
#include <X11/extensions/XShm.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#endif
#elif defined( GUI_IS_SDL1 )
#include <SDL/SDL.h>
#include <SDL/SDL_gfxPrimitives.h>
@ -145,12 +143,13 @@ extern color_t* colors;
#define UPDATE_DISP 2
#endif
#if defined( GUI_IS_SDL1 )
typedef struct keypad_t {
unsigned int width;
unsigned int height;
} keypad_t;
#if defined( GUI_IS_X11 )
Pixmap pixmap;
#endif
} keypad_t;
typedef struct disp_t {
unsigned int w, h;
@ -162,22 +161,18 @@ typedef struct disp_t {
int offset;
int lines;
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
int display_update;
XShmSegmentInfo disp_info;
XImage* disp_image;
XShmSegmentInfo menu_info;
XImage* menu_image;
#endif
#endif
} disp_t;
#if defined( GUI_IS_X11 )
extern disp_t disp;
#ifdef HAVE_XSHM
extern int shm_flag;
#endif
extern Display* dpy;
extern int screen;
@ -264,9 +259,7 @@ extern void exit_x48( int tell_x11 );
#if defined( GUI_IS_X11 )
#ifdef HAVE_XSHM
extern void refresh_display( void );
#endif
#elif defined( GUI_IS_SDL1 )