-
-
Notifications
You must be signed in to change notification settings - Fork 786
Haiku port: more modules #2358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Haiku port: more modules #2358
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| extern "C" { | ||
| #include "bootmgr.h" | ||
| #include "common/io.h" | ||
| } | ||
|
|
||
| const char* ffDetectBootmgr(FFBootmgrResult* result) { | ||
| // TODO: glob haiku_loader.* + check EFI partition | ||
| if (ffPathExists("/system/haiku_loader.bios_ia32", FF_PATHTYPE_FILE)) { | ||
| ffStrbufSetStatic(&result->firmware, "/system/haiku_loader.bios_ia32"); | ||
| } | ||
|
|
||
| ffStrbufSetStatic(&result->name, "haiku_loader"); | ||
|
|
||
| // TODO: detectSecureBoot(&result->secureBoot); | ||
|
|
||
| return NULL; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||
| extern "C" { | ||||||
| #include "brightness.h" | ||||||
| #include "common/strutil.h" | ||||||
| } | ||||||
|
|
||||||
| #include <Application.h> | ||||||
|
Check warning on line 6 in src/detection/brightness/brightness_haiku.cpp
|
||||||
| #include <Screen.h> | ||||||
|
Check warning on line 7 in src/detection/brightness/brightness_haiku.cpp
|
||||||
|
|
||||||
| const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) { | ||||||
| // We need a valid be_app to query the app_server here. | ||||||
| BApplication app("application/x-vnd.fastfetch-cli-fastfetch"); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HIGH RISK Haiku only allows one BApplication per process. Multiple modules are creating their own instances, which will lead to a crash. Check if 'be_app' is already initialized. Try running the following prompt in your coding agent:
|
||||||
| BScreen screen{}; // default screen is the main one | ||||||
|
|
||||||
| do { | ||||||
| if (!screen.IsValid()) { | ||||||
| continue; | ||||||
| } | ||||||
|
|
||||||
| float value = 1.0f; | ||||||
| status_t status = screen.GetBrightness(&value); | ||||||
| if (status != B_OK) { | ||||||
| continue; | ||||||
| } | ||||||
|
|
||||||
| monitor_info monitor; | ||||||
| // WARNING: This is experimental new Haiku API | ||||||
| status_t err = screen.GetMonitorInfo(&monitor); | ||||||
|
|
||||||
| FFBrightnessResult* brightness = FF_LIST_ADD(FFBrightnessResult, *result); | ||||||
|
|
||||||
| if (err == B_OK) { | ||||||
| ffStrbufInitF(&brightness->name, "%s %s (%ld)", monitor.vendor, monitor.name, screen.ID().id); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 MEDIUM RISK Potential format string mismatch for int32 on 64-bit systems.
Suggested change
|
||||||
| ffStrbufTrimRightSpace(&brightness->name); | ||||||
| } else { | ||||||
| ffStrbufInitF(&brightness->name, "Screen %ld", screen.ID().id); | ||||||
| } | ||||||
|
|
||||||
| brightness->max = 1.0f; | ||||||
| brightness->min = 0.0f; | ||||||
| brightness->current = value; | ||||||
| brightness->builtin = true; | ||||||
|
|
||||||
| } while (screen.SetToNext() == B_OK); | ||||||
|
|
||||||
| return NULL; | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| extern "C" { | ||
| #include "fastfetch.h" | ||
| #include "wmtheme.h" | ||
| } | ||
|
|
||
| #include <Application.h> | ||
|
Check warning on line 6 in src/detection/wmtheme/wmtheme_haiku.cpp
|
||
| #include <private/interface/DecorInfo.h> | ||
|
Check warning on line 7 in src/detection/wmtheme/wmtheme_haiku.cpp
|
||
|
|
||
| bool ffDetectWmTheme(FFstrbuf* themeOrError) | ||
| { | ||
| // We need a valid be_app to query the app_server here. | ||
| BApplication app("application/x-vnd.fastfetch-cli-fastfetch"); | ||
|
|
||
| DecorInfoUtility *util = new DecorInfoUtility(); | ||
| DecorInfo* decor = NULL; | ||
|
|
||
| if (util) { | ||
| decor = util->CurrentDecorator(); | ||
| if (decor) { | ||
| ffStrbufAppendS(themeOrError, decor->Name().String()); | ||
| } | ||
| delete util; | ||
| if (decor) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| ffStrbufAppendS(themeOrError, "Failed to get DecorInfo"); | ||
| return false; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ LOW RISK
Nitpick: The
std::nanffunction requires the<cmath>header.