mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-27 11:52:03 +00:00
Flush the display when we poll for events.
This commit is contained in:
parent
e6f4b2e311
commit
59d7d92ee7
1 changed files with 28 additions and 0 deletions
|
@ -15,6 +15,24 @@ event(Event *e)
|
||||||
return eread(~0UL, e);
|
return eread(~0UL, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eflush(void)
|
||||||
|
{
|
||||||
|
/* avoid generating a message if there's nothing to show. */
|
||||||
|
/* this test isn't perfect, though; could do flushimage(display, 0) then call extract */
|
||||||
|
/* also: make sure we don't interfere if we're multiprocessing the display */
|
||||||
|
if(display->locking){
|
||||||
|
/* if locking is being done by program, this means it can't depend on automatic flush in emouse() etc. */
|
||||||
|
if(canqlock(&display->qlock)){
|
||||||
|
if(display->bufp > display->buf)
|
||||||
|
flushimage(display, 1);
|
||||||
|
unlockdisplay(display);
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
if(display->bufp > display->buf)
|
||||||
|
flushimage(display, 1);
|
||||||
|
}
|
||||||
|
|
||||||
ulong
|
ulong
|
||||||
eread(ulong keys, Event *e)
|
eread(ulong keys, Event *e)
|
||||||
{
|
{
|
||||||
|
@ -23,6 +41,8 @@ eread(ulong keys, Event *e)
|
||||||
|
|
||||||
xmask = ExposureMask;
|
xmask = ExposureMask;
|
||||||
|
|
||||||
|
eflush();
|
||||||
|
|
||||||
if(keys&Emouse)
|
if(keys&Emouse)
|
||||||
xmask |= MouseMask|StructureNotifyMask;
|
xmask |= MouseMask|StructureNotifyMask;
|
||||||
if(keys&Ekeyboard)
|
if(keys&Ekeyboard)
|
||||||
|
@ -103,6 +123,7 @@ ecanmouse(void)
|
||||||
XEvent xe;
|
XEvent xe;
|
||||||
Mouse m;
|
Mouse m;
|
||||||
|
|
||||||
|
eflush();
|
||||||
again:
|
again:
|
||||||
if(XCheckWindowEvent(_x.display, _x.drawable, MouseMask, &xe)){
|
if(XCheckWindowEvent(_x.display, _x.drawable, MouseMask, &xe)){
|
||||||
if(xtoplan9mouse(&xe, &m) < 0)
|
if(xtoplan9mouse(&xe, &m) < 0)
|
||||||
|
@ -118,6 +139,7 @@ ecankbd(void)
|
||||||
{
|
{
|
||||||
XEvent xe;
|
XEvent xe;
|
||||||
|
|
||||||
|
eflush();
|
||||||
again:
|
again:
|
||||||
if(XCheckWindowEvent(_x.display, _x.drawable, KeyPressMask, &xe)){
|
if(XCheckWindowEvent(_x.display, _x.drawable, KeyPressMask, &xe)){
|
||||||
if(xtoplan9kbd(&xe) == -1)
|
if(xtoplan9kbd(&xe) == -1)
|
||||||
|
@ -134,3 +156,9 @@ emoveto(Point p)
|
||||||
xmoveto(p);
|
xmoveto(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
esetcursor(Cursor *c)
|
||||||
|
{
|
||||||
|
xsetcursor(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue