mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
cmd/devdraw: make "big arrow" the default cursor in X11
This commit is contained in:
parent
d0d440860f
commit
2da86b690a
1 changed files with 18 additions and 21 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <thread.h>
|
||||
#include "x11-memdraw.h"
|
||||
#include "devdraw.h"
|
||||
#include "bigarrow.h"
|
||||
|
||||
#undef time
|
||||
|
||||
|
@ -39,6 +40,7 @@ static int _xtoplan9mouse(Xwin *w, XEvent *e, Mouse *m);
|
|||
static void _xmovewindow(Xwin *w, Rectangle r);
|
||||
static int _xtoplan9kbd(XEvent *e);
|
||||
static int _xselect(XEvent *e);
|
||||
static void _xsetcursor(Xwin *w, Cursor *c);
|
||||
|
||||
static void rpc_resizeimg(Client*);
|
||||
static void rpc_resizewindow(Client*, Rectangle);
|
||||
|
@ -731,6 +733,8 @@ xattach(Client *client, char *label, char *winsize)
|
|||
XFreePixmap(_x.display, pmid);
|
||||
}
|
||||
|
||||
_xsetcursor(w, nil);
|
||||
|
||||
return w->screenimage;
|
||||
}
|
||||
|
||||
|
@ -1375,35 +1379,17 @@ revbyte(int b)
|
|||
}
|
||||
|
||||
static void
|
||||
xcursorarrow(Xwin *w)
|
||||
_xsetcursor(Xwin *w, Cursor *c)
|
||||
{
|
||||
if(_x.cursor != 0){
|
||||
XFreeCursor(_x.display, _x.cursor);
|
||||
_x.cursor = 0;
|
||||
}
|
||||
XUndefineCursor(_x.display, w->drawable);
|
||||
XFlush(_x.display);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rpc_setcursor(Client *client, Cursor *c, Cursor2 *c2)
|
||||
{
|
||||
Xwin *w = (Xwin*)client->view;
|
||||
XColor fg, bg;
|
||||
XCursor xc;
|
||||
Pixmap xsrc, xmask;
|
||||
int i;
|
||||
uchar src[2*16], mask[2*16];
|
||||
|
||||
USED(c2);
|
||||
if(c == nil)
|
||||
c = &bigarrow;
|
||||
|
||||
xlock();
|
||||
if(c == nil){
|
||||
xcursorarrow(w);
|
||||
xunlock();
|
||||
return;
|
||||
}
|
||||
for(i=0; i<2*16; i++){
|
||||
src[i] = revbyte(c->set[i]);
|
||||
mask[i] = revbyte(c->set[i] | c->clr[i]);
|
||||
|
@ -1423,6 +1409,17 @@ rpc_setcursor(Client *client, Cursor *c, Cursor2 *c2)
|
|||
XFreePixmap(_x.display, xsrc);
|
||||
XFreePixmap(_x.display, xmask);
|
||||
XFlush(_x.display);
|
||||
}
|
||||
|
||||
void
|
||||
rpc_setcursor(Client *client, Cursor *c, Cursor2 *c2)
|
||||
{
|
||||
Xwin *w = (Xwin*)client->view;
|
||||
|
||||
USED(c2);
|
||||
|
||||
xlock();
|
||||
_xsetcursor(w, c);
|
||||
xunlock();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue