🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #37106

simple xlib display

#37106
From: Lenny Tiefel
Date: Wed, 21 Feb 1990 12:27
78 lines
2668 bytes
The simple program below should display a hard-wired
bitmap, but it doesn't -- only the window frame.

Could anyone help?

(This is my first xlib program.)

Len Tiefel
Physics Research
Eastman Kodak Company
(716) 722-2250
(email tiefel@kodak.com)





----------------------------CUT HERE---------------------------------------

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>

#include <stdio.h>

/* SMALL BITMAP TO BE PLACED INTO PIXMAP */
/* ------------------------------------- */
#define spicture_width 32
#define spicture_height 32
static char spicture[] = {
   0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
   0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
   0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x0f,
   0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
   0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
   0xf0, 0xf0, 0xf0, 0xf0, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
   0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0,
   0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
   0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
   0x0f, 0x0f, 0x0f, 0x0f, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
   0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0};


int main()
{

   Display 			*dpy;
   Screen 			*screen;
   Window 			root, win;
   unsigned long 		fg, bg;
   unsigned int 		depth, screen_number;
   XEvent 			event;


   /* CREATE DISPLAY ON ROOT WINDOW */
   /* ----------------------------- */

   dpy = XOpenDisplay(NULL);
   if (dpy == NULL) printf("Dpy is NULL!\n");
   screen_number = XDefaultScreen(dpy);
   screen = XDefaultScreenOfDisplay(dpy);
   root = XDefaultRootWindow(dpy);

i   fg = XBlackPixelOfScreen(screen);
   bg = XWhitePixelOfScreen(screen);
   depth = XDefaultDepth(dpy,screen_number);
   win = XCreateSimpleWindow(dpy, root, 200, 200, 400, 400, 1, fg, bg);

   XCreatePixmapFromBitmapData(dpy, 
                        win, spicture, spicture_width, 
                        spicture_height, fg, bg, depth);

   XMapWindow(dpy, win);
   for (;;) 
      XNextEvent(dpy, &event);
}

   
Technical Details
Message-ID: <2359@kodak.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rutgers!rochester!kodak!tiefel

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rutgers!rochester!kodak!tiefel
From: tiefel@kodak.UUCP (Lenny Tiefel)
Newsgroups: comp.windows.x
Subject: simple xlib display
Keywords: simple,xlib,display
Message-ID: <2359@kodak.UUCP>
Date: 21 Feb 90 12:27:14 GMT
Organization: Eastman Kodak Co., Rochester, NY
Lines: 78