www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/05/15/15:17:31

From: lglynn AT hotmail DOT com (Glynn Leo)
Subject: XCreateSimpleWindow and SIGSEGV
15 May 1998 15:17:31 -0700 :
Message-ID: <19980514105221.19657.qmail.cygnus.gnu-win32@hotmail.com>
To: gnu-win32 AT cygnus DOT com

Thanx to Earnie 
I've got my program Compiling 
I found that XCreateSimpleWindow is giving me 
SIGSEGV fault Anyone have the same problem
Have compiled with mmalloc,downloaded the Latest Binaries on NT
and search archives but to no avail
Also have X-Server and DISPLAY set
(Do get the warning message 
    WinMainCRTStartup ; defaulting to 00401000 )

Anyone see any problem with the following ?
thanx
leo

#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include "Xstuff.h"
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>

typedef struct S_window
{
  Display*  pDisplay;
  int       screen;
  Window    window;
  GC        gc;
  int       imageWidth;
  int       imageHeight;
  XImage*   pImage;
  char*     pImageData;
  XImage*   pSinglePixelImage;
  Colormap  colorMap;
} tSwindow;


tSwindow*
ScreateWindow(char*  pWindowName, char*  pDisplayName,
int imageWidth, int imageHeight);

#define  IMAGE_WIDTH 360
#define  IMAGE_HEIGHT 240
 
 
main()
 
{
  tSwindow*  pWindow;
 
  pWindow = ScreateWindow("rgb_test",
                            ":0.0",
                            IMAGE_WIDTH,
                            IMAGE_HEIGHT);
 
}
 
 
tSwindow*
ScreateWindow(char*  pWindowName,
                char*  pDisplayName,
                int imageWidth, int imageHeight
                )
{
  tSwindow*  pReturnValue;
  XGCValues    gcValues;
  char*        pWindowBanner;
 
  pReturnValue = (tSwindow*)malloc(sizeof(tSwindow));
 
 
  /* Try to connect to the X server */
  pReturnValue->pDisplay = XOpenDisplay(":0.0");
  if (pReturnValue->pDisplay == NULL)
  {
      free(pReturnValue);
      return(NULL);
  }
 
  pReturnValue->screen = DefaultScreen(pReturnValue->pDisplay);
 
  /* Now, create the window */
  /* It seems RootWindow() is causing the SIGSEGV */
  pReturnValue->window =
        XCreateSimpleWindow(pReturnValue->pDisplay,
                        RootWindow(pReturnValue->pDisplay,
                                   pReturnValue->screen),
                            300,
                            300,
                        imageWidth, imageHeight,
                        4,
                        BlackPixel(pReturnValue->pDisplay,
                                   pReturnValue->screen),
                        WhitePixel(pReturnValue->pDisplay,
                                   pReturnValue->screen));
}
 
 

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019