Kaynağa Gözat

Extended 16-bit scrollbar offsets to 32-bit #312

vurtun 8 yıl önce
ebeveyn
işleme
e63ae83349
3 değiştirilmiş dosya ile 88 ekleme ve 69 silme
  1. 1 0
      CHANGELOG.md
  2. 1 1
      demo/overview.c
  3. 86 68
      nuklear.h

+ 1 - 0
CHANGELOG.md

@@ -1,4 +1,5 @@
 # Changelog
 # Changelog
+- 2016/12/31 (1.20) - Extended scrollbar offset from 16-bit to 32-bit
 - 2016/12/31 (1.192)- Fixed closing window bug of minimized windows
 - 2016/12/31 (1.192)- Fixed closing window bug of minimized windows
 - 2016/12/03 (1.191)- Fixed wrapped text with no seperator and C89 error
 - 2016/12/03 (1.191)- Fixed wrapped text with no seperator and C89 error
 - 2016/12/03 (1.19) - Changed text wrapping to process words not characters
 - 2016/12/03 (1.19) - Changed text wrapping to process words not characters

+ 1 - 1
demo/overview.c

@@ -806,7 +806,7 @@ overview(struct nk_context *ctx)
                 nk_checkbox_label(ctx, "Border", &group_border);
                 nk_checkbox_label(ctx, "Border", &group_border);
                 nk_checkbox_label(ctx, "No Scrollbar", &group_no_scrollbar);
                 nk_checkbox_label(ctx, "No Scrollbar", &group_no_scrollbar);
 
 
-                nk_layout_row_begin(ctx, NK_STATIC, 22, 2);
+                nk_layout_row_begin(ctx, NK_STATIC, 22, 3);
                 nk_layout_row_push(ctx, 50);
                 nk_layout_row_push(ctx, 50);
                 nk_label(ctx, "size:", NK_TEXT_LEFT);
                 nk_label(ctx, "size:", NK_TEXT_LEFT);
                 nk_layout_row_push(ctx, 130);
                 nk_layout_row_push(ctx, 130);

+ 86 - 68
nuklear.h

@@ -1,5 +1,5 @@
 /*
 /*
- Nuklear - v1.18 - public domain
+ Nuklear - v1.20 - public domain
  no warrenty implied; use at your own risk.
  no warrenty implied; use at your own risk.
  authored from 2015-2016 by Micha Mettke
  authored from 2015-2016 by Micha Mettke
 
 
@@ -456,7 +456,7 @@ typedef char nk_glyph[NK_UTF_SIZE];
 typedef union {void *ptr; int id;} nk_handle;
 typedef union {void *ptr; int id;} nk_handle;
 struct nk_image {nk_handle handle;unsigned short w,h;unsigned short region[4];};
 struct nk_image {nk_handle handle;unsigned short w,h;unsigned short region[4];};
 struct nk_cursor {struct nk_image img; struct nk_vec2 size, offset;};
 struct nk_cursor {struct nk_image img; struct nk_vec2 size, offset;};
-struct nk_scroll {unsigned short x, y;};
+struct nk_scroll {nk_uint x, y;};
 
 
 enum nk_heading         {NK_UP, NK_RIGHT, NK_DOWN, NK_LEFT};
 enum nk_heading         {NK_UP, NK_RIGHT, NK_DOWN, NK_LEFT};
 enum nk_button_behavior {NK_BUTTON_DEFAULT, NK_BUTTON_REPEATER};
 enum nk_button_behavior {NK_BUTTON_DEFAULT, NK_BUTTON_REPEATER};
@@ -507,8 +507,8 @@ struct nk_list_view {
 /* private: */
 /* private: */
     int total_height;
     int total_height;
     struct nk_context *ctx;
     struct nk_context *ctx;
-    nk_ushort *scroll_pointer;
-    nk_ushort scroll_value;
+    nk_uint *scroll_pointer;
+    nk_uint scroll_value;
 };
 };
 
 
 enum nk_symbol_type {
 enum nk_symbol_type {
@@ -763,10 +763,10 @@ NK_API float                    nk_layout_ratio_from_pixel(struct nk_context*, f
 
 
 /* Layout: Group */
 /* Layout: Group */
 NK_API int                      nk_group_begin(struct nk_context*, const char *title, nk_flags);
 NK_API int                      nk_group_begin(struct nk_context*, const char *title, nk_flags);
-NK_API void                     nk_group_end(struct nk_context*);
-
+NK_API int                      nk_group_scrolled_offset_begin(struct nk_context*, nk_uint *x_offset, nk_uint *y_offset, const char*, nk_flags);
 NK_API int                      nk_group_scrolled_begin(struct nk_context*, struct nk_scroll*, const char *title, nk_flags);
 NK_API int                      nk_group_scrolled_begin(struct nk_context*, struct nk_scroll*, const char *title, nk_flags);
 NK_API void                     nk_group_scrolled_end(struct nk_context*);
 NK_API void                     nk_group_scrolled_end(struct nk_context*);
+NK_API void                     nk_group_end(struct nk_context*);
 
 
 NK_API int                      nk_list_view_begin(struct nk_context*, struct nk_list_view *out, const char *id, nk_flags, int row_height, int row_count);
 NK_API int                      nk_list_view_begin(struct nk_context*, struct nk_list_view *out, const char *id, nk_flags, int row_height, int row_count);
 NK_API void                     nk_list_view_end(struct nk_list_view*);
 NK_API void                     nk_list_view_end(struct nk_list_view*);
@@ -2677,7 +2677,8 @@ struct nk_panel {
     enum nk_panel_type type;
     enum nk_panel_type type;
     nk_flags flags;
     nk_flags flags;
     struct nk_rect bounds;
     struct nk_rect bounds;
-    struct nk_scroll *offset;
+    nk_uint *offset_x;
+    nk_uint *offset_y;
     float at_x, at_y, max_x;
     float at_x, at_y, max_x;
     float footer_height;
     float footer_height;
     float header_height;
     float header_height;
@@ -16643,12 +16644,12 @@ nk_panel_end(struct nk_context *ctx)
         empty_space.y = layout->bounds.y;
         empty_space.y = layout->bounds.y;
         empty_space.w = panel_padding.x + layout->border;
         empty_space.w = panel_padding.x + layout->border;
         empty_space.h = layout->bounds.h;
         empty_space.h = layout->bounds.h;
-        if (layout->offset->y == 0 && !(layout->flags & NK_WINDOW_NO_SCROLLBAR))
+        if (*layout->offset_y == 0 && !(layout->flags & NK_WINDOW_NO_SCROLLBAR))
             empty_space.w += scrollbar_size.x;
             empty_space.w += scrollbar_size.x;
         nk_fill_rect(out, empty_space, 0, style->window.background);
         nk_fill_rect(out, empty_space, 0, style->window.background);
 
 
         /* fill bottom empty space */
         /* fill bottom empty space */
-        if (layout->offset->x != 0 && !(layout->flags & NK_WINDOW_NO_SCROLLBAR)) {
+        if (*layout->offset_x != 0 && !(layout->flags & NK_WINDOW_NO_SCROLLBAR)) {
             empty_space.x = window->bounds.x;
             empty_space.x = window->bounds.x;
             empty_space.y = layout->bounds.y + layout->bounds.h;
             empty_space.y = layout->bounds.y + layout->bounds.h;
             empty_space.w = window->bounds.w;
             empty_space.w = window->bounds.w;
@@ -16676,7 +16677,7 @@ nk_panel_end(struct nk_context *ctx)
             scroll.w = scrollbar_size.x;
             scroll.w = scrollbar_size.x;
             scroll.h = layout->bounds.h;
             scroll.h = layout->bounds.h;
 
 
-            scroll_offset = layout->offset->y;
+            scroll_offset = *layout->offset_y;
             scroll_step = scroll.h * 0.10f;
             scroll_step = scroll.h * 0.10f;
             scroll_inc = scroll.h * 0.01f;
             scroll_inc = scroll.h * 0.01f;
             scroll_target = (float)(int)(layout->at_y - scroll.y);
             scroll_target = (float)(int)(layout->at_y - scroll.y);
@@ -16722,7 +16723,7 @@ nk_panel_end(struct nk_context *ctx)
             scroll_offset = nk_do_scrollbarv(&state, out, scroll, scroll_has_scrolling,
             scroll_offset = nk_do_scrollbarv(&state, out, scroll, scroll_has_scrolling,
                                 scroll_offset, scroll_target, scroll_step, scroll_inc,
                                 scroll_offset, scroll_target, scroll_step, scroll_inc,
                                 &ctx->style.scrollv, in, style->font);
                                 &ctx->style.scrollv, in, style->font);
-            layout->offset->y = (unsigned short)scroll_offset;
+            *layout->offset_y = (nk_uint)scroll_offset;
             if (in && scroll_has_scrolling)
             if (in && scroll_has_scrolling)
                 in->mouse.scroll_delta = 0;
                 in->mouse.scroll_delta = 0;
         }
         }
@@ -16734,7 +16735,7 @@ nk_panel_end(struct nk_context *ctx)
             scroll.w = layout->bounds.w;
             scroll.w = layout->bounds.w;
             scroll.h = scrollbar_size.y;
             scroll.h = scrollbar_size.y;
 
 
-            scroll_offset = layout->offset->x;
+            scroll_offset = *layout->offset_x;
             scroll_target = (float)(int)(layout->max_x - scroll.x);
             scroll_target = (float)(int)(layout->max_x - scroll.x);
             scroll_step = layout->max_x * 0.05f;
             scroll_step = layout->max_x * 0.05f;
             scroll_inc = layout->max_x * 0.005f;
             scroll_inc = layout->max_x * 0.005f;
@@ -16742,7 +16743,7 @@ nk_panel_end(struct nk_context *ctx)
             scroll_offset = nk_do_scrollbarh(&state, out, scroll, scroll_has_scrolling,
             scroll_offset = nk_do_scrollbarh(&state, out, scroll, scroll_has_scrolling,
                                 scroll_offset, scroll_target, scroll_step, scroll_inc,
                                 scroll_offset, scroll_target, scroll_step, scroll_inc,
                                 &ctx->style.scrollh, in, style->font);
                                 &ctx->style.scrollh, in, style->font);
-            layout->offset->x = (unsigned short)scroll_offset;
+            *layout->offset_x = (nk_uint)scroll_offset;
         }
         }
     }
     }
 
 
@@ -17338,7 +17339,8 @@ nk_begin_titled(struct nk_context *ctx, const char *name, const char *title,
     win->layout = (struct nk_panel*)nk_create_panel(ctx);
     win->layout = (struct nk_panel*)nk_create_panel(ctx);
     ctx->current = win;
     ctx->current = win;
     ret = nk_panel_begin(ctx, title, NK_PANEL_WINDOW);
     ret = nk_panel_begin(ctx, title, NK_PANEL_WINDOW);
-    win->layout->offset = &win->scrollbar;
+    win->layout->offset_x = &win->scrollbar.x;
+    win->layout->offset_y = &win->scrollbar.y;
     return ret;
     return ret;
 }
 }
 
 
@@ -17743,8 +17745,9 @@ nk_menubar_begin(struct nk_context *ctx)
     layout->menu.x = layout->at_x;
     layout->menu.x = layout->at_x;
     layout->menu.y = layout->at_y + layout->row.height;
     layout->menu.y = layout->at_y + layout->row.height;
     layout->menu.w = layout->bounds.w;
     layout->menu.w = layout->bounds.w;
-    layout->menu.offset = *layout->offset;
-    layout->offset->y = 0;
+    layout->menu.offset.x = *layout->offset_x;
+    layout->menu.offset.y = *layout->offset_y;
+    *layout->offset_y = 0;
 }
 }
 
 
 NK_API void
 NK_API void
@@ -17770,7 +17773,8 @@ nk_menubar_end(struct nk_context *ctx)
     layout->bounds.y += layout->menu.h + ctx->style.window.spacing.y + layout->row.height;
     layout->bounds.y += layout->menu.h + ctx->style.window.spacing.y + layout->row.height;
     layout->bounds.h -= layout->menu.h + ctx->style.window.spacing.y + layout->row.height;
     layout->bounds.h -= layout->menu.h + ctx->style.window.spacing.y + layout->row.height;
 
 
-    *layout->offset = layout->menu.offset;
+    *layout->offset_x = layout->menu.offset.x;
+    *layout->offset_y = layout->menu.offset.y;
     layout->at_y = layout->bounds.y - layout->row.height;
     layout->at_y = layout->bounds.y - layout->row.height;
 
 
     layout->clip.y = layout->bounds.y;
     layout->clip.y = layout->bounds.y;
@@ -18091,8 +18095,8 @@ nk_layout_space_to_screen(struct nk_context *ctx, struct nk_vec2 ret)
     win = ctx->current;
     win = ctx->current;
     layout = win->layout;
     layout = win->layout;
 
 
-    ret.x += layout->at_x - layout->offset->x;
-    ret.y += layout->at_y - layout->offset->y;
+    ret.x += layout->at_x - *layout->offset_x;
+    ret.y += layout->at_y - *layout->offset_y;
     return ret;
     return ret;
 }
 }
 
 
@@ -18108,8 +18112,8 @@ nk_layout_space_to_local(struct nk_context *ctx, struct nk_vec2 ret)
     win = ctx->current;
     win = ctx->current;
     layout = win->layout;
     layout = win->layout;
 
 
-    ret.x += -layout->at_x + layout->offset->x;
-    ret.y += -layout->at_y + layout->offset->y;
+    ret.x += -layout->at_x + *layout->offset_x;
+    ret.y += -layout->at_y + *layout->offset_y;
     return ret;
     return ret;
 }
 }
 
 
@@ -18125,8 +18129,8 @@ nk_layout_space_rect_to_screen(struct nk_context *ctx, struct nk_rect ret)
     win = ctx->current;
     win = ctx->current;
     layout = win->layout;
     layout = win->layout;
 
 
-    ret.x += layout->at_x - layout->offset->x;
-    ret.y += layout->at_y - layout->offset->y;
+    ret.x += layout->at_x - *layout->offset_x;
+    ret.y += layout->at_y - *layout->offset_y;
     return ret;
     return ret;
 }
 }
 
 
@@ -18142,8 +18146,8 @@ nk_layout_space_rect_to_local(struct nk_context *ctx, struct nk_rect ret)
     win = ctx->current;
     win = ctx->current;
     layout = win->layout;
     layout = win->layout;
 
 
-    ret.x += -layout->at_x + layout->offset->x;
-    ret.y += -layout->at_y + layout->offset->y;
+    ret.x += -layout->at_x + *layout->offset_x;
+    ret.y += -layout->at_y + *layout->offset_y;
     return ret;
     return ret;
 }
 }
 
 
@@ -18217,9 +18221,9 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx,
     case NK_LAYOUT_DYNAMIC_FREE: {
     case NK_LAYOUT_DYNAMIC_FREE: {
         /* panel width depended free widget placing */
         /* panel width depended free widget placing */
         bounds->x = layout->at_x + (layout->bounds.w * layout->row.item.x);
         bounds->x = layout->at_x + (layout->bounds.w * layout->row.item.x);
-        bounds->x -= layout->offset->x;
+        bounds->x -= *layout->offset_x;
         bounds->y = layout->at_y + (layout->row.height * layout->row.item.y);
         bounds->y = layout->at_y + (layout->row.height * layout->row.item.y);
-        bounds->y -= layout->offset->y;
+        bounds->y -= *layout->offset_y;
         bounds->w = layout->bounds.w  * layout->row.item.w;
         bounds->w = layout->bounds.w  * layout->row.item.w;
         bounds->h = layout->row.height * layout->row.item.h;
         bounds->h = layout->row.height * layout->row.item.h;
         return;
         return;
@@ -18259,9 +18263,9 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx,
         bounds->w = layout->row.item.w;
         bounds->w = layout->row.item.w;
         if (((bounds->x + bounds->w) > layout->max_x) && modify)
         if (((bounds->x + bounds->w) > layout->max_x) && modify)
             layout->max_x = (bounds->x + bounds->w);
             layout->max_x = (bounds->x + bounds->w);
-        bounds->x -= layout->offset->x;
+        bounds->x -= *layout->offset_x;
         bounds->y = layout->at_y + layout->row.item.y;
         bounds->y = layout->at_y + layout->row.item.y;
-        bounds->y -= layout->offset->y;
+        bounds->y -= *layout->offset_y;
         bounds->h = layout->row.item.h;
         bounds->h = layout->row.item.h;
         return;
         return;
     };
     };
@@ -18278,11 +18282,11 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx,
     /* set the bounds of the newly allocated widget */
     /* set the bounds of the newly allocated widget */
     bounds->w = item_width;
     bounds->w = item_width;
     bounds->h = layout->row.height - spacing.y;
     bounds->h = layout->row.height - spacing.y;
-    bounds->y = layout->at_y - layout->offset->y;
+    bounds->y = layout->at_y - *layout->offset_y;
     bounds->x = layout->at_x + item_offset + item_spacing + padding.x;
     bounds->x = layout->at_x + item_offset + item_spacing + padding.x;
     if (((bounds->x + bounds->w) > layout->max_x) && modify)
     if (((bounds->x + bounds->w) > layout->max_x) && modify)
         layout->max_x = bounds->x + bounds->w;
         layout->max_x = bounds->x + bounds->w;
-    bounds->x -= layout->offset->x;
+    bounds->x -= *layout->offset_x;
 }
 }
 
 
 NK_INTERN void
 NK_INTERN void
@@ -18431,7 +18435,7 @@ nk_tree_state_base(struct nk_context *ctx, enum nk_tree_type type,
 
 
     /* increase x-axis cursor widget position pointer */
     /* increase x-axis cursor widget position pointer */
     if (*state == NK_MAXIMIZED) {
     if (*state == NK_MAXIMIZED) {
-        layout->at_x = header.x + layout->offset->x + style->tab.indent;
+        layout->at_x = header.x + *layout->offset_x + style->tab.indent;
         layout->bounds.w = NK_MAX(layout->bounds.w, style->tab.indent);
         layout->bounds.w = NK_MAX(layout->bounds.w, style->tab.indent);
         layout->bounds.w -= (style->tab.indent + style->window.padding.x);
         layout->bounds.w -= (style->tab.indent + style->window.padding.x);
         layout->row.tree_depth++;
         layout->row.tree_depth++;
@@ -20302,8 +20306,8 @@ nk_plot_function(struct nk_context *ctx, enum nk_chart_type type, void *userdata
  *
  *
  * --------------------------------------------------------------*/
  * --------------------------------------------------------------*/
 NK_API int
 NK_API int
-nk_group_scrolled_begin(struct nk_context *ctx,
-    struct nk_scroll *scroll, const char *title, nk_flags flags)
+nk_group_scrolled_offset_begin(struct nk_context *ctx,
+    nk_uint *x_offset, nk_uint *y_offset, const char *title, nk_flags flags)
 {
 {
     struct nk_rect bounds;
     struct nk_rect bounds;
     struct nk_window panel;
     struct nk_window panel;
@@ -20324,8 +20328,8 @@ nk_group_scrolled_begin(struct nk_context *ctx,
     nk_zero(&panel, sizeof(panel));
     nk_zero(&panel, sizeof(panel));
     panel.bounds = bounds;
     panel.bounds = bounds;
     panel.flags = flags;
     panel.flags = flags;
-    panel.scrollbar.x = scroll->x;
-    panel.scrollbar.y = scroll->y;
+    panel.scrollbar.x = *x_offset;
+    panel.scrollbar.y = *y_offset;
     panel.buffer = win->buffer;
     panel.buffer = win->buffer;
     panel.layout = (struct nk_panel*)nk_create_panel(ctx);
     panel.layout = (struct nk_panel*)nk_create_panel(ctx);
     ctx->current = &panel;
     ctx->current = &panel;
@@ -20333,7 +20337,8 @@ nk_group_scrolled_begin(struct nk_context *ctx,
 
 
     win->buffer = panel.buffer;
     win->buffer = panel.buffer;
     win->buffer.clip = panel.layout->clip;
     win->buffer.clip = panel.layout->clip;
-    panel.layout->offset = scroll;
+    panel.layout->offset_x = x_offset;
+    panel.layout->offset_y = y_offset;
     panel.layout->parent = win->layout;
     panel.layout->parent = win->layout;
     win->layout = panel.layout;
     win->layout = panel.layout;
     ctx->current = win;
     ctx->current = win;
@@ -20382,8 +20387,8 @@ nk_group_scrolled_end(struct nk_context *ctx)
         pan.bounds.w += ctx->style.window.scrollbar_size.x;
         pan.bounds.w += ctx->style.window.scrollbar_size.x;
         pan.bounds.h += ctx->style.window.scrollbar_size.y;
         pan.bounds.h += ctx->style.window.scrollbar_size.y;
     }
     }
-    pan.scrollbar.x = (unsigned short)g->offset->x;
-    pan.scrollbar.y = (unsigned short)g->offset->y;
+    pan.scrollbar.x = *g->offset_x;
+    pan.scrollbar.y = *g->offset_y;
     pan.flags = g->flags;
     pan.flags = g->flags;
     pan.buffer = win->buffer;
     pan.buffer = win->buffer;
     pan.layout = g;
     pan.layout = g;
@@ -20404,13 +20409,19 @@ nk_group_scrolled_end(struct nk_context *ctx)
     return;
     return;
 }
 }
 
 
+NK_API int
+nk_group_scrolled_begin(struct nk_context *ctx,
+    struct nk_scroll *scroll, const char *title, nk_flags flags)
+{return nk_group_scrolled_offset_begin(ctx, &scroll->x, &scroll->y, title, flags);}
+
 NK_API int
 NK_API int
 nk_group_begin(struct nk_context *ctx, const char *title, nk_flags flags)
 nk_group_begin(struct nk_context *ctx, const char *title, nk_flags flags)
 {
 {
     int title_len;
     int title_len;
     nk_hash title_hash;
     nk_hash title_hash;
-    union {struct nk_scroll *s; nk_uint *i;} value;
     struct nk_window *win;
     struct nk_window *win;
+    nk_uint *x_offset;
+    nk_uint *y_offset;
 
 
     NK_ASSERT(ctx);
     NK_ASSERT(ctx);
     NK_ASSERT(title);
     NK_ASSERT(title);
@@ -20423,21 +20434,22 @@ nk_group_begin(struct nk_context *ctx, const char *title, nk_flags flags)
     win = ctx->current;
     win = ctx->current;
     title_len = (int)nk_strlen(title);
     title_len = (int)nk_strlen(title);
     title_hash = nk_murmur_hash(title, (int)title_len, NK_PANEL_GROUP);
     title_hash = nk_murmur_hash(title, (int)title_len, NK_PANEL_GROUP);
-    value.i = nk_find_value(win, title_hash);
-    if (!value.i) {
-        value.i = nk_add_value(ctx, win, title_hash, 0);
-        NK_ASSERT(value.i);
-        if (!value.i) return 0;
-        *value.i = 0;
-    }
-    return nk_group_scrolled_begin(ctx, value.s, title, flags);
+    x_offset = nk_find_value(win, title_hash);
+    if (!x_offset) {
+        x_offset = nk_add_value(ctx, win, title_hash, 0);
+        y_offset = nk_add_value(ctx, win, title_hash+1, 0);
+
+        NK_ASSERT(x_offset);
+        NK_ASSERT(y_offset);
+        if (!x_offset || !y_offset) return 0;
+        *x_offset = *y_offset = 0;
+    } else y_offset = nk_find_value(win, title_hash+1);
+    return nk_group_scrolled_offset_begin(ctx, x_offset, y_offset, title, flags);
 }
 }
 
 
 NK_API void
 NK_API void
 nk_group_end(struct nk_context *ctx)
 nk_group_end(struct nk_context *ctx)
-{
-    nk_group_scrolled_end(ctx);
-}
+{nk_group_scrolled_end(ctx);}
 
 
 NK_API int
 NK_API int
 nk_list_view_begin(struct nk_context *ctx, struct nk_list_view *view,
 nk_list_view_begin(struct nk_context *ctx, struct nk_list_view *view,
@@ -20445,7 +20457,8 @@ nk_list_view_begin(struct nk_context *ctx, struct nk_list_view *view,
 {
 {
     int title_len;
     int title_len;
     nk_hash title_hash;
     nk_hash title_hash;
-    union {struct nk_scroll *s; nk_uint *i;} value;
+    nk_uint *x_offset;
+    nk_uint *y_offset;
 
 
     int result;
     int result;
     struct nk_window *win;
     struct nk_window *win;
@@ -20463,21 +20476,24 @@ nk_list_view_begin(struct nk_context *ctx, struct nk_list_view *view,
     item_spacing = style->window.spacing;
     item_spacing = style->window.spacing;
     row_height += NK_MAX(0, (int)item_spacing.y);
     row_height += NK_MAX(0, (int)item_spacing.y);
 
 
-    /* find persistent group scrollbar offset */
+    /* find persistent list view scrollbar offset */
     title_len = (int)nk_strlen(title);
     title_len = (int)nk_strlen(title);
     title_hash = nk_murmur_hash(title, (int)title_len, NK_PANEL_GROUP);
     title_hash = nk_murmur_hash(title, (int)title_len, NK_PANEL_GROUP);
-    value.i = nk_find_value(win, title_hash);
-    if (!value.i) {
-        value.i = nk_add_value(ctx, win, title_hash, 0);
-        NK_ASSERT(value.i);
-        if (!value.i) return 0;
-        *value.i = 0;
-    }
-    view->scroll_value = value.s->y;
-    view->scroll_pointer = &value.s->y;
-
-    value.s->y = 0;
-    result = nk_group_scrolled_begin(ctx, value.s, title, flags);
+    x_offset = nk_find_value(win, title_hash);
+    if (!x_offset) {
+        x_offset = nk_add_value(ctx, win, title_hash, 0);
+        y_offset = nk_add_value(ctx, win, title_hash+1, 0);
+
+        NK_ASSERT(x_offset);
+        NK_ASSERT(y_offset);
+        if (!x_offset || !y_offset) return 0;
+        *x_offset = *y_offset = 0;
+    } else y_offset = nk_find_value(win, title_hash+1);
+    view->scroll_value = *y_offset;
+    view->scroll_pointer = y_offset;
+
+    *y_offset = 0;
+    result = nk_group_scrolled_offset_begin(ctx, x_offset, y_offset, title, flags);
     win = ctx->current;
     win = ctx->current;
     layout = win->layout;
     layout = win->layout;
  
  
@@ -20505,7 +20521,7 @@ nk_list_view_end(struct nk_list_view *view)
     win = ctx->current;
     win = ctx->current;
     layout = win->layout;
     layout = win->layout;
     layout->at_y = layout->bounds.y + (float)view->total_height;
     layout->at_y = layout->bounds.y + (float)view->total_height;
-    *view->scroll_pointer = (nk_ushort)(*view->scroll_pointer + view->scroll_value);
+    *view->scroll_pointer = *view->scroll_pointer + view->scroll_value;
     nk_group_end(view->ctx);
     nk_group_end(view->ctx);
 }
 }
 
 
@@ -20588,7 +20604,8 @@ nk_popup_begin(struct nk_context *ctx, enum nk_popup_type type,
             root = root->parent;
             root = root->parent;
         }
         }
         win->popup.active = 1;
         win->popup.active = 1;
-        popup->layout->offset = &popup->scrollbar;
+        popup->layout->offset_x = &popup->scrollbar.x;
+        popup->layout->offset_y = &popup->scrollbar.y;
         popup->layout->parent = win->layout;
         popup->layout->parent = win->layout;
         return 1;
         return 1;
     } else {
     } else {
@@ -20677,7 +20694,8 @@ nk_nonblock_begin(struct nk_context *ctx,
     nk_panel_begin(ctx, 0, panel_type);
     nk_panel_begin(ctx, 0, panel_type);
     win->buffer = popup->buffer;
     win->buffer = popup->buffer;
     popup->layout->parent = win->layout;
     popup->layout->parent = win->layout;
-    popup->layout->offset = &popup->scrollbar;
+    popup->layout->offset_x = &popup->scrollbar.x;
+    popup->layout->offset_y = &popup->scrollbar.y;
 
 
     /* set read only mode to all parent panels */
     /* set read only mode to all parent panels */
     {struct nk_panel *root;
     {struct nk_panel *root;