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.25 by cebix, 2000-10-13T16:47:52Z vs.
Revision 1.26 by cebix, 2000-10-27T17:01:40Z

# Line 122 | Line 122 | static Colormap cmap[2];                                                       // Two co
122   static XColor black, white;
123   static unsigned long black_pixel, white_pixel;
124   static int eventmask;
125 < static const int win_eventmask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | ExposureMask;
125 > static const int win_eventmask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | FocusChangeMask | ExposureMask;
126   static const int dga_eventmask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask;
127  
128   static XColor palette[256];                                                     // Color palette for 8-bit mode
# Line 345 | Line 345 | static bool init_window(int width, int h
345          the_win = XCreateWindow(x_display, rootwin, 0, 0, width, height, 0, xdepth,
346                  InputOutput, vis, CWEventMask | CWBackPixel | CWBorderPixel |
347                  CWBackingStore | CWBackingPlanes, &wattr);
348        XSync(x_display, false);
349        XStoreName(x_display, the_win, GetString(STR_WINDOW_TITLE));
350        XMapRaised(x_display, the_win);
351        XSync(x_display, false);
348  
349 <        // Set colormap
350 <        if (depth == 8) {
351 <                XSetWindowColormap(x_display, the_win, cmap[0]);
352 <                XSetWMColormapWindows(x_display, the_win, &the_win, 1);
349 >        // Indicate that we want keyboard input
350 >        {
351 >                XWMHints *hints = XAllocWMHints();
352 >                if (hints) {
353 >                        hints->input = True;
354 >                        hints->flags = InputHint;
355 >                        XSetWMHints(x_display, the_win, hints);
356 >                        XFree((char *)hints);
357 >                }
358          }
359  
360          // Make window unresizable
361 <        XSizeHints *hints;
362 <        if ((hints = XAllocSizeHints()) != NULL) {
363 <                hints->min_width = width;
364 <                hints->max_width = width;
365 <                hints->min_height = height;
366 <                hints->max_height = height;
367 <                hints->flags = PMinSize | PMaxSize;
368 <                XSetWMNormalHints(x_display, the_win, hints);
369 <                XFree((char *)hints);
361 >        {
362 >                XSizeHints *hints = XAllocSizeHints();
363 >                if (hints) {
364 >                        hints->min_width = width;
365 >                        hints->max_width = width;
366 >                        hints->min_height = height;
367 >                        hints->max_height = height;
368 >                        hints->flags = PMinSize | PMaxSize;
369 >                        XSetWMNormalHints(x_display, the_win, hints);
370 >                        XFree((char *)hints);
371 >                }
372          }
373          
374 +        // Set window title
375 +        {
376 +                XTextProperty title_prop;
377 +                const char *title = GetString(STR_WINDOW_TITLE);
378 +                XStringListToTextProperty((char **)&title, 1, &title_prop);
379 +                XSetWMName(x_display, the_win, &title_prop);
380 +                XFree(title_prop.value);
381 +        }
382 +
383 +        // Set window class
384 +        {
385 +                XClassHint *hints;
386 +                hints = XAllocClassHint();
387 +                if (hints) {
388 +                        hints->res_name = "BasiliskII";
389 +                        hints->res_class = "BasiliskII";
390 +                        XSetClassHint(x_display, the_win, hints);
391 +                        XFree((char *)hints);
392 +                }
393 +        }
394 +
395 +        // Show window
396 +        XSync(x_display, false);
397 +        XMapRaised(x_display, the_win);
398 +        XFlush(x_display);
399 +
400 +        // Set colormap
401 +        if (depth == 8)
402 +                XSetWindowColormap(x_display, the_win, cmap[0]);
403 +
404          // Try to create and attach SHM image
405          have_shm = false;
406          if (depth != 1 && local_X11 && XShmQueryExtension(x_display)) {
# Line 563 | Line 596 | static bool init_fbdev_dga(char *in_fb_n
596                  GrabModeAsync, GrabModeAsync, the_win, None, CurrentTime);
597          
598          // Set colormap
599 <        if (depth == 8) {
599 >        if (depth == 8)
600                  XSetWindowColormap(x_display, the_win, cmap[0]);
568                XSetWMColormapWindows(x_display, the_win, &the_win, 1);
569        }
601          
602          // Set VideoMonitor
603          int bytes_per_row = width;
# Line 679 | Line 710 | static bool init_xf86_dga(int width, int
710          // Set colormap
711          if (depth == 8) {
712                  XSetWindowColormap(x_display, the_win, cmap[current_dga_cmap = 0]);
682                XSetWMColormapWindows(x_display, the_win, &the_win, 1);
713                  XF86DGAInstallColormap(x_display, screen, cmap[current_dga_cmap]);
714          }
715  
# Line 1627 | Line 1657 | static void handle_events(void)
1657                                                  memset(the_buffer_copy, 0, VideoMonitor.bytes_per_row * VideoMonitor.y);
1658                                  }
1659                                  break;
1660 +
1661 +                        case FocusIn:
1662 +                        case FocusOut:
1663 +                                break;
1664                  }
1665          }
1666   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines