URI:
       tRemove undefined behavior from widget vtables - ltk - Socket-based GUI for X11 (WIP)
  HTML git clone git://lumidify.org/ltk.git (fast, but not encrypted)
  HTML git clone https://lumidify.org/git/ltk.git (encrypted, but very slow)
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit e5bdbd74dfdd1a238bde307a3613b995021ffeda
   DIR parent b9b73721a1cc87c9a6b8d68f0529e2c273f3440a
  HTML Author: lumidify <nobody@lumidify.org>
       Date:   Sun, 22 May 2022 21:49:39 +0200
       
       Remove undefined behavior from widget vtables
       
       Diffstat:
         M src/box.c                           |       6 ++++++
         M src/button.c                        |      24 +++++++++++++++++-------
         M src/grid.c                          |       6 ++++++
         M src/label.c                         |      12 ++++++++++++
         M src/menu.c                          |      30 +++++++++++++++++-------------
         M src/scrollbar.c                     |      10 +++++++++-
         M src/widget.h                        |       1 -
       
       7 files changed, 67 insertions(+), 22 deletions(-)
       ---
   DIR diff --git a/src/box.c b/src/box.c
       t@@ -48,14 +48,20 @@ static int ltk_box_mouse_release(ltk_widget *self, XEvent event);
        static int ltk_box_motion_notify(ltk_widget *self, XEvent event);
        
        static struct ltk_widget_vtable vtable = {
       +        .change_state = NULL,
       +        .hide = NULL,
                .draw = &ltk_box_draw,
                .destroy = &ltk_box_destroy,
                .resize = &ltk_recalculate_box,
                .child_size_change = &ltk_box_child_size_change,
                .remove_child = &ltk_box_remove,
       +        .key_press = NULL,
       +        .key_release = NULL,
                .mouse_press = &ltk_box_mouse_press,
                .mouse_release = &ltk_box_mouse_release,
                .motion_notify = &ltk_box_motion_notify,
       +        .mouse_leave = NULL,
       +        .mouse_enter = NULL,
                .needs_redraw = 0,
                .needs_surface = 0,
                .type = LTK_BOX
   DIR diff --git a/src/button.c b/src/button.c
       t@@ -46,13 +46,23 @@ static void ltk_button_change_state(ltk_widget *self);
        static void ltk_button_redraw_surface(ltk_button *button, ltk_surface *s);
        
        static struct ltk_widget_vtable vtable = {
       -    .mouse_release = &ltk_button_mouse_release,
       -    .change_state = &ltk_button_change_state,
       -    .draw = &ltk_button_draw,
       -    .destroy = &ltk_button_destroy,
       -    .type = LTK_BUTTON,
       -    .needs_redraw = 1,
       -    .needs_surface = 1
       +        .key_press = NULL,
       +        .key_release = NULL,
       +        .mouse_press = NULL,
       +        .mouse_release = &ltk_button_mouse_release,
       +        .motion_notify = NULL,
       +        .mouse_leave = NULL,
       +        .mouse_enter = NULL,
       +        .change_state = &ltk_button_change_state,
       +        .resize = NULL,
       +        .hide = NULL,
       +        .draw = &ltk_button_draw,
       +        .destroy = &ltk_button_destroy,
       +        .child_size_change = NULL,
       +        .remove_child = NULL,
       +        .type = LTK_BUTTON,
       +        .needs_redraw = 1,
       +        .needs_surface = 1
        };
        
        static struct {
   DIR diff --git a/src/grid.c b/src/grid.c
       t@@ -60,11 +60,17 @@ static struct ltk_widget_vtable vtable = {
                .draw = &ltk_grid_draw,
                .destroy = &ltk_grid_destroy,
                .resize = &ltk_recalculate_grid,
       +        .hide = NULL,
       +        .change_state = NULL,
                .child_size_change = &ltk_grid_child_size_change,
                .remove_child = &ltk_grid_ungrid,
                .mouse_press = &ltk_grid_mouse_press,
                .mouse_release = &ltk_grid_mouse_release,
                .motion_notify = &ltk_grid_motion_notify,
       +        .mouse_leave = NULL,
       +        .mouse_enter = NULL,
       +        .key_press = NULL,
       +        .key_release = NULL,
                .type = LTK_GRID,
                .needs_redraw = 0,
                .needs_surface = 0
   DIR diff --git a/src/label.c b/src/label.c
       t@@ -45,6 +45,18 @@ static void ltk_label_redraw_surface(ltk_label *label, ltk_surface *s);
        static struct ltk_widget_vtable vtable = {
                .draw = &ltk_label_draw,
                .destroy = &ltk_label_destroy,
       +        .hide = NULL,
       +        .resize = NULL,
       +        .change_state = NULL,
       +        .child_size_change = NULL,
       +        .remove_child = NULL,
       +        .key_press = NULL,
       +        .key_release = NULL,
       +        .mouse_press = NULL,
       +        .mouse_release = NULL,
       +        .motion_notify = NULL,
       +        .mouse_leave = NULL,
       +        .mouse_enter = NULL,
                .type = LTK_LABEL,
                .needs_redraw = 1,
                .needs_surface = 1
   DIR diff --git a/src/menu.c b/src/menu.c
       t@@ -121,19 +121,23 @@ static int ltk_menu_enable_entry_id(ltk_menu *menu, const char *id, char **errst
        static int ltk_menu_enable_all_entries(ltk_menu *menu, char **errstr);
        
        static struct ltk_widget_vtable vtable = {
       -    .mouse_press = &ltk_menu_mouse_press,
       -    .motion_notify = &ltk_menu_motion_notify,
       -    .mouse_release = &ltk_menu_mouse_release,
       -    .mouse_enter = &ltk_menu_mouse_enter,
       -    .mouse_leave = &ltk_menu_mouse_leave,
       -    .resize = &ltk_menu_resize,
       -    .change_state = &ltk_menu_change_state,
       -    .hide = &ltk_menu_hide,
       -    .draw = &ltk_menu_draw,
       -    .destroy = &ltk_menu_destroy,
       -    .type = LTK_MENU,
       -    .needs_redraw = 1,
       -    .needs_surface = 1
       +        .key_press = NULL,
       +        .key_release = NULL,
       +        .mouse_press = &ltk_menu_mouse_press,
       +        .motion_notify = &ltk_menu_motion_notify,
       +        .mouse_release = &ltk_menu_mouse_release,
       +        .mouse_enter = &ltk_menu_mouse_enter,
       +        .mouse_leave = &ltk_menu_mouse_leave,
       +        .resize = &ltk_menu_resize,
       +        .change_state = &ltk_menu_change_state,
       +        .hide = &ltk_menu_hide,
       +        .draw = &ltk_menu_draw,
       +        .destroy = &ltk_menu_destroy,
       +        .child_size_change = NULL,
       +        .remove_child = NULL,
       +        .type = LTK_MENU,
       +        .needs_redraw = 1,
       +        .needs_surface = 1
        };
        
        /* FIXME: maybe just store colors as pointers and check after
   DIR diff --git a/src/scrollbar.c b/src/scrollbar.c
       t@@ -41,9 +41,17 @@ static void ltk_scrollbar_destroy(ltk_widget *self, int shallow);
        
        static struct ltk_widget_vtable vtable = {
                .draw = &ltk_scrollbar_draw,
       +        .destroy = &ltk_scrollbar_destroy,
       +        .change_state = NULL,
       +        .hide = NULL,
       +        .resize = NULL,
                .mouse_press = &ltk_scrollbar_mouse_press,
       +        .mouse_release = NULL,
                .motion_notify = &ltk_scrollbar_motion_notify,
       -        .destroy = &ltk_scrollbar_destroy,
       +        .mouse_leave = NULL,
       +        .mouse_enter = NULL,
       +        .child_size_change = NULL,
       +        .remove_child = NULL,
                .type = LTK_UNKNOWN, /* FIXME */
                .needs_redraw = 1,
                .needs_surface = 1
   DIR diff --git a/src/widget.h b/src/widget.h
       t@@ -90,7 +90,6 @@ struct ltk_widget_vtable {
                void (*key_release) (struct ltk_widget *, XEvent);
                int (*mouse_press) (struct ltk_widget *, XEvent);
                int (*mouse_release) (struct ltk_widget *, XEvent);
       -        int (*mouse_wheel) (struct ltk_widget *, XEvent);
                int (*motion_notify) (struct ltk_widget *, XEvent);
                int (*mouse_leave) (struct ltk_widget *, XEvent);
                int (*mouse_enter) (struct ltk_widget *, XEvent);