--- BasiliskII/src/Unix/video_x.cpp 1999/10/03 16:20:08 1.2 +++ BasiliskII/src/Unix/video_x.cpp 1999/10/05 14:59:46 1.5 @@ -61,7 +61,7 @@ enum { // Constants -const char KEYCODE_FILE_NAME[] = SHAREDIR "keycodes"; +const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes"; // Global variables @@ -75,6 +75,7 @@ static pthread_t redraw_thread; // static bool has_dga = false; // Flag: Video DGA capable static bool ctrl_down = false; // Flag: Ctrl key pressed +static bool caps_on = false; // Flag: Caps Lock on static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread static bool emul_suspended = false; // Flag: Emulator suspended @@ -141,7 +142,7 @@ extern void SysMountFirstFloppy(void); // Set VideoMonitor according to video mode void set_video_monitor(int width, int height, int bytes_per_row, bool native_byte_order) { - int layout; + int layout = FLAYOUT_DIRECT; switch (depth) { case 1: layout = FLAYOUT_DIRECT; @@ -469,9 +470,13 @@ bool VideoInit(bool classic) #if ENABLE_DGA // DGA available? - int dga_flags = 0; - XF86DGAQueryDirectVideo(x_display, screen, &dga_flags); - has_dga = dga_flags & XF86DGADirectPresent; + int event_base, error_base; + if (XF86DGAQueryExtension(x_display, &event_base, &error_base)) { + int dga_flags = 0; + XF86DGAQueryDirectVideo(x_display, screen, &dga_flags); + has_dga = dga_flags & XF86DGADirectPresent; + } else + has_dga = false; #endif // Find black and white colors @@ -539,11 +544,17 @@ bool VideoInit(bool classic) if (mode_str) { if (sscanf(mode_str, "win/%d/%d", &width, &height) == 2) display_type = DISPLAY_WINDOW; - else if (has_dga && strcmp(mode_str, "dga") == 0) { + else if (has_dga && sscanf(mode_str, "dga/%d/%d", &width, &height) == 2) { display_type = DISPLAY_DGA; + if (width > DisplayWidth(x_display, screen)) + width = DisplayWidth(x_display, screen); + if (height > DisplayHeight(x_display, screen)) + height = DisplayHeight(x_display, screen); + } + if (width <= 0) width = DisplayWidth(x_display, screen); + if (height <= 0) height = DisplayHeight(x_display, screen); - } } // Initialize according to display type @@ -968,7 +979,16 @@ static void handle_events(void) code = event2keycode((XKeyEvent *)&event); if (code != -1) { if (!emul_suspended) { - ADBKeyDown(code); + if (code == 0x39) { // Caps Lock pressed + if (caps_on) { + ADBKeyUp(code); + caps_on = false; + } else { + ADBKeyDown(code); + caps_on = true; + } + } else + ADBKeyDown(code); if (code == 0x36) ctrl_down = true; } else { @@ -987,7 +1007,7 @@ static void handle_events(void) code = keycode_table[((XKeyEvent *)&event)->keycode & 0xff]; } else code = event2keycode((XKeyEvent *)&event); - if (code != -1) { + if (code != -1 && code != 0x39) { // Don't propagate Caps Lock releases ADBKeyUp(code); if (code == 0x36) ctrl_down = false;