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.3 by gbeauche, 2003-05-22T22:12:05Z vs.
Revision 1.5 by gbeauche, 2003-11-20T16:24:57Z

# Line 52 | Line 52 | static int32 frame_skip;
52   static bool redraw_thread_active = false;       // Flag: Redraw thread installed
53   static pthread_t redraw_thread;                         // Redraw thread
54  
55 + static bool local_X11;                                          // Flag: X server running on local machine?
56   static volatile bool thread_stop_req = false;
57   static volatile bool thread_stop_ack = false;   // Acknowledge for thread_stop_req
58  
# Line 118 | Line 119 | static int num_x_video_modes;
119   static void *redraw_func(void *arg);
120  
121  
122 < // From main_linux.cpp
122 > // From main_unix.cpp
123 > extern char *x_display_name;
124   extern Display *x_display;
125  
126   // From sys_unix.cpp
# Line 195 | Line 197 | static bool open_window(int width, int h
197                  XFree((char *)hints);
198          }
199  
200 +        // 1-bit mode is big-endian; if the X server is little-endian, we can't
201 +        // use SHM because that doesn't allow changing the image byte order
202 +        bool need_msb_image = (depth == 1 && XImageByteOrder(x_display) == LSBFirst);
203 +
204          // Try to create and attach SHM image
205          have_shm = false;
206 <        if (depth != 1 && XShmQueryExtension(x_display)) {
206 >        if (local_X11 && !need_msb_image && XShmQueryExtension(x_display)) {
207  
208                  // Create SHM image ("height + 2" for safety)
209 <                img = XShmCreateImage(x_display, vis, depth, depth == 1 ? XYBitmap : ZPixmap, 0, &shminfo, width, height);
209 >                img = XShmCreateImage(x_display, vis, depth == 1 ? 1 : xdepth, depth == 1 ? XYBitmap : ZPixmap, 0, &shminfo, width, height);
210                  shminfo.shmid = shmget(IPC_PRIVATE, (height + 2) * img->bytes_per_line, IPC_CREAT | 0777);
211                  the_buffer_copy = (uint8 *)shmat(shminfo.shmid, 0, 0);
212                  shminfo.shmaddr = img->data = (char *)the_buffer_copy;
# Line 597 | Line 603 | bool VideoInit(void)
603          mainBuffer.pageInfo = NULL;
604   #endif
605          
606 +        // Check if X server runs on local machine
607 +        local_X11 = (strncmp(XDisplayName(x_display_name), ":", 1) == 0)
608 +                 || (strncmp(XDisplayName(x_display_name), "unix:", 5) == 0);
609 +    
610          // Init variables
611          private_data = NULL;
612          cur_mode = 0;   // Window 640x480
# Line 612 | Line 622 | bool VideoInit(void)
622   #ifdef ENABLE_XF86_DGA
623          // DGA available?
624      int event_base, error_base;
625 <    if (XF86DGAQueryExtension(x_display, &event_base, &error_base)) {
625 >    if (local_X11 && XF86DGAQueryExtension(x_display, &event_base, &error_base)) {
626                  int dga_flags = 0;
627                  XF86DGAQueryDirectVideo(x_display, screen, &dga_flags);
628                  has_dga = dga_flags & XF86DGADirectPresent;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines