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

Comparing SheepShaver/src/Unix/video_x.cpp (file contents):
Revision 1.27 by gbeauche, 2004-06-11T22:09:27Z vs.
Revision 1.31 by gbeauche, 2004-06-30T22:03:34Z

# Line 46 | Line 46
46   #include "about_window.h"
47   #include "video.h"
48   #include "video_defs.h"
49 + #include "video_blit.h"
50  
51   #define DEBUG 0
52   #include "debug.h"
# Line 65 | Line 66 | static int16 mouse_wheel_mode;
66   static int16 mouse_wheel_lines;
67   static bool redraw_thread_active = false;       // Flag: Redraw thread installed
68   static pthread_attr_t redraw_thread_attr;       // Redraw thread attributes
69 + static volatile bool redraw_thread_cancel;      // Flag: Cancel Redraw thread
70   static pthread_t redraw_thread;                         // Redraw thread
71  
72   static bool local_X11;                                          // Flag: X server running on local machine?
# Line 100 | Line 102 | static int depth;                                                      // Depth of Mac
102   static Window rootwin, the_win;                         // Root window and our window
103   static int num_depths = 0;                                      // Number of available X depths
104   static int *avail_depths = NULL;                        // List of available X depths
105 + static VisualFormat visualFormat;
106   static XVisualInfo visualInfo;
107   static Visual *vis;
108   static int color_class;
# Line 539 | Line 542 | static bool open_window(int width, int h
542          native_byte_order = (XImageByteOrder(x_display) == LSBFirst);
543   #endif
544   #ifdef ENABLE_VOSF
545 <        Screen_blitter_init(&visualInfo, native_byte_order, depth);
545 >        Screen_blitter_init(visualFormat, native_byte_order, depth);
546   #endif
547  
548          // Set bytes per row
# Line 613 | Line 616 | static bool open_dga(int width, int heig
616   #if REAL_ADDRESSING || DIRECT_ADDRESSING
617          // Screen_blitter_init() returns TRUE if VOSF is mandatory
618          // i.e. the framebuffer update function is not Blit_Copy_Raw
619 <        use_vosf = Screen_blitter_init(&visualInfo, native_byte_order, depth);
619 >        use_vosf = Screen_blitter_init(visualFormat, native_byte_order, depth);
620          
621          if (use_vosf) {
622            // Allocate memory for frame buffer (SIZE is extended to page-boundary)
# Line 650 | Line 653 | static bool open_display(void)
653                  return false;
654          }
655  
656 +        // Build up visualFormat structure
657 +        visualFormat.depth = visualInfo.depth;
658 +        visualFormat.Rmask = visualInfo.red_mask;
659 +        visualFormat.Gmask = visualInfo.green_mask;
660 +        visualFormat.Bmask = visualInfo.blue_mask;
661 +
662          // Create color maps
663          if (color_class == PseudoColor || color_class == DirectColor) {
664                  cmap[0] = XCreateColormap(x_display, rootwin, vis, AllocAll);
# Line 883 | Line 892 | static void keycode_init(void)
892  
893                  // Search for server vendor string, then read keycodes
894                  const char *vendor = ServerVendor(x_display);
895 + #if (defined(__APPLE__) && defined(__MACH__))
896 +                // Force use of MacX mappings on MacOS X with Apple's X server
897 +                int dummy;
898 +                if (XQueryExtension(x_display, "Apple-DRI", &dummy, &dummy, &dummy))
899 +                        vendor = "MacX";
900 + #endif
901                  bool vendor_found = false;
902                  char line[256];
903                  while (fgets(line, 255, f)) {
# Line 1193 | Line 1208 | bool VideoInit(void)
1208          // Start periodic thread
1209          XSync(x_display, false);
1210          Set_pthread_attr(&redraw_thread_attr, 0);
1211 +        redraw_thread_cancel = false;
1212          redraw_thread_active = (pthread_create(&redraw_thread, &redraw_thread_attr, redraw_func, NULL) == 0);
1213          D(bug("Redraw thread installed (%ld)\n", redraw_thread));
1214          return true;
# Line 1207 | Line 1223 | void VideoExit(void)
1223   {
1224          // Stop redraw thread
1225          if (redraw_thread_active) {
1226 +                redraw_thread_cancel = true;
1227                  pthread_cancel(redraw_thread);
1228                  pthread_join(redraw_thread, NULL);
1229                  redraw_thread_active = false;
# Line 2295 | Line 2312 | static void *redraw_func(void *arg)
2312          int64 ticks = 0;
2313          uint64 next = GetTicks_usec() + VIDEO_REFRESH_DELAY;
2314  
2315 <        for (;;) {
2315 >        while (!redraw_thread_cancel) {
2316  
2317                  // Pause if requested (during video mode switches)
2318                  while (thread_stop_req)
# Line 2362 | Line 2379 | static void *redraw_func(void *arg)
2379                                          // Set new cursor image if it was changed
2380                                          if (hw_mac_cursor_accl && cursor_changed) {
2381                                                  cursor_changed = false;
2382 <                                                memcpy(cursor_image->data, MacCursor + 4, 32);
2383 <                                                memcpy(cursor_mask_image->data, MacCursor + 36, 32);
2382 >                                                uint8 *x_data = (uint8 *)cursor_image->data;
2383 >                                                uint8 *x_mask = (uint8 *)cursor_mask_image->data;
2384 >                                                for (int i = 0; i < 32; i++) {
2385 >                                                        x_mask[i] = MacCursor[4 + i] | MacCursor[36 + i];
2386 >                                                        x_data[i] = MacCursor[4 + i];
2387 >                                                }
2388                                                  XDisplayLock();
2389                                                  XFreeCursor(x_display, mac_cursor);
2390                                                  XPutImage(x_display, cursor_map, cursor_gc, cursor_image, 0, 0, 0, 0, 16, 16);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines