public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
* An issue with libX11?
@ 2014-11-09 15:38 Angelo Graziosi
2014-11-09 20:17 ` Jon TURNEY
0 siblings, 1 reply; 5+ messages in thread
From: Angelo Graziosi @ 2014-11-09 15:38 UTC (permalink / raw)
To: cygwin-xfree
From another application I have an issue with libX11 which I can
reproduce with the following STC,
$ cat getch_test.c
/*
gcc getch_test.c -lX11 -o getch_test.out
DISPLAY=127.0.0.1:0.0 ./getch_test.out
*/
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>
#include <X11/keysym.h>
Display *dis;
Window win;
int fun()
{
XEvent event;
char c;
printf("1\n");
while(1)
{
printf("2\n");
XNextEvent(dis, &event);
printf("3\n");
if (event.type == KeyPress)
{
c = (char) XLookupKeysym(&event.xkey, 0);
return (int) c;
}
}
}
int main()
{
dis = XOpenDisplay(NULL);
win = XCreateSimpleWindow(dis, RootWindow(dis, 0), 1, 1, 500, 500,
0, BlackPixel (dis, 0), BlackPixel(dis, 0));
XMapWindow(dis, win);
XFlush(dis);
printf("Press a key:\n");
fun();
/*Sleep 5 seconds before closing.*/
//sleep(5);
return (0);
}
Running it, one gets
$ DISPLAY=127.0.0.1:0.0 ./getch_test.out
Press a key:
1
2
HANGS
it does not print "3", so it seems it does not return from
XNextEvent(dis, &event);
I am not an X11 expert, so it could be I am doing the wrong things but
the same code runs fine on OSX+XQuartz and GCC-4.9.1.
For completeness, I start the Cygwin X server with a link on status bar
(W7+Cygwin64) whose target is:
C:\cygwin64\bin\run.exe --quote bash -l -c "rm -rf /tmp/.X*; XWin
-multiwindow -clipboard -silent-dup-error 2>/dev/null &"
Ciao,
Angelo.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: An issue with libX11?
2014-11-09 15:38 An issue with libX11? Angelo Graziosi
@ 2014-11-09 20:17 ` Jon TURNEY
2014-11-09 20:50 ` Angelo Graziosi
0 siblings, 1 reply; 5+ messages in thread
From: Jon TURNEY @ 2014-11-09 20:17 UTC (permalink / raw)
To: cygwin-xfree; +Cc: angelo.graziosi@alice.it >> Angelo Graziosi
On 09/11/2014 15:38, Angelo Graziosi wrote:
> From another application I have an issue with libX11 which I can
> reproduce with the following STC,
I don't think this test case is well-formed.
> int main()
> {
> dis = XOpenDisplay(NULL);
> win = XCreateSimpleWindow(dis, RootWindow(dis, 0), 1, 1, 500, 500,
> 0, BlackPixel (dis, 0), BlackPixel(dis, 0));
>
> XMapWindow(dis, win);
A 'XSelectInput(dis, win, KeyPress)' is needed here to tell the X server
that this client wishes to receive KeyPress event.s
> I am not an X11 expert, so it could be I am doing the wrong things but
> the same code runs fine on OSX+XQuartz and GCC-4.9.1.
I tried with XQuartz 2.7.8_beta1 and I couldn't reproduce that.
--
Jon TURNEY
Volunteer Cygwin/X X Server maintainer
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: An issue with libX11?
2014-11-09 20:17 ` Jon TURNEY
@ 2014-11-09 20:50 ` Angelo Graziosi
2014-11-09 21:16 ` Jon TURNEY
0 siblings, 1 reply; 5+ messages in thread
From: Angelo Graziosi @ 2014-11-09 20:50 UTC (permalink / raw)
To: cygwin-xfree
Il 09/11/2014 21:16, Jon TURNEY ha scritto:
> On 09/11/2014 15:38, Angelo Graziosi wrote:
>> From another application I have an issue with libX11 which I can
>> reproduce with the following STC,
>
> I don't think this test case is well-formed.
>
>> int main()
>> {
>> dis = XOpenDisplay(NULL);
>> win = XCreateSimpleWindow(dis, RootWindow(dis, 0), 1, 1, 500, 500,
>> 0, BlackPixel (dis, 0), BlackPixel(dis, 0));
>>
>> XMapWindow(dis, win);
>
> A 'XSelectInput(dis, win, KeyPress)' is needed here to tell the X server
> that this client wishes to receive KeyPress event.s
I found the issue trying the examples of libXbgi library
(http://libxbgi.sourceforge.net), so I tried to create a STC adapting
the example discusses here:
https://user.xmission.com/~georgeps/documentation/tutorials/Xlib_Beginner.html
Anyway, the STC on Cygwin64 doesn't work if I add your suggestion,
...
XMapWindow(dis, win);
XSelectInput(dis, win, KeyPress);
XFlush(dis);
...
>
>> I am not an X11 expert, so it could be I am doing the wrong things but
>> the same code runs fine on OSX+XQuartz and GCC-4.9.1.
as I wrote, on OSX it works (there XQuartz is 2.7.7). For this reason I
flagged this to X-Cygwin list..
> I tried with XQuartz 2.7.8_beta1 and I couldn't reproduce that.
>
On which system? OSX?
Ciao,
Angelo.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: An issue with libX11?
2014-11-09 20:50 ` Angelo Graziosi
@ 2014-11-09 21:16 ` Jon TURNEY
2014-11-09 21:32 ` Angelo Graziosi
0 siblings, 1 reply; 5+ messages in thread
From: Jon TURNEY @ 2014-11-09 21:16 UTC (permalink / raw)
To: cygwin-xfree; +Cc: angelo.graziosi@alice.it >> Angelo Graziosi
On 09/11/2014 20:49, Angelo Graziosi wrote:
> Il 09/11/2014 21:16, Jon TURNEY ha scritto:
>> On 09/11/2014 15:38, Angelo Graziosi wrote:
>>> From another application I have an issue with libX11 which I can
>>> reproduce with the following STC,
>>
>> I don't think this test case is well-formed.
>>
>>> int main()
>>> {
>>> dis = XOpenDisplay(NULL);
>>> win = XCreateSimpleWindow(dis, RootWindow(dis, 0), 1, 1, 500, 500,
>>> 0, BlackPixel (dis, 0), BlackPixel(dis,
>>> 0));
>>>
>>> XMapWindow(dis, win);
>>
>> A 'XSelectInput(dis, win, KeyPress)' is needed here to tell the X server
>> that this client wishes to receive KeyPress event.s
>
> I found the issue trying the examples of libXbgi library
> (http://libxbgi.sourceforge.net), so I tried to create a STC adapting
> the example discusses here:
>
> https://user.xmission.com/~georgeps/documentation/tutorials/Xlib_Beginner.html
>
>
> Anyway, the STC on Cygwin64 doesn't work if I add your suggestion,
>
> ...
> XMapWindow(dis, win);
> XSelectInput(dis, win, KeyPress);
Oops. I think that should be KeyPressMask.
> XFlush(dis);
> ...
>
>>
>>> I am not an X11 expert, so it could be I am doing the wrong things but
>>> the same code runs fine on OSX+XQuartz and GCC-4.9.1.
>
> as I wrote, on OSX it works (there XQuartz is 2.7.7). For this reason I
> flagged this to X-Cygwin list..
>
>> I tried with XQuartz 2.7.8_beta1 and I couldn't reproduce that.
>
> On which system? OSX?
XQuartz doesn't run on anything else :D
--
Jon TURNEY
Volunteer Cygwin/X X Server maintainer
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: An issue with libX11?
2014-11-09 21:16 ` Jon TURNEY
@ 2014-11-09 21:32 ` Angelo Graziosi
0 siblings, 0 replies; 5+ messages in thread
From: Angelo Graziosi @ 2014-11-09 21:32 UTC (permalink / raw)
To: cygwin-xfree
Il 09/11/2014 22:16, Jon TURNEY ha scritto:
> On 09/11/2014 20:49, Angelo Graziosi wrote:
>>
>> ...
>> XMapWindow(dis, win);
>> XSelectInput(dis, win, KeyPress);
>
> Oops. I think that should be KeyPressMask.
Now, it works as expected. Thanks..
Angelo
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-09 21:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-09 15:38 An issue with libX11? Angelo Graziosi
2014-11-09 20:17 ` Jon TURNEY
2014-11-09 20:50 ` Angelo Graziosi
2014-11-09 21:16 ` Jon TURNEY
2014-11-09 21:32 ` Angelo Graziosi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).