From d0b39ebade7736d47e6b2450bf68b088c0da8e57 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 12 Jan 2021 21:39:12 -0300 Subject: [PATCH] Redraw window immediately on "live resizing" --- laf | 2 +- src/app/console.cpp | 6 ++++-- src/app/modules/gui.cpp | 17 ++++++++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/laf b/laf index 6ace65197..39ff91256 160000 --- a/laf +++ b/laf @@ -1 +1 @@ -Subproject commit 6ace65197891e0e0c79e0e96d7b39daacc56e364 +Subproject commit 39ff91256cc64808bcf735c6d755a1746f841b3a diff --git a/src/app/console.cpp b/src/app/console.cpp index 59fcb4c5a..b2fcf85b6 100644 --- a/src/app/console.cpp +++ b/src/app/console.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018-2020 Igara Studio S.A. +// Copyright (C) 2018-2021 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -177,7 +177,9 @@ void Console::printf(const char* format, ...) // static void Console::showException(const std::exception& e) { - ui::assert_ui_thread(); + // TODO called from Session::deleteBackup() which is run in background thread + //ui::assert_ui_thread(); + if (!ui::is_ui_thread()) { LOG(ERROR, "A problem has occurred.\n\nDetails:\n%s\n", e.what()); return; diff --git a/src/app/modules/gui.cpp b/src/app/modules/gui.cpp index f3441912a..8934679f3 100644 --- a/src/app/modules/gui.cpp +++ b/src/app/modules/gui.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018-2020 Igara Studio S.A. +// Copyright (C) 2018-2021 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -203,6 +203,21 @@ int init_module_gui() if (maximized) main_display->maximize(); + // Handle live resize too redraw the entire manager, dispatch the UI + // messages, and flip the display. + main_display->handleResize = + [](os::Display* display) { + manager->invalidate(); + + Message* msg = new Message(kResizeDisplayMessage); + msg->setRecipient(manager); + msg->setPropagateToChildren(true); + manager->enqueueMessage(msg); + + manager->dispatchMessages(); + manager->flipDisplay(); + }; + // Set graphics options for next time save_gui_config();