[ LUGOS ] X program

Gasper Fele gasper.fele na guest.arnes.si
Ned Sep 28 09:41:22 CEST 1997


Tukaj je moj prvi X program. A mi lahko nekdo prosim pojasni, zakaj ne
dela ?
Hvala!

#include <X11/Xlib.h>
#include <stdio.h>
#include <unistd.h>
#include <X11/xpm.h>


void main () {
  Display *display = XOpenDisplay(NULL);
  int screen = DefaultScreen(display);
  Window buto = XCreateSimpleWindow(display, XRootWindow(display, screen), 1, 1, 200, 200, 4, 1,0);
  XClearWindow(display, buto);
  char** buffer;
  Pixmap pixmap;
  XImage* image;
  pixmap = XCreatePixmap(display, XRootWindow(display, screen), 40, 40, DefaultDepth(display, screen));
  char s;
  char* ime;
  ime = "/home/prog/prog/pixmaps/C.xpm";
  GC thegc = XCreateGC(display, buto, 0, NULL);
  XpmAttributes xpmattr;
  xpmattr.depth = DefaultDepth(display, screen);
  xpmattr.valuemask = XpmDepth;
  XpmReadFileToData(ime, &buffer);
  XpmCreateImageFromData(display, buffer, &image, NULL, &xpmattr);
  XPutImage(display, pixmap, thegc, image, 0, 0, 0, 0, 100, 100);
  XCopyArea(display, pixmap, buto, thegc, 1, 1, 100, 100, 1, 1);
  XFlush(display);
  XMapWindow(display, buto);
  XFlush(display);
  XRaiseWindow(display, buto);
  XCopyArea(display,XRootWindow(display, screen) , pixmap, thegc, 0, 0, 100, 100, 1, 1);
//  XPutImage(display, buto, thegc, image, 0, 0, 0, 0, 100, 100);
  XMapWindow(display, buto);
  scanf(&s);
  XFreePixmap(display, pixmap);
  XDestroyWindow(display, buto);  
  XCloseDisplay(display);  
}








Dodatne informacije o seznamu Starilist