From 50dfc607fb3910de31a15bfe3adff628ef942389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 21 Aug 2009 08:02:09 +0000 Subject: [PATCH] * Fixed typo that prevented the app_server from restoring the ScreenConfigurations correctly. * Removed scoring for the screen ID alone - if there is a monitor info, we don't want to match an existing info if it only has an ID, as that one hasn't been stored for the current monitor. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32556 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ScreenConfigurations.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/servers/app/ScreenConfigurations.cpp b/src/servers/app/ScreenConfigurations.cpp index 4afd837204..d268ca4381 100644 --- a/src/servers/app/ScreenConfigurations.cpp +++ b/src/servers/app/ScreenConfigurations.cpp @@ -43,7 +43,7 @@ ScreenConfigurations::BestFit(int32 id, const monitor_info* info, bool* _exactMatch) const { if (info == NULL) { - // only look for a matching ID - this is all we have + // Only look for a matching ID - this is all we have for (uint32 pass = 0; pass < 2; pass++) { for (int32 i = fConfigurations.CountItems(); i-- > 0;) { screen_configuration* configuration = fConfigurations.ItemAt(i); @@ -57,7 +57,7 @@ ScreenConfigurations::BestFit(int32 id, const monitor_info* info, return NULL; } - // look for a configuration that matches the monitor + // Look for a configuration that matches the monitor bool exactMatch = false; int32 bestScore = 0; @@ -66,13 +66,11 @@ ScreenConfigurations::BestFit(int32 id, const monitor_info* info, for (int32 i = fConfigurations.CountItems(); i-- > 0;) { screen_configuration* configuration = fConfigurations.ItemAt(i); + if (!configuration->has_info) + continue; + int32 score = 0; - // TODO: should we ignore unnamed settings here completely? - - if (configuration->id == id) - score++; - if (!strcasecmp(configuration->info.vendor, info->vendor) && !strcasecmp(configuration->info.name, info->name) && configuration->info.product_id == info->product_id) { @@ -86,8 +84,7 @@ ScreenConfigurations::BestFit(int32 id, const monitor_info* info, if (configuration->info.produced.year == info->produced.year && configuration->info.produced.week == info->produced.week) score++; - } else - score -= 2; + } if (score > bestScore) { bestScore = score; @@ -212,7 +209,7 @@ ScreenConfigurations::Restore(const BMessage& settings) if (stored.FindInt32("id", &id) != B_OK || stored.FindData("mode", B_RAW_TYPE, (const void**)&mode, &size) != B_OK - || size == sizeof(display_mode)) + || size != sizeof(display_mode)) continue; screen_configuration* configuration