diff --git a/headers/private/servers/app/FontServer.h b/headers/private/servers/app/FontServer.h index 0c2d90771f..650f3872d6 100644 --- a/headers/private/servers/app/FontServer.h +++ b/headers/private/servers/app/FontServer.h @@ -39,6 +39,7 @@ public: int32 CountFamilies(void); int32 CountStyles(const char *family); void RemoveFamily(const char *family); + void ScanSystemFolders(void); status_t ScanDirectory(const char *path); void SaveList(void); diff --git a/src/kits/interface/Jamfile b/src/kits/interface/Jamfile index b8605829d0..454d424481 100644 --- a/src/kits/interface/Jamfile +++ b/src/kits/interface/Jamfile @@ -34,7 +34,6 @@ MergeObject interface_kit.o : ChannelControl.cpp ChannelSlider.cpp CheckBox.cpp - ClientFontList.cpp ColorUtils.cc ColorControl.cpp Control.cpp diff --git a/src/servers/app/AppServer.cpp b/src/servers/app/AppServer.cpp index a45773b547..10b8bef542 100644 --- a/src/servers/app/AppServer.cpp +++ b/src/servers/app/AppServer.cpp @@ -100,14 +100,7 @@ AppServer::AppServer() // Create the font server and scan the proper directories. gFontServer = new FontServer; gFontServer->Lock(); - - // Used for testing purposes - - // TODO: Re-enable scanning of all font directories when server is actually put to use - gFontServer->ScanDirectory("/boot/beos/etc/fonts/ttfonts/"); -// gFontServer->ScanDirectory("/boot/beos/etc/fonts/PS-Type1/"); -// gFontServer->ScanDirectory("/boot/home/config/fonts/ttfonts/"); -// gFontServer->ScanDirectory("/boot/home/config/fonts/psfonts/"); + gFontServer->ScanSystemFolders(); gFontServer->SaveList(); if (!gFontServer->SetSystemPlain(DEFAULT_PLAIN_FONT_FAMILY, @@ -327,14 +320,6 @@ AppServer::_DispatchMessage(int32 code, BPrivate::LinkReceiver& msg) break; } - case AS_UPDATED_CLIENT_FONTLIST: - // received when the client-side global font list has been - // refreshed - gFontServer->Lock(); - gFontServer->FontsUpdated(); - gFontServer->Unlock(); - break; - case AS_QUERY_FONTS_CHANGED: { // Client application is asking if the font list has changed since diff --git a/src/servers/app/FontServer.cpp b/src/servers/app/FontServer.cpp index 209f999075..d65348659b 100644 --- a/src/servers/app/FontServer.cpp +++ b/src/servers/app/FontServer.cpp @@ -181,6 +181,19 @@ FontServer::GetFamily(const char* name) const return NULL; } +//! Scans the four default system font folders +void +FontServer::ScanSystemFolders(void) +{ + ScanDirectory("/boot/beos/etc/fonts/ttfonts/"); + + // We don't scan these in test mode to help shave off some startup time +#if !TEST_MODE + ScanDirectory("/boot/beos/etc/fonts/PS-Type1/"); + ScanDirectory("/boot/home/config/fonts/ttfonts/"); + ScanDirectory("/boot/home/config/fonts/psfonts/"); +#endif +} /*! \brief Scan a folder for all valid fonts diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 0c0d94eb58..1bb2871ef2 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -1200,17 +1200,38 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link) } case AS_QUERY_FONTS_CHANGED: { - FTRACE(("ServerApp %s: AS_QUERY_FONTS_CHANGED unimplemented\n", - Signature())); + FTRACE(("ServerApp %s: AS_QUERY_FONTS_CHANGED\n",Signature())); + // Attached Data: // 1) bool check flag - - // if just checking, just give an answer, - // if not and needs updated, - // sync the font list and return true else return false - // TODO: actually do the above... - fLink.StartMessage(SERVER_FALSE); - fLink.Flush(); + bool checkonly; + link.Read(&checkonly); + + gFontServer->Lock(); + bool needsUpdate = gFontServer->FontsNeedUpdated(); + gFontServer->Unlock(); + + if(checkonly) + { + fLink.StartMessage(needsUpdate ? SERVER_TRUE : SERVER_FALSE); + fLink.Flush(); + } + else + { + if(needsUpdate) + { + gFontServer->Lock(); + gFontServer->ScanSystemFolders(); + gFontServer->Unlock(); + fLink.StartMessage(SERVER_TRUE); + fLink.Flush(); + } + else + { + fLink.StartMessage(SERVER_FALSE); + fLink.Flush(); + } + } break; } case AS_GET_FAMILY_NAME: