aboutsummaryrefslogtreecommitdiff
path: root/src/libdraw/x11-event.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2003-11-23 18:15:43 +0000
committerrsc <devnull@localhost>2003-11-23 18:15:43 +0000
commit16a709666981e77a00a88a87b286b586ac77ffdc (patch)
tree7320f931d0cdfcb86fe07dba025b489e66ed5648 /src/libdraw/x11-event.c
parent986b36bccd134726eea42f2cfabff2943d729ac4 (diff)
downloadplan9port-16a709666981e77a00a88a87b286b586ac77ffdc.tar.gz
plan9port-16a709666981e77a00a88a87b286b586ac77ffdc.tar.bz2
plan9port-16a709666981e77a00a88a87b286b586ac77ffdc.zip
Add drawsetlabel(Display*, char*).
Turn window destruction into "hangup" note. Fix (?) snarf buffer management. Add latin1 keyboard translation.
Diffstat (limited to 'src/libdraw/x11-event.c')
-rw-r--r--src/libdraw/x11-event.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/libdraw/x11-event.c b/src/libdraw/x11-event.c
index 1361b42e..408eb419 100644
--- a/src/libdraw/x11-event.c
+++ b/src/libdraw/x11-event.c
@@ -36,6 +36,7 @@ eflush(void)
ulong
eread(ulong keys, Event *e)
{
+ int r;
ulong xmask;
XEvent xevent;
@@ -45,8 +46,13 @@ eread(ulong keys, Event *e)
if(keys&Emouse)
xmask |= MouseMask|StructureNotifyMask;
- if(keys&Ekeyboard)
+ if(keys&Ekeyboard){
xmask |= KeyPressMask;
+ if((r = xtoplan9kbd(nil)) >= 0){
+ e->kbdc = r;
+ return Ekeyboard;
+ }
+ }
XSelectInput(_x.display, _x.drawable, xmask);
again:
@@ -56,6 +62,10 @@ again:
case Expose:
xexpose(&xevent, _x.display);
goto again;
+ case DestroyNotify:
+ if(xdestroy(&xevent, _x.display))
+ postnote(PNGROUP, getpgrp(), "hangup");
+ goto again;
case ConfigureNotify:
if(xconfigure(&xevent, _x.display))
eresized(1);
@@ -63,7 +73,7 @@ again:
case ButtonPress:
case ButtonRelease:
case MotionNotify:
- if(xtoplan9mouse(&xevent, &e->mouse) < 0)
+ if(xtoplan9mouse(_x.display, &xevent, &e->mouse) < 0)
goto again;
return Emouse;
case KeyPress:
@@ -126,7 +136,7 @@ ecanmouse(void)
eflush();
again:
if(XCheckWindowEvent(_x.display, _x.drawable, MouseMask, &xe)){
- if(xtoplan9mouse(&xe, &m) < 0)
+ if(xtoplan9mouse(_x.display, &xe, &m) < 0)
goto again;
XPutBackEvent(_x.display, &xe);
return 1;
@@ -138,8 +148,13 @@ int
ecankbd(void)
{
XEvent xe;
+ int r;
eflush();
+ if((r = xtoplan9kbd(nil)) >= 0){
+ xtoplan9kbd((XEvent*)-1);
+ return 1;
+ }
again:
if(XCheckWindowEvent(_x.display, _x.drawable, KeyPressMask, &xe)){
if(xtoplan9kbd(&xe) == -1)