plan9fox/sys/src/9/pc/vgasoft.c
cinap_lenrek 1fe3143e4c kernel: cleanup the software mouse cursor mess
The swcursor used a 32x32 image for saving/restoring
screen contents for no reason.

Add a doflush argument to swcursorhide(), so that
disabling software cursor with a double buffered
softscreen is properly hidden. The doflush parameter
should be set to 0 in all other cases as swcursordraw()
will flushes both (current and previours) locations.

Make sure swcursorinit() and swcursorhide() clear the
visibility flag, even when gscreen is nil.

Remove the cursor locking and just do everything within
the drawlock. All cursor functions such as curson(),
cursoff() and setcursor() will be called drawlock
locked. This also means &cursor can be read.

Fix devmouse cursor reads and writes. We now have the
global cursor variable that is only modified under
the drawlock. So copy under drawlock.

Move the pc software cursor implementation into vgasoft
driver, so screen.c does not need to handle it as
a special case.

Remove unused functions such as drawhasclients().
2020-04-10 17:12:51 +02:00

51 lines
614 B
C

#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "io.h"
#include "ureg.h"
#include "../port/error.h"
#define Image IMAGE
#include <draw.h>
#include <memdraw.h>
#include <cursor.h>
#include "screen.h"
static void
swenable(VGAscr*)
{
swcursorinit();
swcursorload(&cursor);
}
static void
swdisable(VGAscr*)
{
swcursorhide(1);
}
static void
swload(VGAscr*, Cursor *curs)
{
swcursorload(curs);
}
static int
swmove(VGAscr*, Point p)
{
swcursorhide(0);
swcursordraw(p);
return 0;
}
VGAcur vgasoftcur =
{
"soft",
swenable,
swdisable,
swload,
swmove,
};