* 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
This commit is contained in:
@@ -43,7 +43,7 @@ ScreenConfigurations::BestFit(int32 id, const monitor_info* info,
|
|||||||
bool* _exactMatch) const
|
bool* _exactMatch) const
|
||||||
{
|
{
|
||||||
if (info == NULL) {
|
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 (uint32 pass = 0; pass < 2; pass++) {
|
||||||
for (int32 i = fConfigurations.CountItems(); i-- > 0;) {
|
for (int32 i = fConfigurations.CountItems(); i-- > 0;) {
|
||||||
screen_configuration* configuration = fConfigurations.ItemAt(i);
|
screen_configuration* configuration = fConfigurations.ItemAt(i);
|
||||||
@@ -57,7 +57,7 @@ ScreenConfigurations::BestFit(int32 id, const monitor_info* info,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for a configuration that matches the monitor
|
// Look for a configuration that matches the monitor
|
||||||
|
|
||||||
bool exactMatch = false;
|
bool exactMatch = false;
|
||||||
int32 bestScore = 0;
|
int32 bestScore = 0;
|
||||||
@@ -66,13 +66,11 @@ ScreenConfigurations::BestFit(int32 id, const monitor_info* info,
|
|||||||
|
|
||||||
for (int32 i = fConfigurations.CountItems(); i-- > 0;) {
|
for (int32 i = fConfigurations.CountItems(); i-- > 0;) {
|
||||||
screen_configuration* configuration = fConfigurations.ItemAt(i);
|
screen_configuration* configuration = fConfigurations.ItemAt(i);
|
||||||
|
if (!configuration->has_info)
|
||||||
|
continue;
|
||||||
|
|
||||||
int32 score = 0;
|
int32 score = 0;
|
||||||
|
|
||||||
// TODO: should we ignore unnamed settings here completely?
|
|
||||||
|
|
||||||
if (configuration->id == id)
|
|
||||||
score++;
|
|
||||||
|
|
||||||
if (!strcasecmp(configuration->info.vendor, info->vendor)
|
if (!strcasecmp(configuration->info.vendor, info->vendor)
|
||||||
&& !strcasecmp(configuration->info.name, info->name)
|
&& !strcasecmp(configuration->info.name, info->name)
|
||||||
&& configuration->info.product_id == info->product_id) {
|
&& 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
|
if (configuration->info.produced.year == info->produced.year
|
||||||
&& configuration->info.produced.week == info->produced.week)
|
&& configuration->info.produced.week == info->produced.week)
|
||||||
score++;
|
score++;
|
||||||
} else
|
}
|
||||||
score -= 2;
|
|
||||||
|
|
||||||
if (score > bestScore) {
|
if (score > bestScore) {
|
||||||
bestScore = score;
|
bestScore = score;
|
||||||
@@ -212,7 +209,7 @@ ScreenConfigurations::Restore(const BMessage& settings)
|
|||||||
if (stored.FindInt32("id", &id) != B_OK
|
if (stored.FindInt32("id", &id) != B_OK
|
||||||
|| stored.FindData("mode", B_RAW_TYPE, (const void**)&mode,
|
|| stored.FindData("mode", B_RAW_TYPE, (const void**)&mode,
|
||||||
&size) != B_OK
|
&size) != B_OK
|
||||||
|| size == sizeof(display_mode))
|
|| size != sizeof(display_mode))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
screen_configuration* configuration
|
screen_configuration* configuration
|
||||||
|
|||||||
Reference in New Issue
Block a user