|
@@ -1,7 +1,7 @@
|
|
|
#include "mouse.h"
|
|
#include "mouse.h"
|
|
|
#include "bootinfo.h"
|
|
#include "bootinfo.h"
|
|
|
#include "cirrus.h"
|
|
#include "cirrus.h"
|
|
|
-#include "cursor_shape.h"
|
|
|
|
|
|
|
+#include "cursor.h"
|
|
|
#include "intel.h"
|
|
#include "intel.h"
|
|
|
#include "radeon.h"
|
|
#include "radeon.h"
|
|
|
#include "timer.h"
|
|
#include "timer.h"
|
|
@@ -20,9 +20,6 @@
|
|
|
#define MOUSE_ACK 0xFA
|
|
#define MOUSE_ACK 0xFA
|
|
|
#define MOUSE_RESEND 0xFE
|
|
#define MOUSE_RESEND 0xFE
|
|
|
|
|
|
|
|
-#define MOUSE_CUR_W CURSOR_SHAPE_WIDTH
|
|
|
|
|
-#define MOUSE_CUR_H CURSOR_SHAPE_HEIGHT
|
|
|
|
|
-
|
|
|
|
|
/* One PS/2 wheel notch in scroll pixels; touchpads emit pixels directly. */
|
|
/* One PS/2 wheel notch in scroll pixels; touchpads emit pixels directly. */
|
|
|
#define MOUSE_WHEEL_PX 48
|
|
#define MOUSE_WHEEL_PX 48
|
|
|
#define MOUSE_SCROLL_MAX 100000
|
|
#define MOUSE_SCROLL_MAX 100000
|
|
@@ -42,7 +39,11 @@ static int mouse_aux_irq_ok; /* controller config accepted AUX IRQ */
|
|
|
static unsigned int fbw, fbh;
|
|
static unsigned int fbw, fbh;
|
|
|
static unsigned int cur_x, cur_y;
|
|
static unsigned int cur_x, cur_y;
|
|
|
static unsigned int saved_x, saved_y, saved_w, saved_h;
|
|
static unsigned int saved_x, saved_y, saved_w, saved_h;
|
|
|
-static unsigned char cur_saved[MOUSE_CUR_W * MOUSE_CUR_H * 4];
|
|
|
|
|
|
|
+static int saved_ox, saved_oy; /* unclipped image origin of the save */
|
|
|
|
|
+static unsigned char cur_saved[CURSOR_MAX_DIM * CURSOR_MAX_DIM * 4];
|
|
|
|
|
+static struct cursor_image cur_img; /* the frame on screen */
|
|
|
|
|
+static int cur_shape = CURSOR_DEFAULT;
|
|
|
|
|
+static unsigned int cur_frame, cur_frame_ms;
|
|
|
static unsigned char pkt[4];
|
|
static unsigned char pkt[4];
|
|
|
static unsigned int pkt_idx;
|
|
static unsigned int pkt_idx;
|
|
|
|
|
|
|
@@ -167,21 +168,34 @@ static int mouse_send_cmd_ack(unsigned char cmd)
|
|
|
return r;
|
|
return r;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-enum {
|
|
|
|
|
- MOUSE_PIX_TRANSPARENT = 0,
|
|
|
|
|
- MOUSE_PIX_OUTLINE,
|
|
|
|
|
- MOUSE_PIX_FILL
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-static int mouse_pixel_at(int r, int c)
|
|
|
|
|
-{
|
|
|
|
|
- if (r < 0 || c < 0 || r >= (int)MOUSE_CUR_H || c >= (int)MOUSE_CUR_W)
|
|
|
|
|
- return MOUSE_PIX_TRANSPARENT;
|
|
|
|
|
- if (cursor_shape_fill[(unsigned int)r] & (0x8000u >> c))
|
|
|
|
|
- return MOUSE_PIX_FILL;
|
|
|
|
|
- if (cursor_shape_outline[(unsigned int)r] & (0x8000u >> c))
|
|
|
|
|
- return MOUSE_PIX_OUTLINE;
|
|
|
|
|
- return MOUSE_PIX_TRANSPARENT;
|
|
|
|
|
|
|
+/* ---- Cursor image ---------------------------------------------------------
|
|
|
|
|
+ *
|
|
|
|
|
+ * cur_x/cur_y are the hotspot. The image (kernel/cursor.c: an Adwaita
|
|
|
|
|
+ * shape or the built-in arrow) is drawn with its top-left at
|
|
|
|
|
+ * (cur_x - hot_x, cur_y - hot_y), so near the top/left edge part of it is
|
|
|
|
|
+ * off-screen. The software cursor blends the premultiplied ARGB over the
|
|
|
|
|
+ * saved background; the hardware backends take the same image. */
|
|
|
|
|
+
|
|
|
|
|
+static void cursor_calc_rect(unsigned int *rx, unsigned int *ry,
|
|
|
|
|
+ unsigned int *rw, unsigned int *rh)
|
|
|
|
|
+{
|
|
|
|
|
+ int ox = (int)cur_x - (int)cur_img.hot_x;
|
|
|
|
|
+ int oy = (int)cur_y - (int)cur_img.hot_y;
|
|
|
|
|
+ int x0 = ox, y0 = oy;
|
|
|
|
|
+ int x1 = ox + (int)cur_img.w, y1 = oy + (int)cur_img.h;
|
|
|
|
|
+
|
|
|
|
|
+ if (x0 < 0) x0 = 0;
|
|
|
|
|
+ if (y0 < 0) y0 = 0;
|
|
|
|
|
+ if (x1 > (int)fbw) x1 = (int)fbw;
|
|
|
|
|
+ if (y1 > (int)fbh) y1 = (int)fbh;
|
|
|
|
|
+ if (x1 <= x0 || y1 <= y0) {
|
|
|
|
|
+ *rx = *ry = *rw = *rh = 0;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ *rx = (unsigned int)x0;
|
|
|
|
|
+ *ry = (unsigned int)y0;
|
|
|
|
|
+ *rw = (unsigned int)(x1 - x0);
|
|
|
|
|
+ *rh = (unsigned int)(y1 - y0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void cursor_save_under(void)
|
|
static void cursor_save_under(void)
|
|
@@ -192,10 +206,9 @@ static void cursor_save_under(void)
|
|
|
saved_w = saved_h = 0;
|
|
saved_w = saved_h = 0;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- saved_x = cur_x;
|
|
|
|
|
- saved_y = cur_y;
|
|
|
|
|
- saved_w = (cur_x + MOUSE_CUR_W <= fbw) ? MOUSE_CUR_W : fbw - cur_x;
|
|
|
|
|
- saved_h = (cur_y + MOUSE_CUR_H <= fbh) ? MOUSE_CUR_H : fbh - cur_y;
|
|
|
|
|
|
|
+ cursor_calc_rect(&saved_x, &saved_y, &saved_w, &saved_h);
|
|
|
|
|
+ saved_ox = (int)cur_x - (int)cur_img.hot_x;
|
|
|
|
|
+ saved_oy = (int)cur_y - (int)cur_img.hot_y;
|
|
|
if (saved_w && saved_h)
|
|
if (saved_w && saved_h)
|
|
|
vga_fb_read_rect(saved_x, saved_y, saved_w, saved_h, cur_saved);
|
|
vga_fb_read_rect(saved_x, saved_y, saved_w, saved_h, cur_saved);
|
|
|
}
|
|
}
|
|
@@ -215,22 +228,172 @@ static void cursor_present(void)
|
|
|
vga_fb_present_rect(saved_x, saved_y, saved_w, saved_h);
|
|
vga_fb_present_rect(saved_x, saved_y, saved_w, saved_h);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void mouse_draw_cursor(unsigned int x0, unsigned int y0)
|
|
|
|
|
|
|
+/* Blend the current image over the background saved by cursor_save_under()
|
|
|
|
|
+ * (which must have run for the same position and image). */
|
|
|
|
|
+static void mouse_draw_cursor(void)
|
|
|
{
|
|
{
|
|
|
|
|
+ unsigned int pb = vga_fb_bpp() == 16 ? 2u : vga_fb_bpp() == 24 ? 3u : 4u;
|
|
|
unsigned int r, c;
|
|
unsigned int r, c;
|
|
|
|
|
|
|
|
- /* White arrow body with a black outline around it. */
|
|
|
|
|
- for (r = 0; r < MOUSE_CUR_H; r++) {
|
|
|
|
|
- for (c = 0; c < MOUSE_CUR_W; c++) {
|
|
|
|
|
- int px = mouse_pixel_at((int)r, (int)c);
|
|
|
|
|
- if (px == MOUSE_PIX_FILL)
|
|
|
|
|
- vga_fb_put_pixel(x0 + c, y0 + r, 255, 255, 255);
|
|
|
|
|
- else if (px == MOUSE_PIX_OUTLINE)
|
|
|
|
|
- vga_fb_put_pixel(x0 + c, y0 + r, 0, 0, 0);
|
|
|
|
|
|
|
+ if (!cur_img.px)
|
|
|
|
|
+ return;
|
|
|
|
|
+ for (r = 0; r < saved_h; r++) {
|
|
|
|
|
+ unsigned int iy = saved_y + r - (unsigned int)saved_oy;
|
|
|
|
|
+ const unsigned int *src = cur_img.px + iy * cur_img.w +
|
|
|
|
|
+ (saved_x - (unsigned int)saved_ox);
|
|
|
|
|
+
|
|
|
|
|
+ for (c = 0; c < saved_w; c++) {
|
|
|
|
|
+ unsigned int s = src[c];
|
|
|
|
|
+ unsigned int a = s >> 24;
|
|
|
|
|
+ unsigned int sr = (s >> 16) & 0xFF, sg = (s >> 8) & 0xFF;
|
|
|
|
|
+ unsigned int sb = s & 0xFF;
|
|
|
|
|
+
|
|
|
|
|
+ if (a == 0)
|
|
|
|
|
+ continue;
|
|
|
|
|
+ if (a != 255) {
|
|
|
|
|
+ const unsigned char *d =
|
|
|
|
|
+ cur_saved + (r * saved_w + c) * pb;
|
|
|
|
|
+ unsigned int dr, dg, db, inv = 255 - a;
|
|
|
|
|
+
|
|
|
|
|
+ if (pb == 2) {
|
|
|
|
|
+ unsigned int v = d[0] | (d[1] << 8);
|
|
|
|
|
+
|
|
|
|
|
+ dr = ((v >> 11) & 0x1F) * 255 / 31;
|
|
|
|
|
+ dg = ((v >> 5) & 0x3F) * 255 / 63;
|
|
|
|
|
+ db = (v & 0x1F) * 255 / 31;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ db = d[0];
|
|
|
|
|
+ dg = d[1];
|
|
|
|
|
+ dr = d[2];
|
|
|
|
|
+ }
|
|
|
|
|
+ /* Premultiplied source over the background. */
|
|
|
|
|
+ sr += (dr * inv + 127) / 255;
|
|
|
|
|
+ sg += (dg * inv + 127) / 255;
|
|
|
|
|
+ sb += (db * inv + 127) / 255;
|
|
|
|
|
+ if (sr > 255) sr = 255;
|
|
|
|
|
+ if (sg > 255) sg = 255;
|
|
|
|
|
+ if (sb > 255) sb = 255;
|
|
|
|
|
+ }
|
|
|
|
|
+ vga_fb_put_pixel(saved_x + c, saved_y + r, sr, sg, sb);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/* Hardware cursor position: the image's top-left, may be negative. */
|
|
|
|
|
+static void cursor_hw_move(void)
|
|
|
|
|
+{
|
|
|
|
|
+ int ox = (int)cur_x - (int)cur_img.hot_x;
|
|
|
|
|
+ int oy = (int)cur_y - (int)cur_img.hot_y;
|
|
|
|
|
+
|
|
|
|
|
+ if (mouse_hw_cursor == 3)
|
|
|
|
|
+ intel_cursor_move(ox, oy);
|
|
|
|
|
+ else if (mouse_hw_cursor == 2)
|
|
|
|
|
+ radeon_cursor_move(ox, oy);
|
|
|
|
|
+ else if (mouse_hw_cursor == 1)
|
|
|
|
|
+ cirrus_cursor_move(ox, oy);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void cursor_hw_load(void)
|
|
|
|
|
+{
|
|
|
|
|
+ if (mouse_hw_cursor == 3)
|
|
|
|
|
+ intel_cursor_load(&cur_img);
|
|
|
|
|
+ else if (mouse_hw_cursor == 2)
|
|
|
|
|
+ radeon_cursor_load(&cur_img);
|
|
|
|
|
+ else if (mouse_hw_cursor == 1)
|
|
|
|
|
+ cirrus_cursor_load(&cur_img);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* Switch to `img`: re-upload the hardware image, or erase and redraw the
|
|
|
|
|
+ * software cursor (presenting the union of the old and new rectangles in
|
|
|
|
|
+ * one go, so a shape change does not blink). */
|
|
|
|
|
+static void cursor_set_image(const struct cursor_image *img)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int ox, oy, ow, oh;
|
|
|
|
|
+
|
|
|
|
|
+ if (!mouse_cursor_flag) {
|
|
|
|
|
+ cur_img = *img;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (mouse_hw_cursor) {
|
|
|
|
|
+ unsigned int flags = mouse_irq_save();
|
|
|
|
|
+
|
|
|
|
|
+ cur_img = *img;
|
|
|
|
|
+ cursor_hw_load();
|
|
|
|
|
+ cursor_hw_move();
|
|
|
|
|
+ mouse_irq_restore(flags);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!mouse_auto_draw) {
|
|
|
|
|
+ /* A WM frame owns the shadow; PRESENT redraws the cursor. */
|
|
|
|
|
+ cur_img = *img;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ cursor_restore_under();
|
|
|
|
|
+ ox = saved_x; oy = saved_y; ow = saved_w; oh = saved_h;
|
|
|
|
|
+ cur_img = *img;
|
|
|
|
|
+ cursor_save_under();
|
|
|
|
|
+ mouse_draw_cursor();
|
|
|
|
|
+ if (ow && oh && saved_w && saved_h) {
|
|
|
|
|
+ unsigned int x0 = ox < saved_x ? ox : saved_x;
|
|
|
|
|
+ unsigned int y0 = oy < saved_y ? oy : saved_y;
|
|
|
|
|
+ unsigned int x1 = ox + ow > saved_x + saved_w ?
|
|
|
|
|
+ ox + ow : saved_x + saved_w;
|
|
|
|
|
+ unsigned int y1 = oy + oh > saved_y + saved_h ?
|
|
|
|
|
+ oy + oh : saved_y + saved_h;
|
|
|
|
|
+
|
|
|
|
|
+ vga_fb_present_rect(x0, y0, x1 - x0, y1 - y0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (ow && oh)
|
|
|
|
|
+ vga_fb_present_rect(ox, oy, ow, oh);
|
|
|
|
|
+ cursor_present();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void cursor_select(int shape, unsigned int frame)
|
|
|
|
|
+{
|
|
|
|
|
+ struct cursor_image img;
|
|
|
|
|
+
|
|
|
|
|
+ cursor_get(shape, frame, &img);
|
|
|
|
|
+ cursor_set_image(&img);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void mouse_set_shape(int shape)
|
|
|
|
|
+{
|
|
|
|
|
+ if (shape < 0 || shape >= CURSOR_COUNT)
|
|
|
|
|
+ shape = CURSOR_DEFAULT;
|
|
|
|
|
+ if (shape == cur_shape)
|
|
|
|
|
+ return;
|
|
|
|
|
+ cur_shape = shape;
|
|
|
|
|
+ cur_frame = 0;
|
|
|
|
|
+ cur_frame_ms = get_ticks_ms();
|
|
|
|
|
+ cursor_select(cur_shape, 0);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+int mouse_get_shape(void)
|
|
|
|
|
+{
|
|
|
|
|
+ return cur_shape;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void mouse_cursor_reload(void)
|
|
|
|
|
+{
|
|
|
|
|
+ cursor_select(cur_shape, cur_frame);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* Advance an animated cursor (wait/progress) from the poll loop. */
|
|
|
|
|
+static void mouse_cursor_tick(void)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int now;
|
|
|
|
|
+
|
|
|
|
|
+ if (!mouse_cursor_flag || cur_img.frames <= 1)
|
|
|
|
|
+ return;
|
|
|
|
|
+ now = get_ticks_ms();
|
|
|
|
|
+ if (now - cur_frame_ms < cur_img.delay_ms)
|
|
|
|
|
+ return;
|
|
|
|
|
+ cur_frame_ms = now;
|
|
|
|
|
+ cur_frame = (cur_frame + 1) % cur_img.frames;
|
|
|
|
|
+ cursor_select(cur_shape, cur_frame);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static void mouse_clamp_ptr(long *nx, long *ny)
|
|
static void mouse_clamp_ptr(long *nx, long *ny)
|
|
|
{
|
|
{
|
|
|
long maxx = (long)fbw - 1;
|
|
long maxx = (long)fbw - 1;
|
|
@@ -257,8 +420,10 @@ static void mouse_cursor_setup(void)
|
|
|
return;
|
|
return;
|
|
|
fbw = vga_fb_width();
|
|
fbw = vga_fb_width();
|
|
|
fbh = vga_fb_height();
|
|
fbh = vga_fb_height();
|
|
|
- if (fbw < MOUSE_CUR_W || fbh < MOUSE_CUR_H)
|
|
|
|
|
|
|
+ if (fbw < CURSOR_MAX_DIM || fbh < CURSOR_MAX_DIM)
|
|
|
return;
|
|
return;
|
|
|
|
|
+ cursor_get(cur_shape, cur_frame, &cur_img);
|
|
|
|
|
+ cur_frame_ms = get_ticks_ms();
|
|
|
|
|
|
|
|
/* Cirrus hardware cursor: the card overlays it; no save/restore.
|
|
/* Cirrus hardware cursor: the card overlays it; no save/restore.
|
|
|
* UEFI GOP modes are not programmed through the legacy VGA sequencer,
|
|
* UEFI GOP modes are not programmed through the legacy VGA sequencer,
|
|
@@ -267,8 +432,8 @@ static void mouse_cursor_setup(void)
|
|
|
mouse_hw_cursor = 1;
|
|
mouse_hw_cursor = 1;
|
|
|
cur_x = 100;
|
|
cur_x = 100;
|
|
|
cur_y = 100;
|
|
cur_y = 100;
|
|
|
- cirrus_cursor_setup();
|
|
|
|
|
- cirrus_cursor_move(cur_x, cur_y);
|
|
|
|
|
|
|
+ cirrus_cursor_setup(&cur_img);
|
|
|
|
|
+ cursor_hw_move();
|
|
|
mouse_cursor_flag = 1;
|
|
mouse_cursor_flag = 1;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -278,8 +443,8 @@ static void mouse_cursor_setup(void)
|
|
|
mouse_hw_cursor = 2;
|
|
mouse_hw_cursor = 2;
|
|
|
cur_x = 100;
|
|
cur_x = 100;
|
|
|
cur_y = 100;
|
|
cur_y = 100;
|
|
|
- radeon_cursor_setup();
|
|
|
|
|
- radeon_cursor_move(cur_x, cur_y);
|
|
|
|
|
|
|
+ radeon_cursor_setup(&cur_img);
|
|
|
|
|
+ cursor_hw_move();
|
|
|
mouse_cursor_flag = 1;
|
|
mouse_cursor_flag = 1;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -294,7 +459,9 @@ static void mouse_cursor_setup(void)
|
|
|
mouse_clamp_ptr(&nx, &ny);
|
|
mouse_clamp_ptr(&nx, &ny);
|
|
|
cur_x = (unsigned int)nx;
|
|
cur_x = (unsigned int)nx;
|
|
|
cur_y = (unsigned int)ny;
|
|
cur_y = (unsigned int)ny;
|
|
|
- if (intel_cursor_setup(cur_x, cur_y) == 0) {
|
|
|
|
|
|
|
+ intel_cursor_load(&cur_img);
|
|
|
|
|
+ if (intel_cursor_setup((int)cur_x - (int)cur_img.hot_x,
|
|
|
|
|
+ (int)cur_y - (int)cur_img.hot_y) == 0) {
|
|
|
mouse_hw_cursor = 3;
|
|
mouse_hw_cursor = 3;
|
|
|
mouse_cursor_flag = 1;
|
|
mouse_cursor_flag = 1;
|
|
|
return;
|
|
return;
|
|
@@ -316,7 +483,7 @@ static void mouse_cursor_setup(void)
|
|
|
cur_y = (unsigned int)ny;
|
|
cur_y = (unsigned int)ny;
|
|
|
}
|
|
}
|
|
|
cursor_save_under();
|
|
cursor_save_under();
|
|
|
- mouse_draw_cursor(cur_x, cur_y);
|
|
|
|
|
|
|
+ mouse_draw_cursor();
|
|
|
cursor_present();
|
|
cursor_present();
|
|
|
mouse_cursor_flag = 1;
|
|
mouse_cursor_flag = 1;
|
|
|
}
|
|
}
|
|
@@ -410,12 +577,7 @@ static void mouse_move(int dx, int dy)
|
|
|
|
|
|
|
|
cur_x = (unsigned int)nx;
|
|
cur_x = (unsigned int)nx;
|
|
|
cur_y = (unsigned int)ny;
|
|
cur_y = (unsigned int)ny;
|
|
|
- if (mouse_hw_cursor == 3)
|
|
|
|
|
- intel_cursor_move(cur_x, cur_y);
|
|
|
|
|
- else if (mouse_hw_cursor == 2)
|
|
|
|
|
- radeon_cursor_move(cur_x, cur_y);
|
|
|
|
|
- else
|
|
|
|
|
- cirrus_cursor_move(cur_x, cur_y);
|
|
|
|
|
|
|
+ cursor_hw_move();
|
|
|
mouse_irq_restore(flags);
|
|
mouse_irq_restore(flags);
|
|
|
} else if (!mouse_auto_draw) {
|
|
} else if (!mouse_auto_draw) {
|
|
|
/* A WM frame is between BEGIN and PRESENT: it erased the
|
|
/* A WM frame is between BEGIN and PRESENT: it erased the
|
|
@@ -428,7 +590,7 @@ static void mouse_move(int dx, int dy)
|
|
|
cur_x = (unsigned int)nx;
|
|
cur_x = (unsigned int)nx;
|
|
|
cur_y = (unsigned int)ny;
|
|
cur_y = (unsigned int)ny;
|
|
|
cursor_save_under();
|
|
cursor_save_under();
|
|
|
- mouse_draw_cursor(cur_x, cur_y);
|
|
|
|
|
|
|
+ mouse_draw_cursor();
|
|
|
cursor_present(); /* draw the new position in VRAM */
|
|
cursor_present(); /* draw the new position in VRAM */
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -508,6 +670,7 @@ void mouse_poll_update(void)
|
|
|
if ((mouse_present_flag || usbhid_mouse_attached() ||
|
|
if ((mouse_present_flag || usbhid_mouse_attached() ||
|
|
|
touchpad_present()) && !mouse_cursor_flag)
|
|
touchpad_present()) && !mouse_cursor_flag)
|
|
|
mouse_cursor_setup();
|
|
mouse_cursor_setup();
|
|
|
|
|
+ mouse_cursor_tick();
|
|
|
|
|
|
|
|
/* USB HID mouse: reports arrive through the armed interrupt
|
|
/* USB HID mouse: reports arrive through the armed interrupt
|
|
|
endpoint; the backend also handles hotplug/detach. */
|
|
endpoint; the backend also handles hotplug/detach. */
|
|
@@ -632,10 +795,16 @@ void mouse_redraw_cursor(void)
|
|
|
* rectangle is still the old position and has been restored to the
|
|
* rectangle is still the old position and has been restored to the
|
|
|
* background there. Erase it in VRAM before drawing the new one, so
|
|
* background there. Erase it in VRAM before drawing the new one, so
|
|
|
* a moving cursor does not leave a trail behind a slow frame. */
|
|
* a moving cursor does not leave a trail behind a slow frame. */
|
|
|
- if ((saved_x != cur_x || saved_y != cur_y) && saved_w && saved_h)
|
|
|
|
|
- vga_fb_present_rect(saved_x, saved_y, saved_w, saved_h);
|
|
|
|
|
|
|
+ if (saved_w && saved_h) {
|
|
|
|
|
+ unsigned int nx, ny, nw, nh;
|
|
|
|
|
+
|
|
|
|
|
+ cursor_calc_rect(&nx, &ny, &nw, &nh);
|
|
|
|
|
+ if (nx != saved_x || ny != saved_y || nw != saved_w ||
|
|
|
|
|
+ nh != saved_h)
|
|
|
|
|
+ vga_fb_present_rect(saved_x, saved_y, saved_w, saved_h);
|
|
|
|
|
+ }
|
|
|
cursor_save_under();
|
|
cursor_save_under();
|
|
|
- mouse_draw_cursor(cur_x, cur_y);
|
|
|
|
|
|
|
+ mouse_draw_cursor();
|
|
|
cursor_present();
|
|
cursor_present();
|
|
|
}
|
|
}
|
|
|
|
|
|