On 05/29/2014 11:03 PM, Marco Atzeri wrote:
On 29/05/2014 15:52, Marco Trudel wrote:
<snip>
Am I doing something wrong or is this not supported?
not clear to me what are you trying to do
I'm trying to compile an X11 application with mingw (to run it on Windows).
Lets look at the attached minimal example gui.c (it's from the first
answer on [1] in case attachments are not allowed on the list):
- cygwin with standard cygwin X11 libs works:
gcc gui.c -lX11
./a.exe # -> fine
- mingw with XportMinGW X11 libs [2] works:
i686-w64-mingw32-gcc gui.c -I include -L lib -lX11 -lXau -lws2_32
./a.exe # -> fine
- mingw with cygwin ports X11 libs doesn't work:
i686-w64-mingw32-gcc gui.c -lX11
./a.exe # -> segfaults or exits with code 127
Am I doing something wrong or is this not supported?
Thanks!
Marco
[1]
http://stackoverflow.com/questions/19305982/xlib-closing-window-always-causes-fatal-io-error
[2] https://sites.google.com/site/xportmingw/
Thanks!
Marco
[1] http://www.straightrunning.com/XmingNotes/
[2] https://sites.google.com/site/xportmingw/
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Cygwin-ports-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cygwin-ports-general
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
Display *d;
Window w;
XEvent e;
const char *msg = "Hello, World!";
int s;
d = XOpenDisplay(NULL);
if (d == NULL) {
fprintf(stderr, "Cannot open display\n");
exit(1);
}
s = DefaultScreen(d);
w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 100, 100, 1, BlackPixel(d, s), WhitePixel(d, s));
XSelectInput(d, w, ExposureMask | KeyPressMask);
XMapWindow(d, w);
// I support the WM_DELETE_WINDOW protocol
Atom WM_DELETE_WINDOW = XInternAtom(d, "WM_DELETE_WINDOW", False);
XSetWMProtocols(d, w, &WM_DELETE_WINDOW, 1);
while (1) {
XNextEvent(d, &e);
if (e.type == Expose) {
XFillRectangle(d, w, DefaultGC(d, s), 20, 20, 10, 10);
XDrawString(d, w, DefaultGC(d, s), 10, 50, msg, strlen(msg));
}
else if (e.type == KeyPress)
break;
else if (e.type == ClientMessage)
// TODO Should check here for other client message types -
// however as the only protocol registered above is WM_DELETE_WINDOW
// it is safe for this small example.
break;
}
XCloseDisplay(d);
return 0;
}------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Cygwin-ports-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cygwin-ports-general