summaryrefslogtreecommitdiff
path: root/frontends/beos
diff options
context:
space:
mode:
authorFrançois Revol <revol@free.fr>2020-05-09 01:28:43 +0200
committerFrançois Revol <revol@free.fr>2020-05-09 01:28:43 +0200
commit600b2ed60aceae01c1a1e551d1812c9a3789a92f (patch)
treea33de2bf271155e0f19700c180c3b4a6151dcada /frontends/beos
parent4b8ed9b7775aec686a46b1b2be01a4efa1214e55 (diff)
downloadnetsurf-600b2ed60aceae01c1a1e551d1812c9a3789a92f.tar.gz
netsurf-600b2ed60aceae01c1a1e551d1812c9a3789a92f.tar.bz2
Haiku: Better map mouse cursors
Drop custom cursor bitmaps in favor of the system ones. We only miss the wait cursor now, but the progress one should do.
Diffstat (limited to 'frontends/beos')
-rw-r--r--frontends/beos/window.cpp122
1 files changed, 54 insertions, 68 deletions
diff --git a/frontends/beos/window.cpp b/frontends/beos/window.cpp
index 93555ee8e..b97be0f07 100644
--- a/frontends/beos/window.cpp
+++ b/frontends/beos/window.cpp
@@ -1108,93 +1108,79 @@ static void gui_window_update_extent(struct gui_window *g)
g->view->UnlockLooper();
}
-/* some cursors like those in Firefox */
-// XXX: move to separate file or resource ?
-
-const uint8 kLinkCursorBits[] = {
- 16, /* cursor size */
- 1, /* bits per pixel */
- 2, /* vertical hot spot */
- 2, /* horizontal hot spot */
-
- /* data */
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x24, 0x00, 0x24, 0x00, 0x13, 0xe0, 0x12, 0x5c, 0x09, 0x2a,
- 0x08, 0x01, 0x3c, 0x21, 0x4c, 0x71, 0x42, 0x71, 0x30, 0xf9, 0x0c, 0xf9, 0x02, 0x02, 0x01, 0x00,
-
- /* mask */
- 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x1f, 0xe0, 0x1f, 0xfc, 0x0f, 0xfe,
- 0x0f, 0xff, 0x3f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x3f, 0xff, 0x0f, 0xff, 0x03, 0xfc, 0x01, 0xe0
-};
+static BCursorID gui_haiku_pointer(gui_pointer_shape shape)
+{
+ switch (shape) {
+ case GUI_POINTER_POINT: /* link */
+ return B_CURSOR_ID_FOLLOW_LINK;
-const uint8 kWatchCursorBits[] = {
- 16, /* cursor size */
- 1, /* bits per pixel */
- 0, /* vertical hot spot */
- 1, /* horizontal hot spot */
+ case GUI_POINTER_CARET: /* input */
+ return B_CURSOR_ID_I_BEAM;
- /* data */
- 0x70, 0x00, 0x48, 0x00, 0x48, 0x00, 0x27, 0xc0, 0x24, 0xb8, 0x12, 0x54, 0x10, 0x02, 0x78, 0x02,
- 0x98, 0x02, 0x84, 0x02, 0x60, 0x3a, 0x18, 0x46, 0x04, 0x8a, 0x02, 0x92, 0x01, 0x82, 0x00, 0x45,
+ case GUI_POINTER_MENU:
+ return B_CURSOR_ID_CONTEXT_MENU;
- /* mask */
- 0x70, 0x00, 0x78, 0x00, 0x78, 0x00, 0x3f, 0xc0, 0x3f, 0xf8, 0x1f, 0xfc, 0x1f, 0xfe, 0x7f, 0xfe,
- 0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfe, 0x1f, 0xfe, 0x07, 0xfe, 0x03, 0xfe, 0x01, 0xfe, 0x00, 0x7f
-};
+ case GUI_POINTER_UP:
+ return B_CURSOR_ID_RESIZE_NORTH;
-const uint8 kWatch2CursorBits[] = {
- 16, /* cursor size */
- 1, /* bits per pixel */
- 0, /* vertical hot spot */
- 1, /* horizontal hot spot */
+ case GUI_POINTER_DOWN:
+ return B_CURSOR_ID_RESIZE_SOUTH;
- /* data */
- 0x70, 0x00, 0x48, 0x00, 0x48, 0x00, 0x27, 0xc0, 0x24, 0xb8, 0x12, 0x54, 0x10, 0x02, 0x78, 0x02,
- 0x98, 0x02, 0x84, 0x02, 0x60, 0x3a, 0x18, 0x46, 0x04, 0xa2, 0x02, 0x92, 0x01, 0xa2, 0x00, 0x45,
+ case GUI_POINTER_LEFT:
+ return B_CURSOR_ID_RESIZE_WEST;
- /* mask */
- 0x70, 0x00, 0x78, 0x00, 0x78, 0x00, 0x3f, 0xc0, 0x3f, 0xf8, 0x1f, 0xfc, 0x1f, 0xfe, 0x7f, 0xfe,
- 0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfe, 0x1f, 0xfe, 0x07, 0xfe, 0x03, 0xfe, 0x01, 0xfe, 0x00, 0x7f
-};
+ case GUI_POINTER_RIGHT:
+ return B_CURSOR_ID_RESIZE_EAST;
+ case GUI_POINTER_RU:
+ return B_CURSOR_ID_RESIZE_NORTH_EAST;
-static void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
-{
- BCursor *cursor = NULL;
- bool allocated = false;
+ case GUI_POINTER_LD:
+ return B_CURSOR_ID_RESIZE_SOUTH_WEST;
- if (g->current_pointer == shape)
- return;
+ case GUI_POINTER_LU:
+ return B_CURSOR_ID_RESIZE_NORTH_WEST;
- g->current_pointer = shape;
+ case GUI_POINTER_RD:
+ return B_CURSOR_ID_RESIZE_SOUTH_EAST;
+
+ case GUI_POINTER_CROSS:
+ return B_CURSOR_ID_CROSS_HAIR;
+
+ case GUI_POINTER_MOVE:
+ return B_CURSOR_ID_MOVE;
- switch (shape) {
- case GUI_POINTER_POINT:
- cursor = new BCursor(kLinkCursorBits);
- allocated = true;
- break;
- case GUI_POINTER_CARET:
- cursor = (BCursor *)B_CURSOR_I_BEAM;
- break;
case GUI_POINTER_WAIT:
- cursor = new BCursor(kWatchCursorBits);
- allocated = true;
- break;
case GUI_POINTER_PROGRESS:
- cursor = new BCursor(kWatch2CursorBits);
- allocated = true;
- break;
+ return B_CURSOR_ID_PROGRESS;
+
+ case GUI_POINTER_NO_DROP:
+ case GUI_POINTER_NOT_ALLOWED:
+ return B_CURSOR_ID_NOT_ALLOWED;
+
+ case GUI_POINTER_HELP:
+ return B_CURSOR_ID_HELP;
+
+ case GUI_POINTER_DEFAULT:
default:
- cursor = (BCursor *)B_CURSOR_SYSTEM_DEFAULT;
- allocated = false;
+ break;
}
+ return B_CURSOR_ID_SYSTEM_DEFAULT;
+}
+
+static void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
+{
+ if (g->current_pointer == shape)
+ return;
+
+ g->current_pointer = shape;
+
+ BCursor cursor(gui_haiku_pointer(shape));
if (g->view && g->view->LockLooper()) {
- g->view->SetViewCursor(cursor);
+ g->view->SetViewCursor(&cursor);
g->view->UnlockLooper();
}
-
- if (allocated)
- delete cursor;
}
static void gui_window_place_caret(struct gui_window *g, int x, int y, int height,