From c3c6b9cd6149dff0d7ad6b4207e6bd0ed16184e3 Mon Sep 17 00:00:00 2001 From: Meiguro Date: Sat, 27 Feb 2016 13:57:48 -0800 Subject: [PATCH] Don't reset the scroll layer if it is not being used SimplyMenu does not use the scroll layer, therefore resetting the scroll layer will break SimplyMenu scrolling due to the scroll layer taking over the click config. Add a SimplyWindow boolean property that explicitly specifies whether the scroll layer is used in order to avoid resetting and applying the scroll layer click config if it is not used. --- src/simply/simply_stage.c | 1 + src/simply/simply_ui.c | 1 + src/simply/simply_window.c | 2 +- src/simply/simply_window.h | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/simply/simply_stage.c b/src/simply/simply_stage.c index b6d94e11..2e1f2738 100644 --- a/src/simply/simply_stage.c +++ b/src/simply/simply_stage.c @@ -501,6 +501,7 @@ static void window_load(Window *window) { *(void**) layer_get_data(layer) = self; layer_set_update_proc(layer, layer_update_callback); scroll_layer_add_child(self->window.scroll_layer, layer); + self->window.use_scroll_layer = true; } static void window_appear(Window *window) { diff --git a/src/simply/simply_ui.c b/src/simply/simply_ui.c index ef92c632..5793a413 100644 --- a/src/simply/simply_ui.c +++ b/src/simply/simply_ui.c @@ -381,6 +381,7 @@ static void window_load(Window *window) { *(void**) layer_get_data(layer) = self; layer_set_update_proc(layer, layer_update_callback); scroll_layer_add_child(self->window.scroll_layer, layer); + self->window.use_scroll_layer = true; simply_ui_set_style(self, 1); } diff --git a/src/simply/simply_window.c b/src/simply/simply_window.c index f1c12128..7569051c 100644 --- a/src/simply/simply_window.c +++ b/src/simply/simply_window.c @@ -92,7 +92,7 @@ static void prv_set_scroll_layer_click_config(SimplyWindow *self) { void simply_window_set_scrollable(SimplyWindow *self, bool is_scrollable, bool animated, bool reset) { - if (self->is_scrollable == is_scrollable && !reset) { return; } + if (!self->use_scroll_layer || (self->is_scrollable == is_scrollable && !reset)) { return; } self->is_scrollable = is_scrollable; diff --git a/src/simply/simply_window.h b/src/simply/simply_window.h index ccc5c8e5..4f50db4f 100644 --- a/src/simply/simply_window.h +++ b/src/simply/simply_window.h @@ -24,6 +24,7 @@ struct SimplyWindow { ButtonId button_mask:4; GColor8 background_color; bool is_scrollable:1; + bool use_scroll_layer:1; bool use_status_bar:1; bool use_action_bar:1; #if defined(PBL_ROUND)