From eb48ab72b7220ff939edd3615ce980d6dbcf2df8 Mon Sep 17 00:00:00 2001 From: Stephanie Gawroriski Date: Thu, 8 Aug 2024 01:12:55 +0000 Subject: [PATCH] Get page size before getting the old value from it. --- nanocoat/include/lib/scritchui/scritchuiImpl.h | 6 +++--- nanocoat/lib/scritchui/gtk2/gtk2View.c | 3 ++- nanocoat/lib/scritchui/scritchView.c | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/nanocoat/include/lib/scritchui/scritchuiImpl.h b/nanocoat/include/lib/scritchui/scritchuiImpl.h index a99bfbd725..1715da547d 100644 --- a/nanocoat/include/lib/scritchui/scritchuiImpl.h +++ b/nanocoat/include/lib/scritchui/scritchuiImpl.h @@ -686,9 +686,6 @@ struct sjme_scritchui_internFunctions /** Common component initialization. */ sjme_scritchui_intern_initComponentFunc initComponent; - /** Set of simple user listener. */ - sjme_scritchui_intern_setSimpleListenerFunc setSimpleListener; - /** Maps the given screen. */ sjme_scritchui_intern_mapScreenFunc mapScreen; @@ -698,6 +695,9 @@ struct sjme_scritchui_internFunctions /** Menu item activation propagation, from top down. */ sjme_scritchui_intern_menuItemActivateByIdFunc menuItemActivateById; + /** Set of simple user listener. */ + sjme_scritchui_intern_setSimpleListenerFunc setSimpleListener; + /** Update visibility recursively on container. */ sjme_scritchui_intern_updateVisibleContainerFunc updateVisibleContainer; diff --git a/nanocoat/lib/scritchui/gtk2/gtk2View.c b/nanocoat/lib/scritchui/gtk2/gtk2View.c index 502215cf53..f955e29b4d 100644 --- a/nanocoat/lib/scritchui/gtk2/gtk2View.c +++ b/nanocoat/lib/scritchui/gtk2/gtk2View.c @@ -87,7 +87,8 @@ sjme_errorCode sjme_scritchui_gtk2_viewSetArea( GtkAdjustment* hAdjust; GtkAdjustment* vAdjust; - if (inState == NULL || inComponent == NULL || inViewArea == NULL) + if (inState == NULL || inComponent == NULL || inViewArea == NULL || + inViewPage == NULL) return SJME_ERROR_NULL_ARGUMENTS; /* Get wrapped widget. */ diff --git a/nanocoat/lib/scritchui/scritchView.c b/nanocoat/lib/scritchui/scritchView.c index 7ba1b51577..74442bc85b 100644 --- a/nanocoat/lib/scritchui/scritchView.c +++ b/nanocoat/lib/scritchui/scritchView.c @@ -174,6 +174,9 @@ sjme_errorCode sjme_scritchui_core_viewSetArea( fullArea.width = viewRect.d.width; if (viewRect.d.height > fullArea.height) fullArea.height = viewRect.d.height; + + /* Get page size before we cache it. */ + pageSize = &view->pageSize; /* Get previous view area to check if it changed. */ memmove(&oldArea, &view->area, sizeof(oldArea)); @@ -183,7 +186,6 @@ sjme_errorCode sjme_scritchui_core_viewSetArea( memmove(&view->area, &fullArea, sizeof(view->area)); /* Update the page size. */ - pageSize = &view->pageSize; pageSize->width = viewRect.d.width; pageSize->height = viewRect.d.height; -- 2.11.4.GIT