summaryrefslogtreecommitdiff
path: root/sys/src/9/omap
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2020-04-10 17:12:51 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2020-04-10 17:12:51 +0200
commit1fe3143e4c43ce2c74e0cfdd70b1bd556bbb9e1b (patch)
tree1507caffb47917cb57aeb1382dab568eb833dba2 /sys/src/9/omap
parent7b309d2e280675b6ce39f9b53cef6577e295c4f4 (diff)
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().
Diffstat (limited to 'sys/src/9/omap')
-rw-r--r--sys/src/9/omap/screen.c36
-rw-r--r--sys/src/9/omap/screen.h25
2 files changed, 9 insertions, 52 deletions
diff --git a/sys/src/9/omap/screen.c b/sys/src/9/omap/screen.c
index 0a4e005c5..0e9d2f0dc 100644
--- a/sys/src/9/omap/screen.c
+++ b/sys/src/9/omap/screen.c
@@ -189,24 +189,6 @@ static ulong rep(ulong, int);
static void screenputc(char *buf);
static void screenwin(void);
-/*
- * Software cursor.
- */
-int swvisible; /* is the cursor visible? */
-int swenabled; /* is the cursor supposed to be on the screen? */
-Memimage* swback; /* screen under cursor */
-Memimage* swimg; /* cursor image */
-Memimage* swmask; /* cursor mask */
-Memimage* swimg1;
-Memimage* swmask1;
-
-Point swoffset;
-Rectangle swrect; /* screen rectangle in swback */
-Point swpt; /* desired cursor location */
-Point swvispt; /* actual cursor location */
-int swvers; /* incremented each time cursor image changes */
-int swvisvers; /* the version on the screen */
-
static void
lcdoff(void)
{
@@ -330,28 +312,21 @@ screenpower(int on)
blankscreen(on == 0);
}
+/* called from devmouse */
+
void
cursoron(void)
{
- qlock(&drawlock);
- lock(&cursor);
- swcursorhide();
+ swcursorhide(0);
swcursordraw(mousexy());
- unlock(&cursor);
- qunlock(&drawlock);
}
void
cursoroff(void)
{
- qlock(&drawlock);
- lock(&cursor);
- swcursorhide();
- unlock(&cursor);
- qunlock(&drawlock);
+ swcursorhide(0);
}
-/* called from devmouse */
void
setcursor(Cursor* curs)
{
@@ -404,10 +379,7 @@ screeninit(void)
iprint("screen: frame buffer at %#p for %dx%d\n",
framebuf, oscreen.settings->wid, oscreen.settings->ht);
- swenabled = 1;
swcursorinit(); /* needs gscreen set */
- setcursor(&arrow);
-
first = 0;
}
}
diff --git a/sys/src/9/omap/screen.h b/sys/src/9/omap/screen.h
index d06f83863..287e2ff8c 100644
--- a/sys/src/9/omap/screen.h
+++ b/sys/src/9/omap/screen.h
@@ -1,22 +1,13 @@
typedef struct Cursor Cursor;
-typedef struct Cursorinfo Cursorinfo;
typedef struct OScreen OScreen;
typedef struct Omap3fb Omap3fb;
typedef struct Settings Settings;
-struct Cursorinfo
-{
- Cursor;
- Lock;
-};
-
-extern Cursor arrow;
-extern Cursorinfo cursor;
-
/* devmouse.c */
-extern void mousetrack(int, int, int, ulong);
-extern void absmousetrack(int, int, int, ulong);
-extern Point mousexy(void);
+extern Cursor cursor;
+extern void mousetrack(int, int, int, ulong);
+extern void absmousetrack(int, int, int, ulong);
+extern Point mousexy(void);
extern void mouseaccelerate(int);
extern void mouseresize(void);
@@ -33,15 +24,9 @@ extern int screenaperture(int, int);
extern Rectangle physgscreenr; /* actual monitor size */
extern void blankscreen(int);
-extern void swcursorinit(void);
-extern void swcursorhide(void);
-extern void swcursoravoid(Rectangle);
-extern void swcursorunhide(void);
-
/* devdraw.c */
extern void deletescreenimage(void);
extern void resetscreenimage(void);
-extern int drawhasclients(void);
extern void setscreenimageclipr(Rectangle);
extern void drawflush(void);
extern QLock drawlock;
@@ -49,7 +34,7 @@ extern QLock drawlock;
#define ishwimage(i) 0 /* for ../port/devdraw.c */
/* swcursor.c */
-void swcursorhide(void);
+void swcursorhide(int);
void swcursoravoid(Rectangle);
void swcursordraw(Point);
void swcursorload(Cursor *);