OSDN Git Service

fix #40681
authorSHIRAKATA Kentaro <argrath@ub32.org>
Sun, 30 Aug 2020 13:05:10 +0000 (22:05 +0900)
committerSHIRAKATA Kentaro <argrath@ub32.org>
Tue, 22 Sep 2020 17:25:06 +0000 (02:25 +0900)
ChangeLog.j
include/winX.h
sys/unix/hints/linux-x11
win/X11/winX.c
win/X11/winmap.c

index d6c311d..3f30f7e 100644 (file)
@@ -1,6 +1,7 @@
        * \8e\9f\82Ì\96â\91è\82ð\8fC\90³
          * X11\8aÂ\8b«\82Å\93ú\96{\8cê\93ü\97Í\82ª\82Å\82«\82È\82¢ (#40562)
          * \88ê\95\94\82Ì\83I\83v\83V\83\87\83\93\82Å\89p\8cê\82Ì\83t\83\8b\83l\81[\83\80\82ð\8eg\82¦\82È\82¢ (#40657)
+       * X11LARGETILE\82ð\8dí\8f\9c(#40681)
 
 Sat Apr 18 2020  Kentaro Shirakata  <argrath@ub32.org>
 
index 3a2c8fa..6792051 100644 (file)
@@ -285,10 +285,6 @@ typedef struct {
     Boolean highlight_prompt; /* if 'slow', highlight yn prompts */
     Boolean double_tile_size; /* double tile size */
     String tile_file;         /* name of file to open for tiles */
-#ifdef X11LARGETILE
-    int     tile_width;
-    int            tile_height;
-#endif
     String icon;              /* name of desired icon */
     int message_lines;        /* number of lines to attempt to show */
     int extcmd_height_delta;  /* bottom margin for extended command menu */
index a46c88d..e7cab54 100644 (file)
@@ -23,7 +23,7 @@ POSTINSTALL+= bdftopcf win/X11/nh10.bdf > $(INSTDIR)/nh10.pcf; ( cd $(INSTDIR);
 CFLAGS=-g -O -I../include -DNOTPARMDECL
 CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\"
 CFLAGS+=-DCOMPRESS=\"/bin/gzip\" -DCOMPRESS_EXTENSION=\".gz\"
-CFLAGS+=-DX11_GRAPHICS -DDEFAULT_WINDOW_SYS=\"X11\" -DNOTTYGRAPHICS  -DXI18N -DUSE_XPM -DX11LARGETILE -DINSTALLCOLORMAP
+CFLAGS+=-DX11_GRAPHICS -DDEFAULT_WINDOW_SYS=\"X11\" -DNOTTYGRAPHICS  -DXI18N -DUSE_XPM -DINSTALLCOLORMAP
 CFLAGS+=-DDUMPLOG
 CFLAGS+=-DCONFIG_ERROR_SECURE=FALSE
 
index 4144d53..71ba600 100644 (file)
@@ -1488,12 +1488,6 @@ static XtResource resources[] = {
       nhStr("False") },
     { nhStr("tile_file"), nhStr("Tile_file"), XtRString, sizeof(String),
       XtOffset(AppResources *, tile_file), XtRString, nhStr("x11tiles") },
-#ifdef X11LARGETILE
-    { nhStr("tile_width"), nhStr("Tile_width"), XtRInt, sizeof(int),
-      XtOffset(AppResources *, tile_width), XtRString, nhStr("32") },
-    { nhStr("tile_height"), nhStr("Tile_height"), XtRInt, sizeof(int),
-      XtOffset(AppResources *, tile_height), XtRString, nhStr("32") },
-#endif
     { nhStr("icon"), nhStr("Icon"), XtRString, sizeof(String),
       XtOffset(AppResources *, icon), XtRString, nhStr("nh72") },
     { nhStr("message_lines"), nhStr("Message_lines"), XtRInt, sizeof(int),
index d732027..87bfc19 100644 (file)
@@ -25,7 +25,6 @@
 #include <X11/Xaw/Cardinals.h>
 #include <X11/Xaw/Scrollbar.h>
 #include <X11/Xaw/Viewport.h>
-#include <X11/Xaw/Label.h>
 #include <X11/Xatom.h>
 #include <X11/keysym.h>
 
@@ -69,17 +68,6 @@ static void FDECL(get_text_gc, (struct xwindow *, Font));
 static void FDECL(get_char_info, (struct xwindow *));
 static void FDECL(display_cursor, (struct xwindow *));
 
-#ifdef X11LARGETILE
-struct pxm_slot_t {
-    int fg;
-    int bg;
-    int age;
-    Pixmap pixmap;
-};
-#define MAX_PXM_SLOTS 100
-    struct pxm_slot_t pxm_slot[MAX_PXM_SLOTS]; 
-#endif
-
 /* Global functions ======================================================= */
 
 void
@@ -182,22 +170,10 @@ int y UNUSED;
  * or just keep it on a per-window basis.
  */
 Pixmap tile_pixmap = None;
-#ifdef X11LARGETILE
-Pixmap tile_clipmask = None;
-GC     tile_gc;
-/*JP #ifdef USE_XPM*/
-XpmImage tile_image;
-/* #endif*/
-
-#define TILE_WIDTH      appResources.tile_width
-#define TILE_HEIGHT     appResources.tile_height
-int     TILE_PER_COL;
-#else
 static int tile_width;
 static int tile_height;
 static int tile_count;
 static XImage *tile_image = 0;
-#endif
 
 /*
  * This structure is used for small bitmaps that are used for annotating
@@ -247,7 +223,6 @@ void
 post_process_tiles()
 {
     Display *dpy = XtDisplay(toplevel);
-#ifndef X11LARGETILE
     unsigned int width, height;
 
     if (tile_image == 0)
@@ -270,46 +245,6 @@ post_process_tiles()
 #endif
     XDestroyImage(tile_image); /* data bytes free'd also */
     tile_image = 0;
-#else
-    Colormap cmap;
-# ifdef USE_XPM
-    XpmAttributes attributes;
-# endif
-    Arg args[16];
-    XGCValues val;
-
-# ifdef USE_XPM
-    if(tile_image.data){
-      XtSetArg(args[0], XtNcolormap, &cmap);
-      XtGetValues(toplevel, args, ONE);
-      
-      attributes.valuemask = XpmCloseness | XpmColormap;
-      attributes.colormap = cmap;
-      attributes.closeness = 25000;
-
-      XpmCreatePixmapFromXpmImage(
-                dpy,
-                XtWindow(toplevel),
-                &tile_image,
-                &tile_pixmap,
-                &tile_clipmask,
-                &attributes
-                );
-
-      val.function = GXcopy;
-      val.clip_mask = tile_clipmask;
-
-      tile_gc = XCreateGC(
-                dpy,
-                XtWindow(toplevel),
-                GCFunction | GCClipMask,
-                &val
-                );
-                
-      XpmFreeXpmImage(&tile_image);
-    }
-# endif
-#endif
 
     init_annotation(&pet_annotation, appResources.pet_mark_bitmap,
                     appResources.pet_mark_color);
@@ -369,15 +304,9 @@ struct xwindow *wp;
     attributes.valuemask = XpmCloseness;
     attributes.closeness = 25000;
 
-# ifndef X11LARGETILE
     errorcode = XpmReadFileToImage(dpy, appResources.tile_file, &tile_image,
                                    0, &attributes);
-# else
-    errorcode = XpmReadFileToXpmImage(appResources.tile_file, &tile_image,
-                    NULL);
-# endif
 
-# ifndef X11LARGETILE
     if (errorcode == XpmColorFailed) {
         Sprintf(buf, "Insufficient colors available to load %s.",
                 appResources.tile_file);
@@ -388,7 +317,6 @@ struct xwindow *wp;
         errorcode = XpmReadFileToImage(dpy, appResources.tile_file,
                                        &tile_image, 0, &attributes);
     }
-# endif
 
     if (errorcode != XpmSuccess) {
         if (errorcode == XpmColorFailed) {
@@ -405,9 +333,6 @@ struct xwindow *wp;
         goto tiledone;
     }
 
-# ifdef X11LARGETILE
-        TILE_PER_COL = tile_image.width / TILE_WIDTH;
-# else
     /* assume a fixed number of tiles per row */
     if (tile_image->width % TILES_PER_ROW != 0
         || tile_image->width <= TILES_PER_ROW) {
@@ -431,7 +356,6 @@ struct xwindow *wp;
     }
     tile_width = image_width / TILES_PER_ROW;
     tile_height = image_height / (tile_count / TILES_PER_ROW);
-# endif
 #else /* !USE_XPM */
     /* any less than 16 colours makes tiles useless */
     ddepth = DefaultDepthOfScreen(screen);
@@ -607,14 +531,8 @@ ntiles %ld\n",
     values.graphics_exposures = False;
     values.foreground =
         WhitePixelOfScreen(screen)
-# ifndef X11LARGETILE
         ^ XGetPixel(tile_image, 0,
                     tile_height * glyph2tile[cmap_to_glyph(S_corr)]);
-# else
-        ^ XGetPixel(tile_image, 
-                tile_width*(glyph2tile[cmap_to_glyph(S_corr)]%TILE_PER_COL),
-                tile_height*(glyph2tile[cmap_to_glyph(S_corr)]/TILE_PER_COL));
-# endif
     values.function = GXxor;
     tile_info->white_gc = XtGetGC(wp->w, mask, &values);
 
@@ -634,26 +552,11 @@ tiledone:
         free((genericptr_t) tile_bytes);
     if (colors)
         free((genericptr_t) colors);
-# ifdef X11LARGETILE
-    {
-        int i;
-        for(i = 0; i < MAX_PXM_SLOTS; i++){
-            pxm_slot[i].age = 0;
-            pxm_slot[i].bg = pxm_slot[i].fg = -99;
-            pxm_slot[i].pixmap=0;
-        }
-    }
-# endif
 #endif
 
     if (result) { /* succeeded */
-#ifndef X11LARGETILE
         tile_info->square_height = tile_height;
         tile_info->square_width = tile_width;
-#else
-        tile_info->square_height = TILE_HEIGHT;
-        tile_info->square_width = TILE_WIDTH;
-#endif
         tile_info->square_ascent = 0;
         tile_info->square_lbearing = 0;
         tile_info->image_width = image_width;
@@ -1416,18 +1319,8 @@ boolean inverted;
         Display *dpy = XtDisplay(wp->w);
         Screen *screen = DefaultScreenOfDisplay(dpy);
 
-#ifdef X11LARGETILE
-        /* each slots ages */
-        {
-            int i;
-
-            for(i = 0; i < MAX_PXM_SLOTS; i++)
-                pxm_slot[i].age++;
-        }
-#endif
         for (row = start_row; row <= stop_row; row++) {
             for (cur_col = start_col; cur_col <= stop_col; cur_col++) {
-#ifndef X11LARGETILE
                 int glyph = tile_map->glyphs[row][cur_col].glyph;
                 int tile = glyph2tile[glyph];
                 int src_x, src_y;
@@ -1440,89 +1333,6 @@ boolean inverted;
                           tile_map->black_gc, /* no grapics_expose */
                           src_x, src_y, tile_width, tile_height,
                           dest_x, dest_y);
-#else
-                struct rm *lev = &levl[cur_col][row];
-                int glyph = tile_map->glyphs[row][cur_col].glyph;
-                int bg = back_to_glyph(cur_col, row);
-                int tile = 0;
-                int bgtile = 0;
-                int dest_x = 0;
-                int dest_y = 0;
-                int src_x;
-                int src_y;
-                int bgsrc_x;
-                int bgsrc_y;
-                
-                if(tile_pixmap){
-                    if(youmonst.data && (Blind || (viz_array && !cansee(cur_col, row))))
-                        bg = lev->glyph;
-
-                    bgtile = glyph2tile[bg];
-                    tile = glyph2tile[glyph];
-                    dest_x = cur_col * tile_map->square_width;
-                    dest_y = row * tile_map->square_height;
-                    bgsrc_x = (bgtile % TILE_PER_COL) * TILE_WIDTH;
-                    bgsrc_y = (bgtile / TILE_PER_COL) * TILE_HEIGHT;
-                    src_x = (tile % TILE_PER_COL) * TILE_WIDTH;
-                    src_y = (tile / TILE_PER_COL) * TILE_HEIGHT;
-                    {
-                        int i, match;
-                        int maxage = 0;
-                        
-                        if(bgtile != -1){
-                            match = -1;
-                            for(i = 0; i < MAX_PXM_SLOTS; i++){
-                                if(tile == pxm_slot[i].fg && bgtile == pxm_slot[i].bg){
-                                    match = i;
-                                    break;
-                                }
-                            }
-                            if(match == -1){
-                                /* no match found:dispose the oldest slot and compose pixmap */
-                                for(i = 0; i < MAX_PXM_SLOTS; i++)
-                                    if(maxage < pxm_slot[i].age){
-                                        match = i;
-                                        maxage = pxm_slot[i].age;
-                                    }
-                                if(!pxm_slot[match].pixmap) 
-                                    pxm_slot[match].pixmap = XCreatePixmap(
-                                        dpy, XtWindow(toplevel),
-                                        TILE_WIDTH, TILE_HEIGHT, DefaultDepth(dpy, DefaultScreen(dpy)));
-                                XCopyArea(dpy, tile_pixmap, pxm_slot[match].pixmap,
-                                          tile_map->black_gc,
-                                          bgsrc_x, bgsrc_y,
-                                          TILE_WIDTH, TILE_HEIGHT,
-                                          0,0);
-                                
-                                XSetClipOrigin(dpy, tile_gc, 0 - src_x, 0 - src_y);
-                                
-                                XCopyArea(dpy, tile_pixmap, pxm_slot[match].pixmap,
-                                          tile_gc,
-                                          src_x, src_y,
-                                          TILE_WIDTH, TILE_HEIGHT,
-                                          0,0);
-                                pxm_slot[match].fg = tile;
-                                pxm_slot[match].bg = bgtile;
-                            }
-                            /* slot ready */
-                            pxm_slot[match].age = 0;
-                            XCopyArea(dpy, pxm_slot[match].pixmap, XtWindow(wp->w),
-                                      tile_map->black_gc,
-                                      0, 0,
-                                      TILE_WIDTH, TILE_HEIGHT,
-                                      dest_x, dest_y);
-                        }
-                        else{
-                            /* no clip mask */
-                            XCopyArea(dpy, tile_pixmap, XtWindow(wp->w),
-                                      tile_map->black_gc,
-                                      src_x, src_y,
-                                      TILE_WIDTH, TILE_HEIGHT,
-                                      dest_x, dest_y);
-                        }
-                    }
-                }
-#endif /* X11LARGETILE */
 
                 if (glyph_is_pet(glyph) && iflags.hilite_pet) {
                     /* draw pet annotation (a heart) */