ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/video_x.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/video_x.cpp (file contents):
Revision 1.2 by cebix, 1999-10-03T16:20:08Z vs.
Revision 1.5 by cebix, 1999-10-05T14:59:46Z

# Line 61 | Line 61 | enum {
61  
62  
63   // Constants
64 < const char KEYCODE_FILE_NAME[] = SHAREDIR "keycodes";
64 > const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
65  
66  
67   // Global variables
# Line 75 | Line 75 | static pthread_t redraw_thread;                                                //
75   static bool has_dga = false;                                            // Flag: Video DGA capable
76  
77   static bool ctrl_down = false;                                          // Flag: Ctrl key pressed
78 + static bool caps_on = false;                                            // Flag: Caps Lock on
79   static bool quit_full_screen = false;                           // Flag: DGA close requested from redraw thread
80   static bool emerg_quit = false;                                         // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
81   static bool emul_suspended = false;                                     // Flag: Emulator suspended
# Line 141 | Line 142 | extern void SysMountFirstFloppy(void);
142   // Set VideoMonitor according to video mode
143   void set_video_monitor(int width, int height, int bytes_per_row, bool native_byte_order)
144   {
145 <        int layout;
145 >        int layout = FLAYOUT_DIRECT;
146          switch (depth) {
147                  case 1:
148                          layout = FLAYOUT_DIRECT;
# Line 469 | Line 470 | bool VideoInit(bool classic)
470  
471   #if ENABLE_DGA
472          // DGA available?
473 <        int dga_flags = 0;
474 <        XF86DGAQueryDirectVideo(x_display, screen, &dga_flags);
475 <        has_dga = dga_flags & XF86DGADirectPresent;
473 >        int event_base, error_base;
474 >        if (XF86DGAQueryExtension(x_display, &event_base, &error_base)) {
475 >                int dga_flags = 0;
476 >                XF86DGAQueryDirectVideo(x_display, screen, &dga_flags);
477 >                has_dga = dga_flags & XF86DGADirectPresent;
478 >        } else
479 >                has_dga = false;
480   #endif
481  
482          // Find black and white colors
# Line 539 | Line 544 | bool VideoInit(bool classic)
544          if (mode_str) {
545                  if (sscanf(mode_str, "win/%d/%d", &width, &height) == 2)
546                          display_type = DISPLAY_WINDOW;
547 <                else if (has_dga && strcmp(mode_str, "dga") == 0) {
547 >                else if (has_dga && sscanf(mode_str, "dga/%d/%d", &width, &height) == 2) {
548                          display_type = DISPLAY_DGA;
549 +                        if (width > DisplayWidth(x_display, screen))
550 +                                width = DisplayWidth(x_display, screen);
551 +                        if (height > DisplayHeight(x_display, screen))
552 +                                height = DisplayHeight(x_display, screen);
553 +                }
554 +                if (width <= 0)
555                          width = DisplayWidth(x_display, screen);
556 +                if (height <= 0)
557                          height = DisplayHeight(x_display, screen);
546                }
558          }
559  
560          // Initialize according to display type
# Line 968 | Line 979 | static void handle_events(void)
979                                          code = event2keycode((XKeyEvent *)&event);
980                                  if (code != -1) {
981                                          if (!emul_suspended) {
982 <                                                ADBKeyDown(code);
982 >                                                if (code == 0x39) {     // Caps Lock pressed
983 >                                                        if (caps_on) {
984 >                                                                ADBKeyUp(code);
985 >                                                                caps_on = false;
986 >                                                        } else {
987 >                                                                ADBKeyDown(code);
988 >                                                                caps_on = true;
989 >                                                        }
990 >                                                } else
991 >                                                        ADBKeyDown(code);
992                                                  if (code == 0x36)
993                                                          ctrl_down = true;
994                                          } else {
# Line 987 | Line 1007 | static void handle_events(void)
1007                                          code = keycode_table[((XKeyEvent *)&event)->keycode & 0xff];
1008                                  } else
1009                                          code = event2keycode((XKeyEvent *)&event);
1010 <                                if (code != -1) {
1010 >                                if (code != -1 && code != 0x39) {       // Don't propagate Caps Lock releases
1011                                          ADBKeyUp(code);
1012                                          if (code == 0x36)
1013                                                  ctrl_down = false;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines