dename disp to lcd for clarity, use less variables
This commit is contained in:
parent
89c35e1604
commit
b73090d017
1 changed files with 174 additions and 186 deletions
360
src/ui_x11.c
360
src/ui_x11.c
|
@ -300,20 +300,16 @@ typedef struct x11_ann_struct_t {
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
} x11_ann_struct_t;
|
} x11_ann_struct_t;
|
||||||
|
|
||||||
typedef struct disp_t {
|
typedef struct x11_lcd_t {
|
||||||
unsigned int w, h;
|
|
||||||
|
|
||||||
Window win;
|
Window win;
|
||||||
GC gc;
|
GC gc;
|
||||||
|
|
||||||
short mapped;
|
|
||||||
|
|
||||||
int display_update;
|
int display_update;
|
||||||
XShmSegmentInfo disp_info;
|
XShmSegmentInfo disp_info;
|
||||||
XImage* disp_image;
|
XImage* disp_image;
|
||||||
XShmSegmentInfo menu_info;
|
XShmSegmentInfo menu_info;
|
||||||
XImage* menu_image;
|
XImage* menu_image;
|
||||||
} disp_t;
|
} x11_lcd_t;
|
||||||
|
|
||||||
typedef struct icon_t {
|
typedef struct icon_t {
|
||||||
unsigned int w;
|
unsigned int w;
|
||||||
|
@ -322,12 +318,14 @@ typedef struct icon_t {
|
||||||
unsigned char* bits;
|
unsigned char* bits;
|
||||||
} icon_map_t;
|
} icon_map_t;
|
||||||
|
|
||||||
|
static short mapped;
|
||||||
|
|
||||||
static x11_keypad_t keypad;
|
static x11_keypad_t keypad;
|
||||||
static x11_color_t* colors;
|
static x11_color_t* colors;
|
||||||
|
|
||||||
static int CompletionType = -1;
|
static int CompletionType = -1;
|
||||||
|
|
||||||
static disp_t disp;
|
static x11_lcd_t lcd;
|
||||||
|
|
||||||
static int shm_flag;
|
static int shm_flag;
|
||||||
|
|
||||||
|
@ -2406,8 +2404,6 @@ void CreateKeypad( unsigned int offset_y, unsigned int offset_x,
|
||||||
|
|
||||||
void CreateBezel( x11_keypad_t* keypad ) {
|
void CreateBezel( x11_keypad_t* keypad ) {
|
||||||
int i;
|
int i;
|
||||||
int display_height = DISPLAY_HEIGHT;
|
|
||||||
int display_width = DISPLAY_WIDTH;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* draw the frame around the display
|
* draw the frame around the display
|
||||||
|
@ -2416,18 +2412,18 @@ void CreateBezel( x11_keypad_t* keypad ) {
|
||||||
|
|
||||||
for ( i = 0; i < DISP_FRAME; i++ ) {
|
for ( i = 0; i < DISP_FRAME; i++ ) {
|
||||||
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i ),
|
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * i ),
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i ),
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + i ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * i ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i ) );
|
||||||
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i ),
|
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * i + 1 ),
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i + 1 ),
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + i ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * i + 1 ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i + 1 ) );
|
||||||
XDrawLine( dpy, keypad->pixmap, gc,
|
XDrawLine( dpy, keypad->pixmap, gc,
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + i ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ),
|
||||||
( int )( DISPLAY_OFFSET_Y - i ),
|
( int )( DISPLAY_OFFSET_Y - i ),
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + i ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * i ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetForeground( dpy, gc, COLOR( DISP_PAD_BOT ) );
|
XSetForeground( dpy, gc, COLOR( DISP_PAD_BOT ) );
|
||||||
|
@ -2435,12 +2431,12 @@ void CreateBezel( x11_keypad_t* keypad ) {
|
||||||
for ( i = 0; i < DISP_FRAME; i++ ) {
|
for ( i = 0; i < DISP_FRAME; i++ ) {
|
||||||
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i - 1 ),
|
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y - i - 1 ),
|
( int )( DISPLAY_OFFSET_Y - i - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + i - 1 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + i - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y - i - 1 ) );
|
( int )( DISPLAY_OFFSET_Y - i - 1 ) );
|
||||||
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i - 1 ),
|
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - i - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y - i - 1 ),
|
( int )( DISPLAY_OFFSET_Y - i - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_X - i - 1 ),
|
( int )( DISPLAY_OFFSET_X - i - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * i - 1 ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * i - 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2463,49 +2459,49 @@ void CreateBezel( x11_keypad_t* keypad ) {
|
||||||
( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 1 ) );
|
( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 1 ) );
|
||||||
|
|
||||||
XDrawLine( dpy, keypad->pixmap, gc,
|
XDrawLine( dpy, keypad->pixmap, gc,
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + DISP_FRAME - 4 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 4 ),
|
||||||
( int )( DISPLAY_OFFSET_Y - DISP_FRAME ),
|
( int )( DISPLAY_OFFSET_Y - DISP_FRAME ),
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y - DISP_FRAME ) );
|
( int )( DISPLAY_OFFSET_Y - DISP_FRAME ) );
|
||||||
XDrawLine( dpy, keypad->pixmap, gc,
|
XDrawLine( dpy, keypad->pixmap, gc,
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y - DISP_FRAME ),
|
( int )( DISPLAY_OFFSET_Y - DISP_FRAME ),
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 3 ) );
|
( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 3 ) );
|
||||||
XDrawPoint( dpy, keypad->pixmap, gc,
|
XDrawPoint( dpy, keypad->pixmap, gc,
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + DISP_FRAME - 2 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 2 ),
|
||||||
( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 1 ) );
|
( int )( DISPLAY_OFFSET_Y - DISP_FRAME + 1 ) );
|
||||||
|
|
||||||
XDrawLine(
|
XDrawLine(
|
||||||
dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME ),
|
dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 4 ),
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 4 ),
|
||||||
( int )( DISPLAY_OFFSET_X - DISP_FRAME ),
|
( int )( DISPLAY_OFFSET_X - DISP_FRAME ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) );
|
||||||
XDrawLine(
|
XDrawLine(
|
||||||
dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME ),
|
dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 ),
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_X - DISP_FRAME + 3 ),
|
( int )( DISPLAY_OFFSET_X - DISP_FRAME + 3 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) );
|
||||||
XDrawPoint(
|
XDrawPoint(
|
||||||
dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME + 1 ),
|
dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - DISP_FRAME + 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 2 ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 2 ) );
|
||||||
|
|
||||||
XDrawLine(
|
XDrawLine(
|
||||||
dpy, keypad->pixmap, gc,
|
dpy, keypad->pixmap, gc,
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 4 ),
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 4 ),
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) );
|
||||||
XDrawLine(
|
XDrawLine(
|
||||||
dpy, keypad->pixmap, gc,
|
dpy, keypad->pixmap, gc,
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + DISP_FRAME - 4 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 4 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 ),
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + DISP_FRAME - 1 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 1 ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 1 ) );
|
||||||
XDrawPoint(
|
XDrawPoint(
|
||||||
dpy, keypad->pixmap, gc,
|
dpy, keypad->pixmap, gc,
|
||||||
( int )( DISPLAY_OFFSET_X + display_width + DISP_FRAME - 2 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH + DISP_FRAME - 2 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height + 2 * DISP_FRAME - 2 ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + 2 * DISP_FRAME - 2 ) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* simulate rounded lcd corners
|
* simulate rounded lcd corners
|
||||||
|
@ -2514,20 +2510,20 @@ void CreateBezel( x11_keypad_t* keypad ) {
|
||||||
|
|
||||||
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - 1 ),
|
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + 1 ), ( int )( DISPLAY_OFFSET_X - 1 ),
|
( int )( DISPLAY_OFFSET_Y + 1 ), ( int )( DISPLAY_OFFSET_X - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height - 2 ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT - 2 ) );
|
||||||
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + 1 ),
|
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y - 1 ),
|
( int )( DISPLAY_OFFSET_Y - 1 ),
|
||||||
( int )( DISPLAY_OFFSET_X + display_width - 2 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH - 2 ),
|
||||||
( int )( DISPLAY_OFFSET_Y - 1 ) );
|
( int )( DISPLAY_OFFSET_Y - 1 ) );
|
||||||
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + 1 ),
|
XDrawLine( dpy, keypad->pixmap, gc, ( int )( DISPLAY_OFFSET_X + 1 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height ),
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT ),
|
||||||
( int )( DISPLAY_OFFSET_X + display_width - 2 ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH - 2 ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT ) );
|
||||||
XDrawLine( dpy, keypad->pixmap, gc,
|
XDrawLine( dpy, keypad->pixmap, gc,
|
||||||
( int )( DISPLAY_OFFSET_X + display_width ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH ),
|
||||||
( int )( DISPLAY_OFFSET_Y + 1 ),
|
( int )( DISPLAY_OFFSET_Y + 1 ),
|
||||||
( int )( DISPLAY_OFFSET_X + display_width ),
|
( int )( DISPLAY_OFFSET_X + DISPLAY_WIDTH ),
|
||||||
( int )( DISPLAY_OFFSET_Y + display_height - 2 ) );
|
( int )( DISPLAY_OFFSET_Y + DISPLAY_HEIGHT - 2 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) {
|
void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) {
|
||||||
|
@ -2535,8 +2531,6 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) {
|
||||||
int cut = 0;
|
int cut = 0;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
// int display_height = DISPLAY_HEIGHT;
|
|
||||||
int display_width = DISPLAY_WIDTH;
|
|
||||||
/*
|
/*
|
||||||
* lower the whole thing
|
* lower the whole thing
|
||||||
*/
|
*/
|
||||||
|
@ -2734,7 +2728,7 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) {
|
||||||
XSetForeground( dpy, gc, COLOR( LABEL ) );
|
XSetForeground( dpy, gc, COLOR( LABEL ) );
|
||||||
|
|
||||||
if ( opt_gx ) {
|
if ( opt_gx ) {
|
||||||
x = DISPLAY_OFFSET_X + display_width - gx_128K_ram_width +
|
x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width +
|
||||||
gx_128K_ram_x_hot + 2;
|
gx_128K_ram_x_hot + 2;
|
||||||
y = 10 + gx_128K_ram_y_hot;
|
y = 10 + gx_128K_ram_y_hot;
|
||||||
pix = XCreateBitmapFromData( dpy, keypad->pixmap,
|
pix = XCreateBitmapFromData( dpy, keypad->pixmap,
|
||||||
|
@ -2768,7 +2762,7 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) {
|
||||||
XFreePixmap( dpy, pix );
|
XFreePixmap( dpy, pix );
|
||||||
|
|
||||||
XSetForeground( dpy, gc, COLOR( RIGHT ) );
|
XSetForeground( dpy, gc, COLOR( RIGHT ) );
|
||||||
x = DISPLAY_OFFSET_X + display_width - gx_128K_ram_width +
|
x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width +
|
||||||
gx_green_x_hot + 2;
|
gx_green_x_hot + 2;
|
||||||
y = 10 + gx_green_y_hot;
|
y = 10 + gx_green_y_hot;
|
||||||
pix = XCreateBitmapFromData( dpy, keypad->pixmap,
|
pix = XCreateBitmapFromData( dpy, keypad->pixmap,
|
||||||
|
@ -2795,7 +2789,7 @@ void DrawMore( unsigned int offset_y, x11_keypad_t* keypad ) {
|
||||||
|
|
||||||
XFreePixmap( dpy, pix );
|
XFreePixmap( dpy, pix );
|
||||||
|
|
||||||
x = DISPLAY_OFFSET_X + display_width - 1 - science_width;
|
x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - 1 - science_width;
|
||||||
y = TOP_SKIP - DISP_FRAME - science_height - 4;
|
y = TOP_SKIP - DISP_FRAME - science_height - 4;
|
||||||
|
|
||||||
pix =
|
pix =
|
||||||
|
@ -2953,19 +2947,16 @@ void CreateDispWindow( void ) {
|
||||||
/*
|
/*
|
||||||
* create the display subwindow
|
* create the display subwindow
|
||||||
*/
|
*/
|
||||||
disp.w = DISPLAY_WIDTH;
|
lcd.win = XCreateSimpleWindow(
|
||||||
disp.h = DISPLAY_HEIGHT;
|
dpy, mainW, ( int )DISPLAY_OFFSET_X, ( int )DISPLAY_OFFSET_Y,
|
||||||
|
DISPLAY_WIDTH, DISPLAY_HEIGHT, 0, COLOR( BLACK ), COLOR( LCD ) );
|
||||||
|
|
||||||
disp.win = XCreateSimpleWindow( dpy, mainW, ( int )DISPLAY_OFFSET_X,
|
mapped = 1;
|
||||||
( int )DISPLAY_OFFSET_Y, disp.w, disp.h, 0,
|
|
||||||
COLOR( BLACK ), COLOR( LCD ) );
|
|
||||||
|
|
||||||
disp.mapped = 1;
|
|
||||||
|
|
||||||
xswa.event_mask = ExposureMask | StructureNotifyMask;
|
xswa.event_mask = ExposureMask | StructureNotifyMask;
|
||||||
xswa.backing_store = Always;
|
xswa.backing_store = Always;
|
||||||
|
|
||||||
XChangeWindowAttributes( dpy, disp.win, CWEventMask | CWBackingStore,
|
XChangeWindowAttributes( dpy, lcd.win, CWEventMask | CWBackingStore,
|
||||||
&xswa );
|
&xswa );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2975,26 +2966,25 @@ void CreateDispWindow( void ) {
|
||||||
val.background = COLOR( LCD );
|
val.background = COLOR( LCD );
|
||||||
val.function = GXcopy;
|
val.function = GXcopy;
|
||||||
gc_mask = GCForeground | GCBackground | GCFunction;
|
gc_mask = GCForeground | GCBackground | GCFunction;
|
||||||
disp.gc = XCreateGC( dpy, mainW, gc_mask, &val );
|
lcd.gc = XCreateGC( dpy, mainW, gc_mask, &val );
|
||||||
|
|
||||||
XSetForeground( dpy, disp.gc, COLOR( PIXEL ) );
|
XSetForeground( dpy, lcd.gc, COLOR( PIXEL ) );
|
||||||
|
|
||||||
disp.display_update = UPDATE_DISP | UPDATE_MENU;
|
lcd.display_update = UPDATE_DISP | UPDATE_MENU;
|
||||||
|
|
||||||
xerror_flag = 0;
|
xerror_flag = 0;
|
||||||
XSetErrorHandler( handle_xerror );
|
XSetErrorHandler( handle_xerror );
|
||||||
XFlush( dpy );
|
XFlush( dpy );
|
||||||
|
|
||||||
disp.disp_image = NULL;
|
lcd.disp_image = NULL;
|
||||||
disp.menu_image = NULL;
|
lcd.menu_image = NULL;
|
||||||
if ( shm_flag ) {
|
if ( shm_flag ) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create XShmImage for DISP
|
* create XShmImage for DISP
|
||||||
*/
|
*/
|
||||||
disp.disp_image = XShmCreateImage( dpy, None, 1, XYBitmap, NULL,
|
lcd.disp_image = XShmCreateImage( dpy, None, 1, XYBitmap, NULL,
|
||||||
&disp.disp_info, 262, 128 );
|
&lcd.disp_info, 262, 128 );
|
||||||
if ( disp.disp_image == NULL ) {
|
if ( lcd.disp_image == NULL ) {
|
||||||
shm_flag = 0;
|
shm_flag = 0;
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
|
@ -3005,13 +2995,13 @@ void CreateDispWindow( void ) {
|
||||||
/*
|
/*
|
||||||
* get ID of shared memory block for DISP
|
* get ID of shared memory block for DISP
|
||||||
*/
|
*/
|
||||||
disp.disp_info.shmid = shmget(
|
lcd.disp_info.shmid =
|
||||||
IPC_PRIVATE,
|
shmget( IPC_PRIVATE,
|
||||||
( disp.disp_image->bytes_per_line * disp.disp_image->height ),
|
( lcd.disp_image->bytes_per_line * lcd.disp_image->height ),
|
||||||
IPC_CREAT | 0777 );
|
IPC_CREAT | 0777 );
|
||||||
if ( disp.disp_info.shmid < 0 ) {
|
if ( lcd.disp_info.shmid < 0 ) {
|
||||||
XDestroyImage( disp.disp_image );
|
XDestroyImage( lcd.disp_image );
|
||||||
disp.disp_image = NULL;
|
lcd.disp_image = NULL;
|
||||||
shm_flag = 0;
|
shm_flag = 0;
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
fprintf( stderr, "XShm error in shmget(DISP), disabling.\n" );
|
fprintf( stderr, "XShm error in shmget(DISP), disabling.\n" );
|
||||||
|
@ -3021,27 +3011,27 @@ void CreateDispWindow( void ) {
|
||||||
/*
|
/*
|
||||||
* get address of shared memory block for DISP
|
* get address of shared memory block for DISP
|
||||||
*/
|
*/
|
||||||
disp.disp_info.shmaddr = ( char* )shmat( disp.disp_info.shmid, 0, 0 );
|
lcd.disp_info.shmaddr = ( char* )shmat( lcd.disp_info.shmid, 0, 0 );
|
||||||
if ( disp.disp_info.shmaddr == ( ( char* )-1 ) ) {
|
if ( lcd.disp_info.shmaddr == ( ( char* )-1 ) ) {
|
||||||
XDestroyImage( disp.disp_image );
|
XDestroyImage( lcd.disp_image );
|
||||||
disp.disp_image = NULL;
|
lcd.disp_image = NULL;
|
||||||
shm_flag = 0;
|
shm_flag = 0;
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
fprintf( stderr, "XShm error in shmat(DISP), disabling.\n" );
|
fprintf( stderr, "XShm error in shmat(DISP), disabling.\n" );
|
||||||
goto shm_error;
|
goto shm_error;
|
||||||
}
|
}
|
||||||
disp.disp_image->data = disp.disp_info.shmaddr;
|
lcd.disp_image->data = lcd.disp_info.shmaddr;
|
||||||
disp.disp_info.readOnly = False;
|
lcd.disp_info.readOnly = False;
|
||||||
XShmAttach( dpy, &disp.disp_info );
|
XShmAttach( dpy, &lcd.disp_info );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create XShmImage for MENU
|
* create XShmImage for MENU
|
||||||
*/
|
*/
|
||||||
disp.menu_image = XShmCreateImage( dpy, None, 1, XYBitmap, NULL,
|
lcd.menu_image = XShmCreateImage( dpy, None, 1, XYBitmap, NULL,
|
||||||
&disp.menu_info, 262, 128 );
|
&lcd.menu_info, 262, 128 );
|
||||||
if ( disp.menu_image == NULL ) {
|
if ( lcd.menu_image == NULL ) {
|
||||||
XDestroyImage( disp.disp_image );
|
XDestroyImage( lcd.disp_image );
|
||||||
disp.disp_image = NULL;
|
lcd.disp_image = NULL;
|
||||||
shm_flag = 0;
|
shm_flag = 0;
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
fprintf( stderr,
|
fprintf( stderr,
|
||||||
|
@ -3052,15 +3042,15 @@ void CreateDispWindow( void ) {
|
||||||
/*
|
/*
|
||||||
* get ID of shared memory block for MENU
|
* get ID of shared memory block for MENU
|
||||||
*/
|
*/
|
||||||
disp.menu_info.shmid = shmget(
|
lcd.menu_info.shmid =
|
||||||
IPC_PRIVATE,
|
shmget( IPC_PRIVATE,
|
||||||
( disp.menu_image->bytes_per_line * disp.menu_image->height ),
|
( lcd.menu_image->bytes_per_line * lcd.menu_image->height ),
|
||||||
IPC_CREAT | 0777 );
|
IPC_CREAT | 0777 );
|
||||||
if ( disp.menu_info.shmid < 0 ) {
|
if ( lcd.menu_info.shmid < 0 ) {
|
||||||
XDestroyImage( disp.disp_image );
|
XDestroyImage( lcd.disp_image );
|
||||||
disp.disp_image = NULL;
|
lcd.disp_image = NULL;
|
||||||
XDestroyImage( disp.menu_image );
|
XDestroyImage( lcd.menu_image );
|
||||||
disp.menu_image = NULL;
|
lcd.menu_image = NULL;
|
||||||
shm_flag = 0;
|
shm_flag = 0;
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
fprintf( stderr, "XShm error in shmget(MENU), disabling.\n" );
|
fprintf( stderr, "XShm error in shmget(MENU), disabling.\n" );
|
||||||
|
@ -3070,45 +3060,45 @@ void CreateDispWindow( void ) {
|
||||||
/*
|
/*
|
||||||
* get address of shared memory block for MENU
|
* get address of shared memory block for MENU
|
||||||
*/
|
*/
|
||||||
disp.menu_info.shmaddr = ( char* )shmat( disp.menu_info.shmid, 0, 0 );
|
lcd.menu_info.shmaddr = ( char* )shmat( lcd.menu_info.shmid, 0, 0 );
|
||||||
if ( disp.menu_info.shmaddr == ( ( char* )-1 ) ) {
|
if ( lcd.menu_info.shmaddr == ( ( char* )-1 ) ) {
|
||||||
XDestroyImage( disp.disp_image );
|
XDestroyImage( lcd.disp_image );
|
||||||
disp.disp_image = NULL;
|
lcd.disp_image = NULL;
|
||||||
XDestroyImage( disp.menu_image );
|
XDestroyImage( lcd.menu_image );
|
||||||
disp.menu_image = NULL;
|
lcd.menu_image = NULL;
|
||||||
shm_flag = 0;
|
shm_flag = 0;
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
fprintf( stderr, "XShm error in shmat(MENU), disabling.\n" );
|
fprintf( stderr, "XShm error in shmat(MENU), disabling.\n" );
|
||||||
goto shm_error;
|
goto shm_error;
|
||||||
}
|
}
|
||||||
disp.menu_image->data = disp.menu_info.shmaddr;
|
lcd.menu_image->data = lcd.menu_info.shmaddr;
|
||||||
disp.menu_info.readOnly = False;
|
lcd.menu_info.readOnly = False;
|
||||||
XShmAttach( dpy, &disp.menu_info );
|
XShmAttach( dpy, &lcd.menu_info );
|
||||||
|
|
||||||
XFlush( dpy );
|
XFlush( dpy );
|
||||||
XSync( dpy, 0 );
|
XSync( dpy, 0 );
|
||||||
sleep( 1 );
|
sleep( 1 );
|
||||||
|
|
||||||
if ( xerror_flag ) {
|
if ( xerror_flag ) {
|
||||||
XDestroyImage( disp.disp_image );
|
XDestroyImage( lcd.disp_image );
|
||||||
disp.disp_image = NULL;
|
lcd.disp_image = NULL;
|
||||||
XDestroyImage( disp.menu_image );
|
XDestroyImage( lcd.menu_image );
|
||||||
disp.menu_image = NULL;
|
lcd.menu_image = NULL;
|
||||||
shm_flag = 0;
|
shm_flag = 0;
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
fprintf( stderr, "XShm error in shmget(MENU), disabling.\n" );
|
fprintf( stderr, "XShm error in shmget(MENU), disabling.\n" );
|
||||||
goto shm_error;
|
goto shm_error;
|
||||||
} else {
|
} else {
|
||||||
shmctl( disp.disp_info.shmid, IPC_RMID, 0 );
|
shmctl( lcd.disp_info.shmid, IPC_RMID, 0 );
|
||||||
shmctl( disp.menu_info.shmid, IPC_RMID, 0 );
|
shmctl( lcd.menu_info.shmid, IPC_RMID, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
memset( disp.disp_image->data, 0,
|
memset( lcd.disp_image->data, 0,
|
||||||
( size_t )( disp.disp_image->bytes_per_line *
|
( size_t )( lcd.disp_image->bytes_per_line *
|
||||||
disp.disp_image->height ) );
|
lcd.disp_image->height ) );
|
||||||
memset( disp.menu_image->data, 0,
|
memset( lcd.menu_image->data, 0,
|
||||||
( size_t )( disp.menu_image->bytes_per_line *
|
( size_t )( lcd.menu_image->bytes_per_line *
|
||||||
disp.menu_image->height ) );
|
lcd.menu_image->height ) );
|
||||||
|
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
printf( "using XShm extension.\n" );
|
printf( "using XShm extension.\n" );
|
||||||
|
@ -3124,8 +3114,8 @@ shm_error:
|
||||||
rect.x = 5;
|
rect.x = 5;
|
||||||
rect.y = 0;
|
rect.y = 0;
|
||||||
rect.width = 262;
|
rect.width = 262;
|
||||||
rect.height = disp.h;
|
rect.height = DISPLAY_HEIGHT;
|
||||||
XSetClipRectangles( dpy, disp.gc, 0, 0, &rect, 1, Unsorted );
|
XSetClipRectangles( dpy, lcd.gc, 0, 0, &rect, 1, Unsorted );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3490,8 +3480,8 @@ int CreateWindows( int argc, char** argv ) {
|
||||||
DrawSerialDevices( wire_name, ir_name );
|
DrawSerialDevices( wire_name, ir_name );
|
||||||
|
|
||||||
if ( shm_flag ) {
|
if ( shm_flag ) {
|
||||||
XSetForeground( dpy, disp.gc, COLOR( PIXEL ) );
|
XSetForeground( dpy, lcd.gc, COLOR( PIXEL ) );
|
||||||
XFillRectangle( dpy, disp.win, disp.gc, 5, 20, 262, 128 );
|
XFillRectangle( dpy, lcd.win, lcd.gc, 5, 20, 262, 128 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3540,22 +3530,22 @@ void refresh_display( void ) {
|
||||||
if ( !shm_flag )
|
if ( !shm_flag )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( disp.display_update & UPDATE_DISP ) {
|
if ( lcd.display_update & UPDATE_DISP ) {
|
||||||
XShmPutImage( dpy, disp.win, disp.gc, disp.disp_image,
|
XShmPutImage( dpy, lcd.win, lcd.gc, lcd.disp_image, 2 * display.offset,
|
||||||
2 * display.offset, 0, 5, 20, 262,
|
0, 5, 20, 262,
|
||||||
( unsigned int )( ( 2 * display.lines ) + 2 ), 0 );
|
( unsigned int )( ( 2 * display.lines ) + 2 ), 0 );
|
||||||
}
|
}
|
||||||
if ( ( ( 2 * display.lines ) < 126 ) &&
|
if ( ( ( 2 * display.lines ) < 126 ) &&
|
||||||
( disp.display_update & UPDATE_MENU ) ) {
|
( lcd.display_update & UPDATE_MENU ) ) {
|
||||||
XShmPutImage( dpy, disp.win, disp.gc, disp.menu_image, 0, 0, 5,
|
XShmPutImage( dpy, lcd.win, lcd.gc, lcd.menu_image, 0, 0, 5,
|
||||||
( int )( ( 2 * display.lines ) + 22 ), 262,
|
( int )( ( 2 * display.lines ) + 22 ), 262,
|
||||||
( unsigned int )( 126 - ( 2 * display.lines ) ), 0 );
|
( unsigned int )( 126 - ( 2 * display.lines ) ), 0 );
|
||||||
}
|
}
|
||||||
disp.display_update = 0;
|
lcd.display_update = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void redraw_display( void ) {
|
void redraw_display( void ) {
|
||||||
XClearWindow( dpy, disp.win );
|
XClearWindow( dpy, lcd.win );
|
||||||
memset( disp_buf, 0, sizeof( disp_buf ) );
|
memset( disp_buf, 0, sizeof( disp_buf ) );
|
||||||
memset( lcd_buffer, 0, sizeof( lcd_buffer ) );
|
memset( lcd_buffer, 0, sizeof( lcd_buffer ) );
|
||||||
x11_update_LCD();
|
x11_update_LCD();
|
||||||
|
@ -3568,16 +3558,16 @@ void redraw_annunc( void ) {
|
||||||
|
|
||||||
void DrawDisp( void ) {
|
void DrawDisp( void ) {
|
||||||
if ( shm_flag ) {
|
if ( shm_flag ) {
|
||||||
XShmPutImage( dpy, disp.win, disp.gc, disp.disp_image,
|
XShmPutImage( dpy, lcd.win, lcd.gc, lcd.disp_image, 2 * display.offset,
|
||||||
2 * display.offset, 0, 5, 20, 262,
|
0, 5, 20, 262,
|
||||||
( unsigned int )( ( 2 * display.lines ) + 2 ), 0 );
|
( unsigned int )( ( 2 * display.lines ) + 2 ), 0 );
|
||||||
if ( display.lines < 63 ) {
|
if ( display.lines < 63 ) {
|
||||||
XShmPutImage( dpy, disp.win, disp.gc, disp.menu_image, 0,
|
XShmPutImage( dpy, lcd.win, lcd.gc, lcd.menu_image, 0,
|
||||||
( 2 * display.lines ) - 110, 5,
|
( 2 * display.lines ) - 110, 5,
|
||||||
22 + ( 2 * display.lines ), 262,
|
22 + ( 2 * display.lines ), 262,
|
||||||
( unsigned int )( 126 - ( 2 * display.lines ) ), 0 );
|
( unsigned int )( 126 - ( 2 * display.lines ) ), 0 );
|
||||||
}
|
}
|
||||||
disp.display_update = 0;
|
lcd.display_update = 0;
|
||||||
} else {
|
} else {
|
||||||
redraw_display();
|
redraw_display();
|
||||||
}
|
}
|
||||||
|
@ -4063,8 +4053,8 @@ static inline void draw_nibble( int c, int r, int val ) {
|
||||||
y = ( r * 2 ) + 20;
|
y = ( r * 2 ) + 20;
|
||||||
val &= 0x0f;
|
val &= 0x0f;
|
||||||
if ( val != lcd_buffer[ r ][ c ] ) {
|
if ( val != lcd_buffer[ r ][ c ] ) {
|
||||||
XCopyPlane( dpy, nibble_maps[ val ], disp.win, disp.gc, 0, 0, 8, 2, x,
|
XCopyPlane( dpy, nibble_maps[ val ], lcd.win, lcd.gc, 0, 0, 8, 2, x, y,
|
||||||
y, 1 );
|
1 );
|
||||||
lcd_buffer[ r ][ c ] = val;
|
lcd_buffer[ r ][ c ] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4088,7 +4078,7 @@ static inline void draw_row( long addr, int row ) {
|
||||||
static inline void init_annunc( void ) {
|
static inline void init_annunc( void ) {
|
||||||
for ( int i = 0; ann_tbl[ i ].bit; i++ )
|
for ( int i = 0; ann_tbl[ i ].bit; i++ )
|
||||||
ann_tbl[ i ].pixmap =
|
ann_tbl[ i ].pixmap =
|
||||||
XCreateBitmapFromData( dpy, disp.win, ( char* )ann_tbl[ i ].bits,
|
XCreateBitmapFromData( dpy, lcd.win, ( char* )ann_tbl[ i ].bits,
|
||||||
ann_tbl[ i ].width, ann_tbl[ i ].height );
|
ann_tbl[ i ].width, ann_tbl[ i ].height );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4163,7 +4153,7 @@ int x11_get_event( void ) {
|
||||||
case Expose:
|
case Expose:
|
||||||
|
|
||||||
if ( xev.xexpose.count == 0 ) {
|
if ( xev.xexpose.count == 0 ) {
|
||||||
if ( xev.xexpose.window == disp.win ) {
|
if ( xev.xexpose.window == lcd.win ) {
|
||||||
DrawDisp();
|
DrawDisp();
|
||||||
} else if ( xev.xexpose.window == iconW ) {
|
} else if ( xev.xexpose.window == iconW ) {
|
||||||
DrawIcon();
|
DrawIcon();
|
||||||
|
@ -4180,13 +4170,13 @@ int x11_get_event( void ) {
|
||||||
break;
|
break;
|
||||||
case UnmapNotify:
|
case UnmapNotify:
|
||||||
|
|
||||||
disp.mapped = 0;
|
mapped = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MapNotify:
|
case MapNotify:
|
||||||
|
|
||||||
if ( !disp.mapped ) {
|
if ( !mapped ) {
|
||||||
disp.mapped = 1;
|
mapped = 1;
|
||||||
x11_update_LCD();
|
x11_update_LCD();
|
||||||
redraw_annunc();
|
redraw_annunc();
|
||||||
}
|
}
|
||||||
|
@ -4194,9 +4184,9 @@ int x11_get_event( void ) {
|
||||||
|
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
|
|
||||||
if ( xev.xbutton.subwindow == disp.win ) {
|
if ( xev.xbutton.subwindow == lcd.win ) {
|
||||||
if ( xev.xbutton.button == Button2 ) {
|
if ( xev.xbutton.button == Button2 ) {
|
||||||
if ( xev.xbutton.subwindow == disp.win ) {
|
if ( xev.xbutton.subwindow == lcd.win ) {
|
||||||
int x;
|
int x;
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
char* paste_in = XFetchBuffer( dpy, &x, 0 );
|
char* paste_in = XFetchBuffer( dpy, &x, 0 );
|
||||||
|
@ -4767,8 +4757,8 @@ void x11_adjust_contrast( void ) {
|
||||||
colors[ PIXEL ].g = g;
|
colors[ PIXEL ].g = g;
|
||||||
colors[ PIXEL ].b = b;
|
colors[ PIXEL ].b = b;
|
||||||
AllocColors();
|
AllocColors();
|
||||||
XSetForeground( dpy, disp.gc, COLOR( PIXEL ) );
|
XSetForeground( dpy, lcd.gc, COLOR( PIXEL ) );
|
||||||
disp.display_update = UPDATE_DISP | UPDATE_MENU;
|
lcd.display_update = UPDATE_DISP | UPDATE_MENU;
|
||||||
refresh_display();
|
refresh_display();
|
||||||
redraw_annunc();
|
redraw_annunc();
|
||||||
last_icon_state = -1;
|
last_icon_state = -1;
|
||||||
|
@ -4782,8 +4772,8 @@ void x11_adjust_contrast( void ) {
|
||||||
fprintf( stderr, "warning: can\'t alloc new pixel color.\n" );
|
fprintf( stderr, "warning: can\'t alloc new pixel color.\n" );
|
||||||
} else {
|
} else {
|
||||||
XFreeColors( dpy, cmap, &old, 1, 0 );
|
XFreeColors( dpy, cmap, &old, 1, 0 );
|
||||||
XSetForeground( dpy, disp.gc, COLOR( PIXEL ) );
|
XSetForeground( dpy, lcd.gc, COLOR( PIXEL ) );
|
||||||
disp.display_update = UPDATE_DISP | UPDATE_MENU;
|
lcd.display_update = UPDATE_DISP | UPDATE_MENU;
|
||||||
refresh_display();
|
refresh_display();
|
||||||
redraw_annunc();
|
redraw_annunc();
|
||||||
last_icon_state = -1;
|
last_icon_state = -1;
|
||||||
|
@ -4826,12 +4816,12 @@ void x11_init_LCD( void ) {
|
||||||
/* init nibble_maps */
|
/* init nibble_maps */
|
||||||
for ( int i = 0; i < 16; i++ )
|
for ( int i = 0; i < 16; i++ )
|
||||||
nibble_maps[ i ] =
|
nibble_maps[ i ] =
|
||||||
XCreateBitmapFromData( dpy, disp.win, ( char* )nibbles[ i ], 8, 2 );
|
XCreateBitmapFromData( dpy, lcd.win, ( char* )nibbles[ i ], 8, 2 );
|
||||||
|
|
||||||
if ( !shm_flag )
|
if ( !shm_flag )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( disp.disp_image->bitmap_bit_order == MSBFirst ) {
|
if ( lcd.disp_image->bitmap_bit_order == MSBFirst ) {
|
||||||
nibble_bitmap[ 0x0 ] = 0x00; /* ---- */
|
nibble_bitmap[ 0x0 ] = 0x00; /* ---- */
|
||||||
nibble_bitmap[ 0x1 ] = 0xc0; /* *--- */
|
nibble_bitmap[ 0x1 ] = 0xc0; /* *--- */
|
||||||
nibble_bitmap[ 0x2 ] = 0x30; /* -*-- */
|
nibble_bitmap[ 0x2 ] = 0x30; /* -*-- */
|
||||||
|
@ -4877,7 +4867,7 @@ void x11_update_LCD( void ) {
|
||||||
int val, line_pad, line_length;
|
int val, line_pad, line_length;
|
||||||
word_20 data_addr, data_addr_2;
|
word_20 data_addr, data_addr_2;
|
||||||
|
|
||||||
if ( !disp.mapped ) {
|
if ( !mapped ) {
|
||||||
refresh_icon();
|
refresh_icon();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4885,24 +4875,24 @@ void x11_update_LCD( void ) {
|
||||||
addr = display.disp_start;
|
addr = display.disp_start;
|
||||||
if ( shm_flag ) {
|
if ( shm_flag ) {
|
||||||
data_addr = 0;
|
data_addr = 0;
|
||||||
data_addr_2 = disp.disp_image->bytes_per_line;
|
data_addr_2 = lcd.disp_image->bytes_per_line;
|
||||||
line_length = NIBBLES_PER_ROW;
|
line_length = NIBBLES_PER_ROW;
|
||||||
if ( display.offset > 3 )
|
if ( display.offset > 3 )
|
||||||
line_length += 2;
|
line_length += 2;
|
||||||
line_pad = 2 * disp.disp_image->bytes_per_line - line_length;
|
line_pad = 2 * lcd.disp_image->bytes_per_line - line_length;
|
||||||
addr_pad = display.nibs_per_line - line_length;
|
addr_pad = display.nibs_per_line - line_length;
|
||||||
for ( i = 0; i <= display.lines; i++ ) {
|
for ( i = 0; i <= display.lines; i++ ) {
|
||||||
for ( j = 0; j < line_length; j++ ) {
|
for ( j = 0; j < line_length; j++ ) {
|
||||||
val = read_nibble( addr++ );
|
val = read_nibble( addr++ );
|
||||||
disp.disp_image->data[ data_addr++ ] = nibble_bitmap[ val ];
|
lcd.disp_image->data[ data_addr++ ] = nibble_bitmap[ val ];
|
||||||
disp.disp_image->data[ data_addr_2++ ] =
|
lcd.disp_image->data[ data_addr_2++ ] =
|
||||||
nibble_bitmap[ val ];
|
nibble_bitmap[ val ];
|
||||||
}
|
}
|
||||||
addr += addr_pad;
|
addr += addr_pad;
|
||||||
data_addr += line_pad;
|
data_addr += line_pad;
|
||||||
data_addr_2 += line_pad;
|
data_addr_2 += line_pad;
|
||||||
}
|
}
|
||||||
disp.display_update |= UPDATE_DISP;
|
lcd.display_update |= UPDATE_DISP;
|
||||||
} else {
|
} else {
|
||||||
if ( display.offset != old_offset ) {
|
if ( display.offset != old_offset ) {
|
||||||
memset(
|
memset(
|
||||||
|
@ -4929,21 +4919,20 @@ void x11_update_LCD( void ) {
|
||||||
addr = display.menu_start;
|
addr = display.menu_start;
|
||||||
if ( shm_flag ) {
|
if ( shm_flag ) {
|
||||||
data_addr = 0;
|
data_addr = 0;
|
||||||
data_addr_2 = disp.menu_image->bytes_per_line;
|
data_addr_2 = lcd.menu_image->bytes_per_line;
|
||||||
line_pad =
|
line_pad = 2 * lcd.menu_image->bytes_per_line - NIBBLES_PER_ROW;
|
||||||
2 * disp.menu_image->bytes_per_line - NIBBLES_PER_ROW;
|
|
||||||
for ( ; i < DISP_ROWS; i++ ) {
|
for ( ; i < DISP_ROWS; i++ ) {
|
||||||
for ( j = 0; j < NIBBLES_PER_ROW; j++ ) {
|
for ( j = 0; j < NIBBLES_PER_ROW; j++ ) {
|
||||||
val = read_nibble( addr++ );
|
val = read_nibble( addr++ );
|
||||||
disp.menu_image->data[ data_addr++ ] =
|
lcd.menu_image->data[ data_addr++ ] =
|
||||||
nibble_bitmap[ val ];
|
nibble_bitmap[ val ];
|
||||||
disp.menu_image->data[ data_addr_2++ ] =
|
lcd.menu_image->data[ data_addr_2++ ] =
|
||||||
nibble_bitmap[ val ];
|
nibble_bitmap[ val ];
|
||||||
}
|
}
|
||||||
data_addr += line_pad;
|
data_addr += line_pad;
|
||||||
data_addr_2 += line_pad;
|
data_addr_2 += line_pad;
|
||||||
}
|
}
|
||||||
disp.display_update |= UPDATE_MENU;
|
lcd.display_update |= UPDATE_MENU;
|
||||||
} else {
|
} else {
|
||||||
for ( ; i < DISP_ROWS; i++ ) {
|
for ( ; i < DISP_ROWS; i++ ) {
|
||||||
draw_row( addr, i );
|
draw_row( addr, i );
|
||||||
|
@ -4953,13 +4942,13 @@ void x11_update_LCD( void ) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( shm_flag ) {
|
if ( shm_flag ) {
|
||||||
memset( disp.disp_image->data, 0,
|
memset( lcd.disp_image->data, 0,
|
||||||
( size_t )( disp.disp_image->bytes_per_line *
|
( size_t )( lcd.disp_image->bytes_per_line *
|
||||||
disp.disp_image->height ) );
|
lcd.disp_image->height ) );
|
||||||
memset( disp.menu_image->data, 0,
|
memset( lcd.menu_image->data, 0,
|
||||||
( size_t )( disp.menu_image->bytes_per_line *
|
( size_t )( lcd.menu_image->bytes_per_line *
|
||||||
disp.menu_image->height ) );
|
lcd.menu_image->height ) );
|
||||||
disp.display_update = UPDATE_DISP | UPDATE_MENU;
|
lcd.display_update = UPDATE_DISP | UPDATE_MENU;
|
||||||
} else {
|
} else {
|
||||||
memset( disp_buf, 0xf0, sizeof( disp_buf ) );
|
memset( disp_buf, 0xf0, sizeof( disp_buf ) );
|
||||||
for ( i = 0; i < 64; i++ ) {
|
for ( i = 0; i < 64; i++ ) {
|
||||||
|
@ -4970,12 +4959,12 @@ void x11_update_LCD( void ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( disp.display_update )
|
if ( lcd.display_update )
|
||||||
refresh_display();
|
refresh_display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void x11_refresh_LCD( void ) {
|
void x11_refresh_LCD( void ) {
|
||||||
if ( disp.display_update )
|
if ( lcd.display_update )
|
||||||
refresh_display();
|
refresh_display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4993,12 +4982,11 @@ void x11_disp_draw_nibble( word_20 addr, word_4 val ) {
|
||||||
if ( y < 0 || y > 63 )
|
if ( y < 0 || y > 63 )
|
||||||
return;
|
return;
|
||||||
if ( shm_flag ) {
|
if ( shm_flag ) {
|
||||||
shm_addr = ( 2 * y * disp.disp_image->bytes_per_line ) + x;
|
shm_addr = ( 2 * y * lcd.disp_image->bytes_per_line ) + x;
|
||||||
disp.disp_image->data[ shm_addr ] = nibble_bitmap[ val ];
|
lcd.disp_image->data[ shm_addr ] = nibble_bitmap[ val ];
|
||||||
disp.disp_image
|
lcd.disp_image->data[ shm_addr + lcd.disp_image->bytes_per_line ] =
|
||||||
->data[ shm_addr + disp.disp_image->bytes_per_line ] =
|
|
||||||
nibble_bitmap[ val ];
|
nibble_bitmap[ val ];
|
||||||
disp.display_update |= UPDATE_DISP;
|
lcd.display_update |= UPDATE_DISP;
|
||||||
} else {
|
} else {
|
||||||
if ( val != disp_buf[ y ][ x ] ) {
|
if ( val != disp_buf[ y ][ x ] ) {
|
||||||
disp_buf[ y ][ x ] = val;
|
disp_buf[ y ][ x ] = val;
|
||||||
|
@ -5009,12 +4997,12 @@ void x11_disp_draw_nibble( word_20 addr, word_4 val ) {
|
||||||
if ( shm_flag ) {
|
if ( shm_flag ) {
|
||||||
shm_addr = x;
|
shm_addr = x;
|
||||||
for ( y = 0; y < display.lines; y++ ) {
|
for ( y = 0; y < display.lines; y++ ) {
|
||||||
disp.disp_image->data[ shm_addr ] = nibble_bitmap[ val ];
|
lcd.disp_image->data[ shm_addr ] = nibble_bitmap[ val ];
|
||||||
shm_addr += disp.disp_image->bytes_per_line;
|
shm_addr += lcd.disp_image->bytes_per_line;
|
||||||
disp.disp_image->data[ shm_addr ] = nibble_bitmap[ val ];
|
lcd.disp_image->data[ shm_addr ] = nibble_bitmap[ val ];
|
||||||
shm_addr += disp.disp_image->bytes_per_line;
|
shm_addr += lcd.disp_image->bytes_per_line;
|
||||||
}
|
}
|
||||||
disp.display_update |= UPDATE_DISP;
|
lcd.display_update |= UPDATE_DISP;
|
||||||
} else {
|
} else {
|
||||||
for ( y = 0; y < display.lines; y++ ) {
|
for ( y = 0; y < display.lines; y++ ) {
|
||||||
if ( val != disp_buf[ y ][ x ] ) {
|
if ( val != disp_buf[ y ][ x ] ) {
|
||||||
|
@ -5034,12 +5022,12 @@ void x11_menu_draw_nibble( word_20 addr, word_4 val ) {
|
||||||
offset = ( addr - display.menu_start );
|
offset = ( addr - display.menu_start );
|
||||||
if ( shm_flag ) {
|
if ( shm_flag ) {
|
||||||
shm_addr =
|
shm_addr =
|
||||||
2 * ( offset / NIBBLES_PER_ROW ) * disp.menu_image->bytes_per_line +
|
2 * ( offset / NIBBLES_PER_ROW ) * lcd.menu_image->bytes_per_line +
|
||||||
( offset % NIBBLES_PER_ROW );
|
( offset % NIBBLES_PER_ROW );
|
||||||
disp.menu_image->data[ shm_addr ] = nibble_bitmap[ val ];
|
lcd.menu_image->data[ shm_addr ] = nibble_bitmap[ val ];
|
||||||
disp.menu_image->data[ shm_addr + disp.menu_image->bytes_per_line ] =
|
lcd.menu_image->data[ shm_addr + lcd.menu_image->bytes_per_line ] =
|
||||||
nibble_bitmap[ val ];
|
nibble_bitmap[ val ];
|
||||||
disp.display_update |= UPDATE_MENU;
|
lcd.display_update |= UPDATE_MENU;
|
||||||
} else {
|
} else {
|
||||||
x = offset % NIBBLES_PER_ROW;
|
x = offset % NIBBLES_PER_ROW;
|
||||||
y = display.lines + ( offset / NIBBLES_PER_ROW ) + 1;
|
y = display.lines + ( offset / NIBBLES_PER_ROW ) + 1;
|
||||||
|
@ -5061,11 +5049,11 @@ void x11_draw_annunc( void ) {
|
||||||
|
|
||||||
for ( int i = 0; ann_tbl[ i ].bit; i++ ) {
|
for ( int i = 0; ann_tbl[ i ].bit; i++ ) {
|
||||||
if ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit )
|
if ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit )
|
||||||
XCopyPlane( dpy, ann_tbl[ i ].pixmap, disp.win, disp.gc, 0, 0,
|
XCopyPlane( dpy, ann_tbl[ i ].pixmap, lcd.win, lcd.gc, 0, 0,
|
||||||
ann_tbl[ i ].width, ann_tbl[ i ].height, ann_tbl[ i ].x,
|
ann_tbl[ i ].width, ann_tbl[ i ].height, ann_tbl[ i ].x,
|
||||||
ann_tbl[ i ].y, 1 );
|
ann_tbl[ i ].y, 1 );
|
||||||
else
|
else
|
||||||
XClearArea( dpy, disp.win, ann_tbl[ i ].x, ann_tbl[ i ].y,
|
XClearArea( dpy, lcd.win, ann_tbl[ i ].x, ann_tbl[ i ].y,
|
||||||
ann_tbl[ i ].width, ann_tbl[ i ].height, False );
|
ann_tbl[ i ].width, ann_tbl[ i ].height, False );
|
||||||
}
|
}
|
||||||
refresh_icon();
|
refresh_icon();
|
||||||
|
|
Loading…
Reference in a new issue