make pointer image change

svn path=/trunk/netsurf/; revision=6538
This commit is contained in:
Vincent Sanders 2009-02-15 23:15:42 +00:00
parent e8cb20ac2a
commit 7f2ec301cf
5 changed files with 63 additions and 19 deletions

View File

@ -198,28 +198,26 @@ fb_cursor_plot(framebuffer_t *fb)
fb_plot_ctx = saved_plot_ctx;
}
void
fb_cursor_set(fb_cursor_t *cursor, struct bitmap *bmp)
{
cursor->width = bmp->width;
cursor->height = bmp->height;
cursor->bitmap = bmp;
}
fb_cursor_t *
fb_cursor_init(framebuffer_t *fb)
fb_cursor_init(framebuffer_t *fb, struct bitmap *bmp)
{
fb_cursor_t *cursor;
cursor = calloc(1, sizeof(fb_cursor_t));
cursor->x = fb->width / 2;
cursor->y = fb->height / 2;
cursor->width = pointer_image.width;
cursor->height = pointer_image.height;
cursor->bitmap = bitmap_create(cursor->width, cursor->height, 0);
memcpy(cursor->bitmap->pixdata,
pointer_image.pixel_data,
pointer_image.width *
pointer_image.height *
pointer_image.bytes_per_pixel);
cursor->plotted = false;
fb_cursor_set(cursor, bmp);
return cursor;
}

View File

@ -27,7 +27,9 @@ void fb_cursor_move(struct framebuffer_s *fb, int x, int y);
void fb_cursor_plot(struct framebuffer_s *fb);
fb_cursor_t *fb_cursor_init(struct framebuffer_s *fb);
void fb_cursor_set(fb_cursor_t *cursor, struct bitmap *bmp);
fb_cursor_t *fb_cursor_init(struct framebuffer_s *fb, struct bitmap *bmp);
void fb_cursor_click(framebuffer_t *fb, struct gui_window *g, browser_mouse_state st);

View File

@ -43,6 +43,7 @@
#include "framebuffer/fb_cursor.h"
#include "framebuffer/fb_findfile.h"
#include "framebuffer/fb_rootwindow.h"
#include "framebuffer/fb_image_data.h"
#include "content/urldb.h"
#include "desktop/history_core.h"
@ -223,7 +224,7 @@ void gui_init(int argc, char** argv)
exit(1);
}
framebuffer->cursor = fb_cursor_init(framebuffer);
framebuffer->cursor = fb_cursor_init(framebuffer, &pointer_image);
}
void gui_init2(int argc, char** argv)
@ -485,10 +486,18 @@ void gui_window_set_status(struct gui_window *g, const char *text)
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
{
switch (shape) {
case GUI_POINTER_POINT:
fb_cursor_set(framebuffer->cursor, &hand_image);
break;
default:
fb_cursor_set(framebuffer->cursor, &pointer_image);
}
}
void gui_window_hide_pointer(struct gui_window *g)
{
{
}
void gui_window_set_url(struct gui_window *g, const char *url)

View File

@ -16,10 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "framebuffer/fb_image_data.h"
#include <stdint.h>
const fb_widget_image_t pointer_image = {
11, 15, 4,
#include "framebuffer/fb_image_data.h"
#include "framebuffer/fb_bitmap.h"
struct bitmap pointer_image = {
11, 15,
"\0\0\0'\0\0\0""8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0`\230\230\230\275\3\3\3D\0\0\0\1\0\0\0\4\0\0\0\1\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0`\377\377\377\277\230\230\230"
@ -44,6 +47,36 @@ const fb_widget_image_t pointer_image = {
"\0\0\0\4",
};
struct bitmap hand_image = {
13, 15,
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0CGTe,/?]\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0LPa`|~\210\342\205"
"\206\213\333\25\25$K\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0""9<Kl\216\217\225\347\236\237\243\347\24\23\40^\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""69"
"Ig\217\220\225\347\236\240\244\347\21\21\34s\0\0\0M\0\0\0'\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0io\177\22>CRa6;Ka(+8\225\217\220\226\347\242\243\247\347"
"\22\22\32\211\12\13\15Z\20\21\26\204\4\4\14\6\0\0\0\0\0\0\0\0\333\344\366"
"\1""24D\240LLS\347<<E\347ddk\347\221\222\230\347\244\246\251\347\26\25\35"
"\21256>\275\200\201\205\356\0\0\0L\0\0\0\0\0\0\0\0DFPy\222\223\230\347ii"
"p\347uu{\347\245\246\253\347\241\242\247\347\245\246\252\34700:\351\254\256"
"\263\356ghm\340\0\0\0\35\0\0\0\0\0\0\0\0@@J~\250\251\256\347\235\237\245"
"\347\330\332\337\347\334\337\343\354\336\340\344\355\242\244\251\355\202"
"\203\211\356\257\261\265\356\17\16\26\242\0\0\0\5\0\0\0,\0\0\0""5:;D~\260"
"\262\267\347\315\320\325\347\323\325\333\354\332\335\342\356\334\337\344"
"\356\307\311\316\356\272\274\301\356OOW\312\3\3\6^\0\0\0""1\0\0\0M\0\0\0"
"G)*5C\216\220\227\341\317\321\327\347\305\307\315\356\312\315\323\356\314"
"\317\325\356\314\316\323\356klr\356\1\1\1]\0\0\0M\0\0\0M\0\0\0M\0\0\0\32"
"\0\0\0\0GIT\330\306\310\315\347\274\276\303\356\277\302\306\356\277\302\307"
"\356\251\253\257\35622;\262\0\0\0P\0\0\0M\0\0\0M\0\0\0@\0\0\0\10\0\0\0\0"
"+,1\253\202\204\207\326vvy\344vwy\346vwy\346^_a\347\7\7\17~\0\0\0M\0\0\0"
"M\0\0\0@\0\0\0\14\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0\12\0\0\0(\0\0\0T\0\0\0T\0"
"\0\0T\0\0\0M\0\0\0M\0\0\0M\0\0\0*\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\32\0\0\0M\0\0\0M\0\0\0M\0\0\0M\0\0\0M\0\0\0M\0\0\0\6\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0\0\0!\0\0\0\40\0\0\0\"\0\0\0\"\0\0\0"
"\"\0\0\0\31\0\0\0\1\0\0\0\0\0\0\0\0",
};
const fb_widget_image_t left_arrow = {
22, 25, 4,
"\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377"

View File

@ -28,4 +28,6 @@ typedef struct fb_widget_image_s fb_widget_image_t;
extern const fb_widget_image_t left_arrow;
extern const fb_widget_image_t right_arrow;
extern const fb_widget_image_t reload;
extern const fb_widget_image_t pointer_image;
extern struct bitmap pointer_image;
extern struct bitmap hand_image;