*** x48_x11.c.ORIG	Sun Apr 10 12:27:33 2005
--- x48_x11.c	Tue May  3 10:46:29 2005
***************
*** 159,164 ****
--- 159,167 ----
  # define DEBUG_SHM 1
  #endif
  
+ #define HACKWIDTH 640
+ #define HACKHEIGHT 425
+ 
  typedef struct keypad_t {
    unsigned int	width;
    unsigned int	height;
***************
*** 481,614 ****
    { 0 }
  };
  
  button_t buttons_gx[] = {
!   { "A", 0, 0, 0x14,  0, 0, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "A", 0, 0, 0, 0, 0 },
!   { "B", 0, 0, 0x84,  50, 0, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "B", 0, 0, 0, 0, 0 },
!   { "C", 0, 0, 0x83, 100, 0, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "C", 0, 0, 0, 0, 0 },
!   { "D", 0, 0, 0x82, 150, 0, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "D", 0, 0, 0, 0, 0 },
!   { "E", 0, 0, 0x81, 200, 0, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "E", 0, 0, 0, 0, 0 },
!   { "F", 0, 0, 0x80, 250, 0, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "F", 0, 0, 0, 0, 0 },
  
!   { "MTH", 0, 0, 0x24,  0, 50, 36, 26, WHITE, "MTH", 0, 0, 0, 0,
      "G", "RAD", 0, "POLAR", 0, 0 },
!   { "PRG", 0, 0, 0x74,  50, 50, 36, 26, WHITE, "PRG", 0, 0, 0, 0,
      "H", 0, 0, "CHARS", 0, 0 },
!   { "CST", 0, 0, 0x73, 100, 50, 36, 26, WHITE, "CST", 0, 0, 0, 0,
      "I", 0, 0, "MODES", 0, 0 },
!   { "VAR", 0, 0, 0x72, 150, 50, 36, 26, WHITE, "VAR", 0, 0, 0, 0,
      "J", 0, 0, "MEMORY", 0, 0 },
!   { "UP", 0, 0, 0x71, 200, 50, 36, 26, WHITE,
       0, 0, up_width, up_height, up_bits,
      "K", 0, 0, "STACK", 0, 0 },
!   { "NXT", 0, 0, 0x70, 250, 50, 36, 26, WHITE, "NXT", 0, 0, 0, 0,
      "L", "PREV", 0, "MENU", 0, 0 },
  
!   { "COLON", 0, 0, 0x04,  0, 100, 36, 26, WHITE,
       0, 0, colon_width, colon_height, colon_bits,
      "M", "UP", 0, "HOME", 0, 0 },
!   { "STO", 0, 0, 0x64,  50, 100, 36, 26, WHITE, "STO", 0, 0, 0, 0,
      "N", "DEF", 0, "RCL", 0, 0 },
!   { "EVAL", 0, 0, 0x63, 100, 100, 36, 26, WHITE, "EVAL", 0, 0, 0, 0,
      "O", "aNUM", 0, "UNDO", 0, 0 },
!   { "LEFT", 0, 0, 0x62, 150, 100, 36, 26, WHITE,
       0, 0, left_width, left_height, left_bits,
      "P", "PICTURE", 0, 0, 0, 0 },
!   { "DOWN", 0, 0, 0x61, 200, 100, 36, 26, WHITE,
       0, 0, down_width, down_height, down_bits,
      "Q", "VIEW", 0, 0, 0, 0 },
!   { "RIGHT", 0, 0, 0x60, 250, 100, 36, 26, WHITE,
       0, 0, right_width, right_height, right_bits,
      "R", "SWAP", 0, 0, 0, 0 },
  
!   { "SIN", 0, 0, 0x34,  0, 150, 36, 26, WHITE, "SIN", 0, 0, 0, 0,
      "S", "ASIN", 0, "b", 0, 0 },
!   { "COS", 0, 0, 0x54,  50, 150, 36, 26, WHITE, "COS", 0, 0, 0, 0,
      "T", "ACOS", 0, "c", 0, 0 },
!   { "TAN", 0, 0, 0x53,  100, 150, 36, 26, WHITE, "TAN", 0, 0, 0, 0,
      "U", "ATAN", 0, "d", 0, 0 },
!   { "SQRT", 0, 0, 0x52,  150, 150, 36, 26, WHITE,
       0, 0, sqrt_width, sqrt_height, sqrt_bits,
      "V", "n", 0, "o", 0, 0 },
!   { "POWER", 0, 0, 0x51,  200, 150, 36, 26, WHITE,
       0, 0, power_width, power_height, power_bits,
      "W", "p", 0, "LOG", 0, 0 },
!   { "INV", 0, 0, 0x50,  250, 150, 36, 26, WHITE,
       0, 0, inv_width, inv_height, inv_bits,
      "X", "q", 0, "LN", 0, 0 },
  
!   { "ENTER", 0, 0, 0x44, 0, 200, 86, 26, WHITE, "ENTER", 2, 0, 0, 0,
       0, "EQUATION", 0, "MATRIX", 0, 0 },
!   { "NEG", 0, 0, 0x43, 100, 200, 36, 26, WHITE,
       0, 0, neg_width, neg_height, neg_bits,
      "Y", "EDIT", 0, "CMD", 0, 0 },
!   { "EEX", 0, 0, 0x42, 150, 200, 36, 26, WHITE, "EEX", 0, 0, 0, 0,
      "Z", "PURG", 0, "ARG", 0, 0 },
!   { "DEL", 0, 0, 0x41, 200, 200, 36, 26, WHITE, "DEL", 0, 0, 0, 0,
       0, "CLEAR", 0, 0, 0, 0 },
!   { "BS", 0, 0, 0x40, 250, 200, 36, 26, WHITE,
       0, 0, bs_width, bs_height, bs_bits,
       0, "DROP", 0, 0, 0, 0 },
  
!   { "ALPHA", 0, 0, 0x35, 0, 250, 36, 26, WHITE,
       0, 0, alpha_width, alpha_height, alpha_bits,
       0, "USER", 0, "ENTRY", 0, 0 },
!   { "7", 0, 0, 0x33, 60, 250, 46, 26, WHITE, "7", 1, 0, 0, 0,
       0, 0, 1, "SOLVE", 0, 0 },
!   { "8", 0, 0, 0x32, 120, 250, 46, 26, WHITE, "8", 1, 0, 0, 0,
       0, 0, 1, "PLOT", 0, 0 },
!   { "9", 0, 0, 0x31, 180, 250, 46, 26, WHITE, "9", 1, 0, 0, 0,
       0, 0, 1, "SYMBOLIC", 0, 0 },
!   { "DIV", 0, 0, 0x30, 240, 250, 46, 26, WHITE,
       0, 0, div_width, div_height, div_bits,
       0, "r ", 0, "s", 0, 0 },
  
!   { "SHL", 0, 0, 0x25, 0, 300, 36, 26, LEFT,
       0, 0, shl_width, shl_height, shl_bits,
       0, 0, 0, 0, 0, 0 },
!   { "4", 0, 0, 0x23, 60, 300, 46, 26, WHITE, "4", 1, 0, 0, 0,
       0, 0, 1, "TIME", 0, 0 },
!   { "5", 0, 0, 0x22, 120, 300, 46, 26, WHITE, "5", 1, 0, 0, 0,
       0, 0, 1, "STAT", 0, 0 },
!   { "6", 0, 0, 0x21, 180, 300, 46, 26, WHITE, "6", 1, 0, 0, 0,
       0, 0, 1, "UNITS", 0, 0 },
!   { "MUL", 0, 0, 0x20, 240, 300, 46, 26, WHITE,
       0, 0, mul_width, mul_height, mul_bits,
       0, "t ", 0, "u", 0, 0 },
  
!   { "SHR", 0, 0, 0x15, 0, 350, 36, 26, RIGHT,
       0, 0, shr_width, shr_height, shr_bits,
       0, 0, 1, " ", 0, 0 },
!   { "1", 0, 0, 0x13, 60, 350, 46, 26, WHITE, "1", 1, 0, 0, 0,
       0, 0, 1, "I/O", 0, 0 },
!   { "2", 0, 0, 0x12, 120, 350, 46, 26, WHITE, "2", 1, 0, 0, 0,
       0, 0, 1, "LIBRARY", 0, 0 },
!   { "3", 0, 0, 0x11, 180, 350, 46, 26, WHITE, "3", 1, 0, 0, 0,
       0, 0, 1, "EQ LIB", 0, 0 },
!   { "MINUS", 0, 0, 0x10, 240, 350, 46, 26, WHITE,
       0, 0, minus_width, minus_height, minus_bits,
       0, "v ", 0, "w", 0, 0 },
  
!   { "ON", 0, 0, 0x8000, 0, 400, 36, 26, WHITE, "ON", 0, 0, 0, 0,
       0, "CONT", 0, "OFF", "CANCEL", 0 },
!   { "0", 0, 0, 0x03, 60, 400, 46, 26, WHITE, "0", 1, 0, 0, 0,
       0, "\004 ", 0, "\003", 0, 0 },
!   { "PERIOD", 0, 0, 0x02, 120, 400, 46, 26, WHITE, ".", 1, 0, 0, 0,
       0, "\002 ", 0, "\001", 0, 0 },
!   { "SPC", 0, 0, 0x01, 180, 400, 46, 26, WHITE, "SPC", 0, 0, 0, 0,
       0, "\005 ", 0, "z", 0, 0 },
!   { "PLUS", 0, 0, 0x00, 240, 400, 46, 26, WHITE,
       0, 0, plus_width, plus_height, plus_bits,
       0, "x ", 0, "y", 0, 0 },
  
--- 484,622 ----
    { 0 }
  };
  
+ #define HACKXO 317
+ #define LHACKXO -3
+ #define HACKYO -305
+ #define LHACKYO 30
+ 
  button_t buttons_gx[] = {
!   { "A", 0, 0, 0x14,  0+LHACKXO, 0+LHACKYO, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "A", 0, 0, 0, 0, 0 },
!   { "B", 0, 0, 0x84,  50+LHACKXO, 0+LHACKYO, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "B", 0, 0, 0, 0, 0 },
!   { "C", 0, 0, 0x83, 100+LHACKXO, 0+LHACKYO, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "C", 0, 0, 0, 0, 0 },
!   { "D", 0, 0, 0x82, 150+LHACKXO, 0+LHACKYO, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "D", 0, 0, 0, 0, 0 },
!   { "E", 0, 0, 0x81, 200+LHACKXO, 0+LHACKYO, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "E", 0, 0, 0, 0, 0 },
!   { "F", 0, 0, 0x80, 250+LHACKXO, 0+LHACKYO, 36, 23, WHITE,
       0, 0, menu_label_width, menu_label_height, menu_label_bits,
      "F", 0, 0, 0, 0, 0 },
  
!   { "MTH", 0, 0, 0x24,  0+HACKXO, 50+HACKYO, 36, 26, WHITE, "MTH", 0, 0, 0, 0,
      "G", "RAD", 0, "POLAR", 0, 0 },
!   { "PRG", 0, 0, 0x74,  50+HACKXO, 50+HACKYO, 36, 26, WHITE, "PRG", 0, 0, 0, 0,
      "H", 0, 0, "CHARS", 0, 0 },
!   { "CST", 0, 0, 0x73, 100+HACKXO, 50+HACKYO, 36, 26, WHITE, "CST", 0, 0, 0, 0,
      "I", 0, 0, "MODES", 0, 0 },
!   { "VAR", 0, 0, 0x72, 150+HACKXO, 50+HACKYO, 36, 26, WHITE, "VAR", 0, 0, 0, 0,
      "J", 0, 0, "MEMORY", 0, 0 },
!   { "UP", 0, 0, 0x71, 200+HACKXO, 50+HACKYO, 36, 26, WHITE,
       0, 0, up_width, up_height, up_bits,
      "K", 0, 0, "STACK", 0, 0 },
!   { "NXT", 0, 0, 0x70, 250+HACKXO, 50+HACKYO, 36, 26, WHITE, "NXT", 0, 0, 0, 0,
      "L", "PREV", 0, "MENU", 0, 0 },
  
!   { "COLON", 0, 0, 0x04,  0+HACKXO, 100+HACKYO, 36, 26, WHITE,
       0, 0, colon_width, colon_height, colon_bits,
      "M", "UP", 0, "HOME", 0, 0 },
!   { "STO", 0, 0, 0x64,  50+HACKXO, 100+HACKYO, 36, 26, WHITE, "STO", 0, 0, 0, 0,
      "N", "DEF", 0, "RCL", 0, 0 },
!   { "EVAL", 0, 0, 0x63, 100+HACKXO, 100+HACKYO, 36, 26, WHITE, "EVAL", 0, 0, 0, 0,
      "O", "aNUM", 0, "UNDO", 0, 0 },
!   { "LEFT", 0, 0, 0x62, 150+HACKXO, 100+HACKYO, 36, 26, WHITE,
       0, 0, left_width, left_height, left_bits,
      "P", "PICTURE", 0, 0, 0, 0 },
!   { "DOWN", 0, 0, 0x61, 200+HACKXO, 100+HACKYO, 36, 26, WHITE,
       0, 0, down_width, down_height, down_bits,
      "Q", "VIEW", 0, 0, 0, 0 },
!   { "RIGHT", 0, 0, 0x60, 250+HACKXO, 100+HACKYO, 36, 26, WHITE,
       0, 0, right_width, right_height, right_bits,
      "R", "SWAP", 0, 0, 0, 0 },
  
!   { "SIN", 0, 0, 0x34,  0+HACKXO, 150+HACKYO, 36, 26, WHITE, "SIN", 0, 0, 0, 0,
      "S", "ASIN", 0, "b", 0, 0 },
!   { "COS", 0, 0, 0x54,  50+HACKXO, 150+HACKYO, 36, 26, WHITE, "COS", 0, 0, 0, 0,
      "T", "ACOS", 0, "c", 0, 0 },
!   { "TAN", 0, 0, 0x53,  100+HACKXO, 150+HACKYO, 36, 26, WHITE, "TAN", 0, 0, 0, 0,
      "U", "ATAN", 0, "d", 0, 0 },
!   { "SQRT", 0, 0, 0x52,  150+HACKXO, 150+HACKYO, 36, 26, WHITE,
       0, 0, sqrt_width, sqrt_height, sqrt_bits,
      "V", "n", 0, "o", 0, 0 },
!   { "POWER", 0, 0, 0x51,  200+HACKXO, 150+HACKYO, 36, 26, WHITE,
       0, 0, power_width, power_height, power_bits,
      "W", "p", 0, "LOG", 0, 0 },
!   { "INV", 0, 0, 0x50,  250+HACKXO, 150+HACKYO, 36, 26, WHITE,
       0, 0, inv_width, inv_height, inv_bits,
      "X", "q", 0, "LN", 0, 0 },
  
!   { "ENTER", 0, 0, 0x44, 0+HACKXO, 200+HACKYO, 86, 26, WHITE, "ENTER", 2, 0, 0, 0,
       0, "EQUATION", 0, "MATRIX", 0, 0 },
!   { "NEG", 0, 0, 0x43, 100+HACKXO, 200+HACKYO, 36, 26, WHITE,
       0, 0, neg_width, neg_height, neg_bits,
      "Y", "EDIT", 0, "CMD", 0, 0 },
!   { "EEX", 0, 0, 0x42, 150+HACKXO, 200+HACKYO, 36, 26, WHITE, "EEX", 0, 0, 0, 0,
      "Z", "PURG", 0, "ARG", 0, 0 },
!   { "DEL", 0, 0, 0x41, 200+HACKXO, 200+HACKYO, 36, 26, WHITE, "DEL", 0, 0, 0, 0,
       0, "CLEAR", 0, 0, 0, 0 },
!   { "BS", 0, 0, 0x40, 250+HACKXO, 200+HACKYO, 36, 26, WHITE,
       0, 0, bs_width, bs_height, bs_bits,
       0, "DROP", 0, 0, 0, 0 },
  
!   { "ALPHA", 0, 0, 0x35, 0+HACKXO, 250+HACKYO, 36, 26, WHITE,
       0, 0, alpha_width, alpha_height, alpha_bits,
       0, "USER", 0, "ENTRY", 0, 0 },
!   { "7", 0, 0, 0x33, 60+HACKXO, 250+HACKYO, 46, 26, WHITE, "7", 1, 0, 0, 0,
       0, 0, 1, "SOLVE", 0, 0 },
!   { "8", 0, 0, 0x32, 120+HACKXO, 250+HACKYO, 46, 26, WHITE, "8", 1, 0, 0, 0,
       0, 0, 1, "PLOT", 0, 0 },
!   { "9", 0, 0, 0x31, 180+HACKXO, 250+HACKYO, 46, 26, WHITE, "9", 1, 0, 0, 0,
       0, 0, 1, "SYMBOLIC", 0, 0 },
!   { "DIV", 0, 0, 0x30, 240+HACKXO, 250+HACKYO, 46, 26, WHITE,
       0, 0, div_width, div_height, div_bits,
       0, "r ", 0, "s", 0, 0 },
  
!   { "SHL", 0, 0, 0x25, 0+HACKXO, 300+HACKYO, 36, 26, LEFT,
       0, 0, shl_width, shl_height, shl_bits,
       0, 0, 0, 0, 0, 0 },
!   { "4", 0, 0, 0x23, 60+HACKXO, 300+HACKYO, 46, 26, WHITE, "4", 1, 0, 0, 0,
       0, 0, 1, "TIME", 0, 0 },
!   { "5", 0, 0, 0x22, 120+HACKXO, 300+HACKYO, 46, 26, WHITE, "5", 1, 0, 0, 0,
       0, 0, 1, "STAT", 0, 0 },
!   { "6", 0, 0, 0x21, 180+HACKXO, 300+HACKYO, 46, 26, WHITE, "6", 1, 0, 0, 0,
       0, 0, 1, "UNITS", 0, 0 },
!   { "MUL", 0, 0, 0x20, 240+HACKXO, 300+HACKYO, 46, 26, WHITE,
       0, 0, mul_width, mul_height, mul_bits,
       0, "t ", 0, "u", 0, 0 },
  
!   { "SHR", 0, 0, 0x15, 0+HACKXO, 350+HACKYO, 36, 26, RIGHT,
       0, 0, shr_width, shr_height, shr_bits,
       0, 0, 1, " ", 0, 0 },
!   { "1", 0, 0, 0x13, 60+HACKXO, 350+HACKYO, 46, 26, WHITE, "1", 1, 0, 0, 0,
       0, 0, 1, "I/O", 0, 0 },
!   { "2", 0, 0, 0x12, 120+HACKXO, 350+HACKYO, 46, 26, WHITE, "2", 1, 0, 0, 0,
       0, 0, 1, "LIBRARY", 0, 0 },
!   { "3", 0, 0, 0x11, 180+HACKXO, 350+HACKYO, 46, 26, WHITE, "3", 1, 0, 0, 0,
       0, 0, 1, "EQ LIB", 0, 0 },
!   { "MINUS", 0, 0, 0x10, 240+HACKXO, 350+HACKYO, 46, 26, WHITE,
       0, 0, minus_width, minus_height, minus_bits,
       0, "v ", 0, "w", 0, 0 },
  
!   { "ON", 0, 0, 0x8000, 0+HACKXO, 400+HACKYO, 36, 26, WHITE, "ON", 0, 0, 0, 0,
       0, "CONT", 0, "OFF", "CANCEL", 0 },
!   { "0", 0, 0, 0x03, 60+HACKXO, 400+HACKYO, 46, 26, WHITE, "0", 1, 0, 0, 0,
       0, "\004 ", 0, "\003", 0, 0 },
!   { "PERIOD", 0, 0, 0x02, 120+HACKXO, 400+HACKYO, 46, 26, WHITE, ".", 1, 0, 0, 0,
       0, "\002 ", 0, "\001", 0, 0 },
!   { "SPC", 0, 0, 0x01, 180+HACKXO, 400+HACKYO, 46, 26, WHITE, "SPC", 0, 0, 0, 0,
       0, "\005 ", 0, "z", 0, 0 },
!   { "PLUS", 0, 0, 0x00, 240+HACKXO, 400+HACKYO, 46, 26, WHITE,
       0, 0, plus_width, plus_height, plus_bits,
       0, "x ", 0, "y", 0, 0 },
  
***************
*** 666,673 ****
  
  #define DISPLAY_WIDTH		(264 + 8)
  #define DISPLAY_HEIGHT		(128 + 16 + 8)
! #define DISPLAY_OFFSET_X	(SIDE_SKIP+(KEYBOARD_WIDTH-DISPLAY_WIDTH)/2)
! #define DISPLAY_OFFSET_Y	TOP_SKIP
  
  #define DISP_FRAME		8
  
--- 674,682 ----
  
  #define DISPLAY_WIDTH		(264 + 8)
  #define DISPLAY_HEIGHT		(128 + 16 + 8)
! //#define DISPLAY_OFFSET_X	(SIDE_SKIP+(KEYBOARD_WIDTH-DISPLAY_WIDTH)/2)
! #define DISPLAY_OFFSET_X	SIDE_SKIP + 4
! #define DISPLAY_OFFSET_Y	TOP_SKIP + 30
  
  #define DISP_FRAME		8
  
***************
*** 899,904 ****
--- 908,917 ----
        r = (0x13 - contrast) * (colors[LCD].r / 0x10);
        g = (0x13 - contrast) * (colors[LCD].g / 0x10);
        b = 128 - ((0x13 - contrast) * ((128 - colors[LCD].b) / 0x10));
+ //r=46;
+ //g=49;
+ //b=73;
+ //COLOR(LCD) = 0x788264;
        colors[PIXEL].xcolor.red = r << 8;
        colors[PIXEL].xcolor.green = g << 8;
        colors[PIXEL].xcolor.blue = b << 8;
***************
*** 1687,1693 ****
  
    cut = KEYBOARD_OFFSET_Y + buttons[BUTTON_MTH].y - 19;
  
!   XFillRectangle(dpy, keypad.pixmap, gc, 0, 0, w, (unsigned int)cut);
  
    /*
     * draw the character labels
--- 1700,1708 ----
  
    cut = KEYBOARD_OFFSET_Y + buttons[BUTTON_MTH].y - 19;
  
! #define HACKLW 320
! //  XFillRectangle(dpy, keypad.pixmap, gc, 0, 0, w, (unsigned int)cut);
!   XFillRectangle(dpy, keypad.pixmap, gc, 0, 0, HACKLW, h);
  
    /*
     * draw the character labels
***************
*** 2091,2192 ****
              (int)(DISPLAY_OFFSET_X + DISPLAY_WIDTH),
  	    (int)(DISPLAY_OFFSET_Y + DISPLAY_HEIGHT - 2));
  
!   /*
!    * lower the whole thing
!    */
    XSetForeground(dpy, gc, COLOR(PAD_TOP));
  
!   /* bottom lines */
    XDrawLine(dpy, keypad.pixmap, gc, 1, (int)(keypad.height - 1),
! 	    (int)(keypad.width - 1), (int)(keypad.height - 1));
    XDrawLine(dpy, keypad.pixmap, gc, 2, (int)(keypad.height - 2),
! 	    (int)(keypad.width - 2), (int)(keypad.height - 2));
! 
!   /* right lines */
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 1),
! 	    (int)(keypad.height - 1), (int)(keypad.width - 1), cut);
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 2),
! 	    (int)(keypad.height - 2), (int)(keypad.width - 2), cut);
  
    XSetForeground(dpy, gc, COLOR(DISP_PAD_TOP));
  
!   /* right lines */
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 1),
! 	    cut - 1, (int)(keypad.width - 1), 1);
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 2),
! 	    cut - 1, (int)(keypad.width - 2), 2);
  
    XSetForeground(dpy, gc, COLOR(DISP_PAD_BOT));
  
!   /* top lines */
!   XDrawLine(dpy, keypad.pixmap, gc, 0, 0, (int)(keypad.width - 2), 0);
!   XDrawLine(dpy, keypad.pixmap, gc, 1, 1, (int)(keypad.width - 3), 1);
  
!   /* left lines */
    XDrawLine(dpy, keypad.pixmap, gc, 0, cut - 1, 0, 0);
    XDrawLine(dpy, keypad.pixmap, gc, 1, cut - 1, 1, 1);
  
    XSetForeground(dpy, gc, COLOR(PAD_BOT));
  
!   /* left lines */
    XDrawLine(dpy, keypad.pixmap, gc, 0, (int)(keypad.height - 2), 0, cut);
    XDrawLine(dpy, keypad.pixmap, gc, 1, (int)(keypad.height - 3), 1, cut);
  
!   /*
!    * lower the menu buttons
!    */
    XSetForeground(dpy, gc, COLOR(PAD_TOP));
  
!   /* bottom lines */
    XDrawLine(dpy, keypad.pixmap, gc, 3, (int)(keypad.height - 3),
! 	    (int)(keypad.width - 3), (int)(keypad.height - 3));
    XDrawLine(dpy, keypad.pixmap, gc, 4, (int)(keypad.height - 4),
! 	    (int)(keypad.width - 4), (int)(keypad.height - 4));
  
!   /* right lines */
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 3),
! 	    (int)(keypad.height - 3), (int)(keypad.width - 3), cut);
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 4),
! 	    (int)(keypad.height - 4), (int)(keypad.width - 4), cut);
  
    XSetForeground(dpy, gc, COLOR(DISP_PAD_TOP));
  
!   /* right lines */
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 3),
! 	    cut - 1, (int)(keypad.width - 3), KEYBOARD_OFFSET_Y - 24);
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 4),
! 	    cut - 1, (int)(keypad.width - 4), KEYBOARD_OFFSET_Y - 23);
  
    XSetForeground(dpy, gc, COLOR(DISP_PAD_BOT));
  
!   /* top lines */
!   XDrawLine(dpy, keypad.pixmap, gc, 2, KEYBOARD_OFFSET_Y - 25,
!             (int)(keypad.width - 4), KEYBOARD_OFFSET_Y - 25);
!   XDrawLine(dpy, keypad.pixmap, gc, 3, KEYBOARD_OFFSET_Y - 24,
!             (int)(keypad.width - 5), KEYBOARD_OFFSET_Y - 24);
! 
!   /* left lines */
!   XDrawLine(dpy, keypad.pixmap, gc, 2, cut - 1, 2, KEYBOARD_OFFSET_Y - 24);
!   XDrawLine(dpy, keypad.pixmap, gc, 3, cut - 1, 3, KEYBOARD_OFFSET_Y - 23);
  
    XSetForeground(dpy, gc, COLOR(PAD_BOT));
  
!   /* left lines */
    XDrawLine(dpy, keypad.pixmap, gc, 2, (int)(keypad.height - 4), 2, cut);
    XDrawLine(dpy, keypad.pixmap, gc, 3, (int)(keypad.height - 5), 3, cut);
  
!   /*
!    * lower the keyboard
!    */
    XSetForeground(dpy, gc, COLOR(PAD_TOP));
  
!   /* bottom lines */
    XDrawLine(dpy, keypad.pixmap, gc, 5, (int)(keypad.height - 5),
! 	    (int)(keypad.width - 3), (int)(keypad.height - 5));
    XDrawLine(dpy, keypad.pixmap, gc, 6, (int)(keypad.height - 6),
! 	    (int)(keypad.width - 4), (int)(keypad.height - 6));
! 
!   /* right lines */
    XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 5),
  	    (int)(keypad.height - 5), (int)(keypad.width - 5), cut + 1);
    XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 6),
--- 2106,2204 ----
              (int)(DISPLAY_OFFSET_X + DISPLAY_WIDTH),
  	    (int)(DISPLAY_OFFSET_Y + DISPLAY_HEIGHT - 2));
  
! 
!    // lower the whole thing
    XSetForeground(dpy, gc, COLOR(PAD_TOP));
  
! cut = HACKHEIGHT;
! 
!   // bottom lines 
    XDrawLine(dpy, keypad.pixmap, gc, 1, (int)(keypad.height - 1),
! 	    (int)(HACKLW - 1), (int)(keypad.height - 1));
    XDrawLine(dpy, keypad.pixmap, gc, 2, (int)(keypad.height - 2),
! 	    (int)(HACKLW - 2), (int)(keypad.height - 2));
  
+   // right lines 
+   XDrawLine(dpy, keypad.pixmap, gc, (int)(HACKLW - 1),
+ 	    (int)(keypad.height - 1), (int)(HACKLW - 1), cut);
+   XDrawLine(dpy, keypad.pixmap, gc, (int)(HACKLW - 2),
+ 	    (int)(keypad.height - 2), (int)(HACKLW - 2), cut);
    XSetForeground(dpy, gc, COLOR(DISP_PAD_TOP));
  
!   // right lines 
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(HACKLW - 1),
! 	    cut - 1, (int)(HACKLW - 1), 1);
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(HACKLW - 2),
! 	    cut - 1, (int)(HACKLW - 2), 2);
  
    XSetForeground(dpy, gc, COLOR(DISP_PAD_BOT));
  
!   // top lines
!   XDrawLine(dpy, keypad.pixmap, gc, 0, 0, (int)(HACKLW - 2), 0);
!   XDrawLine(dpy, keypad.pixmap, gc, 1, 1, (int)(HACKLW - 3), 1);
  
!   // left lines 
    XDrawLine(dpy, keypad.pixmap, gc, 0, cut - 1, 0, 0);
    XDrawLine(dpy, keypad.pixmap, gc, 1, cut - 1, 1, 1);
  
    XSetForeground(dpy, gc, COLOR(PAD_BOT));
  
!   // left lines
    XDrawLine(dpy, keypad.pixmap, gc, 0, (int)(keypad.height - 2), 0, cut);
    XDrawLine(dpy, keypad.pixmap, gc, 1, (int)(keypad.height - 3), 1, cut);
  
!    //lower the menu buttons
    XSetForeground(dpy, gc, COLOR(PAD_TOP));
  
!   // bottom lines 
    XDrawLine(dpy, keypad.pixmap, gc, 3, (int)(keypad.height - 3),
! 	    (int)(HACKLW - 3), (int)(keypad.height - 3));
    XDrawLine(dpy, keypad.pixmap, gc, 4, (int)(keypad.height - 4),
! 	    (int)(HACKLW - 4), (int)(keypad.height - 4));
  
!   // right lines 
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(HACKLW - 3),
! 	    (int)(keypad.height - 3), (int)(HACKLW - 3), cut);
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(HACKLW - 4),
! 	    (int)(keypad.height - 4), (int)(HACKLW - 4), cut);
  
    XSetForeground(dpy, gc, COLOR(DISP_PAD_TOP));
  
!   // right lines
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(HACKLW - 3),
! 	    cut - 1, (int)(HACKLW - 3), KEYBOARD_OFFSET_Y - 24 + LHACKYO);
!   XDrawLine(dpy, keypad.pixmap, gc, (int)(HACKLW - 4),
! 	    cut - 1, (int)(HACKLW - 4), KEYBOARD_OFFSET_Y - 23 + LHACKYO);
  
    XSetForeground(dpy, gc, COLOR(DISP_PAD_BOT));
  
!   // top lines 
!   XDrawLine(dpy, keypad.pixmap, gc, 2, KEYBOARD_OFFSET_Y - 25 + LHACKYO,
!             (int)(HACKLW - 4), KEYBOARD_OFFSET_Y - 25 + LHACKYO);
!   XDrawLine(dpy, keypad.pixmap, gc, 3, KEYBOARD_OFFSET_Y - 24 + LHACKYO,
!             (int)(HACKLW - 5), KEYBOARD_OFFSET_Y - 24 + LHACKYO);
! 
!   // left lines
!   XDrawLine(dpy, keypad.pixmap, gc, 2, cut - 1, 2, KEYBOARD_OFFSET_Y - 24 + LHACKYO);
!   XDrawLine(dpy, keypad.pixmap, gc, 3, cut - 1, 3, KEYBOARD_OFFSET_Y - 23 + LHACKYO);
  
    XSetForeground(dpy, gc, COLOR(PAD_BOT));
  
!   // left lines 
    XDrawLine(dpy, keypad.pixmap, gc, 2, (int)(keypad.height - 4), 2, cut);
    XDrawLine(dpy, keypad.pixmap, gc, 3, (int)(keypad.height - 5), 3, cut);
  
! /*
!   // lower the keyboard
    XSetForeground(dpy, gc, COLOR(PAD_TOP));
  
!   // bottom lines 
    XDrawLine(dpy, keypad.pixmap, gc, 5, (int)(keypad.height - 5),
! 	    (int)(HACKLW - 3), (int)(keypad.height - 5));
    XDrawLine(dpy, keypad.pixmap, gc, 6, (int)(keypad.height - 6),
! 	    (int)(HACKLW - 4), (int)(keypad.height - 6));
! /*
!   // right lines 
    XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 5),
  	    (int)(keypad.height - 5), (int)(keypad.width - 5), cut + 1);
    XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 6),
***************
*** 2194,2200 ****
  
    XSetForeground(dpy, gc, COLOR(DISP_PAD_BOT));
  
!   /* top lines */
    XDrawLine(dpy, keypad.pixmap, gc, 4, cut,
              (int)(keypad.width - 6), cut);
    XDrawLine(dpy, keypad.pixmap, gc, 5, cut + 1,
--- 2206,2212 ----
  
    XSetForeground(dpy, gc, COLOR(DISP_PAD_BOT));
  
!   // top lines
    XDrawLine(dpy, keypad.pixmap, gc, 4, cut,
              (int)(keypad.width - 6), cut);
    XDrawLine(dpy, keypad.pixmap, gc, 5, cut + 1,
***************
*** 2202,2214 ****
  
    XSetForeground(dpy, gc, COLOR(PAD_BOT));
  
!   /* left lines */
    XDrawLine(dpy, keypad.pixmap, gc, 4, (int)(keypad.height - 6), 4, cut + 1);
    XDrawLine(dpy, keypad.pixmap, gc, 5, (int)(keypad.height - 7), 5, cut + 2);
  
!   /*
!    * round off the bottom edge
!    */
    XSetForeground(dpy, gc, COLOR(PAD_TOP));
  
    XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 7),
--- 2214,2224 ----
  
    XSetForeground(dpy, gc, COLOR(PAD_BOT));
  
!   // left lines
    XDrawLine(dpy, keypad.pixmap, gc, 4, (int)(keypad.height - 6), 4, cut + 1);
    XDrawLine(dpy, keypad.pixmap, gc, 5, (int)(keypad.height - 7), 5, cut + 2);
  
!   // round off the bottom edge
    XSetForeground(dpy, gc, COLOR(PAD_TOP));
  
    XDrawLine(dpy, keypad.pixmap, gc, (int)(keypad.width - 7),
***************
*** 2235,2241 ****
              (int)(keypad.height - 14));
    XDrawLine(dpy, keypad.pixmap, gc, 7, (int)(keypad.height - 9), 7,
              (int)(keypad.height - 11));
! 
    /*
     * insert the HP Logo
     */
--- 2245,2251 ----
              (int)(keypad.height - 14));
    XDrawLine(dpy, keypad.pixmap, gc, 7, (int)(keypad.height - 9), 7,
              (int)(keypad.height - 11));
! */
    /*
     * insert the HP Logo
     */
***************
*** 2252,2258 ****
      x = DISPLAY_OFFSET_X;
  
    XCopyPlane(dpy, pix, keypad.pixmap, gc, 0, 0, hp_width, hp_height,
!              x, 10, 1);
  
    XFreePixmap(dpy, pix);
  
--- 2262,2268 ----
      x = DISPLAY_OFFSET_X;
  
    XCopyPlane(dpy, pix, keypad.pixmap, gc, 0, 0, hp_width, hp_height,
!              x, 10 + LHACKYO, 1);
  
    XFreePixmap(dpy, pix);
  
***************
*** 2278,2286 ****
--- 2288,2299 ----
  
    if (opt_gx)
      {
+ 
        x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width
            + gx_128K_ram_x_hot + 2;
        y = 10 + gx_128K_ram_y_hot;
+ //eff
+ y += LHACKYO;
        pix = XCreateBitmapFromData(dpy, keypad.pixmap, (char *)gx_128K_ram_bits,
                                    gx_128K_ram_width, gx_128K_ram_height);
        XCopyPlane(dpy, pix, keypad.pixmap, gc, 0, 0, gx_128K_ram_width,
***************
*** 2290,2295 ****
--- 2303,2309 ----
        XSetForeground(dpy, gc, COLOR(LOGO));
        x = DISPLAY_OFFSET_X + hp_width;
        y = hp_height + 8 - hp48gx_height;
+ y += LHACKYO;
        pix = XCreateBitmapFromData(dpy, keypad.pixmap, (char *)hp48gx_bits,
                                    hp48gx_width, hp48gx_height);
        XCopyPlane(dpy, pix, keypad.pixmap, gc, 0, 0, hp48gx_width,
***************
*** 2300,2305 ****
--- 2314,2320 ----
        x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width
            + gx_silver_x_hot + 2;
        y = 10 + gx_silver_y_hot;
+ y += LHACKYO;
        pix = XCreateBitmapFromData(dpy, keypad.pixmap, (char *)gx_silver_bits,
                                    gx_silver_width, gx_silver_height);
        XSetStipple(dpy, gc, pix);
***************
*** 2312,2317 ****
--- 2327,2333 ----
        x = DISPLAY_OFFSET_X + DISPLAY_WIDTH - gx_128K_ram_width
            + gx_green_x_hot + 2;
        y = 10 + gx_green_y_hot;
+ y += LHACKYO;
        pix = XCreateBitmapFromData(dpy, keypad.pixmap, (char *)gx_green_bits,
                                    gx_green_width, gx_green_height);
        XSetStipple(dpy, gc, pix);
***************
*** 2844,2852 ****
    /*
     * create the window
     */
!   width = KEYBOARD_WIDTH + 2 * SIDE_SKIP;
!   height = DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + DISP_KBD_SKIP +
!            KEYBOARD_HEIGHT + BOTTOM_SKIP;
  
    mainW = XCreateWindow(dpy, RootWindow(dpy, screen),
                          0, 0, width, height,
--- 2860,2872 ----
    /*
     * create the window
     */
! //eff
! //  width = KEYBOARD_WIDTH + 2 * SIDE_SKIP;
! //  width = DISPLAY_WIDTH + KEYBOARD_WIDTH + 2 * SIDE_SKIP;
!   width = HACKWIDTH;
! //  height = DISPLAY_OFFSET_Y + DISPLAY_HEIGHT + DISP_KBD_SKIP +
! //           KEYBOARD_HEIGHT + BOTTOM_SKIP;
!   height = HACKHEIGHT;
  
    mainW = XCreateWindow(dpy, RootWindow(dpy, screen),
                          0, 0, width, height,
