summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-06-25 15:05:09 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-06-25 15:05:09 +0200
commitd5095a462df8c1373da36924a86c1da7fb3b1c49 (patch)
tree40df07dbf466d4ee65f0069547ca2166fd6cb535 /src/gui
parent96d1781a9ba365baef0f89ef85a2b103bfd6370a (diff)
downloadabaos-d5095a462df8c1373da36924a86c1da7fb3b1c49.tar.gz
abaos-d5095a462df8c1373da36924a86c1da7fb3b1c49.tar.bz2
we have a flickering mouse cursor and terrible redrawing of the desktop now :-)
removed the font window for now, far too slow!
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/desktop.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/gui/desktop.c b/src/gui/desktop.c
index 7c886b6..0c0aa01 100644
--- a/src/gui/desktop.c
+++ b/src/gui/desktop.c
@@ -26,9 +26,11 @@ void desktop_init( desktop_t *desktop, const int w, const int h, const vga_color
composite_widget_init( &desktop->base, NULL, 0, 0, w, h, background_color );
- desktop->mouse_x = 0;
- desktop->mouse_y = 0;
+ desktop->mouse_x = w / 2;
+ desktop->mouse_y = h / 2;
+ desktop->base.base.vtable = (widget_vtable_t *)&desktop_vtable;
+ desktop->base.vtable = (composite_widget_vtable_t *)&desktop_vtable;
desktop->vtable = &desktop_vtable;
}
@@ -38,15 +40,22 @@ void desktop_draw( void *obj, graphics_context_t *context )
vga_clear_screen( context, desktop->base.base.background_color );
- ((widget_vtable_t *)(desktop->base.vtable))->draw( obj, context );
+ composite_widget_draw( obj, context );
- // TODO: use a mouse bitmap and copy it
-/*
for( int i = 0; i < 4; i++ ) {
- vga_set_pixel( context,
-void vga_set_pixel( vga_t *vga, const int x, const int y, const vga_color_t color );
+ if( desktop->mouse_x > i ) {
+ vga_set_pixel( context, desktop->mouse_x - i, desktop->mouse_y, VGA_COLOR_WHITE );
+ }
+ if( desktop->mouse_x < context->mode.x - i ) {
+ vga_set_pixel( context, desktop->mouse_x + i, desktop->mouse_y, VGA_COLOR_WHITE );
+ }
+ if( desktop->mouse_y > i ) {
+ vga_set_pixel( context, desktop->mouse_x, desktop->mouse_y - i, VGA_COLOR_WHITE );
+ }
+ if( desktop->mouse_y < context->mode.y - i ) {
+ vga_set_pixel( context, desktop->mouse_x, desktop->mouse_y + i, VGA_COLOR_WHITE );
+ }
}
-*/
}
void desktop_on_mouse_down( void *obj, const int x, const int y )
@@ -55,8 +64,13 @@ void desktop_on_mouse_down( void *obj, const int x, const int y )
void desktop_on_mouse_up( void *obj, const int x, const int y )
{
+ composite_widget_on_mouse_up( obj, x, y );
}
void desktop_on_mouse_move( void *obj, const int old_x, const int old_y, const int x, const int y )
{
+ desktop_t *desktop = obj;
+
+ desktop->mouse_x = x;
+ desktop->mouse_y = y;
}