diff --git a/src/app/app.cpp b/src/app/app.cpp index d23060d6a..3e387da83 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -578,8 +578,7 @@ InputChain& App::inputChain() } #endif -// Updates palette and redraw the screen. -void app_refresh_screen() +void app_update_current_palette() { #ifdef ENABLE_UI Context* context = UIContext::instance(); @@ -590,7 +589,15 @@ void app_refresh_screen() if (Palette* pal = site.palette()) set_current_palette(pal, false); else - set_current_palette(NULL, false); + set_current_palette(nullptr, false); +#endif // ENABLE_UI +} + +// Updates palette and redraw the screen. +void app_refresh_screen() +{ +#ifdef ENABLE_UI + app_update_current_palette(); // Invalidate the whole screen. ui::Manager::getDefault()->invalidate(); diff --git a/src/app/app.h b/src/app/app.h index 7b692a270..72134c461 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -147,6 +147,7 @@ namespace app { #endif }; + void app_update_current_palette(); void app_refresh_screen(); void app_rebuild_documents_tabs(); PixelFormat app_get_current_pixel_format(); diff --git a/src/app/doc.cpp b/src/app/doc.cpp index 8aaf08710..343406569 100644 --- a/src/app/doc.cpp +++ b/src/app/doc.cpp @@ -34,6 +34,7 @@ #include "doc/sprite.h" #include "os/display.h" #include "os/system.h" +#include "ui/system.h" #include #include @@ -508,6 +509,14 @@ void Doc::updateOSColorSpace(bool appWideSignal) context()->activeDocument() == this) { App::instance()->ColorSpaceChange(); } + + if (ui::is_ui_thread()) { + // As the color space has changed, we might need to upate the + // current palette (because the color space conversion might be + // came from a cmd::ConvertColorProfile, so the palette might be + // changed). This might generate a PaletteChange() signal. + app_update_current_palette(); + } } // static