From f8181f1355cf8218daf2ee2153606b7eccf1cb18 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 1 Jul 2017 20:56:00 +0200 Subject: got rid of superflous vtables in GUI class hierarchy --- src/gui/composite_widget.c | 1 - src/gui/composite_widget.h | 1 - src/gui/desktop.c | 2 -- src/gui/desktop.h | 1 - src/gui/text_widget.c | 1 - src/gui/text_widget.h | 1 - src/gui/window.c | 2 -- src/gui/window.h | 1 - 8 files changed, 10 deletions(-) (limited to 'src/gui') diff --git a/src/gui/composite_widget.c b/src/gui/composite_widget.c index e71bac6..355e3c6 100644 --- a/src/gui/composite_widget.c +++ b/src/gui/composite_widget.c @@ -29,7 +29,6 @@ void composite_widget_init( composite_widget_t *widget, widget_t *parent, const memset( widget->children, 0, MAX_NOF_WIDGET_CHILDREN * sizeof( widget_t * ) ); widget->base.vtable = (widget_vtable_t *)&composite_widget_vtable; - widget->vtable = &composite_widget_vtable; } void composite_widget_draw( void *obj, graphics_context_t *context ) diff --git a/src/gui/composite_widget.h b/src/gui/composite_widget.h index 28e1e02..c055e09 100644 --- a/src/gui/composite_widget.h +++ b/src/gui/composite_widget.h @@ -12,7 +12,6 @@ typedef struct { typedef struct { widget_t base; - composite_widget_vtable_t *vtable; widget_t *children[MAX_NOF_WIDGET_CHILDREN]; int nof_children; widget_t *focused_child; diff --git a/src/gui/desktop.c b/src/gui/desktop.c index 4a3876e..08da59b 100644 --- a/src/gui/desktop.c +++ b/src/gui/desktop.c @@ -31,8 +31,6 @@ void desktop_init( desktop_t *desktop, const int w, const int h, const vga_color desktop->needs_redrawing = true; desktop->base.base.vtable = (widget_vtable_t *)&desktop_vtable; - desktop->base.vtable = (composite_widget_vtable_t *)&desktop_vtable; - desktop->vtable = &desktop_vtable; } void desktop_draw( void *obj, graphics_context_t *context ) diff --git a/src/gui/desktop.h b/src/gui/desktop.h index f644691..09a2d75 100644 --- a/src/gui/desktop.h +++ b/src/gui/desktop.h @@ -13,7 +13,6 @@ typedef struct { typedef struct { composite_widget_t base; - desktop_vtable_t *vtable; int mouse_x; int mouse_y; bool needs_redrawing; diff --git a/src/gui/text_widget.c b/src/gui/text_widget.c index f6ba8eb..2567df3 100644 --- a/src/gui/text_widget.c +++ b/src/gui/text_widget.c @@ -29,7 +29,6 @@ void text_widget_init( text_widget_t *widget, widget_t *parent, const int x, con widget->base.focusable = true; widget->base.vtable = (widget_vtable_t *)&text_widget_vtable; - widget->vtable = &text_widget_vtable; } void text_widget_draw( void *obj, graphics_context_t *context ) diff --git a/src/gui/text_widget.h b/src/gui/text_widget.h index 3b22cf1..316f56e 100644 --- a/src/gui/text_widget.h +++ b/src/gui/text_widget.h @@ -12,7 +12,6 @@ typedef struct { typedef struct { widget_t base; - text_widget_vtable_t *vtable; char s[TEXT_WIDGET_MAX_TEXT_SIZE]; } text_widget_t; diff --git a/src/gui/window.c b/src/gui/window.c index cd62e47..f56c8e6 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -30,8 +30,6 @@ void window_init( window_t *window, widget_t *parent, const int x, const int y, window->dragging = false; window->base.base.vtable = (widget_vtable_t *)&window_vtable; - window->base.vtable = (composite_widget_vtable_t *)&window_vtable; - window->vtable = &window_vtable; } void window_draw( void *obj, graphics_context_t *context ) diff --git a/src/gui/window.h b/src/gui/window.h index 3a0cc97..793d8b3 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -11,7 +11,6 @@ typedef struct { typedef struct { composite_widget_t base; - window_vtable_t *vtable; bool dragging; } window_t; -- cgit v1.2.3-54-g00ecf