Each window now announces a WindowIdentity (app id + title) instead of the hardcoded "modules" app id, so GNOME/KDE can match a running window to its .desktop launcher and show the right icon in the dock and app grid. cmake/DesktopEntry.cmake is the single place an executable declares that identity: modules_add_desktop_entry() compiles MODULES_APP_ID/NAME into the target, generates <id>.desktop pointing at the built binary and stages the icon into the hicolor theme layout. The install-desktop-entries target copies them into ~/.local/share and refreshes the desktop database and icon cache. Launchers: Sketch2D (reuses the Android launcher icon), Taskboard (new kanban icon) and the generic Modules identity/icon used by the widget gallery and by every application that has no entry of its own.
69 lines
No EOL
1.6 KiB
C++
69 lines
No EOL
1.6 KiB
C++
|
|
#pragma once
|
|
|
|
#include "Window.hpp"
|
|
#include "Graphics.hpp"
|
|
#include "Timing.hpp"
|
|
#include "HangWatchdog.hpp"
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace tp {
|
|
class Application {
|
|
public:
|
|
explicit Application(const WindowIdentity& identity = WindowIdentity::generic());
|
|
|
|
void run();
|
|
|
|
void start();
|
|
void step(halnf deltaMs);
|
|
void finish();
|
|
[[nodiscard]] bool isRunning() const { return mEventHandler != nullptr; }
|
|
[[nodiscard]] Window& window() { return *mWindow; }
|
|
|
|
virtual bool forceNewFrame() { return false; }
|
|
|
|
virtual void processFrame(EventHandler* eventHandler, halnf deltaTime);
|
|
virtual void drawFrame(Canvas* canvas);
|
|
|
|
virtual ~Application();
|
|
|
|
void drawDebug();
|
|
|
|
void addHangContributor(HangWatchdog::Contributor contributor);
|
|
[[nodiscard]] HangWatchdog* hangWatchdog() { return mHangWatchdog.get(); }
|
|
|
|
protected:
|
|
[[nodiscard]] virtual HangSettings hangSettings() const;
|
|
|
|
private:
|
|
void enterPhase(UiPhase phase);
|
|
void runFrame();
|
|
[[nodiscard]] bool wantsFrame();
|
|
void runFrame(halnf deltaMs);
|
|
void processPendingInput(halnf deltaMs);
|
|
void present();
|
|
void updateFrameCounters();
|
|
|
|
EventHandler* mEventHandler = nullptr;
|
|
time_ms mPreviousFrameTime = 0;
|
|
time_ns mFrameStart = 0;
|
|
std::unique_ptr<HangWatchdog> mHangWatchdog;
|
|
std::vector<HangWatchdog::Contributor> mHangContributors;
|
|
|
|
protected:
|
|
bool mInitialized = false;
|
|
|
|
Timer mPerSecondTimer;
|
|
|
|
halnf mFramesProcessedPerSecond = 0;
|
|
halnf mFramesDrawnPerSecond = 0;
|
|
|
|
halnf mFramesProcessed = 0;
|
|
halnf mFramesDrawn = 0;
|
|
|
|
Graphics* mGraphics = nullptr;
|
|
Window* mWindow = nullptr;
|
|
};
|
|
} |