Changeset 834

Show
Ignore:
Timestamp:
04/09/08 14:34:08 (4 months ago)
Author:
takkaria
Message:

Remove the maid-x11.* files, incorporate into main-x11.c.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/Makefile.inc

    r815 r834  
    6262dungeon.o: dungeon.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    6363  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
    64   defines.h option.h types.h ui.h z-type.h object.h externs.h cmds.h 
     64  defines.h option.h types.h ui.h z-type.h object.h externs.h cmds.h \ 
     65  game-event.h 
    6566effects.o: effects.c angband.h h-basic.h z-file.h z-form.h z-util.h \ 
    6667  z-virt.h z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h \ 
     
    207208xtra3.o: xtra3.c angband.h h-basic.h z-file.h z-form.h z-util.h z-virt.h \ 
    208209  z-rand.h z-term.h ui-event.h z-quark.h z-msg.h config.h defines.h \ 
    209   option.h types.h ui.h z-type.h object.h externs.h game-event.h 
     210  option.h types.h ui.h z-type.h object.h externs.h game-event.h \ 
     211  ui-birth.h 
    210212z-file.o: z-file.c z-file.h h-basic.h z-virt.h z-util.h z-form.h 
    211213z-form.o: z-form.c z-form.h h-basic.h z-type.h z-util.h z-virt.h 
  • trunk/src/Makefile.src

    r830 r834  
    2222        h-basic.h \ 
    2323        init.h \ 
    24         maid-x11.h \ 
    2524        main.h \ 
    2625        option.h \ 
     
    4948ZFILES = z-file.o z-form.o z-msg.o z-quark.o z-rand.o z-term.o z-type.o \ 
    5049         z-util.o z-virt.o z-blockfile.o z-smap.o  
    51 MAINFILES = main.o maid-x11.o main-crb.o main-gcu.o $(GTKMAINFILES) \ 
     50MAINFILES = main.o main-crb.o main-gcu.o $(GTKMAINFILES) \ 
    5251            main-ros.o main-sdl.o main-win.o main-x11.o snd-sdl.o 
    5352 
  • trunk/src/Makefile.std

    r814 r834  
    7979 
    8080# Object definitions 
    81 X11OBJS = maid-x11.o main-x11.o 
    8281GTKOBJS = gtk/main-gtk.o gtk/cairo-utils.o 
    83 MAINOBJS = main.o main-gcu.o main-sdl.o snd-sdl.o $(X11OBJS) $(GTKOBJS) 
     82MAINOBJS = main.o main-gcu.o main-x11.o main-sdl.o snd-sdl.o $(GTKOBJS) 
    8483OBJS = $(BASEOBJS) $(MAINOBJS) 
    8584 
     
    159158 
    160159# X11 dependencies 
    161 $(X11OBJS) : $(HEADERS) maid-x11.h main.h 
     160main-x11.o: $(HEADERS) main.h 
    162161 
    163162# Basic dependencies for main-xxx.c, main.c 
  • trunk/src/main-x11.c

    r833 r834  
    100100#ifdef USE_X11 
    101101 
    102 #include "main.h" 
    103  
    104 #ifndef __MAKEDEPEND__ 
    105102#include <X11/Xlib.h> 
    106103#include <X11/Xutil.h> 
    107104#include <X11/keysym.h> 
    108105#include <X11/keysymdef.h> 
    109 #endif /* __MAKEDEPEND__ */ 
    110  
    111  
    112 /* 
    113  * Include some helpful X11 code. 
    114  */ 
    115 #include "maid-x11.h" 
     106 
     107#include "main.h" 
     108 
     109#ifndef IsModifierKey 
     110 
     111/* 
     112 * Keysym macros, used on Keysyms to test for classes of symbols 
     113 * These were stolen from one of the X11 header files 
     114 */ 
     115 
     116#define IsKeypadKey(keysym) \ 
     117  (((unsigned)(keysym) >= XK_KP_Space) && ((unsigned)(keysym) <= XK_KP_Equal)) 
     118 
     119#define IsCursorKey(keysym) \ 
     120  (((unsigned)(keysym) >= XK_Home)     && ((unsigned)(keysym) <  XK_Select)) 
     121 
     122#define IsPFKey(keysym) \ 
     123  (((unsigned)(keysym) >= XK_KP_F1)    && ((unsigned)(keysym) <= XK_KP_F4)) 
     124 
     125#define IsFunctionKey(keysym) \ 
     126  (((unsigned)(keysym) >= XK_F1)       && ((unsigned)(keysym) <= XK_F35)) 
     127 
     128#define IsMiscFunctionKey(keysym) \ 
     129  (((unsigned)(keysym) >= XK_Select)   && ((unsigned)(keysym) <  XK_KP_Space)) 
     130 
     131#define IsModifierKey(keysym) \ 
     132  (((unsigned)(keysym) >= XK_Shift_L)  && ((unsigned)(keysym) <= XK_Hyper_R)) 
     133 
     134#endif /* IsModifierKey */ 
     135 
     136 
     137/* 
     138 * Checks if the keysym is a special key or a normal key 
     139 * Assume that XK_MISCELLANY keysyms are special 
     140 */ 
     141#define IsSpecialKey(keysym) \ 
     142  ((unsigned)(keysym) >= 0xFF00) 
    116143 
    117144 
     
    459486 */ 
    460487static infoclr *clr[MAX_COLORS]; 
     488 
     489 
     490 
     491/**** Code imported from the old maid-x11.c ****/ 
     492 
     493#ifdef SUPPORT_GAMMA 
     494static bool gamma_table_ready = FALSE; 
     495static int gamma_val = 0; 
     496#endif /* SUPPORT_GAMMA */ 
     497 
     498 
     499/* 
     500 * Hack -- Convert an RGB value to an X11 Pixel, or die. 
     501 */ 
     502u32b create_pixel(Display *dpy, byte red, byte green, byte blue) 
     503{ 
     504        Colormap cmap = DefaultColormapOfScreen(DefaultScreenOfDisplay(dpy)); 
     505 
     506        XColor xcolour; 
     507 
     508#ifdef SUPPORT_GAMMA 
     509 
     510        if (!gamma_table_ready) 
     511        { 
     512                cptr str = getenv("ANGBAND_X11_GAMMA"); 
     513                if (str != NULL) gamma_val = atoi(str); 
     514 
     515                gamma_table_ready = TRUE; 
     516 
     517                /* Only need to build the table if gamma exists */ 
     518                if (gamma_val) build_gamma_table(gamma_val); 
     519        } 
     520 
     521        /* Hack -- Gamma Correction */ 
     522        if (gamma_val > 0) 
     523        { 
     524                red = gamma_table[red]; 
     525                green = gamma_table[green]; 
     526                blue = gamma_table[blue]; 
     527        } 
     528 
     529#endif /* SUPPORT_GAMMA */ 
     530 
     531        /* Build the color */ 
     532 
     533        xcolour.red = red * 255; 
     534        xcolour.green = green * 255; 
     535        xcolour.blue = blue * 255; 
     536        xcolour.flags = DoRed | DoGreen | DoBlue; 
     537 
     538        /* Attempt to Allocate the Parsed color */ 
     539        if (!(XAllocColor(dpy, cmap, &xcolour))) 
     540        { 
     541                quit_fmt("Couldn't allocate bitmap color #%04x%04x%04x\n", 
     542                         xcolour.red, xcolour.green, xcolour.blue); 
     543        } 
     544 
     545        return (xcolour.pixel); 
     546} 
     547 
     548 
     549/* 
     550 * Get the name of the default font to use for the term. 
     551 */ 
     552const char *get_default_font(int term_num) 
     553{ 
     554        const char *font; 
     555        char buf[80]; 
     556 
     557        /* Window specific font name */ 
     558        strnfmt(buf, sizeof(buf), "ANGBAND_X11_FONT_%d", term_num); 
     559 
     560        /* Check environment for that font */ 
     561        font = getenv(buf); 
     562        if (font) return font; 
     563 
     564        /* Check environment for "base" font */ 
     565        font = getenv("ANGBAND_X11_FONT"); 
     566        if (font) return font; 
     567 
     568        switch (term_num) 
     569        { 
     570                case 0: 
     571                        return DEFAULT_X11_FONT_0; 
     572                case 1: 
     573                        return DEFAULT_X11_FONT_1; 
     574                case 2: 
     575                        return DEFAULT_X11_FONT_2; 
     576                case 3: 
     577                        return DEFAULT_X11_FONT_3; 
     578                case 4: 
     579                        return DEFAULT_X11_FONT_4; 
     580                case 5: 
     581                        return DEFAULT_X11_FONT_5; 
     582                case 6: 
     583                        return DEFAULT_X11_FONT_6; 
     584                case 7: 
     585                        return DEFAULT_X11_FONT_7; 
     586        } 
     587 
     588        return DEFAULT_X11_FONT; 
     589} 
    461590 
    462591