diff options
author | Fazlul Shahriar <fshahriar@gmail.com> | 2019-04-05 15:09:35 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2019-04-05 15:09:35 -0400 |
commit | 7bb69ba88b8083b3eb9b3afefd8cdeae6aea2149 (patch) | |
tree | 9bdc6a2a7d6cee77c67fd9eaa57cefaa3280aaf6 | |
parent | 61601587295f6d0ef1c4084530fe0318e0c72b16 (diff) | |
download | plan9port-7bb69ba88b8083b3eb9b3afefd8cdeae6aea2149.tar.gz plan9port-7bb69ba88b8083b3eb9b3afefd8cdeae6aea2149.tar.bz2 plan9port-7bb69ba88b8083b3eb9b3afefd8cdeae6aea2149.zip |
libdraw,devdraw: fix compatibility with old 16x16 cursor protocol (#217)
Some libraries that depend on devdraw don't know about
32x32 cursor -- mainly 9fans.net/go/draw.
-rw-r--r-- | src/cmd/devdraw/cocoa-srv.c | 8 | ||||
-rw-r--r-- | src/cmd/devdraw/x11-srv.c | 1 | ||||
-rw-r--r-- | src/libdraw/drawclient.c | 2 | ||||
-rw-r--r-- | src/libdraw/drawfcall.c | 23 |
4 files changed, 33 insertions, 1 deletions
diff --git a/src/cmd/devdraw/cocoa-srv.c b/src/cmd/devdraw/cocoa-srv.c index 329dd71f..c1cf5983 100644 --- a/src/cmd/devdraw/cocoa-srv.c +++ b/src/cmd/devdraw/cocoa-srv.c @@ -165,6 +165,14 @@ runmsg(Wsysmsg *m) if(m->arrowcursor) setcursor(nil, nil); else + setcursor(&m->cursor, nil); + replymsg(m); + break; + + case Tcursor2: + if(m->arrowcursor) + setcursor(nil, nil); + else setcursor(&m->cursor, &m->cursor2); replymsg(m); break; diff --git a/src/cmd/devdraw/x11-srv.c b/src/cmd/devdraw/x11-srv.c index 17563f41..81416482 100644 --- a/src/cmd/devdraw/x11-srv.c +++ b/src/cmd/devdraw/x11-srv.c @@ -332,6 +332,7 @@ runmsg(Wsysmsg *m) break; case Tcursor: + case Tcursor2: if(m->arrowcursor) _xsetcursor(nil); else diff --git a/src/libdraw/drawclient.c b/src/libdraw/drawclient.c index de20d3a3..f0b1d388 100644 --- a/src/libdraw/drawclient.c +++ b/src/libdraw/drawclient.c @@ -296,7 +296,7 @@ _displaycursor(Display *d, Cursor *c, Cursor2 *c2) { Wsysmsg tx, rx; - tx.type = Tcursor; + tx.type = Tcursor2; if(c == nil){ memset(&tx.cursor, 0, sizeof tx.cursor); memset(&tx.cursor2, 0, sizeof tx.cursor2); diff --git a/src/libdraw/drawfcall.c b/src/libdraw/drawfcall.c index e36413b6..09051bbc 100644 --- a/src/libdraw/drawfcall.c +++ b/src/libdraw/drawfcall.c @@ -48,6 +48,7 @@ sizeW2M(Wsysmsg *m) case Rbouncemouse: case Rmoveto: case Rcursor: + case Rcursor2: case Trdkbd: case Rlabel: case Rinit: @@ -64,6 +65,8 @@ sizeW2M(Wsysmsg *m) case Tmoveto: return 4+1+1+4+4; case Tcursor: + return 4+1+1+4+4+2*16+2*16+1; + case Tcursor2: return 4+1+1+4+4+2*16+2*16+4+4+4*32+4*32+1; case Rerror: return 4+1+1+_stringsize(m->error); @@ -108,6 +111,7 @@ convW2M(Wsysmsg *m, uchar *p, uint n) case Rbouncemouse: case Rmoveto: case Rcursor: + case Rcursor2: case Trdkbd: case Rlabel: case Rinit: @@ -141,6 +145,13 @@ convW2M(Wsysmsg *m, uchar *p, uint n) PUT(p+10, m->cursor.offset.y); memmove(p+14, m->cursor.clr, sizeof m->cursor.clr); memmove(p+46, m->cursor.set, sizeof m->cursor.set); + p[78] = m->arrowcursor; + break; + case Tcursor2: + PUT(p+6, m->cursor.offset.x); + PUT(p+10, m->cursor.offset.y); + memmove(p+14, m->cursor.clr, sizeof m->cursor.clr); + memmove(p+46, m->cursor.set, sizeof m->cursor.set); PUT(p+78, m->cursor2.offset.x); PUT(p+82, m->cursor2.offset.y); memmove(p+86, m->cursor2.clr, sizeof m->cursor2.clr); @@ -200,6 +211,7 @@ convM2W(uchar *p, uint n, Wsysmsg *m) case Rbouncemouse: case Rmoveto: case Rcursor: + case Rcursor2: case Trdkbd: case Rlabel: case Rinit: @@ -233,6 +245,13 @@ convM2W(uchar *p, uint n, Wsysmsg *m) GET(p+10, m->cursor.offset.y); memmove(m->cursor.clr, p+14, sizeof m->cursor.clr); memmove(m->cursor.set, p+46, sizeof m->cursor.set); + m->arrowcursor = p[78]; + break; + case Tcursor2: + GET(p+6, m->cursor.offset.x); + GET(p+10, m->cursor.offset.y); + memmove(m->cursor.clr, p+14, sizeof m->cursor.clr); + memmove(m->cursor.set, p+46, sizeof m->cursor.set); GET(p+78, m->cursor2.offset.x); GET(p+82, m->cursor2.offset.y); memmove(m->cursor2.clr, p+86, sizeof m->cursor2.clr); @@ -319,8 +338,12 @@ drawfcallfmt(Fmt *fmt) return fmtprint(fmt, "Rmoveto"); case Tcursor: return fmtprint(fmt, "Tcursor arrow=%d", m->arrowcursor); + case Tcursor2: + return fmtprint(fmt, "Tcursor2 arrow=%d", m->arrowcursor); case Rcursor: return fmtprint(fmt, "Rcursor"); + case Rcursor2: + return fmtprint(fmt, "Rcursor2"); case Trdkbd: return fmtprint(fmt, "Trdkbd"); case Rrdkbd: |