Compare commits
1 Commits
master
...
tray_test1
Author | SHA1 | Date | |
---|---|---|---|
a6df1ecf8e |
2
.github/workflows/cd.yml
vendored
2
.github/workflows/cd.yml
vendored
@ -64,8 +64,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
platform:
|
platform:
|
||||||
- vcpkg_toolkit: arm-neon-android
|
|
||||||
ndk_abi: armeabi-v7a
|
|
||||||
- vcpkg_toolkit: arm64-android
|
- vcpkg_toolkit: arm64-android
|
||||||
ndk_abi: arm64-v8a
|
ndk_abi: arm64-v8a
|
||||||
- vcpkg_toolkit: x64-android
|
- vcpkg_toolkit: x64-android
|
||||||
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -38,8 +38,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
platform:
|
platform:
|
||||||
- vcpkg_toolkit: arm-neon-android
|
|
||||||
ndk_abi: armeabi-v7a
|
|
||||||
- vcpkg_toolkit: arm64-android
|
- vcpkg_toolkit: arm64-android
|
||||||
ndk_abi: arm64-v8a
|
ndk_abi: arm64-v8a
|
||||||
- vcpkg_toolkit: x64-android
|
- vcpkg_toolkit: x64-android
|
||||||
|
5
external/sdl/CMakeLists.txt
vendored
5
external/sdl/CMakeLists.txt
vendored
@ -9,7 +9,8 @@ if (NOT TARGET SDL3::SDL3)
|
|||||||
set(SDL_DISABLE_ANDROID_JAR OFF CACHE INTERNAL "")
|
set(SDL_DISABLE_ANDROID_JAR OFF CACHE INTERNAL "")
|
||||||
|
|
||||||
FetchContent_Declare(SDL3
|
FetchContent_Declare(SDL3
|
||||||
GIT_REPOSITORY https://github.com/libsdl-org/SDL
|
#GIT_REPOSITORY https://github.com/libsdl-org/SDL
|
||||||
|
GIT_REPOSITORY https://github.com/Semphriss/SDL
|
||||||
#GIT_TAG 0429f5d6a36fc35b551bcc2acd4a40c2db6dab82 # tip when looking
|
#GIT_TAG 0429f5d6a36fc35b551bcc2acd4a40c2db6dab82 # tip when looking
|
||||||
#GIT_TAG 14f584a94bfd49cf1524db75bf3c419fdf9436cd # tip 26-04-2024
|
#GIT_TAG 14f584a94bfd49cf1524db75bf3c419fdf9436cd # tip 26-04-2024
|
||||||
#GIT_TAG 06d6f2cb2518622593570985589700910cf4399f # 13-05-2024 - before
|
#GIT_TAG 06d6f2cb2518622593570985589700910cf4399f # 13-05-2024 - before
|
||||||
@ -26,7 +27,7 @@ if (NOT TARGET SDL3::SDL3)
|
|||||||
#GIT_TAG 9dd8859240703d886941733ad32c1dc6f50d64f0 # tip 19-09-2024
|
#GIT_TAG 9dd8859240703d886941733ad32c1dc6f50d64f0 # tip 19-09-2024
|
||||||
#GIT_TAG afdf325fb4090e93a124519d1a3bc1fbe0ba9025 # bad
|
#GIT_TAG afdf325fb4090e93a124519d1a3bc1fbe0ba9025 # bad
|
||||||
#GIT_TAG e292d1f5ace469f718d7b6b4dec8c28e37dcaa0e # tip 05-10-2024 (3.1.3)
|
#GIT_TAG e292d1f5ace469f718d7b6b4dec8c28e37dcaa0e # tip 05-10-2024 (3.1.3)
|
||||||
GIT_TAG 2654d5d48b8f764148a7c246fea85b32b1133578 # tip 18-10-2024
|
GIT_TAG c523f0bcfeb5700ee233b7fae3c2b036822b8627
|
||||||
|
|
||||||
FIND_PACKAGE_ARGS # for the future
|
FIND_PACKAGE_ARGS # for the future
|
||||||
)
|
)
|
||||||
|
2
external/solanaceae_util
vendored
2
external/solanaceae_util
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 9a4df12d68373cd19adddde2364843eeac51c28d
|
Subproject commit 17d2baf7365c3499172dc5afd71171cb3a138d99
|
@ -63,17 +63,17 @@
|
|||||||
"sdl3": {
|
"sdl3": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1729218869,
|
"lastModified": 1728073678,
|
||||||
"narHash": "sha256-0KrwC3Yrs1LHwT9SPvknDwPymNmksq6dixM4/KiFqFA=",
|
"narHash": "sha256-S7yRcLHMPgq6+gec8l+ESxp2dJ+6Po/UNsBUXptQzMQ=",
|
||||||
"owner": "libsdl-org",
|
"owner": "libsdl-org",
|
||||||
"repo": "SDL",
|
"repo": "SDL",
|
||||||
"rev": "2654d5d48b8f764148a7c246fea85b32b1133578",
|
"rev": "e292d1f5ace469f718d7b6b4dec8c28e37dcaa0e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "libsdl-org",
|
"owner": "libsdl-org",
|
||||||
"repo": "SDL",
|
"repo": "SDL",
|
||||||
"rev": "2654d5d48b8f764148a7c246fea85b32b1133578",
|
"rev": "e292d1f5ace469f718d7b6b4dec8c28e37dcaa0e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
sdl3 = {
|
sdl3 = {
|
||||||
url = "github:libsdl-org/SDL/2654d5d48b8f764148a7c246fea85b32b1133578"; # keep in sync this cmake
|
url = "github:libsdl-org/SDL/e292d1f5ace469f718d7b6b4dec8c28e37dcaa0e"; # keep in sync this cmake
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
sdl3_image = {
|
sdl3_image = {
|
||||||
|
@ -66,6 +66,9 @@ target_sources(tomato PUBLIC
|
|||||||
./sdl_clipboard_utils.hpp
|
./sdl_clipboard_utils.hpp
|
||||||
./sdl_clipboard_utils.cpp
|
./sdl_clipboard_utils.cpp
|
||||||
|
|
||||||
|
./sys_tray.hpp
|
||||||
|
./sys_tray.cpp
|
||||||
|
|
||||||
./chat_gui/theme.hpp
|
./chat_gui/theme.hpp
|
||||||
./chat_gui/theme.cpp
|
./chat_gui/theme.cpp
|
||||||
./chat_gui/icons/direct.hpp
|
./chat_gui/icons/direct.hpp
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include "./tox_avatar_loader.hpp"
|
#include "./tox_avatar_loader.hpp"
|
||||||
#include "./message_image_loader.hpp"
|
#include "./message_image_loader.hpp"
|
||||||
|
|
||||||
|
#include "./sys_tray.hpp"
|
||||||
|
|
||||||
#include "./chat_gui4.hpp"
|
#include "./chat_gui4.hpp"
|
||||||
#include "./chat_gui/settings_window.hpp"
|
#include "./chat_gui/settings_window.hpp"
|
||||||
#include "./object_store_ui.hpp"
|
#include "./object_store_ui.hpp"
|
||||||
@ -91,6 +93,8 @@ struct MainScreen final : public Screen {
|
|||||||
MessageImageLoader mil;
|
MessageImageLoader mil;
|
||||||
TextureCache<void*, Message3Handle, MessageImageLoader> msg_tc;
|
TextureCache<void*, Message3Handle, MessageImageLoader> msg_tc;
|
||||||
|
|
||||||
|
SystemTray st;
|
||||||
|
|
||||||
ChatGui4 cg;
|
ChatGui4 cg;
|
||||||
SettingsWindow sw;
|
SettingsWindow sw;
|
||||||
ObjectStoreUI osui;
|
ObjectStoreUI osui;
|
||||||
|
52
src/sys_tray.cpp
Normal file
52
src/sys_tray.cpp
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#include "./sys_tray.hpp"
|
||||||
|
|
||||||
|
#include "./image_loader_sdl_image.hpp"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <fstream>
|
||||||
|
#include <ios>
|
||||||
|
#include <memory>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
SystemTray::SystemTray(void) {
|
||||||
|
std::cout << "adding sys tray\n";
|
||||||
|
|
||||||
|
std::ifstream file("../res/icon/tomato_v1_256.png");
|
||||||
|
file.seekg(0, std::ios::end);
|
||||||
|
size_t file_size = file.tellg();
|
||||||
|
file.seekg(0, std::ios::beg);
|
||||||
|
std::vector<uint8_t> data(file_size);
|
||||||
|
file.read(reinterpret_cast<char*>(data.data()), file_size);
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
std::cout << "tray icon file size: " << file_size << "\n";
|
||||||
|
|
||||||
|
ImageLoaderSDLImage il;
|
||||||
|
auto image = il.loadFromMemoryRGBA(data.data(), data.size());
|
||||||
|
std::unique_ptr<SDL_Surface, decltype(&SDL_DestroySurface)> surf = {
|
||||||
|
SDL_CreateSurfaceFrom(
|
||||||
|
image.width, image.height,
|
||||||
|
SDL_PIXELFORMAT_RGBA32,
|
||||||
|
(void*)image.frames.at(0).data.data(),
|
||||||
|
4*image.width
|
||||||
|
),
|
||||||
|
&SDL_DestroySurface
|
||||||
|
};
|
||||||
|
|
||||||
|
std::cout << "tray dims " << image.width << "x" << image.height << "\n";
|
||||||
|
|
||||||
|
|
||||||
|
// different icons?
|
||||||
|
_tray = SDL_CreateTray(surf.get(), "tomato");
|
||||||
|
if (_tray == nullptr) {
|
||||||
|
std::cerr << "failed to create SystemTray!!\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemTray::~SystemTray(void) {
|
||||||
|
if (_tray != nullptr) {
|
||||||
|
SDL_DestroyTray(_tray);
|
||||||
|
_tray = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
12
src/sys_tray.hpp
Normal file
12
src/sys_tray.hpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
class SystemTray {
|
||||||
|
SDL_Tray* _tray {nullptr};
|
||||||
|
|
||||||
|
public:
|
||||||
|
SystemTray(void);
|
||||||
|
~SystemTray(void);
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user