Annotation of uae/xwin.cc, revision 1.1

1.1     ! root        1:  /* 
        !             2:   * UAE - The Unusable Amiga Emulator
        !             3:   * 
        !             4:   * X interface v0.0
        !             5:   * v0.0: 950305: black and white window
        !             6:   * 
        !             7:   * (c) 1995 Bernd Schmidt
        !             8:   */
        !             9: 
        !            10: #include <stdio.h>
        !            11: #include <X11/Xlib.h>
        !            12: 
        !            13: #include "xwin.h"
        !            14: 
        !            15: Display *display;
        !            16: int screen;
        !            17: Window rootwin, mywin;
        !            18: GC whitegc,blackgc;
        !            19: XColor black,white;
        !            20: Colormap cmap;
        !            21: 
        !            22: void InitX()
        !            23: {
        !            24:    char *display_name = 0;
        !            25:    XSetWindowAttributes wattr;
        !            26:    
        !            27:    display = XOpenDisplay(display_name);
        !            28:    if (display == 0)  {
        !            29:       printf("Can't connect to X server %s\n",XDisplayName(display_name));
        !            30:       exit(-1);
        !            31:    }
        !            32:    screen = XDefaultScreen(display);
        !            33:    rootwin = XRootWindow(display,screen);
        !            34: /*   wattr.backing_store = Always;*/
        !            35:   /* dimensions are not exact */
        !            36:    mywin = XCreateWindow(display,rootwin,0,0,800,400,0,
        !            37:                         CopyFromParent,CopyFromParent,CopyFromParent,
        !            38:                         0,&wattr);
        !            39:    XMapWindow(display,mywin);
        !            40:    
        !            41:    whitegc = XCreateGC(display,mywin,0,0);
        !            42:    blackgc = XCreateGC(display,mywin,0,0);
        !            43:    cmap = XDefaultColormap(display,screen);
        !            44:    
        !            45:    XParseColor(display,cmap,"#000000",&black);
        !            46:    if (!XAllocColor(display,cmap,&black)) printf("Fehlschlag\n");
        !            47:    XParseColor(display,cmap,"#ffffff",&white);
        !            48:    if (!XAllocColor(display,cmap,&white)) printf("Fehlschlag 2\n");
        !            49:    XSetForeground(display,blackgc,black.pixel);
        !            50:    XSetForeground(display,whitegc,white.pixel);
        !            51: }
        !            52: 
        !            53: void DrawPixel(int x,int y,int col)
        !            54: {
        !            55:   if (col){
        !            56:     XDrawPoint(display,mywin,blackgc,x,y);
        !            57:   } else {
        !            58:     XDrawPoint(display,mywin,whitegc,x,y);
        !            59:   }
        !            60: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.