test_app_server: add multiple screen support

Change-Id: I89fb30936160615d28aebb36c8b1f84690007de7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2511
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
X512 2020-04-25 08:26:09 +09:00 committed by waddlesplash
parent 04fac889f7
commit f569b97029
2 changed files with 19 additions and 17 deletions

View File

@ -134,16 +134,16 @@ ScreenManager::AcquireScreens(ScreenOwner* owner, int32* wishList,
}
}
#if TEST_MODE == 0
if (added == 0 && target != NULL) {
// there's a specific target screen we want to initialize
// TODO: right now we only support remote screens, but we could
// also target specific accelerants to support other graphics cards
HWInterface* interface;
/*if (strncmp(target, "vnc:", 4) == 0)
interface = new(nothrow) VNCHWInterface(target);
else*/
interface = new(nothrow) RemoteHWInterface(target);
#ifdef HAIKU_TARGET_PLATFORM_LIBBE_TEST
interface = new(nothrow) ViewHWInterface();
#else
interface = new(nothrow) RemoteHWInterface(target);
#endif
if (interface != NULL) {
screen_item* item = _AddHWInterface(interface);
if (item != NULL && list.AddItem(item->screen)) {
@ -152,7 +152,6 @@ ScreenManager::AcquireScreens(ScreenOwner* owner, int32* wishList,
}
}
}
#endif // TEST_MODE == 0
return added > 0 ? B_OK : B_ENTRY_NOT_FOUND;
}

View File

@ -483,19 +483,22 @@ ViewHWInterface::SetMode(const display_mode& mode)
// has not been created either, but we need one to display
// a real BWindow in the test environment.
// be_app->Run() needs to be called in another thread
BApplication* app = new BApplication(
"application/x-vnd.Haiku-test-app_server");
app->Unlock();
thread_id appThread = spawn_thread(run_app_thread, "app thread",
B_NORMAL_PRIORITY, app);
if (appThread >= B_OK)
ret = resume_thread(appThread);
else
ret = appThread;
if (be_app == NULL) {
BApplication* app = new BApplication(
"application/x-vnd.Haiku-test-app_server");
app->Unlock();
if (ret < B_OK)
return ret;
thread_id appThread = spawn_thread(run_app_thread, "app thread",
B_NORMAL_PRIORITY, app);
if (appThread >= B_OK)
ret = resume_thread(appThread);
else
ret = appThread;
if (ret < B_OK)
return ret;
}
fWindow = new CardWindow(frame.OffsetToCopy(BPoint(50.0, 50.0)));