M gnot/screen.c => gnot/screen.c +29 -0
@@ 9,6 9,7 @@
#include <libg.h>
#include <gnot.h>
+#include "mouse.h"
#define MINX 8
@@ 77,6 78,13 @@ screenputc(int c)
}
}
+/* Use the balu version */
+void
+gbitblt(GBitmap *d, Point p, GBitmap *s, Rectangle r, Fcode f)
+{
+ balubitblt(d, p, s, r, f);
+}
+
void
screenputs(char *s, int n)
{
@@ 112,6 120,7 @@ getcolor(ulong p, ulong *pr, ulong *pg, ulong *pb)
case 1: ans = 0xAAAAAAAA; break;
case 2: ans = 0x55555555; break;
default: ans = 0; break;
+ }
}
*pr = *pg = *pb = ans;
}
@@ 133,3 142,23 @@ hwcursmove(int x, int y)
{
return 0;
}
+
+void
+mouseclock(void) /* called spl6 */
+{
+ ++mouse.clock;
+}
+
+void
+mousetry(Ureg *ur)
+{
+ int s;
+
+ if(mouse.clock && mouse.track && (ur->sr&SPL(7)) == 0 && canlock(&cursor)){
+ s = spl1();
+ mouseupdate(0);
+ splx(s);
+ unlock(&cursor);
+ wakeup(&mouse.r);
+ }
+}
M port/devbit.c => port/devbit.c +30 -39
@@ 9,6 9,7 @@
#include <libg.h>
#include <gnot.h>
+#include "mouse.h"
extern GFont *defont;
@@ 67,18 68,8 @@ void bitcompact(void);
void bitfree(GBitmap*);
extern GBitmap gscreen;
-struct{
- /*
- * First four fields are known in screen.c
- */
- int dx; /* interrupt-time delta */
- int dy;
- int track; /* update cursor on screen */
- Mouse;
- int changed; /* mouse structure changed since last read */
- Rendez r;
- int newbuttons; /* interrupt time access only */
-}mouse;
+Mouseinfo mouse;
+Cursorinfo cursor;
Cursor arrow =
{
@@ 95,13 86,6 @@ Cursor arrow =
}
};
-struct{
- Cursor;
- Lock;
- int visible; /* on screen */
- Rectangle r; /* location */
-}cursor;
-
ulong setbits[16];
GBitmap set =
{
@@ 1211,29 1195,36 @@ mousebuttons(int b) /* called at higher priority */
mouseclock();
}
+
void
-mouseclock(void) /* called splhi */
+mouseupdate(int dolock)
{
int x, y;
- if(mouse.track && canlock(&cursor)){
- x = mouse.xy.x + mouse.dx;
- if(x < gscreen.r.min.x)
- x = gscreen.r.min.x;
- if(x >= gscreen.r.max.x)
- x = gscreen.r.max.x;
- y = mouse.xy.y + mouse.dy;
- if(y < gscreen.r.min.y)
- y = gscreen.r.min.y;
- if(y >= gscreen.r.max.y)
- y = gscreen.r.max.y;
- cursoroff(0);
- mouse.xy = Pt(x, y);
- cursoron(0);
- mouse.dx = 0;
- mouse.dy = 0;
- mouse.track = 0;
- mouse.buttons = mouse.newbuttons;
- mouse.changed = 1;
+
+ if(!mouse.track || (dolock && !canlock(&cursor)))
+ return;
+
+ x = mouse.xy.x + mouse.dx;
+ if(x < gscreen.r.min.x)
+ x = gscreen.r.min.x;
+ if(x >= gscreen.r.max.x)
+ x = gscreen.r.max.x;
+ y = mouse.xy.y + mouse.dy;
+ if(y < gscreen.r.min.y)
+ y = gscreen.r.min.y;
+ if(y >= gscreen.r.max.y)
+ y = gscreen.r.max.y;
+ cursoroff(0);
+ mouse.xy = Pt(x, y);
+ cursoron(0);
+ mouse.dx = 0;
+ mouse.dy = 0;
+ mouse.clock = 0;
+ mouse.track = 0;
+ mouse.buttons = mouse.newbuttons;
+ mouse.changed = 1;
+
+ if(dolock){
unlock(&cursor);
wakeup(&mouse.r);
}
M port/sysproc.c => port/sysproc.c +1 -1
@@ 279,11 279,11 @@ sysexec(ulong *arg)
* Move the stack
*/
s = p->seg[ESEG];
+ p->seg[ESEG] = 0;
p->seg[SSEG] = s;
s->base = USTKTOP-USTKSIZE;
s->top = USTKTOP;
relocateseg(s, TSTKTOP-USTKTOP);
- p->seg[ESEG] = 0;
close(tc);
poperror();
M power/main.c => power/main.c +1 -1
@@ 377,7 377,7 @@ exit(void)
splhi();
for(i=0; i<2000000; i++)
;
- duartreset();
+/* duartreset(); /**/
firmware();
}
M ss/screen.c => ss/screen.c +47 -0
@@ 9,6 9,7 @@
#include <libg.h>
#include <gnot.h>
+#include "mouse.h"
#define MINX 8
@@ 471,3 472,49 @@ void
lights(int mask)
{
}
+
+int
+screenbits(void)
+{
+ return 1; /* bits per pixel */
+}
+
+void
+getcolor(ulong p, ulong *pr, ulong *pg, ulong *pb)
+{
+ ulong ans;
+
+ /*
+ * The slc monochrome says 0 is white (max intensity)
+ */
+ if(p == 0)
+ ans = ~0;
+ else
+ ans = 0;
+ *pr = *pg = *pb = ans;
+}
+
+
+int
+setcolor(ulong p, ulong r, ulong g, ulong b)
+{
+ return 0; /* can't change mono screen colormap */
+}
+
+int
+hwcursset(uchar *s, uchar *c, int ox, int oy)
+{
+ return 0;
+}
+
+int
+hwcursmove(int x, int y)
+{
+ return 0;
+}
+
+void
+mouseclock(void) /* called splhi */
+{
+ mouseupdate(1);
+}