From c98934d8a8315c883106fdadf1a5905c24452e21 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Thu, 25 Feb 2021 17:39:25 +1000 Subject: [PATCH] Telegram: bump version --- .../additional-files/logo_256_no_margin.png | Bin 24770 -> 0 bytes .../patches/libtgvoip-2.6.1.patchset | 954 +++++ .../telegram_desktop-2.5.9-owt.patchset | 822 ---- .../patches/telegram_desktop-2.5.9.patchset | 3405 ----------------- .../patches/telegram_desktop-2.6.1.patchset | 742 ++++ ...9.recipe => telegram_desktop-2.6.1.recipe} | 80 +- 6 files changed, 1720 insertions(+), 4283 deletions(-) delete mode 100644 net-im/telegram-desktop/additional-files/logo_256_no_margin.png create mode 100644 net-im/telegram-desktop/patches/libtgvoip-2.6.1.patchset delete mode 100644 net-im/telegram-desktop/patches/telegram_desktop-2.5.9-owt.patchset delete mode 100644 net-im/telegram-desktop/patches/telegram_desktop-2.5.9.patchset create mode 100644 net-im/telegram-desktop/patches/telegram_desktop-2.6.1.patchset rename net-im/telegram-desktop/{telegram_desktop-2.5.9.recipe => telegram_desktop-2.6.1.recipe} (64%) diff --git a/net-im/telegram-desktop/additional-files/logo_256_no_margin.png b/net-im/telegram-desktop/additional-files/logo_256_no_margin.png deleted file mode 100644 index 82b67376f98c3e042813e196ace14912a94a07a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24770 zcmbSyWmlVR&}|YzaWAE~TWN8JLhw?&XmNLUC%6`Om*Vd3v{-R>cXx-A=e+0r1Lp%F ziPWP@E#oQz3P^%7 zywf(ftm^&^xyIEqj#s|QbG9$-q?@>0ar(||6`2VEG|BeZt1DHR1 z&_*O8{r5c((-Za~U1pLdY_)fq@DYT|hx6iWRV!C_SkY`vGe|j=h)9q(U3Q9zPE<`a zX`<=HYtq9Dq#lH>obGa2L|+OjK(`Qf6l12w-(?}g#1Ev(Yn`TyJv7=6P(-X7u`3YWC<4{wMa`EF&0n8zYNKk=X zEJ+_y{Z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QOo@;@-5Myu< zuN#q)LjfsdS@}7M^N>A*h<=<9N?vQ!(FP!V_94@SgGkZSjrDz#ss zoCu3wYV6SlAbLIw+zi}+WG~tU?5^t@S(8RY`!=gP=l+9wiTDB{_ObGB?aYfA+5p6d zeTXsG30wo*SpFP#Mv?+>7Fj|&QT{oHh}O%hpGs1Vi-;#b)_L(89c=)T!A{ohUfcon z8$Ry^+NzF~kR0_DiiXd|^M08|hWGEFJ@|=18-Vq}0C0O9o_m>94}NHCgf-#O>U@bN z0c?%%S@W#!xYNsV6OJ|j$)}C*S0yeXf*(i6>em(803@Fw+|)=^N5|?L0Br!0&-(*x zOULRP3~d0CO$z_H4Rx%(fzbva*?8^!^GH_QaU@o+6J<6iW;qG<0001GNklJ@th}hpj#II9lX|w@IFkMJeQ#%$B!Cyir)6kfp4M1|SDuq6ah<*YcveP)A4M1`! zAj9}3q<6oB%<28q$kS*v38EY8k$^^{(P%UpjYgx +Date: Thu, 25 Feb 2021 17:18:39 +1000 +Subject: Add Haiku support + + +diff --git a/Telegram/ThirdParty/libtgvoip/VoIPController.cpp b/Telegram/ThirdParty/libtgvoip/VoIPController.cpp +index d0b0038..c2c258b 100644 +--- a/Telegram/ThirdParty/libtgvoip/VoIPController.cpp ++++ b/Telegram/ThirdParty/libtgvoip/VoIPController.cpp +@@ -8,6 +8,9 @@ + #include + #include + #endif ++#ifdef __HAIKU__ ++#include ++#endif + #include + #include + #include +@@ -3009,6 +3012,10 @@ double VoIPController::GetCurrentTime(){ + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return ts.tv_sec+(double)ts.tv_nsec/1000000000.0; ++#elif defined(__HAIKU__) ++ struct timeval tm; ++ gettimeofday(&tm, NULL); ++ return tm.tv_sec+(double)tm.tv_usec/1000000.0; + #elif defined(__APPLE__) + static pthread_once_t token = PTHREAD_ONCE_INIT; + pthread_once(&token, &initMachTimestart); +diff --git a/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp b/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp +index 2c16ca7..e00c731 100644 +--- a/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp ++++ b/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp +@@ -39,6 +39,9 @@ + #ifndef WITHOUT_PULSE + #include "../os/linux/AudioPulse.h" + #endif ++#elif defined(__HAIKU__) ++#include "../os/haiku/AudioInputHaiku.h" ++#include "../os/haiku/AudioOutputHaiku.h" + #else + #error "Unsupported operating system" + #endif +@@ -65,6 +68,8 @@ AudioIO* AudioIO::Create(std::string inputDevice, std::string outputDevice){ + return new ContextlessAudioIO(inputDevice, outputDevice); + #endif + return new ContextlessAudioIO(inputDevice, outputDevice); ++#elif defined(__HAIKU__) ++ return new ContextlessAudioIO(); + #elif defined(__linux__) + #ifndef WITHOUT_ALSA + #ifndef WITHOUT_PULSE +diff --git a/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp b/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp +index 674cd34..83a6dbb 100644 +--- a/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp ++++ b/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp +@@ -33,6 +33,8 @@ + #ifndef WITHOUT_PULSE + #include "../os/linux/AudioPulse.h" + #endif ++#elif defined(__HAIKU__) ++#include "../os/haiku/AudioInputHaiku.h" + #else + #error "Unsupported operating system" + #endif +diff --git a/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp b/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp +index 14ab0be..44c615e 100644 +--- a/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp ++++ b/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp +@@ -37,6 +37,8 @@ + #include "../os/linux/AudioOutputPulse.h" + #include "../os/linux/AudioPulse.h" + #endif ++#elif defined(__HAIKU__) ++#include "../os/haiku/AudioOutputHaiku.h" + #else + #error "Unsupported operating system" + #endif +diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.cpp b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.cpp +new file mode 100644 +index 0000000..7cce3e3 +--- /dev/null ++++ b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.cpp +@@ -0,0 +1,276 @@ ++// ++// libtgvoip is free and unencumbered public domain software. ++// For more information, see http://unlicense.org or the UNLICENSE file ++// you should have received with this source code distribution. ++// ++ ++#include ++#include ++#include ++#include ++#include "AudioInputHaiku.h" ++#include "../../logging.h" ++#include "../../audio/Resampler.h" ++#include "../../VoIPController.h" ++ ++#include "RingBuffer.h" ++ ++using namespace tgvoip::audio; ++ ++void RecordData(void* cookie, bigtime_t timestamp, void* data, size_t size, const media_format &format) ++{ ++ AudioInputHaiku *audioInput = (AudioInputHaiku*)cookie; ++ if (!audioInput->IsRecording()) ++ return; ++ ++ if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT && ++ format.u.raw_audio.channel_count == 1) { ++ audioInput->fRingBuffer->Write((unsigned char*)data, size); ++ return; ++ } ++ ++ uint32 bytesPerSample = 2; ++ switch (format.u.raw_audio.format) { ++ case media_raw_audio_format::B_AUDIO_CHAR: ++ bytesPerSample = 1; ++ break; ++ case media_raw_audio_format::B_AUDIO_SHORT: ++ bytesPerSample = 2; ++ break; ++ case media_raw_audio_format::B_AUDIO_INT: ++ bytesPerSample = 4; ++ break; ++ case media_raw_audio_format::B_AUDIO_FLOAT: ++ bytesPerSample = 4; ++ break; ++ default: ++ break; ++ } ++ ++ int frames = size / (format.u.raw_audio.channel_count * bytesPerSample); ++ int16_t *dst = audioInput->workBuffer; ++ ++ if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_CHAR) { ++ unsigned char* src=reinterpret_cast(data); ++ for (int n=0; n < frames; n++) { ++ int32_t value = 0; ++ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { ++ value += ((int32_t)(*src) - INT8_MAX) * UINT8_MAX; ++ } ++ value /= format.u.raw_audio.channel_count; ++ dst[n] = (int16_t)value; ++ } ++ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT) { ++ int16_t* src=reinterpret_cast(data); ++ for (int n=0; n < frames; n++) { ++ int32_t value = 0; ++ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { ++ value += *src; ++ } ++ value /= format.u.raw_audio.channel_count; ++ dst[n] = (int16_t)value; ++ } ++ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_INT) { ++ int32_t* src=reinterpret_cast(data); ++ for (int n=0; n < frames; n++) { ++ int64_t value = 0; ++ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { ++ value += (int64_t)(*src); ++ } ++ value /= format.u.raw_audio.channel_count; ++ dst[n] = (int16_t)(value / (UINT16_MAX + 1)); ++ } ++ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_FLOAT) { ++ float* src=reinterpret_cast(data); ++ for (int n=0; n < frames; n++) { ++ float value = 0; ++ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { ++ value += *src; ++ } ++ value /= format.u.raw_audio.channel_count; ++ dst[n] = (int16_t)(value*INT16_MAX); ++ } ++ } ++ ++ if(format.u.raw_audio.frame_rate != audioInput->tgFrameRate) { ++ size_t len = tgvoip::audio::Resampler::Convert(dst, audioInput->convertBuffer, ++ frames, frames, audioInput->tgFrameRate, format.u.raw_audio.frame_rate) * audioInput->tgBytesPerSample; ++ audioInput->fRingBuffer->Write((unsigned char*)audioInput->convertBuffer, len); ++ } else { ++ audioInput->fRingBuffer->Write((unsigned char*)dst, frames * audioInput->tgBytesPerSample); ++ } ++} ++ ++void NotifyRecordData(void * cookie, BMediaRecorder::notification code, ...) ++{ ++ AudioInputHaiku *audioInput = (AudioInputHaiku*)cookie; ++ if (code == BMediaRecorder::B_WILL_STOP) { ++ if (audioInput->IsRecording()) { ++ audioInput->Stop(); ++ } ++ } ++} ++ ++AudioInputHaiku::AudioInputHaiku() ++{ ++ fRecorder = NULL; ++ fRingBuffer = NULL; ++ isRecording = false; ++ ++ tgFrameRate = 48000; ++ tgChannelsCount = 1; ++ tgBytesPerSample = 2; ++ ++ status_t error; ++ ++ fRoster = BMediaRoster::Roster(&error); ++ if (!fRoster) { ++ failed=true; ++ return; ++ } ++ error = fRoster->GetAudioInput(&fAudioInputNode); ++ if (error < B_OK) { ++ failed=true; ++ return; ++ } ++ error = fRoster->GetAudioMixer(&fAudioMixerNode); ++ if (error < B_OK) { ++ failed=true; ++ return; ++ } ++ fRecorder = new BMediaRecorder("Telegram", B_MEDIA_RAW_AUDIO); ++ if (fRecorder->InitCheck() < B_OK) { ++ failed=true; ++ return; ++ } ++ media_format output_format; ++ output_format.type = B_MEDIA_RAW_AUDIO; ++ output_format.u.raw_audio = media_raw_audio_format::wildcard; ++ output_format.u.raw_audio.channel_count = 1; ++ fRecorder->SetAcceptedFormat(output_format); ++ ++ const int maxInputCount = 64; ++ dormant_node_info dni[maxInputCount]; ++ ++ int32 real_count = maxInputCount; ++ ++ error = fRoster->GetDormantNodes(dni, &real_count, 0, &output_format, 0, B_BUFFER_PRODUCER | B_PHYSICAL_INPUT); ++ if (real_count > maxInputCount) ++ real_count = maxInputCount; ++ char selected_name[B_MEDIA_NAME_LENGTH] = "Default input"; ++ ++ for (int i = 0; i < real_count; i++) { ++ media_node_id ni[12]; ++ int32 ni_count = 12; ++ error = fRoster->GetInstancesFor(dni[i].addon, dni[i].flavor_id, ni, &ni_count); ++ if (error == B_OK) { ++ for (int j = 0; j < ni_count; j++) { ++ if (ni[j] == fAudioInputNode.node) { ++ strcpy(selected_name, dni[i].name); ++ break; ++ } ++ } ++ } ++ } ++ ++ media_output audioOutput; ++ if (!fRecorder->IsConnected()) { ++ int32 count = 0; ++ error = fRoster->GetFreeOutputsFor(fAudioInputNode, &audioOutput, 1, &count, B_MEDIA_RAW_AUDIO); ++ if (error < B_OK) { ++ failed=true; ++ return; ++ } ++ ++ if (count < 1) { ++ failed=true; ++ return; ++ } ++ fRecordFormat.u.raw_audio = audioOutput.format.u.raw_audio; ++ } else { ++ fRecordFormat.u.raw_audio = fRecorder->AcceptedFormat().u.raw_audio; ++ } ++ fRecordFormat.type = B_MEDIA_RAW_AUDIO; ++ ++ error = fRecorder->SetHooks(RecordData, NotifyRecordData, this); ++ if (error < B_OK) { ++ failed=true; ++ return; ++ } ++ ++ if (!fRecorder->IsConnected()) { ++ error = fRecorder->Connect(fAudioInputNode, &audioOutput, &fRecordFormat); ++ if (error < B_OK) { ++ fRecorder->SetHooks(NULL, NULL, NULL); ++ failed=true; ++ return; ++ } ++ } ++ ++ fRingBuffer = new RingBuffer(BUFFER_SIZE * 2 * 3); ++ if (fRingBuffer->InitCheck() != B_OK) { ++ failed=true; ++ return; ++ } ++} ++ ++AudioInputHaiku::~AudioInputHaiku(){ ++ if (fRecorder != NULL) { ++ if (fRecorder->InitCheck() == B_OK) { ++ if (fRecorder->IsConnected()) ++ fRecorder->Disconnect(); ++ } ++ delete fRecorder; ++ } ++ if (fRingBuffer != NULL) ++ delete fRingBuffer; ++} ++ ++void AudioInputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){ ++ tgFrameRate = sampleRate; ++ tgChannelsCount = channels; ++ tgBytesPerSample = bitsPerSample / 8; ++} ++ ++bool AudioInputHaiku::IsRecording(){ ++ return isRecording; ++} ++ ++void AudioInputHaiku::Start(){ ++ if(failed || isRecording) ++ return; ++ ++ isRecording=true; ++ ++ thread = new Thread(std::bind(&AudioInputHaiku::RunThread, this)); ++ thread->SetName("AudioInputHaiku"); ++ thread->Start(); ++ ++ fRecorder->Start(); ++} ++ ++void AudioInputHaiku::Stop(){ ++ if(!isRecording) ++ return; ++ ++ isRecording=false; ++ ++ fRecorder->Stop(); ++ ++ thread->Join(); ++ delete thread; ++ thread=NULL; ++} ++ ++void AudioInputHaiku::RunThread(){ ++ unsigned char buffer[BUFFER_SIZE*2]; ++ while (isRecording){ ++ if (fRingBuffer->GetReadAvailable() >= sizeof(buffer)) { ++ int readed = fRingBuffer->Read(buffer, sizeof(buffer)); ++ if (readed < sizeof(buffer)) ++ memset(buffer + readed, 0, sizeof(buffer) - readed); ++ InvokeCallback(buffer, sizeof(buffer)); ++ } else ++ snooze(100); ++ } ++} +diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.h b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.h +new file mode 100644 +index 0000000..1c63afe +--- /dev/null ++++ b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.h +@@ -0,0 +1,66 @@ ++// ++// libtgvoip is free and unencumbered public domain software. ++// For more information, see http://unlicense.org or the UNLICENSE file ++// you should have received with this source code distribution. ++// ++ ++#ifndef LIBTGVOIP_AUDIOINPUTHAIKU_H ++#define LIBTGVOIP_AUDIOINPUTHAIKU_H ++ ++#include "../../audio/AudioInput.h" ++#include "../../threading.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "RingBuffer.h" ++ ++#define BUFFER_SIZE 960 ++ ++namespace tgvoip{ ++namespace audio{ ++ ++class AudioInputHaiku : public AudioInput{ ++ ++public: ++ AudioInputHaiku(); ++ virtual ~AudioInputHaiku(); ++ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels); ++ virtual void Start(); ++ virtual void Stop(); ++ virtual bool IsRecording(); ++ ++ RingBuffer *fRingBuffer; ++ int16_t workBuffer[BUFFER_SIZE * 64]; ++ int16_t convertBuffer[BUFFER_SIZE * 64]; ++ ++ uint32 tgFrameRate; ++ uint32 tgChannelsCount; ++ uint32 tgBytesPerSample; ++ ++private: ++ void RunThread(); ++ ++ bool isConfigured; ++ bool isRecording; ++ ++ BMediaRoster * fRoster; ++ BMediaRecorder * fRecorder; ++ media_format fRecordFormat; ++ media_node fAudioInputNode; ++ media_node fAudioMixerNode; ++ ++ Thread* thread; ++}; ++ ++} ++} ++ ++#endif //LIBTGVOIP_AUDIOINPUTHAIKU_H +diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.cpp b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.cpp +new file mode 100644 +index 0000000..2fca8a1 +--- /dev/null ++++ b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.cpp +@@ -0,0 +1,99 @@ ++// ++// libtgvoip is free and unencumbered public domain software. ++// For more information, see http://unlicense.org or the UNLICENSE file ++// you should have received with this source code distribution. ++// ++ ++ ++#include ++#include ++#include "AudioOutputHaiku.h" ++#include "../../logging.h" ++#include "../../VoIPController.h" ++ ++#define BUFFER_SIZE 960 ++ ++using namespace tgvoip::audio; ++ ++static void playerProc(void *cookie, void *buffer, size_t len, const media_raw_audio_format &format) ++{ ++ AudioOutputHaiku *obj = (AudioOutputHaiku*)cookie; ++ obj->InvokeCallback((unsigned char*)buffer, len); ++} ++ ++ ++AudioOutputHaiku::AudioOutputHaiku(){ ++ soundPlayer = NULL; ++ isPlaying = false; ++ isConfigured = false; ++ Configure(48000, 16, 1); ++ return; ++} ++ ++AudioOutputHaiku::~AudioOutputHaiku(){ ++ if (isConfigured) { ++ if (soundPlayer != NULL) { ++ soundPlayer->Stop(); ++ delete soundPlayer; ++ } ++ } ++} ++ ++void AudioOutputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){ ++ media_raw_audio_format mediaKitFormat = { ++ (float)sampleRate, ++ (uint32)channels, ++ media_raw_audio_format::B_AUDIO_SHORT, ++ B_MEDIA_LITTLE_ENDIAN, ++ (uint32)BUFFER_SIZE * (bitsPerSample / 8) * channels ++ }; ++ ++ switch (bitsPerSample) { ++ case 8: ++ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_CHAR; ++ break; ++ case 16: ++ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_SHORT; ++ break; ++ case 32: ++ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_INT; ++ break; ++ default: ++ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_SHORT; ++ break; ++ } ++ ++ soundPlayer = new BSoundPlayer(&mediaKitFormat, "Telegram", playerProc, NULL, (void*)this); ++ ++ if(soundPlayer->InitCheck() != B_OK) { ++ delete soundPlayer; ++ soundPlayer = NULL; ++ isPlaying = false; ++ failed = true; ++ return; ++ } ++ ++ isConfigured = true; ++} ++ ++void AudioOutputHaiku::Start(){ ++ if(soundPlayer == NULL || isPlaying) ++ return; ++ ++ soundPlayer->Start(); ++ soundPlayer->SetHasData(true); ++ ++ isPlaying=true; ++} ++ ++void AudioOutputHaiku::Stop(){ ++ if(!isPlaying) ++ return; ++ ++ soundPlayer->Stop(); ++ isPlaying=false; ++} ++ ++bool AudioOutputHaiku::IsPlaying(){ ++ return isPlaying; ++} +diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.h b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.h +new file mode 100644 +index 0000000..91f2521 +--- /dev/null ++++ b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.h +@@ -0,0 +1,35 @@ ++// ++// libtgvoip is free and unencumbered public domain software. ++// For more information, see http://unlicense.org or the UNLICENSE file ++// you should have received with this source code distribution. ++// ++ ++#ifndef LIBTGVOIP_AUDIOOUTPUTHAIKU_H ++#define LIBTGVOIP_AUDIOOUTPUTHAIKU_H ++ ++#include "../../audio/AudioOutput.h" ++#include "../../threading.h" ++ ++#include ++ ++namespace tgvoip{ ++namespace audio{ ++ ++class AudioOutputHaiku : public AudioOutput{ ++public: ++ AudioOutputHaiku(); ++ virtual ~AudioOutputHaiku(); ++ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels); ++ virtual void Start(); ++ virtual void Stop(); ++ virtual bool IsPlaying() override; ++private: ++ bool isPlaying; ++ bool isConfigured; ++ BSoundPlayer *soundPlayer; ++}; ++ ++} ++} ++ ++#endif //LIBTGVOIP_AUDIOOUTPUTHAIKU_H +diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.cpp b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.cpp +new file mode 100644 +index 0000000..6c94933 +--- /dev/null ++++ b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.cpp +@@ -0,0 +1,136 @@ ++// ++// libtgvoip is free and unencumbered public domain software. ++// For more information, see http://unlicense.org or the UNLICENSE file ++// you should have received with this source code distribution. ++// ++ ++#include ++#include ++#include ++#include ++ ++#include "RingBuffer.h" ++ ++RingBuffer::RingBuffer( int size ) ++{ ++ initialized = false; ++ Buffer = new unsigned char[size]; ++ if(Buffer!=NULL) { ++ memset( Buffer, 0, size ); ++ BufferSize = size; ++ } else { ++ BufferSize = 0; ++ } ++ reader = 0; ++ writer = 0; ++ writeBytesAvailable = size; ++ if((locker=create_sem(1,"locker")) >= B_OK) { ++ initialized = true; ++ } else { ++ if(Buffer!=NULL) { ++ delete[] Buffer; ++ } ++ } ++} ++ ++RingBuffer::~RingBuffer( ) ++{ ++ if(initialized) { ++ delete[] Buffer; ++ delete_sem(locker); ++ } ++} ++ ++bool ++RingBuffer::Empty( void ) ++{ ++ memset( Buffer, 0, BufferSize ); ++ reader = 0; ++ writer = 0; ++ writeBytesAvailable = BufferSize; ++ return true; ++} ++ ++int ++RingBuffer::Read( unsigned char *data, int size ) ++{ ++ acquire_sem(locker); ++ ++ if( data == 0 || size <= 0 || writeBytesAvailable == BufferSize ) { ++ release_sem(locker); ++ return 0; ++ } ++ ++ int readBytesAvailable = BufferSize - writeBytesAvailable; ++ ++ if( size > readBytesAvailable ) { ++ size = readBytesAvailable; ++ } ++ ++ if(size > BufferSize - reader) { ++ int len = BufferSize - reader; ++ memcpy(data, Buffer + reader, len); ++ memcpy(data + len, Buffer, size-len); ++ } else { ++ memcpy(data, Buffer + reader, size); ++ } ++ ++ reader = (reader + size) % BufferSize; ++ writeBytesAvailable += size; ++ ++ release_sem(locker); ++ return size; ++} ++ ++int ++RingBuffer::Write( unsigned char *data, int size ) ++{ ++ acquire_sem(locker); ++ ++ if( data == 0 || size <= 0 || writeBytesAvailable == 0 ) { ++ release_sem(locker); ++ return 0; ++ } ++ ++ if( size > writeBytesAvailable ) { ++ size = writeBytesAvailable; ++ } ++ ++ if(size > BufferSize - writer) { ++ int len = BufferSize - writer; ++ memcpy(Buffer + writer, data, len); ++ memcpy(Buffer, data+len, size-len); ++ } else { ++ memcpy(Buffer + writer, data, size); ++ } ++ ++ writer = (writer + size) % BufferSize; ++ writeBytesAvailable -= size; ++ ++ release_sem(locker); ++ return size; ++} ++ ++int ++RingBuffer::GetSize( void ) ++{ ++ return BufferSize; ++} ++ ++int ++RingBuffer::GetWriteAvailable( void ) ++{ ++ return writeBytesAvailable; ++} ++ ++int ++RingBuffer::GetReadAvailable( void ) ++{ ++ return BufferSize - writeBytesAvailable; ++} ++ ++status_t ++RingBuffer::InitCheck( void ) ++{ ++ return initialized?B_OK:B_ERROR; ++} +diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.h b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.h +new file mode 100644 +index 0000000..01f6096 +--- /dev/null ++++ b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.h +@@ -0,0 +1,37 @@ ++// ++// libtgvoip is free and unencumbered public domain software. ++// For more information, see http://unlicense.org or the UNLICENSE file ++// you should have received with this source code distribution. ++// ++ ++#ifndef __RING_BUFFER_H__ ++#define __RING_BUFFER_H__ ++ ++#include ++ ++class RingBuffer { ++ ++public: ++ RingBuffer(int size); ++ ~RingBuffer(); ++ int Read( unsigned char* dataPtr, int numBytes ); ++ int Write( unsigned char *dataPtr, int numBytes ); ++ ++ bool Empty( void ); ++ int GetSize( ); ++ int GetWriteAvailable( ); ++ int GetReadAvailable( ); ++ status_t InitCheck( ); ++private: ++ unsigned char *Buffer; ++ int BufferSize; ++ int reader; ++ int writer; ++ int writeBytesAvailable; ++ ++ sem_id locker; ++ ++ bool initialized; ++}; ++ ++#endif +diff --git a/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp b/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp +index 78e0583..81bf9fc 100644 +--- a/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp ++++ b/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp +@@ -248,12 +248,13 @@ void NetworkSocketPosix::Open(){ + } + int flag=0; + int res=setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag)); ++#ifndef __HAIKU__ + if(res<0){ + LOGE("error enabling dual stack socket: %d / %s", errno, strerror(errno)); + failed=true; + return; + } +- ++#endif + SetMaxPriority(); + fcntl(fd, F_SETFL, O_NONBLOCK); + +@@ -403,6 +404,8 @@ std::string NetworkSocketPosix::GetLocalInterfaceInfo(IPv4Address *v4addr, IPv6A + if(didAttach){ + sharedJVM->DetachCurrentThread(); + } ++#elif defined(__HAIKU__) ++ return name; + #else + struct ifaddrs* interfaces; + if(!getifaddrs(&interfaces)){ +diff --git a/Telegram/ThirdParty/libtgvoip/threading.h b/Telegram/ThirdParty/libtgvoip/threading.h +old mode 100755 +new mode 100644 +index 81c577c..1ccf029 +--- a/Telegram/ThirdParty/libtgvoip/threading.h ++++ b/Telegram/ThirdParty/libtgvoip/threading.h +@@ -9,7 +9,7 @@ + + #include + +-#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) ++#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || defined(__HAIKU__) || (defined(__APPLE__) && defined(__MACH__)) + + #include + #include +@@ -92,6 +92,7 @@ namespace tgvoip{ + static void* ActualEntryPoint(void* arg){ + Thread* self=reinterpret_cast(arg); + if(self->name){ ++#ifndef __HAIKU__ + #if !defined(__APPLE__) && !defined(__gnu_hurd__) + pthread_setname_np(self->thread, self->name); + #elif !defined(__gnu_hurd__) +@@ -100,6 +101,7 @@ namespace tgvoip{ + DarwinSpecific::SetCurrentThreadPriority(DarwinSpecific::THREAD_PRIO_USER_INTERACTIVE); + } + #endif ++#endif //__HAIKU__ + } + self->entry(); + return NULL; +diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc +old mode 100755 +new mode 100644 +index a8d1522..991241b +--- a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc ++++ b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc +@@ -28,6 +28,10 @@ + static const int kMaxLogLineSize = 1024 - 60; + #endif // WEBRTC_MAC && !defined(WEBRTC_IOS) || WEBRTC_ANDROID + ++#if defined(WEBRTC_HAIKU) ++#include ++#endif ++ + #include + #include + #include +@@ -120,7 +124,12 @@ LogMessage::LogMessage(const char* file, + + if (thread_) { + PlatformThreadId id = CurrentThreadId(); ++#if defined(WEBRTC_HAIKU) ++ thread_id tid = get_pthread_thread_id(id); ++ print_stream_ << "[" << tid << "] "; ++#else + print_stream_ << "[" << id << "] "; ++#endif + } + + if (file != nullptr) { +diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_file.h b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_file.h +old mode 100755 +new mode 100644 +diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc +index cf7d478..f27b9a1 100644 +--- a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc ++++ b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc +@@ -20,6 +20,8 @@ namespace rtc { + PlatformThreadId CurrentThreadId() { + #if defined(WEBRTC_WIN) + return GetCurrentThreadId(); ++#elif defined(WEBRTC_HAIKU) ++ return pthread_self(); + #elif defined(WEBRTC_POSIX) + #if defined(WEBRTC_MAC) || defined(WEBRTC_IOS) + return pthread_mach_thread_np(pthread_self()); +diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h +index 0bc42eb..c87cde9 100644 +--- a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h ++++ b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h +@@ -35,6 +35,9 @@ typedef DWORD PlatformThreadRef; + #elif defined(WEBRTC_FUCHSIA) + typedef zx_handle_t PlatformThreadId; + typedef zx_handle_t PlatformThreadRef; ++#elif defined(WEBRTC_HAIKU) ++typedef pthread_t PlatformThreadId; ++typedef pthread_t PlatformThreadRef; + #elif defined(WEBRTC_POSIX) + typedef pid_t PlatformThreadId; + typedef pthread_t PlatformThreadRef; +diff --git a/Telegram/cmake/lib_tgvoip.cmake b/Telegram/cmake/lib_tgvoip.cmake +index 74d4f26..79f5023 100644 +--- a/Telegram/cmake/lib_tgvoip.cmake ++++ b/Telegram/cmake/lib_tgvoip.cmake +@@ -120,6 +120,14 @@ if (NOT TGVOIP_FOUND) + os/linux/AudioPulse.cpp + os/linux/AudioPulse.h + ++ # Haiku ++ os/haiku/AudioInputHaiku.cpp ++ os/haiku/AudioInputHaiku.h ++ os/haiku/AudioOutputHaiku.cpp ++ os/haiku/AudioOutputHaiku.h ++ os/haiku/RingBuffer.cpp ++ os/haiku/RingBuffer.h ++ + # POSIX + os/posix/NetworkSocketPosix.cpp + os/posix/NetworkSocketPosix.h +@@ -157,6 +165,38 @@ if (NOT TGVOIP_FOUND) + TGVOIP_NO_OSX_PRIVATE_API + ) + endif() ++ elseif (HAIKU) ++ target_compile_definitions(lib_tgvoip_bundled ++ PUBLIC ++ WEBRTC_POSIX ++ WEBRTC_HAIKU ++ ) ++ target_compile_options(lib_tgvoip_bundled ++ PRIVATE ++ -Wno-unknown-pragmas ++ -Wno-error=sequence-point ++ -Wno-error=unused-result ++ -mmmx ++ -msse2 ++ ) ++ target_link_libraries(lib_tgvoip_bundled ++ PRIVATE ++ be ++ network ++ media ++ ) ++ remove_target_sources(lib_tgvoip_bundled ${tgvoip_loc} ++ os/linux/AudioInputALSA.cpp ++ os/linux/AudioInputALSA.h ++ os/linux/AudioOutputALSA.cpp ++ os/linux/AudioOutputALSA.h ++ os/linux/AudioOutputPulse.cpp ++ os/linux/AudioOutputPulse.h ++ os/linux/AudioInputPulse.cpp ++ os/linux/AudioInputPulse.h ++ os/linux/AudioPulse.cpp ++ os/linux/AudioPulse.h ++ ) + else() + target_compile_options(lib_tgvoip_bundled + PRIVATE +@@ -179,7 +219,7 @@ if (NOT TGVOIP_FOUND) + desktop-app::external_opus + ) + +- if (LINUX) ++ if (LINUX AND NOT HAIKU) + find_package(PkgConfig REQUIRED) + find_package(ALSA REQUIRED) + pkg_check_modules(PULSE REQUIRED libpulse) +-- +2.30.0 + diff --git a/net-im/telegram-desktop/patches/telegram_desktop-2.5.9-owt.patchset b/net-im/telegram-desktop/patches/telegram_desktop-2.5.9-owt.patchset deleted file mode 100644 index 7cfb661d8..000000000 --- a/net-im/telegram-desktop/patches/telegram_desktop-2.5.9-owt.patchset +++ /dev/null @@ -1,822 +0,0 @@ -From c7cf52d0deb5c65488d287ba89fe58026011a000 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sat, 30 Jan 2021 21:16:28 +1000 -Subject: Add Haiku support - - -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/CMakeLists.txt b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/CMakeLists.txt -index 7a5bb2c..24db2ef 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/CMakeLists.txt -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/CMakeLists.txt -@@ -58,7 +58,7 @@ include(cmake/libusrsctp.cmake) - include(cmake/libvpx.cmake) - include(cmake/libwebrtcbuild.cmake) - include(cmake/libyuv.cmake) --if (NOT WIN32 AND NOT APPLE) -+if (NOT WIN32 AND NOT APPLE AND NOT HAIKU) - include(cmake/libevent.cmake) - endif() - if (APPLE) -@@ -127,7 +127,7 @@ PRIVATE - ${libopenh264_yasm_objects} - ) - --if (NOT WIN32 AND NOT APPLE) -+if (NOT WIN32 AND NOT APPLE AND NOT HAIKU) - target_link_libraries(tg_owt PRIVATE tg_owt::libevent) - endif() - if (APPLE) -@@ -410,6 +410,8 @@ PRIVATE - rtc_base/task_queue.cc - rtc_base/task_queue_gcd.cc - rtc_base/task_queue_gcd.h -+ rtc_base/task_queue_stdlib.cc -+ rtc_base/task_queue_stdlib.h - rtc_base/task_queue_libevent.cc - rtc_base/task_queue_libevent.h - rtc_base/task_queue_win.cc -@@ -489,6 +491,7 @@ PRIVATE - api/stats_types.cc - api/task_queue/default_task_queue_factory.h - api/task_queue/default_task_queue_factory_gcd.cc -+ api/task_queue/default_task_queue_factory_stdlib.cc - api/task_queue/default_task_queue_factory_libevent.cc - api/task_queue/default_task_queue_factory_win.cc - api/task_queue/task_queue_base.cc -@@ -1410,6 +1413,8 @@ PRIVATE - modules/video_capture/device_info_impl.cc - modules/video_capture/linux/device_info_linux.cc - modules/video_capture/linux/video_capture_linux.cc -+ modules/video_capture/haiku/device_info_haiku.cc -+ modules/video_capture/haiku/video_capture_haiku.cc - modules/video_capture/windows/device_info_ds.cc - modules/video_capture/windows/device_info_ds.h - modules/video_capture/windows/help_functions_ds.cc -@@ -2105,7 +2110,7 @@ else() - ) - endif() - --if (WIN32 OR APPLE) -+if (WIN32 OR APPLE OR HAIKU) - remove_target_sources(tg_owt ${webrtc_loc} - rtc_base/task_queue_libevent.cc - rtc_base/task_queue_libevent.h -@@ -2121,7 +2126,7 @@ else() - endif() - - set(platform_export) --if (NOT WIN32 AND NOT APPLE) -+if (NOT WIN32 AND NOT APPLE AND NOT HAIKU) - set(platform_export - libevent - ) -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libusrsctp.cmake b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libusrsctp.cmake -index f652679..0c00f10 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libusrsctp.cmake -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libusrsctp.cmake -@@ -25,6 +25,11 @@ elseif (APPLE) - PRIVATE - -U__APPLE__ - ) -+elseif (HAIKU) -+ target_compile_definitions(libusrsctp -+ PRIVATE -+ __Userspace_os_Haiku -+ ) - else() - target_compile_definitions(libusrsctp - PRIVATE -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libwebrtcbuild.cmake b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libwebrtcbuild.cmake -index d79049e..bad89f0 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libwebrtcbuild.cmake -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/libwebrtcbuild.cmake -@@ -17,8 +17,8 @@ INTERFACE - WEBRTC_USE_H264 - WEBRTC_LIBRARY_IMPL - WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1 -- WEBRTC_ENABLE_LINUX_ALSA -- WEBRTC_ENABLE_LINUX_PULSE -+# WEBRTC_ENABLE_LINUX_ALSA -+# WEBRTC_ENABLE_LINUX_PULSE - HAVE_WEBRTC_VIDEO - RTC_ENABLE_VP9 - ) -@@ -34,6 +34,12 @@ elseif (APPLE) - WEBRTC_POSIX - WEBRTC_MAC - ) -+elseif (HAIKU) -+ target_compile_definitions(libwebrtcbuild -+ INTERFACE -+ WEBRTC_POSIX -+ WEBRTC_HAIKU -+ ) - else() - target_compile_definitions(libwebrtcbuild - INTERFACE -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/nice_target_sources.cmake b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/nice_target_sources.cmake -index cfc6aeb..699d0e6 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/nice_target_sources.cmake -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/cmake/nice_target_sources.cmake -@@ -15,6 +15,7 @@ function(nice_target_sources target_name src_loc) - set(not_win_sources "") - set(not_mac_sources "") - set(not_linux_sources "") -+ set(not_haiku_sources "") - foreach (entry ${list}) - if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") - set(writing_now ${entry}) -@@ -23,12 +24,19 @@ function(nice_target_sources target_name src_loc) - if (${entry} MATCHES "(^|/)win/" OR ${entry} MATCHES "(^|/)winrc/" OR ${entry} MATCHES "(^|/)windows/" OR ${entry} MATCHES "[_\\/]win\\.") - list(APPEND not_mac_sources ${full_name}) - list(APPEND not_linux_sources ${full_name}) -+ list(APPEND not_haiku_sources ${full_name}) - elseif (${entry} MATCHES "(^|/)mac/" OR ${entry} MATCHES "(^|/)darwin/" OR ${entry} MATCHES "(^|/)osx/" OR ${entry} MATCHES "[_\\/]mac\\." OR ${entry} MATCHES "[_\\/]darwin\\." OR ${entry} MATCHES "[_\\/]osx\\.") - list(APPEND not_win_sources ${full_name}) - list(APPEND not_linux_sources ${full_name}) -+ list(APPEND not_haiku_sources ${full_name}) - elseif (${entry} MATCHES "(^|/)linux/" OR ${entry} MATCHES "[_\\/]linux\\.") - list(APPEND not_win_sources ${full_name}) - list(APPEND not_mac_sources ${full_name}) -+ list(APPEND not_haiku_sources ${full_name}) -+ elseif (${entry} MATCHES "(^|/)haiku/" OR ${entry} MATCHES "[_\\/]haiku\\.") -+ list(APPEND not_win_sources ${full_name}) -+ list(APPEND not_mac_sources ${full_name}) -+ list(APPEND not_linux_sources ${full_name}) - elseif (${entry} MATCHES "(^|/)posix/" OR ${entry} MATCHES "[_\\/]posix\\.") - list(APPEND not_win_sources ${full_name}) - endif() -@@ -64,6 +72,9 @@ function(nice_target_sources target_name src_loc) - elseif (APPLE) - set_source_files_properties(${not_mac_sources} PROPERTIES HEADER_FILE_ONLY TRUE) - set_source_files_properties(${not_mac_sources} PROPERTIES SKIP_AUTOGEN TRUE) -+ elseif (HAIKU) -+ set_source_files_properties(${not_haiku_sources} PROPERTIES HEADER_FILE_ONLY TRUE) -+ set_source_files_properties(${not_haiku_sources} PROPERTIES SKIP_AUTOGEN TRUE) - else() - set_source_files_properties(${not_linux_sources} PROPERTIES HEADER_FILE_ONLY TRUE) - set_source_files_properties(${not_linux_sources} PROPERTIES SKIP_AUTOGEN TRUE) -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/api/task_queue/BUILD.gn b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/api/task_queue/BUILD.gn -index 1072057..745f5b7 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/api/task_queue/BUILD.gn -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/api/task_queue/BUILD.gn -@@ -82,7 +82,7 @@ rtc_library("default_task_queue_factory") { - sources = [ "default_task_queue_factory.h" ] - deps = [ ":task_queue" ] - -- if (rtc_enable_libevent) { -+ if (rtc_enable_libevent && !is_haiku) { - sources += [ "default_task_queue_factory_libevent.cc" ] - deps += [ "../../rtc_base:rtc_task_queue_libevent" ] - } else if (is_mac || is_ios) { -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.cc -new file mode 100644 -index 0000000..6f1c551 ---- /dev/null -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.cc -@@ -0,0 +1,69 @@ -+#include "modules/video_capture/haiku/device_info_haiku.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+#include "modules/video_capture/video_capture.h" -+#include "modules/video_capture/video_capture_defines.h" -+#include "modules/video_capture/video_capture_impl.h" -+#include "rtc_base/logging.h" -+ -+namespace webrtc { -+namespace videocapturemodule { -+VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo() { -+ return new videocapturemodule::DeviceInfoHaiku(); -+} -+ -+DeviceInfoHaiku::DeviceInfoHaiku() : DeviceInfoImpl() {} -+ -+int32_t DeviceInfoHaiku::Init() { -+ return 0; -+} -+ -+DeviceInfoHaiku::~DeviceInfoHaiku() {} -+ -+uint32_t DeviceInfoHaiku::NumberOfDevices() { -+ return 0; -+} -+ -+int32_t DeviceInfoHaiku::GetDeviceName(uint32_t deviceNumber, -+ char* deviceNameUTF8, -+ uint32_t deviceNameLength, -+ char* deviceUniqueIdUTF8, -+ uint32_t deviceUniqueIdUTF8Length, -+ char* /*productUniqueIdUTF8*/, -+ uint32_t /*productUniqueIdUTF8Length*/) { -+ return -1; -+} -+ -+int32_t DeviceInfoHaiku::CreateCapabilityMap(const char* deviceUniqueIdUTF8) { -+ return -1; -+} -+ -+int32_t DeviceInfoHaiku::DisplayCaptureSettingsDialogBox( -+ const char* /*deviceUniqueIdUTF8*/, -+ const char* /*dialogTitleUTF8*/, -+ void* /*parentWindow*/, -+ uint32_t /*positionX*/, -+ uint32_t /*positionY*/) { -+ return -1; -+} -+ -+bool DeviceInfoHaiku::IsDeviceNameMatches(const char* name, -+ const char* deviceUniqueIdUTF8) { -+ return false; -+} -+ -+int32_t DeviceInfoHaiku::FillCapabilities(int fd) { -+ return -1; -+} -+ -+} // namespace videocapturemodule -+} // namespace webrtc -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.h -new file mode 100644 -index 0000000..96352fa ---- /dev/null -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/device_info_haiku.h -@@ -0,0 +1,36 @@ -+#ifndef MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_DEVICE_INFO_HAIKU_H_ -+#define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_DEVICE_INFO_HAIKU_H_ -+ -+#include -+ -+#include "modules/video_capture/device_info_impl.h" -+ -+namespace webrtc { -+namespace videocapturemodule { -+class DeviceInfoHaiku : public DeviceInfoImpl { -+ public: -+ DeviceInfoHaiku(); -+ ~DeviceInfoHaiku() override; -+ uint32_t NumberOfDevices() override; -+ int32_t GetDeviceName(uint32_t deviceNumber, -+ char* deviceNameUTF8, -+ uint32_t deviceNameLength, -+ char* deviceUniqueIdUTF8, -+ uint32_t deviceUniqueIdUTF8Length, -+ char* productUniqueIdUTF8 = 0, -+ uint32_t productUniqueIdUTF8Length = 0) override; -+ int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) override; -+ int32_t DisplayCaptureSettingsDialogBox(const char*, -+ const char*, -+ void*, -+ uint32_t, -+ uint32_t) override; -+ int32_t FillCapabilities(int fd); -+ int32_t Init() override; -+ -+ private: -+ bool IsDeviceNameMatches(const char* name, const char* deviceUniqueIdUTF8); -+}; -+} // namespace videocapturemodule -+} // namespace webrtc -+#endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_DEVICE_INFO_HAIKU_H_ -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.cc -new file mode 100644 -index 0000000..94a79df ---- /dev/null -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.cc -@@ -0,0 +1,29 @@ -+#include "modules/video_capture/haiku/video_capture_haiku.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include "api/scoped_refptr.h" -+#include "media/base/video_common.h" -+#include "modules/video_capture/video_capture.h" -+#include "rtc_base/logging.h" -+#include "rtc_base/ref_counted_object.h" -+ -+namespace webrtc { -+namespace videocapturemodule { -+rtc::scoped_refptr VideoCaptureImpl::Create( -+ const char* deviceUniqueId) { -+ return nullptr; -+} -+} // namespace videocapturemodule -+} // namespace webrtc -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h -new file mode 100644 -index 0000000..55a27fc ---- /dev/null -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h -@@ -0,0 +1,20 @@ -+#ifndef MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_VIDEO_CAPTURE_HAIKU_H_ -+#define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_VIDEO_CAPTURE_HAIKU_H_ -+ -+#include -+#include -+ -+#include -+ -+#include "modules/video_capture/video_capture_defines.h" -+#include "modules/video_capture/video_capture_impl.h" -+#include "rtc_base/critical_section.h" -+#include "rtc_base/platform_thread.h" -+ -+namespace webrtc { -+namespace videocapturemodule { -+ -+} // namespace videocapturemodule -+} // namespace webrtc -+ -+#endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_VIDEO_CAPTURE_HAIKU_H_ -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/BUILD.gn b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/BUILD.gn -index c4f4d32..d5d82d1 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/BUILD.gn -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/BUILD.gn -@@ -489,7 +489,7 @@ rtc_source_set("rtc_operations_chain") { - absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] - } - --if (rtc_enable_libevent) { -+if (rtc_enable_libevent && !is_haiku) { - rtc_library("rtc_task_queue_libevent") { - visibility = [ "../api/task_queue:default_task_queue_factory" ] - sources = [ -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/ip_address.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/ip_address.cc -index 9dd534c..aadf0fd 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/ip_address.cc -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/ip_address.cc -@@ -11,6 +11,9 @@ - #if defined(WEBRTC_POSIX) - #include - #include -+#if defined(WEBRTC_HAIKU) -+#include -+#endif - #ifdef OPENBSD - #include - #endif -@@ -32,6 +35,15 @@ - namespace rtc { - - // Prefixes used for categorizing IPv6 addresses. -+#if defined(WEBRTC_HAIKU) -+static const in6_addr kV4MappedPrefix = { -+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0}}; -+static const in6_addr k6To4Prefix = {{0x20, 0x02, 0}}; -+static const in6_addr kTeredoPrefix = {{0x20, 0x01, 0x00, 0x00}}; -+static const in6_addr kV4CompatibilityPrefix = {{0}}; -+static const in6_addr k6BonePrefix = {{0x3f, 0xfe, 0}}; -+static const in6_addr kPrivateNetworkPrefix = {{0xFD}}; -+#else - static const in6_addr kV4MappedPrefix = { - {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0}}}; - static const in6_addr k6To4Prefix = {{{0x20, 0x02, 0}}}; -@@ -39,6 +51,7 @@ static const in6_addr kTeredoPrefix = {{{0x20, 0x01, 0x00, 0x00}}}; - static const in6_addr kV4CompatibilityPrefix = {{{0}}}; - static const in6_addr k6BonePrefix = {{{0x3f, 0xfe, 0}}}; - static const in6_addr kPrivateNetworkPrefix = {{{0xFD}}}; -+#endif - - static bool IPIsHelper(const IPAddress& ip, - const in6_addr& tomatch, -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/logging.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/logging.cc -index 13a5f02..8362c3e 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/logging.cc -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/logging.cc -@@ -122,7 +122,11 @@ LogMessage::LogMessage(const char* file, - - if (thread_) { - PlatformThreadId id = CurrentThreadId(); -+#ifdef WEBRTC_HAIKU -+ print_stream_ << "[" << (uint64_t)id << "] "; -+#else - print_stream_ << "[" << id << "] "; -+#endif - } - - if (file != nullptr) { -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/network.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/network.cc -index 07c39ae..a2c077a 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/network.cc -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/network.cc -@@ -524,7 +524,7 @@ void BasicNetworkManager::ConvertIfAddrs(struct ifaddrs* interfaces, - continue; - } - // Skip ones which are down. -- if (!(cursor->ifa_flags & IFF_RUNNING)) { -+ if (!(cursor->ifa_flags & IFF_LINK)) { - continue; - } - // Skip unknown family. -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/physical_socket_server.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/physical_socket_server.cc -index 3cb7c20..ee1b674 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/physical_socket_server.cc -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/physical_socket_server.cc -@@ -69,7 +69,7 @@ typedef void* SockOptArg; - - #endif // WEBRTC_POSIX - --#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(__native_client__) -+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(WEBRTC_HAIKU) && !defined(__native_client__) - - int64_t GetSocketRecvTimestamp(int socket) { - struct timeval tv_ioctl; -@@ -332,7 +332,7 @@ int PhysicalSocket::SetOption(Option opt, int value) { - value <<= 2; - #endif - } --#if defined(WEBRTC_POSIX) -+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_HAIKU) - if (sopt == IPV6_TCLASS) { - // Set the IPv4 option in all cases to support dual-stack sockets. - // Don't bother checking the return code, as this is expected to fail if -@@ -574,7 +574,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) { - #elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__) - RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported."; - return -1; --#elif defined(WEBRTC_POSIX) -+#elif defined(WEBRTC_POSIX) && !defined(WEBRTC_HAIKU) - *slevel = IPPROTO_IP; - *sopt = IP_MTU_DISCOVER; - break; -@@ -592,7 +592,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) { - *sopt = TCP_NODELAY; - break; - case OPT_DSCP: --#if defined(WEBRTC_POSIX) -+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_HAIKU) - if (family_ == AF_INET6) { - *slevel = IPPROTO_IPV6; - *sopt = IPV6_TCLASS; -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/platform_thread_types.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/platform_thread_types.h -index 6b9101e..0ae52e5 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/platform_thread_types.h -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/platform_thread_types.h -@@ -38,6 +38,9 @@ typedef DWORD PlatformThreadRef; - #elif defined(WEBRTC_FUCHSIA) - typedef zx_handle_t PlatformThreadId; - typedef zx_handle_t PlatformThreadRef; -+#elif defined(WEBRTC_HAIKU) -+typedef pthread_t PlatformThreadId; -+typedef pthread_t PlatformThreadRef; - #elif defined(WEBRTC_POSIX) - typedef pid_t PlatformThreadId; - typedef pthread_t PlatformThreadRef; -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export.h -index d1eb60a..9dc761d 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export.h -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export.h -@@ -28,7 +28,7 @@ - - #else // WEBRTC_WIN - --#if __has_attribute(visibility) && defined(WEBRTC_LIBRARY_IMPL) -+#if defined(WEBRTC_LIBRARY_IMPL) - #define RTC_EXPORT __attribute__((visibility("default"))) - #endif - -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export_template.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export_template.h -index 4ac7043..5fe950f 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export_template.h -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/rtc_base/system/rtc_export_template.h -@@ -185,7 +185,7 @@ - - RTC_EXPORT_TEMPLATE_TEST(DEFAULT, ); // NOLINT - RTC_EXPORT_TEMPLATE_TEST(DEFAULT, __attribute__((visibility("default")))); --RTC_EXPORT_TEMPLATE_TEST(MSVC_HACK, __declspec(dllexport)); -+//RTC_EXPORT_TEMPLATE_TEST(MSVC_HACK, __declspec(dllexport)); - RTC_EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport)); - - #undef RTC_EXPORT_TEMPLATE_TEST -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/base/options.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/base/options.h -index 230bf1e..6e1b9e5 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/base/options.h -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/base/options.h -@@ -100,7 +100,7 @@ - // User code should not inspect this macro. To check in the preprocessor if - // absl::any is a typedef of std::any, use the feature macro ABSL_USES_STD_ANY. - --#define ABSL_OPTION_USE_STD_ANY 2 -+#define ABSL_OPTION_USE_STD_ANY 0 - - - // ABSL_OPTION_USE_STD_OPTIONAL -@@ -127,7 +127,7 @@ - // absl::optional is a typedef of std::optional, use the feature macro - // ABSL_USES_STD_OPTIONAL. - --#define ABSL_OPTION_USE_STD_OPTIONAL 2 -+#define ABSL_OPTION_USE_STD_OPTIONAL 0 - - - // ABSL_OPTION_USE_STD_STRING_VIEW -@@ -154,7 +154,7 @@ - // absl::string_view is a typedef of std::string_view, use the feature macro - // ABSL_USES_STD_STRING_VIEW. - --#define ABSL_OPTION_USE_STD_STRING_VIEW 2 -+#define ABSL_OPTION_USE_STD_STRING_VIEW 0 - - // ABSL_OPTION_USE_STD_VARIANT - // -@@ -180,7 +180,7 @@ - // absl::variant is a typedef of std::variant, use the feature macro - // ABSL_USES_STD_VARIANT. - --#define ABSL_OPTION_USE_STD_VARIANT 2 -+#define ABSL_OPTION_USE_STD_VARIANT 0 - - - // ABSL_OPTION_USE_INLINE_NAMESPACE -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.cc b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.cc -index 8127cb0..40a23b6 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.cc -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.cc -@@ -19,22 +19,5 @@ - namespace absl { - ABSL_NAMESPACE_BEGIN - --bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2) { -- return (piece1.size() == piece2.size() && -- 0 == absl::strings_internal::memcasecmp(piece1.data(), piece2.data(), -- piece1.size())); -- // memcasecmp uses absl::ascii_tolower(). --} -- --bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix) { -- return (text.size() >= prefix.size()) && -- EqualsIgnoreCase(text.substr(0, prefix.size()), prefix); --} -- --bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix) { -- return (text.size() >= suffix.size()) && -- EqualsIgnoreCase(text.substr(text.size() - suffix.size()), suffix); --} -- - ABSL_NAMESPACE_END - } // namespace absl -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.h -index 90fca98..53ada13 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.h -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/abseil-cpp/absl/strings/match.h -@@ -35,7 +35,9 @@ - - #include - -+#include "absl/strings/match.h" - #include "absl/strings/string_view.h" -+#include "absl/strings/internal/memutil.h" - - namespace absl { - ABSL_NAMESPACE_BEGIN -@@ -70,19 +72,30 @@ inline bool EndsWith(absl::string_view text, absl::string_view suffix) { - // - // Returns whether given ASCII strings `piece1` and `piece2` are equal, ignoring - // case in the comparison. --bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2); -+inline bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2) { -+ return (piece1.size() == piece2.size() && -+ 0 == absl::strings_internal::memcasecmp(piece1.data(), piece2.data(), -+ piece1.size())); -+ // memcasecmp uses absl::ascii_tolower(). -+} - - // StartsWithIgnoreCase() - // - // Returns whether a given ASCII string `text` starts with `prefix`, - // ignoring case in the comparison. --bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix); -+inline bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix) { -+ return (text.size() >= prefix.size()) && -+ EqualsIgnoreCase(text.substr(0, prefix.size()), prefix); -+} - - // EndsWithIgnoreCase() - // - // Returns whether a given ASCII string `text` ends with `suffix`, ignoring - // case in the comparison. --bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix); -+inline bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix) { -+ return (text.size() >= suffix.size()) && -+ EqualsIgnoreCase(text.substr(text.size() - suffix.size()), suffix); -+} - - ABSL_NAMESPACE_END - } // namespace absl -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp -index 8aa67f1..5c2b6e1 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp -@@ -48,7 +48,7 @@ - #include - #include - #include --#ifndef __Fuchsia__ -+#if !defined(__Fuchsia__) && !defined(__HAIKU__) - #include - #endif - #ifdef __APPLE__ -@@ -244,7 +244,7 @@ WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_ - err = pthread_attr_init (&at); - if (err) - return err; --#if !defined(__ANDROID__) && !defined(__Fuchsia__) -+#if !defined(__ANDROID__) && !defined(__Fuchsia__) && !defined(__HAIKU__) - err = pthread_attr_setscope (&at, PTHREAD_SCOPE_SYSTEM); - if (err) - return err; -@@ -517,6 +517,10 @@ WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* p - - return WELS_THREAD_ERROR_OK; - -+#elif defined(__HAIKU__) -+ pInfo->ProcessorCount = 1; -+ return WELS_THREAD_ERROR_OK; -+ - #elif defined(__EMSCRIPTEN__) - - // There is not yet a way to determine CPU count in emscripten JS environment. -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h -index 9847624..82409dd 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h -@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD: head/sys/netinet/sctp.h 356357 2020-01-04 20:33:12Z tuexen $ - #ifndef _NETINET_SCTP_H_ - #define _NETINET_SCTP_H_ - --#if (defined(__APPLE__) || defined(__Userspace_os_Linux) || defined(__Userspace_os_Darwin)) -+#if (defined(__APPLE__) || defined(__Userspace_os_Linux) || defined(__Userspace_os_Darwin) || defined(__Userspace_os_Haiku)) - #include - #endif - -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c -index 5afe781..e1d99a7 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c -@@ -6304,7 +6304,7 @@ sctp_input(i_pak, va_alist) - #if defined(__Windows__) - NTOHS(ip->ip_len); - #endif --#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows) -+#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Haiku) - ip->ip_len = ntohs(ip->ip_len); - #endif - #if defined(__FreeBSD__) -@@ -6316,7 +6316,7 @@ sctp_input(i_pak, va_alist) - #elif defined(__APPLE__) - length = ip->ip_len + iphlen; - #elif defined(__Userspace__) --#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows) -+#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Haiku) - length = ip->ip_len; - #else - length = ip->ip_len + iphlen; -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h -index f09cb8d..c26fad1 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h -@@ -277,7 +277,7 @@ typedef char* caddr_t; - - #else /* !defined(Userspace_os_Windows) */ - #include --#if defined(__Userspace_os_DragonFly) || defined(__Userspace_os_FreeBSD) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_OpenBSD) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_Fuchsia) -+#if defined(__Userspace_os_DragonFly) || defined(__Userspace_os_FreeBSD) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_OpenBSD) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_Fuchsia) || defined(__Userspace_os_Haiku) - #include - #endif - typedef pthread_mutex_t userland_mutex_t; -@@ -1155,7 +1155,7 @@ sctp_get_mbuf_for_msg(unsigned int space_needed, int want_header, int how, int a - - #define SCTP_IS_LISTENING(inp) ((inp->sctp_flags & SCTP_PCB_FLAGS_ACCEPTING) != 0) - --#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia) -+#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia) || defined(__Userspace_os_Haiku) - int - timingsafe_bcmp(const void *, const void *, size_t); - #endif -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c -index 28922b6..dba15fd 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c -@@ -94,7 +94,7 @@ sctp_userspace_set_threadname(const char *name) - #endif - } - --#if !defined(_WIN32) && !defined(__Userspace_os_NaCl) -+#if !defined(_WIN32) && !defined(__Userspace_os_NaCl) && !defined(__Userspace_os_Haiku) - int - sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af) - { -@@ -118,7 +118,7 @@ sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af) - } - #endif - --#if defined(__Userspace_os_NaCl) -+#if defined(__Userspace_os_NaCl) || defined(__Userspace_os_Haiku) - int - sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af) - { -@@ -126,7 +126,7 @@ sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af) - } - #endif - --#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia) -+#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia) || defined(__Userspace_os_Haiku) - int - timingsafe_bcmp(const void *b1, const void *b2, size_t n) - { -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c -index 146a6d9..63a6240 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c -@@ -50,6 +50,9 @@ - #if defined(__Userspace_os_Linux) - #define __FAVOR_BSD /* (on Ubuntu at least) enables UDP header field names like BSD in RFC 768 */ - #endif -+#if defined(__Userspace_os_Haiku) -+#define UIO_MAXIOV _SC_IOV_MAX -+#endif - #if !defined (__Userspace_os_Windows) - #if defined INET || defined INET6 - #include -@@ -1068,7 +1071,7 @@ userspace_sctp_recvmsg(struct socket *so, - if (error) { - if ((auio.uio_resid != ulen) && - (error == EINTR || --#if !defined(__Userspace_os_NetBSD) -+#if !defined(__Userspace_os_NetBSD) && !defined(__Userspace_os_Haiku) - error == ERESTART || - #endif - error == EWOULDBLOCK)) { -@@ -1161,7 +1164,7 @@ usrsctp_recvv(struct socket *so, - if (errno) { - if ((auio.uio_resid != ulen) && - (errno == EINTR || --#if !defined(__Userspace_os_NetBSD) -+#if !defined(__Userspace_os_NetBSD) && !defined(__Userspace_os_Haiku) - errno == ERESTART || - #endif - errno == EWOULDBLOCK)) { -@@ -2117,7 +2120,7 @@ int user_connect(struct socket *so, struct sockaddr *sa) - error = pthread_cond_wait(SOCK_COND(so), SOCK_MTX(so)); - #endif - if (error) { --#if defined(__Userspace_os_NetBSD) -+#if defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Haiku) - if (error == EINTR) { - #else - if (error == EINTR || error == ERESTART) { -@@ -2137,7 +2140,7 @@ bad: - if (!interrupted) { - so->so_state &= ~SS_ISCONNECTING; - } --#if !defined(__Userspace_os_NetBSD) -+#if !defined(__Userspace_os_NetBSD) && !defined(__Userspace_os_Haiku) - if (error == ERESTART) { - error = EINTR; - } --- -2.30.0 - - -From 489b7fbcdf3eb5f9ea7e80bc3aab944be19c3001 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sat, 30 Jan 2021 22:18:47 +1000 -Subject: Fix build - - -diff --git a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h -index 55a27fc..ac60bb0 100644 ---- a/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h -+++ b/tg_owt-be23804afce3bb2e80a1d57a7c1318c71b82b7de/src/modules/video_capture/haiku/video_capture_haiku.h -@@ -8,8 +8,8 @@ - - #include "modules/video_capture/video_capture_defines.h" - #include "modules/video_capture/video_capture_impl.h" --#include "rtc_base/critical_section.h" - #include "rtc_base/platform_thread.h" -+#include "rtc_base/synchronization/mutex.h" - - namespace webrtc { - namespace videocapturemodule { --- -2.30.0 - diff --git a/net-im/telegram-desktop/patches/telegram_desktop-2.5.9.patchset b/net-im/telegram-desktop/patches/telegram_desktop-2.5.9.patchset deleted file mode 100644 index 0822fe1b2..000000000 --- a/net-im/telegram-desktop/patches/telegram_desktop-2.5.9.patchset +++ /dev/null @@ -1,3405 +0,0 @@ -From 8d6196668c8a25cdd359fda508973d0b07fec133 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Thu, 18 Feb 2021 09:41:18 +1000 -Subject: Add Haiku support - - -diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt -index 85f8277..03e3292 100644 ---- a/Telegram/CMakeLists.txt -+++ b/Telegram/CMakeLists.txt -@@ -908,6 +908,18 @@ PRIVATE - platform/win/windows_dlls.h - platform/win/windows_event_filter.cpp - platform/win/windows_event_filter.h -+ platform/haiku/file_utilities_haiku.cpp -+ platform/haiku/file_utilities_haiku.h -+ platform/haiku/launcher_haiku.cpp -+ platform/haiku/launcher_haiku.h -+ platform/haiku/main_window_haiku.cpp -+ platform/haiku/main_window_haiku.h -+ platform/haiku/notifications_manager_haiku.cpp -+ platform/haiku/notifications_manager_haiku.h -+ platform/haiku/window_title_haiku.cpp -+ platform/haiku/window_title_haiku.h -+ platform/haiku/specific_haiku.cpp -+ platform/haiku/specific_haiku.h - platform/platform_audio.h - platform/platform_file_utilities.h - platform/platform_launcher.h -@@ -1121,7 +1133,7 @@ PRIVATE - stdafx.h - ) - --if (NOT LINUX) -+if (NOT LINUX AND NOT HAIKU) - remove_target_sources(Telegram ${src_loc} - window/window_title_qt.cpp - window/window_title_qt.h -diff --git a/Telegram/SourceFiles/core/core_settings.h b/Telegram/SourceFiles/core/core_settings.h -index 76320ad..e2f3147 100644 ---- a/Telegram/SourceFiles/core/core_settings.h -+++ b/Telegram/SourceFiles/core/core_settings.h -@@ -599,7 +599,7 @@ private: - rpl::variable _dialogsWidthRatio; // per-window - rpl::variable _thirdColumnWidth = kDefaultThirdColumnWidth; // p-w - bool _notifyFromAll = true; -- rpl::variable _nativeWindowFrame = false; -+ rpl::variable _nativeWindowFrame = true; - rpl::variable> _systemDarkMode = std::nullopt; - rpl::variable _systemDarkModeEnabled = false; - rpl::variable _windowControlsLayout; -diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp -index 850e153..3bd14db 100644 ---- a/Telegram/SourceFiles/core/update_checker.cpp -+++ b/Telegram/SourceFiles/core/update_checker.cpp -@@ -1553,7 +1553,7 @@ bool checkReadyUpdate() { - ClearAll(); - return false; - } --#elif defined Q_OS_UNIX // Q_OS_MAC -+#elif defined Q_OS_UNIX && !defined Q_OS_HAIKU // Q_OS_MAC - if (!linuxMoveFile(QFile::encodeName(updater.absoluteFilePath()).constData(), QFile::encodeName(curUpdater).constData())) { - ClearAll(); - return false; -diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp -index bcc4392..6e838e6 100644 ---- a/Telegram/SourceFiles/data/data_session.cpp -+++ b/Telegram/SourceFiles/data/data_session.cpp -@@ -237,7 +237,7 @@ Session::Session(not_null session) - _cache->open(_session->local().cacheKey()); - _bigFileCache->open(_session->local().cacheBigFileKey()); - -- if constexpr (Platform::IsLinux()) { -+ if constexpr (Platform::IsLinux() || Platform::IsHaiku()) { - const auto wasVersion = _session->local().oldMapVersion(); - if (wasVersion >= 1007011 && wasVersion < 1007015) { - _bigFileCache->clear(); -diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp -index 7607cd2..f906b23 100644 ---- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp -+++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp -@@ -374,7 +374,7 @@ OverlayWidget::OverlayWidget() - - hide(); - createWinId(); -- if (Platform::IsLinux()) { -+ if (Platform::IsLinux() || Platform::IsHaiku()) { - windowHandle()->setTransientParent(App::wnd()->windowHandle()); - setWindowModality(Qt::WindowModal); - } -diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp -new file mode 100644 -index 0000000..c0784ff ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp -@@ -0,0 +1,34 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "platform/haiku/file_utilities_haiku.h" -+ -+#include "core/application.h" -+#include "mainwindow.h" -+#include "boxes/abstract_box.h" -+#include "base/platform/base_platform_file_utilities.h" -+#include "storage/localstorage.h" -+#include "facades.h" -+ -+#include -+ -+namespace Platform { -+namespace File { -+ -+void UnsafeShowInFolder(const QString &filepath) { -+ Ui::hideLayer(anim::type::instant); -+ base::Platform::ShowInFolder(filepath); -+} -+ -+void UnsafeOpenUrl(const QString &url) { -+ QDesktopServices::openUrl(url); -+} -+ -+} // namespace File -+} // namespace Platform -diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h -new file mode 100644 -index 0000000..429f17a ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h -@@ -0,0 +1,66 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include "platform/platform_file_utilities.h" -+ -+namespace Platform { -+namespace File { -+ -+inline QString UrlToLocal(const QUrl &url) { -+ return ::File::internal::UrlToLocalDefault(url); -+} -+ -+inline void UnsafeOpenEmailLink(const QString &email) { -+ return ::File::internal::UnsafeOpenEmailLinkDefault(email); -+} -+ -+inline bool UnsafeShowOpenWith(const QString &filepath) { -+ return false; -+} -+inline bool UnsafeShowOpenWithDropdown(const QString &filepath, QPoint menuPosition) { -+ return false; -+} -+ -+inline void UnsafeLaunch(const QString &filepath) { -+ return ::File::internal::UnsafeLaunchDefault(filepath); -+} -+ -+inline void PostprocessDownloaded(const QString &filepath) { -+} -+ -+} // namespace File -+ -+namespace FileDialog { -+ -+inline void InitLastPath() { -+ ::FileDialog::internal::InitLastPathDefault(); -+} -+ -+inline bool Get( -+ QPointer parent, -+ QStringList &files, -+ QByteArray &remoteContent, -+ const QString &caption, -+ const QString &filter, -+ ::FileDialog::internal::Type type, -+ QString startFile) { -+ return ::FileDialog::internal::GetDefault( -+ parent, -+ files, -+ remoteContent, -+ caption, -+ filter, -+ type, -+ startFile); -+} -+ -+} // namespace FileDialog -+} // namespace Platform -diff --git a/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp -new file mode 100644 -index 0000000..9796438 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp -@@ -0,0 +1,32 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2021 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "platform/haiku/launcher_haiku.h" -+ -+#include "base/platform/base_platform_info.h" -+#include "core/crash_reports.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+namespace Platform { -+ -+Launcher::Launcher(int argc, char *argv[]) -+: Core::Launcher(argc, argv) { -+} -+ -+bool Launcher::launchUpdater(UpdaterLaunch action) { -+ return false; -+} -+ -+} // namespace -diff --git a/Telegram/SourceFiles/platform/haiku/launcher_haiku.h b/Telegram/SourceFiles/platform/haiku/launcher_haiku.h -new file mode 100644 -index 0000000..45d4cf8 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.h -@@ -0,0 +1,25 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include "core/launcher.h" -+ -+namespace Platform { -+ -+class Launcher : public Core::Launcher { -+public: -+ Launcher(int argc, char *argv[]); -+ -+private: -+ bool launchUpdater(UpdaterLaunch action) override; -+ -+}; -+ -+} // namespace Platform -diff --git a/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp -new file mode 100644 -index 0000000..e30d9ba ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp -@@ -0,0 +1,95 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "platform/haiku/main_window_haiku.h" -+ -+#include "styles/style_window.h" -+#include "platform/platform_notifications_manager.h" -+#include "window/notifications_manager.h" -+#include "mainwindow.h" -+#include "base/crc32hash.h" -+#include "core/application.h" -+#include "lang/lang_keys.h" -+#include "storage/localstorage.h" -+#include "ui/widgets/popup_menu.h" -+#include "window/themes/window_theme.h" -+#include "history/history.h" -+#include "facades.h" -+#include "app.h" -+ -+#include -+ -+namespace Platform { -+ -+MainWindow::MainWindow(not_null controller) -+: Window::MainWindow(controller) { -+} -+ -+bool MainWindow::hasTrayIcon() const { -+ return true; -+} -+ -+void MainWindow::psShowTrayMenu() { -+} -+ -+bool MainWindow::isActiveForTrayMenu() { -+ return isVisible(); -+} -+ -+void MainWindow::psTrayMenuUpdated() { -+ if (trayIcon && trayIconMenu -+ && trayIcon->contextMenu() != trayIconMenu) { -+ trayIcon->setContextMenu(trayIconMenu); -+ } -+} -+ -+void MainWindow::psSetupTrayIcon() { -+ if (!trayIcon) { -+ trayIcon = new QSystemTrayIcon(this); -+ auto icon = QIcon(App::pixmapFromImageInPlace(Core::App().logoNoMargin())); -+ trayIcon->setIcon(icon); -+ attachToTrayIcon(trayIcon); -+ } -+ updateIconCounters(); -+ trayIcon->show(); -+} -+ -+void MainWindow::workmodeUpdated(DBIWorkMode mode) { -+ psSetupTrayIcon(); -+ if (mode == dbiwmWindowOnly) { -+ if (trayIcon) { -+ trayIcon->setContextMenu(0); -+ delete trayIcon; -+ trayIcon = nullptr; -+ } -+ } -+} -+ -+void MainWindow::unreadCounterChangedHook() { -+ setWindowTitle(titleText()); -+ updateIconCounters(); -+} -+ -+void MainWindow::updateIconCounters() { -+ const auto counter = Core::App().unreadBadge(); -+ const auto muted = Core::App().unreadBadgeMuted(); -+ auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg); -+ auto &fg = st::trayCounterFg; -+ if (trayIcon) { -+ QIcon icon; -+ icon.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(16, counter, bg, fg, true))); -+ icon.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(32, counter, bg, fg, true))); -+ trayIcon->setIcon(icon); -+ } -+} -+ -+MainWindow::~MainWindow() { -+} -+ -+} // namespace Platform -diff --git a/Telegram/SourceFiles/platform/haiku/main_window_haiku.h b/Telegram/SourceFiles/platform/haiku/main_window_haiku.h -new file mode 100644 -index 0000000..cd3e888 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.h -@@ -0,0 +1,54 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include "platform/platform_main_window.h" -+#include "ui/widgets/popup_menu.h" -+#include "base/flags.h" -+ -+#include -+ -+namespace Platform { -+ -+class MainWindow : public Window::MainWindow { -+ Q_OBJECT -+ -+public: -+ explicit MainWindow(not_null controller); -+ -+ virtual QImage iconWithCounter(int size, int count, style::color bg, style::color fg, bool smallIcon) = 0; -+ -+ bool isActiveForTrayMenu() override; -+ -+ ~MainWindow(); -+ -+public slots: -+ void psShowTrayMenu(); -+ -+protected: -+ void unreadCounterChangedHook() override; -+ -+ bool hasTrayIcon() const override; -+ -+ void workmodeUpdated(DBIWorkMode mode) override; -+ -+ QSystemTrayIcon *trayIcon = nullptr; -+ QMenu *trayIconMenu = nullptr; -+ -+ void psTrayMenuUpdated(); -+ void psSetupTrayIcon(); -+ -+ virtual void placeSmallCounter(QImage &img, int size, int count, style::color bg, const QPoint &shift, style::color color) = 0; -+ -+private: -+ void updateIconCounters(); -+}; -+ -+} // namespace Platform -diff --git a/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp -new file mode 100644 -index 0000000..d567f10 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp -@@ -0,0 +1,64 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include -+#include -+ -+#include -+#include -+ -+#define APPSIGNATURE "application/x-vnd.tg-notify-gate" -+#define NOTIFY_PORT_NAME "tg_notify" -+#define NOTIFY_MESSAGE 'TGNF' -+ -+typedef struct notify_msg -+{ -+ uint64 sessionId; -+ uint64 peerId; -+ int32 msgId; -+} notify_msg; -+ -+class SimpleLauncherApp : public BApplication { -+ public: -+ SimpleLauncherApp(int argc, char **argv); -+ void ArgvReceived(int32 argc, char **argv); -+ virtual void ReadyToRun(); -+}; -+ -+SimpleLauncherApp::SimpleLauncherApp(int argc, char **argv) : BApplication(APPSIGNATURE) -+{ -+} -+ -+void -+SimpleLauncherApp::ArgvReceived(int32 argc, char **argv) -+{ -+ if (argc == 2) { -+ notify_msg message; -+ sscanf(argv[1], "%lld %lld %d", &message.sessionId, &message.peerId, &message.msgId); -+ if (message.peerId != 0 && message.msgId != 0) { -+ port_id portId = find_port(NOTIFY_PORT_NAME); -+ if (portId > 0) { -+ write_port(portId, NOTIFY_MESSAGE, &message, sizeof(message)); -+ } -+ } -+ } -+} -+ -+void -+SimpleLauncherApp::ReadyToRun() -+{ -+ Quit(); -+} -+ -+int main(int argc, char **argv) -+{ -+ SimpleLauncherApp application(argc, argv); -+ application.Run(); -+ return 0; -+} -diff --git a/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef -new file mode 100644 -index 0000000..b6f3490 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef -@@ -0,0 +1,13 @@ -+resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP; -+ -+resource app_version { -+ major = 0, -+ middle = 0, -+ minor = 1, -+ variety = B_APPV_FINAL, -+ internal = 0, -+ short_info = "tg-notify-gate", -+ long_info = "Telegram native notifications gate" -+}; -+ -+resource app_signature "application/x-vnd.tg-notify-gate"; -diff --git a/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp -new file mode 100644 -index 0000000..e77c32e ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp -@@ -0,0 +1,202 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2021 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#ifdef __x86_64__ -+#define int64 XXX -+#define uint64 YYY -+#else -+#define int32 XXX -+#define uint32 YYY -+#endif -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "platform/haiku/notifications_manager_haiku.h" -+ -+#include "window/notifications_utilities.h" -+#include "history/history.h" -+#include "lang/lang_keys.h" -+#include "core/application.h" -+#include "core/core_settings.h" -+#include "main/main_session.h" -+ -+#define DeclareReadOnlyVar(Type, Name) const Type &Name(); -+#define DeclareRefVar(Type, Name) DeclareReadOnlyVar(Type, Name) \ -+ Type &Ref##Name(); -+#define DeclareVar(Type, Name) DeclareRefVar(Type, Name) \ -+ void Set##Name(const Type &Name); -+ -+#include -+#include -+#include -+#include -+#include -+ -+namespace Platform { -+namespace Notifications { -+namespace { -+ -+} // namespace -+ -+bool Supported() { -+ return true; -+} -+ -+void Create(Window::Notifications::System *system) { -+ if (Core::App().settings().nativeNotifications() && Supported()) { -+ auto result = std::make_unique(system); -+ system->setManager(std::move(result)); -+ return; -+ } -+ system->setManager(nullptr); -+} -+ -+void Finish() { -+} -+ -+NotifyReader::NotifyReader() -+{ -+ portId = create_port(NOTIFY_MESSAGE_DEEP, NOTIFY_PORT_NAME); -+} -+ -+NotifyReader::~NotifyReader() -+{ -+ if (portId >= B_OK) -+ delete_port(portId); -+} -+ -+void NotifyReader::run() -+{ -+ notify_msg message; -+ int32 code; -+ -+ while (true) { -+ ssize_t bytesRead = read_port(portId, &code, &message, sizeof(message)); -+ if (bytesRead == B_BAD_PORT_ID) -+ break; -+ if (bytesRead < (ssize_t)sizeof(message) || code != NOTIFY_MESSAGE) -+ continue; -+ if (message.peerId != 0 && message.msgId != 0) -+ notificationActivated(message.sessionId, message.peerId, message.msgId); -+ } -+} -+ -+Manager::Private::Private(not_null manager, Type type) -+: _cachedUserpics(type) -+, _manager(manager) { -+ portReaderThread = new QThread; -+ portReader = new NotifyReader(); -+ portReader->moveToThread(portReaderThread); -+ connect(portReaderThread, SIGNAL(started()), portReader, SLOT(run())); -+ qRegisterMetaType("PeerId"); -+ qRegisterMetaType("MsgId"); -+ connect( -+ portReader, -+ SIGNAL(notificationActivated(PeerId, PeerId, MsgId)), -+ this, -+ SLOT(notificationActivatedSlot(PeerId, PeerId, MsgId))); -+ portReaderThread->start(); -+} -+ -+void Manager::Private::showNotification( -+ not_null peer, -+ std::shared_ptr &userpicView, -+ MsgId msgId, -+ const QString &title, -+ const QString &subtitle, -+ const QString &msg, -+ bool hideNameAndPhoto, -+ bool hideReplyButton) { -+ auto titleText = title; -+ auto subtitleText = subtitle; -+ auto msgText = msg; -+ -+ const auto key = hideNameAndPhoto -+ ? InMemoryKey() -+ : peer->userpicUniqueKey(userpicView); -+ -+ auto userpicPath = _cachedUserpics.get(key, peer, userpicView); -+ BBitmap *icon = BTranslationUtils::GetBitmapFile(userpicPath.toUtf8().data()); -+ QString args = QString("%1 %2 %3").arg(peer->session().uniqueId()).arg(peer->id).arg(msgId); -+ BNotification notify(B_INFORMATION_NOTIFICATION); -+ if (icon) -+ notify.SetIcon(icon); -+ notify.SetGroup("Telegram"); -+ notify.SetTitle(titleText.toUtf8().data()); -+ notify.SetContent(msgText.toUtf8().data()); -+ entry_ref ref; -+ BEntry entry(NOTIFY_GATE_NAME); -+ entry.GetRef(&ref); -+ notify.SetOnClickFile(&ref); -+ notify.AddOnClickArg(BString(args.toUtf8().data())); -+ notify.Send(); -+} -+ -+void -+Manager::Private::notificationActivatedSlot(PeerId _sessionId, PeerId _peerId, MsgId _msgId) { -+ const auto manager = _manager; -+ const auto my = Window::Notifications::Manager::NotificationId{ -+ .full = Manager::FullPeer{ -+ .sessionId = _sessionId, -+ .peerId = _peerId -+ }, -+ .msgId = _msgId -+ }; -+ crl::on_main(manager, [=] { -+ manager->notificationActivated(my); -+ }); -+} -+ -+Manager::Manager(Window::Notifications::System *system) : NativeManager(system) -+, _private(std::make_unique(this, Private::Type::Rounded)) { -+} -+ -+Manager::~Manager() = default; -+ -+void Manager::doShowNativeNotification( -+ not_null peer, -+ std::shared_ptr &userpicView, -+ MsgId msgId, -+ const QString &title, -+ const QString &subtitle, -+ const QString &msg, -+ bool hideNameAndPhoto, -+ bool hideReplyButton) { -+ _private->showNotification( -+ peer, -+ userpicView, -+ msgId, -+ title, -+ subtitle, -+ msg, -+ hideNameAndPhoto, -+ hideReplyButton); -+} -+ -+void Manager::doClearAllFast() { -+} -+ -+void Manager::doClearFromHistory(not_null history) { -+} -+ -+void Manager::doClearFromSession(not_null session) { -+} -+ -+} // namespace Notifications -+} // namespace Platform -diff --git a/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.h b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.h -new file mode 100644 -index 0000000..52adcb0 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.h -@@ -0,0 +1,123 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include "platform/platform_notifications_manager.h" -+#include "window/notifications_utilities.h" -+ -+#include -+#include -+#include -+ -+#define NOTIFY_MESSAGE_DEEP 16 -+#define NOTIFY_PORT_NAME "tg_notify" -+#define NOTIFY_GATE_NAME "/bin/tg-notify-gate" -+#define NOTIFY_MESSAGE 'TGNF' -+ -+typedef struct notify_msg -+{ -+ uint64 sessionId; -+ uint64 peerId; -+ int32 msgId; -+} notify_msg; -+ -+namespace Platform { -+namespace Notifications { -+ -+inline bool SkipAudio() { -+ return false; -+} -+ -+inline bool SkipToast() { -+ return false; -+} -+ -+inline bool SkipFlashBounce() { -+ return false; -+} -+ -+inline bool Enforced() { -+ return false; -+} -+ -+inline bool ByDefault() { -+ return true; -+} -+ -+void Finish(); -+ -+class NotifyReader:public QObject { -+ Q_OBJECT -+public: -+ NotifyReader(); -+ ~NotifyReader(); -+public slots: -+ void run(); -+signals: -+ void notificationActivated(PeerId sessionId, PeerId peerId, MsgId msgId); -+private: -+ int32 portId; -+}; -+ -+ -+class Manager : public Window::Notifications::NativeManager, public base::has_weak_ptr { -+public: -+ Manager(Window::Notifications::System *system); -+ ~Manager(); -+ -+protected: -+ void doShowNativeNotification( -+ not_null peer, -+ std::shared_ptr &userpicView, -+ MsgId msgId, -+ const QString &title, -+ const QString &subtitle, -+ const QString &msg, -+ bool hideNameAndPhoto, -+ bool hideReplyButton) override; -+ void doClearAllFast() override; -+ void doClearFromHistory(not_null history) override; -+ void doClearFromSession(not_null session) override; -+ -+private: -+ class Private; -+ const std::unique_ptr _private; -+}; -+ -+class Manager::Private : public QObject { -+ Q_OBJECT -+ -+public: -+ using Type = Window::Notifications::CachedUserpics::Type; -+ explicit Private(not_null manager, Type type); -+ -+ void showNotification( -+ not_null peer, -+ std::shared_ptr &userpicView, -+ MsgId msgId, -+ const QString &title, -+ const QString &subtitle, -+ const QString &msg, -+ bool hideNameAndPhoto, -+ bool hideReplyButton); -+ -+public slots: -+ void notificationActivatedSlot(PeerId sessionId, PeerId peerId, MsgId msgId); -+ -+private: -+ Window::Notifications::CachedUserpics _cachedUserpics; -+ base::weak_ptr _manager; -+ -+ QThread *portReaderThread; -+ NotifyReader *portReader; -+}; -+ -+} // namespace Notifications -+} // namespace Platform -diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp -new file mode 100644 -index 0000000..6383199 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp -@@ -0,0 +1,264 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2021 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "platform/haiku/specific_haiku.h" -+ -+#include "base/platform/base_platform_info.h" -+#include "base/qt_adapters.h" -+#include "platform/haiku/file_utilities_haiku.h" -+#include "lang/lang_keys.h" -+#include "mainwidget.h" -+#include "mainwindow.h" -+#include "storage/localstorage.h" -+#include "window/window_controller.h" -+#include "core/update_checker.h" -+#include "core/application.h" -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+ -+using namespace Platform; -+ -+namespace Platform { -+namespace DesktopEnvironment { -+enum class Type { -+ Other -+}; -+Type Get() { -+ return Type::Other; -+} -+} -+ -+QString CurrentExecutablePath(int argc, char *argv[]) { -+ return argc ? QFile::decodeName(argv[0]) : QString(); -+} -+ -+QString SingleInstanceLocalServerName(const QString &hash) { -+ return QStandardPaths::writableLocation(QStandardPaths::TempLocation) -+ + '/' + hash + '-' + cGUIDStr(); -+} -+ -+bool AutostartSupported() { -+ return true; -+} -+ -+bool TrayIconSupported() { -+ return true; -+} -+ -+bool SetWindowExtents(QWindow *window, const QMargins &extents) { -+ return false; -+} -+ -+bool UnsetWindowExtents(QWindow *window) { -+ return false; -+} -+ -+std::optional IsDarkMode() { -+ return std::nullopt; -+} -+ -+Window::ControlsLayout WindowControlsLayout() { -+ Window::ControlsLayout controls; -+ controls.left = { -+ Window::Control::Close, -+ }; -+ -+ controls.right = { -+ Window::Control::Minimize, -+ Window::Control::Maximize, -+ }; -+ -+ return controls; -+} -+ -+} // namespace Platform -+ -+namespace { -+ -+QRect _monitorRect; -+auto _monitorLastGot = 0LL; -+ -+} // namespace -+ -+QRect psDesktopRect() { -+ auto tnow = crl::now(); -+ if (tnow > _monitorLastGot + 1000LL || tnow < _monitorLastGot) { -+ _monitorLastGot = tnow; -+ _monitorRect = QApplication::desktop()->availableGeometry(App::wnd()); -+ } -+ return _monitorRect; -+} -+ -+void psWriteDump() { -+} -+ -+bool _removeDirectory(const QString &path) { // from http://stackoverflow.com/questions/2256945/removing-a-non-empty-directory-programmatically-in-c-or-c -+ QByteArray pathRaw = QFile::encodeName(path); -+ DIR *d = opendir(pathRaw.constData()); -+ if (!d) return false; -+ -+ while (struct dirent *p = readdir(d)) { -+ /* Skip the names "." and ".." as we don't want to recurse on them. */ -+ if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, "..")) continue; -+ -+ QString fname = path + '/' + p->d_name; -+ QByteArray fnameRaw = QFile::encodeName(fname); -+ struct stat statbuf; -+ if (!stat(fnameRaw.constData(), &statbuf)) { -+ if (S_ISDIR(statbuf.st_mode)) { -+ if (!_removeDirectory(fname)) { -+ closedir(d); -+ return false; -+ } -+ } else { -+ if (unlink(fnameRaw.constData())) { -+ closedir(d); -+ return false; -+ } -+ } -+ } -+ } -+ closedir(d); -+ -+ return !rmdir(pathRaw.constData()); -+} -+ -+void psDeleteDir(const QString &dir) { -+ _removeDirectory(dir); -+} -+ -+void psActivateProcess(uint64 pid) { -+} -+ -+QString psAppDataPath() { -+ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + '/'; -+} -+ -+void psDoCleanup() { -+ try { -+ psAutoStart(false, true); -+ psSendToMenu(false, true); -+ } catch (...) { -+ } -+} -+ -+int psCleanup() { -+ psDoCleanup(); -+ return 0; -+} -+ -+void psDoFixPrevious() { -+} -+ -+int psFixPrevious() { -+ psDoFixPrevious(); -+ return 0; -+} -+ -+namespace Platform { -+ -+void start() { -+} -+ -+void finish() { -+} -+ -+void RegisterCustomScheme(bool force) { -+} -+ -+void SetApplicationIcon(const QIcon &icon) { -+ qApp->setWindowIcon(icon); -+} -+ -+PermissionStatus GetPermissionStatus(PermissionType type){ -+ return PermissionStatus::Granted; -+} -+ -+void RequestPermission(PermissionType type, Fn resultCallback){ -+ resultCallback(PermissionStatus::Granted); -+} -+ -+void OpenSystemSettingsForPermission(PermissionType type){ -+} -+ -+bool OpenSystemSettings(SystemSettingsType type) { -+ if (type == SystemSettingsType::Audio) { -+ auto options = std::vector(); -+ const auto add = [&](const char *option) { -+ options.emplace_back(option); -+ }; -+ add("Media"); -+ return ranges::find_if(options, [](const QString &command) { -+ return QProcess::startDetached(command); -+ }) != end(options); -+ } -+ return true; -+} -+ -+namespace ThirdParty { -+ -+void start() { -+} -+ -+void finish() { -+} -+ -+} // namespace ThirdParty -+ -+} // namespace Platform -+ -+void psNewVersion() { -+ Platform::RegisterCustomScheme(); -+} -+ -+bool psShowOpenWithMenu(int x, int y, const QString &file) { -+ return false; -+} -+ -+void psAutoStart(bool start, bool silent) { -+ auto home = QDir::homePath(); -+ if (home.isEmpty()) -+ return; -+ -+ QFile file(home + "/config/settings/boot/launch/telegram-desktop"); -+ if (start) { -+ if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { -+ QTextStream out(&file); -+ out << "#!/bin/bash" << endl -+ << "cd /system/apps" << endl -+ << "./Telegram -autostart" << " &" << endl; -+ file.close(); -+ file.setPermissions(file.permissions() -+ | QFileDevice::ExeOwner -+ | QFileDevice::ExeGroup -+ | QFileDevice::ExeOther); -+ } -+ } else { -+ file.remove(); -+ } -+} -+ -+void psSendToMenu(bool send, bool silent) { -+} -+ -+bool psLaunchMaps(const Data::LocationPoint &point) { -+ return false; -+} -diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.h b/Telegram/SourceFiles/platform/haiku/specific_haiku.h -new file mode 100644 -index 0000000..ceda709 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.h -@@ -0,0 +1,133 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2021 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include -+#include "platform/platform_specific.h" -+ -+namespace Data { -+class LocationPoint; -+} // namespace Data -+ -+namespace Platform { -+ -+inline void SetWatchingMediaKeys(bool watching) { -+} -+ -+inline void IgnoreApplicationActivationRightNow() { -+} -+ -+inline std::optional LastUserInputTime() { -+ return std::nullopt; -+} -+ -+inline void FallbackFontConfigCheckBegin() { -+} -+ -+inline void FallbackFontConfigCheckEnd() { -+} -+ -+inline QImage GetImageFromClipboard() { -+ return {}; -+} -+ -+inline bool StartSystemMove(QWindow *window) { -+ return false; -+} -+ -+inline bool StartSystemResize(QWindow *window, Qt::Edges edges) { -+ return false; -+} -+ -+inline bool ShowWindowMenu(QWindow *window) { -+ return false; -+} -+ -+inline bool WindowsNeedShadow() { -+ return false; -+} -+ -+inline bool SkipTaskbarSupported() { -+ return false; -+} -+ -+inline bool InFlatpak() { -+ return false; -+} -+ -+inline bool InSnap() { -+ return false; -+} -+ -+inline void InstallLauncher(bool force = false) { -+}; -+ -+} // namespace Platform -+ -+inline void psCheckLocalSocket(const QString &serverName) { -+ QFile address(serverName); -+ if (address.exists()) { -+ address.remove(); -+ } -+} -+ -+void psWriteDump(); -+ -+void psDeleteDir(const QString &dir); -+ -+QStringList psInitLogs(); -+void psClearInitLogs(); -+ -+void psActivateProcess(uint64 pid = 0); -+QString psLocalServerPrefix(); -+QString psAppDataPath(); -+void psAutoStart(bool start, bool silent = false); -+void psSendToMenu(bool send, bool silent = false); -+ -+QRect psDesktopRect(); -+ -+int psCleanup(); -+int psFixPrevious(); -+ -+void psNewVersion(); -+ -+inline QByteArray psDownloadPathBookmark(const QString &path) { -+ return QByteArray(); -+} -+inline QByteArray psPathBookmark(const QString &path) { -+ return QByteArray(); -+} -+inline void psDownloadPathEnableAccess() { -+} -+ -+class PsFileBookmark { -+public: -+ PsFileBookmark(const QByteArray &bookmark) { -+ } -+ bool check() const { -+ return true; -+ } -+ bool enable() const { -+ return true; -+ } -+ void disable() const { -+ } -+ const QString &name(const QString &original) const { -+ return original; -+ } -+ QByteArray bookmark() const { -+ return QByteArray(); -+ } -+ -+}; -+ -+//ool linuxMoveFile(const char *from, const char *to); -+ -+bool psLaunchMaps(const Data::LocationPoint &point); -diff --git a/Telegram/SourceFiles/platform/haiku/window_title_haiku.cpp b/Telegram/SourceFiles/platform/haiku/window_title_haiku.cpp -new file mode 100644 -index 0000000..6987284 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/window_title_haiku.cpp -@@ -0,0 +1,33 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "platform/haiku/window_title_haiku.h" -+ -+#include "base/platform/base_platform_info.h" -+ -+namespace Platform { -+namespace { -+ -+bool SystemMoveResizeSupported() { -+ return true; -+} -+ -+} // namespace -+ -+bool AllowNativeWindowFrameToggle() { -+ return SystemMoveResizeSupported(); -+} -+ -+object_ptr CreateTitleWidget(QWidget *parent) { -+ return SystemMoveResizeSupported() -+ ? object_ptr(parent) -+ : object_ptr{ nullptr }; -+} -+ -+} // namespace Platform -diff --git a/Telegram/SourceFiles/platform/haiku/window_title_haiku.h b/Telegram/SourceFiles/platform/haiku/window_title_haiku.h -new file mode 100644 -index 0000000..86431b6 ---- /dev/null -+++ b/Telegram/SourceFiles/platform/haiku/window_title_haiku.h -@@ -0,0 +1,41 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include "platform/platform_window_title.h" -+#include "base/object_ptr.h" -+ -+namespace Window { -+namespace Theme { -+ -+int DefaultPreviewTitleHeight(); -+void DefaultPreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRect body, int outerWidth); -+ -+} // namespace Theme -+} // namespace Window -+ -+namespace Platform { -+ -+bool AllowNativeWindowFrameToggle(); -+object_ptr CreateTitleWidget(QWidget *parent); -+ -+inline bool NativeTitleRequiresShadow() { -+ return false; -+} -+ -+inline int PreviewTitleHeight() { -+ return Window::Theme::DefaultPreviewTitleHeight(); -+} -+ -+inline void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRect body, int outerWidth) { -+ return Window::Theme::DefaultPreviewWindowFramePaint(preview, palette, body, outerWidth); -+} -+ -+} // namespace Platform -diff --git a/Telegram/SourceFiles/platform/platform_file_utilities.h b/Telegram/SourceFiles/platform/platform_file_utilities.h -index ad229d2..d37e402 100644 ---- a/Telegram/SourceFiles/platform/platform_file_utilities.h -+++ b/Telegram/SourceFiles/platform/platform_file_utilities.h -@@ -45,6 +45,8 @@ bool Get( - - #ifdef Q_OS_MAC - #include "platform/mac/file_utilities_mac.h" -+#elif defined Q_OS_HAIKU -+#include "platform/haiku/file_utilities_haiku.h" - #elif defined Q_OS_UNIX // Q_OS_MAC - #include "platform/linux/file_utilities_linux.h" - #elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX -diff --git a/Telegram/SourceFiles/platform/platform_launcher.h b/Telegram/SourceFiles/platform/platform_launcher.h -index d79aea6..53a1b91 100644 ---- a/Telegram/SourceFiles/platform/platform_launcher.h -+++ b/Telegram/SourceFiles/platform/platform_launcher.h -@@ -23,6 +23,8 @@ namespace Platform { - - #ifdef Q_OS_MAC - #include "platform/mac/launcher_mac.h" -+#elif defined Q_OS_HAIKU -+#include "platform/haiku/launcher_haiku.h" - #elif defined Q_OS_UNIX // Q_OS_MAC - #include "platform/linux/launcher_linux.h" - #elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX -diff --git a/Telegram/SourceFiles/platform/platform_main_window.h b/Telegram/SourceFiles/platform/platform_main_window.h -index 4bdb939..88bfaf6 100644 ---- a/Telegram/SourceFiles/platform/platform_main_window.h -+++ b/Telegram/SourceFiles/platform/platform_main_window.h -@@ -19,6 +19,8 @@ class MainWindow; - - #ifdef Q_OS_MAC - #include "platform/mac/main_window_mac.h" -+#elif defined Q_OS_HAIKU -+#include "platform/haiku/main_window_haiku.h" - #elif defined Q_OS_UNIX // Q_OS_MAC - #include "platform/linux/main_window_linux.h" - #elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX -diff --git a/Telegram/SourceFiles/platform/platform_notifications_manager.h b/Telegram/SourceFiles/platform/platform_notifications_manager.h -index eb3efbd..783d442 100644 ---- a/Telegram/SourceFiles/platform/platform_notifications_manager.h -+++ b/Telegram/SourceFiles/platform/platform_notifications_manager.h -@@ -28,6 +28,8 @@ void Create(Window::Notifications::System *system); - - #ifdef Q_OS_MAC - #include "platform/mac/notifications_manager_mac.h" -+#elif defined Q_OS_HAIKU -+#include "platform/haiku/notifications_manager_haiku.h" - #elif defined Q_OS_UNIX // Q_OS_MAC - #include "platform/linux/notifications_manager_linux.h" - #elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX -diff --git a/Telegram/SourceFiles/platform/platform_specific.h b/Telegram/SourceFiles/platform/platform_specific.h -index 45fafae..4c11a0d 100644 ---- a/Telegram/SourceFiles/platform/platform_specific.h -+++ b/Telegram/SourceFiles/platform/platform_specific.h -@@ -65,6 +65,8 @@ void finish(); - - #ifdef Q_OS_MAC - #include "platform/mac/specific_mac.h" -+#elif defined Q_OS_HAIKU -+#include "platform/haiku/specific_haiku.h" - #elif defined Q_OS_UNIX // Q_OS_MAC - #include "platform/linux/specific_linux.h" - #elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX -diff --git a/Telegram/SourceFiles/platform/platform_window_title.h b/Telegram/SourceFiles/platform/platform_window_title.h -index cd6b3a6..e08f0bd 100644 ---- a/Telegram/SourceFiles/platform/platform_window_title.h -+++ b/Telegram/SourceFiles/platform/platform_window_title.h -@@ -27,6 +27,8 @@ void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRe - - #ifdef Q_OS_MAC - #include "platform/mac/window_title_mac.h" -+#elif defined Q_OS_HAIKU -+#include "platform/haiku/window_title_haiku.h" - #elif defined Q_OS_WIN // Q_OS_MAC - #include "platform/win/window_title_win.h" - #elif defined Q_OS_UNIX // Q_OS_MAC || Q_OS_WIN -diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp -index 6ed2698..56259f4 100644 ---- a/Telegram/SourceFiles/window/main_window.cpp -+++ b/Telegram/SourceFiles/window/main_window.cpp -@@ -118,7 +118,7 @@ QIcon CreateOfficialIcon(Main::Session *session) { - - QIcon CreateIcon(Main::Session *session) { - auto result = CreateOfficialIcon(session); --#if defined Q_OS_UNIX && !defined Q_OS_MAC -+#if defined Q_OS_UNIX && !defined Q_OS_MAC && !defined Q_OS_HAIKU - return QIcon::fromTheme(Platform::GetIconName(), result); - #endif - return result; -diff --git a/Telegram/ThirdParty/libtgvoip/VoIPController.cpp b/Telegram/ThirdParty/libtgvoip/VoIPController.cpp -index d0b0038..c2c258b 100644 ---- a/Telegram/ThirdParty/libtgvoip/VoIPController.cpp -+++ b/Telegram/ThirdParty/libtgvoip/VoIPController.cpp -@@ -8,6 +8,9 @@ - #include - #include - #endif -+#ifdef __HAIKU__ -+#include -+#endif - #include - #include - #include -@@ -3009,6 +3012,10 @@ double VoIPController::GetCurrentTime(){ - struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - return ts.tv_sec+(double)ts.tv_nsec/1000000000.0; -+#elif defined(__HAIKU__) -+ struct timeval tm; -+ gettimeofday(&tm, NULL); -+ return tm.tv_sec+(double)tm.tv_usec/1000000.0; - #elif defined(__APPLE__) - static pthread_once_t token = PTHREAD_ONCE_INIT; - pthread_once(&token, &initMachTimestart); -diff --git a/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp b/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp -index 2c16ca7..e00c731 100644 ---- a/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp -+++ b/Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp -@@ -39,6 +39,9 @@ - #ifndef WITHOUT_PULSE - #include "../os/linux/AudioPulse.h" - #endif -+#elif defined(__HAIKU__) -+#include "../os/haiku/AudioInputHaiku.h" -+#include "../os/haiku/AudioOutputHaiku.h" - #else - #error "Unsupported operating system" - #endif -@@ -65,6 +68,8 @@ AudioIO* AudioIO::Create(std::string inputDevice, std::string outputDevice){ - return new ContextlessAudioIO(inputDevice, outputDevice); - #endif - return new ContextlessAudioIO(inputDevice, outputDevice); -+#elif defined(__HAIKU__) -+ return new ContextlessAudioIO(); - #elif defined(__linux__) - #ifndef WITHOUT_ALSA - #ifndef WITHOUT_PULSE -diff --git a/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp b/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp -index 674cd34..83a6dbb 100644 ---- a/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp -+++ b/Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp -@@ -33,6 +33,8 @@ - #ifndef WITHOUT_PULSE - #include "../os/linux/AudioPulse.h" - #endif -+#elif defined(__HAIKU__) -+#include "../os/haiku/AudioInputHaiku.h" - #else - #error "Unsupported operating system" - #endif -diff --git a/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp b/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp -index 14ab0be..44c615e 100644 ---- a/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp -+++ b/Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp -@@ -37,6 +37,8 @@ - #include "../os/linux/AudioOutputPulse.h" - #include "../os/linux/AudioPulse.h" - #endif -+#elif defined(__HAIKU__) -+#include "../os/haiku/AudioOutputHaiku.h" - #else - #error "Unsupported operating system" - #endif -diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.cpp b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.cpp -new file mode 100644 -index 0000000..7cce3e3 ---- /dev/null -+++ b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.cpp -@@ -0,0 +1,276 @@ -+// -+// libtgvoip is free and unencumbered public domain software. -+// For more information, see http://unlicense.org or the UNLICENSE file -+// you should have received with this source code distribution. -+// -+ -+#include -+#include -+#include -+#include -+#include "AudioInputHaiku.h" -+#include "../../logging.h" -+#include "../../audio/Resampler.h" -+#include "../../VoIPController.h" -+ -+#include "RingBuffer.h" -+ -+using namespace tgvoip::audio; -+ -+void RecordData(void* cookie, bigtime_t timestamp, void* data, size_t size, const media_format &format) -+{ -+ AudioInputHaiku *audioInput = (AudioInputHaiku*)cookie; -+ if (!audioInput->IsRecording()) -+ return; -+ -+ if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT && -+ format.u.raw_audio.channel_count == 1) { -+ audioInput->fRingBuffer->Write((unsigned char*)data, size); -+ return; -+ } -+ -+ uint32 bytesPerSample = 2; -+ switch (format.u.raw_audio.format) { -+ case media_raw_audio_format::B_AUDIO_CHAR: -+ bytesPerSample = 1; -+ break; -+ case media_raw_audio_format::B_AUDIO_SHORT: -+ bytesPerSample = 2; -+ break; -+ case media_raw_audio_format::B_AUDIO_INT: -+ bytesPerSample = 4; -+ break; -+ case media_raw_audio_format::B_AUDIO_FLOAT: -+ bytesPerSample = 4; -+ break; -+ default: -+ break; -+ } -+ -+ int frames = size / (format.u.raw_audio.channel_count * bytesPerSample); -+ int16_t *dst = audioInput->workBuffer; -+ -+ if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_CHAR) { -+ unsigned char* src=reinterpret_cast(data); -+ for (int n=0; n < frames; n++) { -+ int32_t value = 0; -+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { -+ value += ((int32_t)(*src) - INT8_MAX) * UINT8_MAX; -+ } -+ value /= format.u.raw_audio.channel_count; -+ dst[n] = (int16_t)value; -+ } -+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_SHORT) { -+ int16_t* src=reinterpret_cast(data); -+ for (int n=0; n < frames; n++) { -+ int32_t value = 0; -+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { -+ value += *src; -+ } -+ value /= format.u.raw_audio.channel_count; -+ dst[n] = (int16_t)value; -+ } -+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_INT) { -+ int32_t* src=reinterpret_cast(data); -+ for (int n=0; n < frames; n++) { -+ int64_t value = 0; -+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { -+ value += (int64_t)(*src); -+ } -+ value /= format.u.raw_audio.channel_count; -+ dst[n] = (int16_t)(value / (UINT16_MAX + 1)); -+ } -+ } else if (format.u.raw_audio.format == media_raw_audio_format::B_AUDIO_FLOAT) { -+ float* src=reinterpret_cast(data); -+ for (int n=0; n < frames; n++) { -+ float value = 0; -+ for (int j=0; j < format.u.raw_audio.channel_count; j++, src++) { -+ value += *src; -+ } -+ value /= format.u.raw_audio.channel_count; -+ dst[n] = (int16_t)(value*INT16_MAX); -+ } -+ } -+ -+ if(format.u.raw_audio.frame_rate != audioInput->tgFrameRate) { -+ size_t len = tgvoip::audio::Resampler::Convert(dst, audioInput->convertBuffer, -+ frames, frames, audioInput->tgFrameRate, format.u.raw_audio.frame_rate) * audioInput->tgBytesPerSample; -+ audioInput->fRingBuffer->Write((unsigned char*)audioInput->convertBuffer, len); -+ } else { -+ audioInput->fRingBuffer->Write((unsigned char*)dst, frames * audioInput->tgBytesPerSample); -+ } -+} -+ -+void NotifyRecordData(void * cookie, BMediaRecorder::notification code, ...) -+{ -+ AudioInputHaiku *audioInput = (AudioInputHaiku*)cookie; -+ if (code == BMediaRecorder::B_WILL_STOP) { -+ if (audioInput->IsRecording()) { -+ audioInput->Stop(); -+ } -+ } -+} -+ -+AudioInputHaiku::AudioInputHaiku() -+{ -+ fRecorder = NULL; -+ fRingBuffer = NULL; -+ isRecording = false; -+ -+ tgFrameRate = 48000; -+ tgChannelsCount = 1; -+ tgBytesPerSample = 2; -+ -+ status_t error; -+ -+ fRoster = BMediaRoster::Roster(&error); -+ if (!fRoster) { -+ failed=true; -+ return; -+ } -+ error = fRoster->GetAudioInput(&fAudioInputNode); -+ if (error < B_OK) { -+ failed=true; -+ return; -+ } -+ error = fRoster->GetAudioMixer(&fAudioMixerNode); -+ if (error < B_OK) { -+ failed=true; -+ return; -+ } -+ fRecorder = new BMediaRecorder("Telegram", B_MEDIA_RAW_AUDIO); -+ if (fRecorder->InitCheck() < B_OK) { -+ failed=true; -+ return; -+ } -+ media_format output_format; -+ output_format.type = B_MEDIA_RAW_AUDIO; -+ output_format.u.raw_audio = media_raw_audio_format::wildcard; -+ output_format.u.raw_audio.channel_count = 1; -+ fRecorder->SetAcceptedFormat(output_format); -+ -+ const int maxInputCount = 64; -+ dormant_node_info dni[maxInputCount]; -+ -+ int32 real_count = maxInputCount; -+ -+ error = fRoster->GetDormantNodes(dni, &real_count, 0, &output_format, 0, B_BUFFER_PRODUCER | B_PHYSICAL_INPUT); -+ if (real_count > maxInputCount) -+ real_count = maxInputCount; -+ char selected_name[B_MEDIA_NAME_LENGTH] = "Default input"; -+ -+ for (int i = 0; i < real_count; i++) { -+ media_node_id ni[12]; -+ int32 ni_count = 12; -+ error = fRoster->GetInstancesFor(dni[i].addon, dni[i].flavor_id, ni, &ni_count); -+ if (error == B_OK) { -+ for (int j = 0; j < ni_count; j++) { -+ if (ni[j] == fAudioInputNode.node) { -+ strcpy(selected_name, dni[i].name); -+ break; -+ } -+ } -+ } -+ } -+ -+ media_output audioOutput; -+ if (!fRecorder->IsConnected()) { -+ int32 count = 0; -+ error = fRoster->GetFreeOutputsFor(fAudioInputNode, &audioOutput, 1, &count, B_MEDIA_RAW_AUDIO); -+ if (error < B_OK) { -+ failed=true; -+ return; -+ } -+ -+ if (count < 1) { -+ failed=true; -+ return; -+ } -+ fRecordFormat.u.raw_audio = audioOutput.format.u.raw_audio; -+ } else { -+ fRecordFormat.u.raw_audio = fRecorder->AcceptedFormat().u.raw_audio; -+ } -+ fRecordFormat.type = B_MEDIA_RAW_AUDIO; -+ -+ error = fRecorder->SetHooks(RecordData, NotifyRecordData, this); -+ if (error < B_OK) { -+ failed=true; -+ return; -+ } -+ -+ if (!fRecorder->IsConnected()) { -+ error = fRecorder->Connect(fAudioInputNode, &audioOutput, &fRecordFormat); -+ if (error < B_OK) { -+ fRecorder->SetHooks(NULL, NULL, NULL); -+ failed=true; -+ return; -+ } -+ } -+ -+ fRingBuffer = new RingBuffer(BUFFER_SIZE * 2 * 3); -+ if (fRingBuffer->InitCheck() != B_OK) { -+ failed=true; -+ return; -+ } -+} -+ -+AudioInputHaiku::~AudioInputHaiku(){ -+ if (fRecorder != NULL) { -+ if (fRecorder->InitCheck() == B_OK) { -+ if (fRecorder->IsConnected()) -+ fRecorder->Disconnect(); -+ } -+ delete fRecorder; -+ } -+ if (fRingBuffer != NULL) -+ delete fRingBuffer; -+} -+ -+void AudioInputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){ -+ tgFrameRate = sampleRate; -+ tgChannelsCount = channels; -+ tgBytesPerSample = bitsPerSample / 8; -+} -+ -+bool AudioInputHaiku::IsRecording(){ -+ return isRecording; -+} -+ -+void AudioInputHaiku::Start(){ -+ if(failed || isRecording) -+ return; -+ -+ isRecording=true; -+ -+ thread = new Thread(std::bind(&AudioInputHaiku::RunThread, this)); -+ thread->SetName("AudioInputHaiku"); -+ thread->Start(); -+ -+ fRecorder->Start(); -+} -+ -+void AudioInputHaiku::Stop(){ -+ if(!isRecording) -+ return; -+ -+ isRecording=false; -+ -+ fRecorder->Stop(); -+ -+ thread->Join(); -+ delete thread; -+ thread=NULL; -+} -+ -+void AudioInputHaiku::RunThread(){ -+ unsigned char buffer[BUFFER_SIZE*2]; -+ while (isRecording){ -+ if (fRingBuffer->GetReadAvailable() >= sizeof(buffer)) { -+ int readed = fRingBuffer->Read(buffer, sizeof(buffer)); -+ if (readed < sizeof(buffer)) -+ memset(buffer + readed, 0, sizeof(buffer) - readed); -+ InvokeCallback(buffer, sizeof(buffer)); -+ } else -+ snooze(100); -+ } -+} -diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.h b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.h -new file mode 100644 -index 0000000..1c63afe ---- /dev/null -+++ b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioInputHaiku.h -@@ -0,0 +1,66 @@ -+// -+// libtgvoip is free and unencumbered public domain software. -+// For more information, see http://unlicense.org or the UNLICENSE file -+// you should have received with this source code distribution. -+// -+ -+#ifndef LIBTGVOIP_AUDIOINPUTHAIKU_H -+#define LIBTGVOIP_AUDIOINPUTHAIKU_H -+ -+#include "../../audio/AudioInput.h" -+#include "../../threading.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "RingBuffer.h" -+ -+#define BUFFER_SIZE 960 -+ -+namespace tgvoip{ -+namespace audio{ -+ -+class AudioInputHaiku : public AudioInput{ -+ -+public: -+ AudioInputHaiku(); -+ virtual ~AudioInputHaiku(); -+ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels); -+ virtual void Start(); -+ virtual void Stop(); -+ virtual bool IsRecording(); -+ -+ RingBuffer *fRingBuffer; -+ int16_t workBuffer[BUFFER_SIZE * 64]; -+ int16_t convertBuffer[BUFFER_SIZE * 64]; -+ -+ uint32 tgFrameRate; -+ uint32 tgChannelsCount; -+ uint32 tgBytesPerSample; -+ -+private: -+ void RunThread(); -+ -+ bool isConfigured; -+ bool isRecording; -+ -+ BMediaRoster * fRoster; -+ BMediaRecorder * fRecorder; -+ media_format fRecordFormat; -+ media_node fAudioInputNode; -+ media_node fAudioMixerNode; -+ -+ Thread* thread; -+}; -+ -+} -+} -+ -+#endif //LIBTGVOIP_AUDIOINPUTHAIKU_H -diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.cpp b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.cpp -new file mode 100644 -index 0000000..2fca8a1 ---- /dev/null -+++ b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.cpp -@@ -0,0 +1,99 @@ -+// -+// libtgvoip is free and unencumbered public domain software. -+// For more information, see http://unlicense.org or the UNLICENSE file -+// you should have received with this source code distribution. -+// -+ -+ -+#include -+#include -+#include "AudioOutputHaiku.h" -+#include "../../logging.h" -+#include "../../VoIPController.h" -+ -+#define BUFFER_SIZE 960 -+ -+using namespace tgvoip::audio; -+ -+static void playerProc(void *cookie, void *buffer, size_t len, const media_raw_audio_format &format) -+{ -+ AudioOutputHaiku *obj = (AudioOutputHaiku*)cookie; -+ obj->InvokeCallback((unsigned char*)buffer, len); -+} -+ -+ -+AudioOutputHaiku::AudioOutputHaiku(){ -+ soundPlayer = NULL; -+ isPlaying = false; -+ isConfigured = false; -+ Configure(48000, 16, 1); -+ return; -+} -+ -+AudioOutputHaiku::~AudioOutputHaiku(){ -+ if (isConfigured) { -+ if (soundPlayer != NULL) { -+ soundPlayer->Stop(); -+ delete soundPlayer; -+ } -+ } -+} -+ -+void AudioOutputHaiku::Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels){ -+ media_raw_audio_format mediaKitFormat = { -+ (float)sampleRate, -+ (uint32)channels, -+ media_raw_audio_format::B_AUDIO_SHORT, -+ B_MEDIA_LITTLE_ENDIAN, -+ (uint32)BUFFER_SIZE * (bitsPerSample / 8) * channels -+ }; -+ -+ switch (bitsPerSample) { -+ case 8: -+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_CHAR; -+ break; -+ case 16: -+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_SHORT; -+ break; -+ case 32: -+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_INT; -+ break; -+ default: -+ mediaKitFormat.format = media_raw_audio_format::B_AUDIO_SHORT; -+ break; -+ } -+ -+ soundPlayer = new BSoundPlayer(&mediaKitFormat, "Telegram", playerProc, NULL, (void*)this); -+ -+ if(soundPlayer->InitCheck() != B_OK) { -+ delete soundPlayer; -+ soundPlayer = NULL; -+ isPlaying = false; -+ failed = true; -+ return; -+ } -+ -+ isConfigured = true; -+} -+ -+void AudioOutputHaiku::Start(){ -+ if(soundPlayer == NULL || isPlaying) -+ return; -+ -+ soundPlayer->Start(); -+ soundPlayer->SetHasData(true); -+ -+ isPlaying=true; -+} -+ -+void AudioOutputHaiku::Stop(){ -+ if(!isPlaying) -+ return; -+ -+ soundPlayer->Stop(); -+ isPlaying=false; -+} -+ -+bool AudioOutputHaiku::IsPlaying(){ -+ return isPlaying; -+} -diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.h b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.h -new file mode 100644 -index 0000000..91f2521 ---- /dev/null -+++ b/Telegram/ThirdParty/libtgvoip/os/haiku/AudioOutputHaiku.h -@@ -0,0 +1,35 @@ -+// -+// libtgvoip is free and unencumbered public domain software. -+// For more information, see http://unlicense.org or the UNLICENSE file -+// you should have received with this source code distribution. -+// -+ -+#ifndef LIBTGVOIP_AUDIOOUTPUTHAIKU_H -+#define LIBTGVOIP_AUDIOOUTPUTHAIKU_H -+ -+#include "../../audio/AudioOutput.h" -+#include "../../threading.h" -+ -+#include -+ -+namespace tgvoip{ -+namespace audio{ -+ -+class AudioOutputHaiku : public AudioOutput{ -+public: -+ AudioOutputHaiku(); -+ virtual ~AudioOutputHaiku(); -+ virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels); -+ virtual void Start(); -+ virtual void Stop(); -+ virtual bool IsPlaying() override; -+private: -+ bool isPlaying; -+ bool isConfigured; -+ BSoundPlayer *soundPlayer; -+}; -+ -+} -+} -+ -+#endif //LIBTGVOIP_AUDIOOUTPUTHAIKU_H -diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.cpp b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.cpp -new file mode 100644 -index 0000000..6c94933 ---- /dev/null -+++ b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.cpp -@@ -0,0 +1,136 @@ -+// -+// libtgvoip is free and unencumbered public domain software. -+// For more information, see http://unlicense.org or the UNLICENSE file -+// you should have received with this source code distribution. -+// -+ -+#include -+#include -+#include -+#include -+ -+#include "RingBuffer.h" -+ -+RingBuffer::RingBuffer( int size ) -+{ -+ initialized = false; -+ Buffer = new unsigned char[size]; -+ if(Buffer!=NULL) { -+ memset( Buffer, 0, size ); -+ BufferSize = size; -+ } else { -+ BufferSize = 0; -+ } -+ reader = 0; -+ writer = 0; -+ writeBytesAvailable = size; -+ if((locker=create_sem(1,"locker")) >= B_OK) { -+ initialized = true; -+ } else { -+ if(Buffer!=NULL) { -+ delete[] Buffer; -+ } -+ } -+} -+ -+RingBuffer::~RingBuffer( ) -+{ -+ if(initialized) { -+ delete[] Buffer; -+ delete_sem(locker); -+ } -+} -+ -+bool -+RingBuffer::Empty( void ) -+{ -+ memset( Buffer, 0, BufferSize ); -+ reader = 0; -+ writer = 0; -+ writeBytesAvailable = BufferSize; -+ return true; -+} -+ -+int -+RingBuffer::Read( unsigned char *data, int size ) -+{ -+ acquire_sem(locker); -+ -+ if( data == 0 || size <= 0 || writeBytesAvailable == BufferSize ) { -+ release_sem(locker); -+ return 0; -+ } -+ -+ int readBytesAvailable = BufferSize - writeBytesAvailable; -+ -+ if( size > readBytesAvailable ) { -+ size = readBytesAvailable; -+ } -+ -+ if(size > BufferSize - reader) { -+ int len = BufferSize - reader; -+ memcpy(data, Buffer + reader, len); -+ memcpy(data + len, Buffer, size-len); -+ } else { -+ memcpy(data, Buffer + reader, size); -+ } -+ -+ reader = (reader + size) % BufferSize; -+ writeBytesAvailable += size; -+ -+ release_sem(locker); -+ return size; -+} -+ -+int -+RingBuffer::Write( unsigned char *data, int size ) -+{ -+ acquire_sem(locker); -+ -+ if( data == 0 || size <= 0 || writeBytesAvailable == 0 ) { -+ release_sem(locker); -+ return 0; -+ } -+ -+ if( size > writeBytesAvailable ) { -+ size = writeBytesAvailable; -+ } -+ -+ if(size > BufferSize - writer) { -+ int len = BufferSize - writer; -+ memcpy(Buffer + writer, data, len); -+ memcpy(Buffer, data+len, size-len); -+ } else { -+ memcpy(Buffer + writer, data, size); -+ } -+ -+ writer = (writer + size) % BufferSize; -+ writeBytesAvailable -= size; -+ -+ release_sem(locker); -+ return size; -+} -+ -+int -+RingBuffer::GetSize( void ) -+{ -+ return BufferSize; -+} -+ -+int -+RingBuffer::GetWriteAvailable( void ) -+{ -+ return writeBytesAvailable; -+} -+ -+int -+RingBuffer::GetReadAvailable( void ) -+{ -+ return BufferSize - writeBytesAvailable; -+} -+ -+status_t -+RingBuffer::InitCheck( void ) -+{ -+ return initialized?B_OK:B_ERROR; -+} -diff --git a/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.h b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.h -new file mode 100644 -index 0000000..01f6096 ---- /dev/null -+++ b/Telegram/ThirdParty/libtgvoip/os/haiku/RingBuffer.h -@@ -0,0 +1,37 @@ -+// -+// libtgvoip is free and unencumbered public domain software. -+// For more information, see http://unlicense.org or the UNLICENSE file -+// you should have received with this source code distribution. -+// -+ -+#ifndef __RING_BUFFER_H__ -+#define __RING_BUFFER_H__ -+ -+#include -+ -+class RingBuffer { -+ -+public: -+ RingBuffer(int size); -+ ~RingBuffer(); -+ int Read( unsigned char* dataPtr, int numBytes ); -+ int Write( unsigned char *dataPtr, int numBytes ); -+ -+ bool Empty( void ); -+ int GetSize( ); -+ int GetWriteAvailable( ); -+ int GetReadAvailable( ); -+ status_t InitCheck( ); -+private: -+ unsigned char *Buffer; -+ int BufferSize; -+ int reader; -+ int writer; -+ int writeBytesAvailable; -+ -+ sem_id locker; -+ -+ bool initialized; -+}; -+ -+#endif -diff --git a/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp b/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp -index 78e0583..81bf9fc 100644 ---- a/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp -+++ b/Telegram/ThirdParty/libtgvoip/os/posix/NetworkSocketPosix.cpp -@@ -248,12 +248,13 @@ void NetworkSocketPosix::Open(){ - } - int flag=0; - int res=setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag)); -+#ifndef __HAIKU__ - if(res<0){ - LOGE("error enabling dual stack socket: %d / %s", errno, strerror(errno)); - failed=true; - return; - } -- -+#endif - SetMaxPriority(); - fcntl(fd, F_SETFL, O_NONBLOCK); - -@@ -403,6 +404,8 @@ std::string NetworkSocketPosix::GetLocalInterfaceInfo(IPv4Address *v4addr, IPv6A - if(didAttach){ - sharedJVM->DetachCurrentThread(); - } -+#elif defined(__HAIKU__) -+ return name; - #else - struct ifaddrs* interfaces; - if(!getifaddrs(&interfaces)){ -diff --git a/Telegram/ThirdParty/libtgvoip/threading.h b/Telegram/ThirdParty/libtgvoip/threading.h -old mode 100755 -new mode 100644 -index 81c577c..1ccf029 ---- a/Telegram/ThirdParty/libtgvoip/threading.h -+++ b/Telegram/ThirdParty/libtgvoip/threading.h -@@ -9,7 +9,7 @@ - - #include - --#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) -+#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || defined(__HAIKU__) || (defined(__APPLE__) && defined(__MACH__)) - - #include - #include -@@ -92,6 +92,7 @@ namespace tgvoip{ - static void* ActualEntryPoint(void* arg){ - Thread* self=reinterpret_cast(arg); - if(self->name){ -+#ifndef __HAIKU__ - #if !defined(__APPLE__) && !defined(__gnu_hurd__) - pthread_setname_np(self->thread, self->name); - #elif !defined(__gnu_hurd__) -@@ -100,6 +101,7 @@ namespace tgvoip{ - DarwinSpecific::SetCurrentThreadPriority(DarwinSpecific::THREAD_PRIO_USER_INTERACTIVE); - } - #endif -+#endif //__HAIKU__ - } - self->entry(); - return NULL; -diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc -old mode 100755 -new mode 100644 -index a8d1522..991241b ---- a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc -+++ b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/logging_webrtc.cc -@@ -28,6 +28,10 @@ - static const int kMaxLogLineSize = 1024 - 60; - #endif // WEBRTC_MAC && !defined(WEBRTC_IOS) || WEBRTC_ANDROID - -+#if defined(WEBRTC_HAIKU) -+#include -+#endif -+ - #include - #include - #include -@@ -120,7 +124,12 @@ LogMessage::LogMessage(const char* file, - - if (thread_) { - PlatformThreadId id = CurrentThreadId(); -+#if defined(WEBRTC_HAIKU) -+ thread_id tid = get_pthread_thread_id(id); -+ print_stream_ << "[" << tid << "] "; -+#else - print_stream_ << "[" << id << "] "; -+#endif - } - - if (file != nullptr) { -diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_file.h b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_file.h -old mode 100755 -new mode 100644 -diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc -index cf7d478..f27b9a1 100644 ---- a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc -+++ b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc -@@ -20,6 +20,8 @@ namespace rtc { - PlatformThreadId CurrentThreadId() { - #if defined(WEBRTC_WIN) - return GetCurrentThreadId(); -+#elif defined(WEBRTC_HAIKU) -+ return pthread_self(); - #elif defined(WEBRTC_POSIX) - #if defined(WEBRTC_MAC) || defined(WEBRTC_IOS) - return pthread_mach_thread_np(pthread_self()); -diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h -index 0bc42eb..c87cde9 100644 ---- a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h -+++ b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.h -@@ -35,6 +35,9 @@ typedef DWORD PlatformThreadRef; - #elif defined(WEBRTC_FUCHSIA) - typedef zx_handle_t PlatformThreadId; - typedef zx_handle_t PlatformThreadRef; -+#elif defined(WEBRTC_HAIKU) -+typedef pthread_t PlatformThreadId; -+typedef pthread_t PlatformThreadRef; - #elif defined(WEBRTC_POSIX) - typedef pid_t PlatformThreadId; - typedef pthread_t PlatformThreadRef; -diff --git a/Telegram/cmake/lib_tgcalls.cmake b/Telegram/cmake/lib_tgcalls.cmake -index 7a7e68e..7619a4e 100644 ---- a/Telegram/cmake/lib_tgcalls.cmake -+++ b/Telegram/cmake/lib_tgcalls.cmake -@@ -132,6 +132,11 @@ if (WIN32) - PRIVATE - WEBRTC_WIN - ) -+elseif (HAIKU) -+ target_compile_definitions(lib_tgcalls -+ PRIVATE -+ WEBRTC_HAIKU -+ ) - elseif (APPLE) - target_compile_options(lib_tgcalls - PRIVATE -diff --git a/Telegram/cmake/lib_tgvoip.cmake b/Telegram/cmake/lib_tgvoip.cmake -index 74d4f26..ec89ac7 100644 ---- a/Telegram/cmake/lib_tgvoip.cmake -+++ b/Telegram/cmake/lib_tgvoip.cmake -@@ -120,6 +120,14 @@ if (NOT TGVOIP_FOUND) - os/linux/AudioPulse.cpp - os/linux/AudioPulse.h - -+ # Haiku -+ os/haiku/AudioInputHaiku.cpp -+ os/haiku/AudioInputHaiku.h -+ os/haiku/AudioOutputHaiku.cpp -+ os/haiku/AudioOutputHaiku.h -+ os/haiku/RingBuffer.cpp -+ os/haiku/RingBuffer.h -+ - # POSIX - os/posix/NetworkSocketPosix.cpp - os/posix/NetworkSocketPosix.h -@@ -157,6 +165,20 @@ if (NOT TGVOIP_FOUND) - TGVOIP_NO_OSX_PRIVATE_API - ) - endif() -+ elseif (HAIKU) -+ target_compile_definitions(lib_tgvoip_bundled -+ PUBLIC -+ WEBRTC_POSIX -+ WEBRTC_HAIKU -+ ) -+ target_compile_options(lib_tgvoip_bundled -+ PRIVATE -+ -Wno-unknown-pragmas -+ -Wno-error=sequence-point -+ -Wno-error=unused-result -+ -mmmx -+ -msse2 -+ ) - else() - target_compile_options(lib_tgvoip_bundled - PRIVATE -diff --git a/Telegram/lib_base/CMakeLists.txt b/Telegram/lib_base/CMakeLists.txt -index 6330f68..79b4d51 100644 ---- a/Telegram/lib_base/CMakeLists.txt -+++ b/Telegram/lib_base/CMakeLists.txt -@@ -69,6 +69,20 @@ PRIVATE - base/platform/win/base_windows_safe_library.cpp - base/platform/win/base_windows_safe_library.h - base/platform/win/wrl/wrl_implements_h.h -+ base/platform/haiku/base_file_utilities_haiku.cpp -+ base/platform/haiku/base_file_utilities_haiku.h -+ base/platform/haiku/base_global_shortcuts_haiku.cpp -+ base/platform/haiku/base_global_shortcuts_haiku.h -+ base/platform/haiku/base_info_haiku.cpp -+ base/platform/haiku/base_info_haiku.h -+ base/platform/haiku/base_last_input_haiku.cpp -+ base/platform/haiku/base_last_input_haiku.h -+ base/platform/haiku/base_layout_switch_haiku.cpp -+ base/platform/haiku/base_layout_switch_haiku.h -+ base/platform/haiku/base_process_haiku.cpp -+ base/platform/haiku/base_process_haiku.h -+ base/platform/haiku/base_url_scheme_haiku.cpp -+ base/platform/haiku/base_url_scheme_haiku.h - base/platform/base_platform_global_shortcuts.h - base/platform/base_platform_info.h - base/platform/base_platform_last_input.h -diff --git a/Telegram/lib_base/base/crash_report_writer.cpp b/Telegram/lib_base/base/crash_report_writer.cpp -index 0552958..202b6ae 100644 ---- a/Telegram/lib_base/base/crash_report_writer.cpp -+++ b/Telegram/lib_base/base/crash_report_writer.cpp -@@ -111,6 +111,8 @@ const char *PlatformString() { - return "Linux32Bit"; - } else if (Platform::IsLinux64Bit()) { - return "Linux64bit"; -+ } else if (Platform::IsHaiku()) { -+ return "Haiku"; - } - Unexpected("Platform in CrashReports::PlatformString."); - } -@@ -247,7 +249,7 @@ void SignalHandler(int signum) { - ReportingThreadId = nullptr; - } - --bool SetSignalHandlers = Platform::IsLinux() || Platform::IsMac(); -+bool SetSignalHandlers = Platform::IsLinux() || Platform::IsMac() || Platform::IsHaiku(); - bool CrashLogged = false; - - #ifdef USE_BREAKPAD -diff --git a/Telegram/lib_base/base/platform/base_platform_file_utilities.h b/Telegram/lib_base/base/platform/base_platform_file_utilities.h -index 1b63b2a..00a9900 100644 ---- a/Telegram/lib_base/base/platform/base_platform_file_utilities.h -+++ b/Telegram/lib_base/base/platform/base_platform_file_utilities.h -@@ -26,6 +26,8 @@ void FlushFileData(QFile &file); - - #ifdef Q_OS_MAC - #include "base/platform/mac/base_file_utilities_mac.h" -+#elif defined Q_OS_HAIKU -+#include "base/platform/haiku/base_file_utilities_haiku.h" - #elif defined Q_OS_UNIX // Q_OS_MAC - #include "base/platform/linux/base_file_utilities_linux.h" - #elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX -diff --git a/Telegram/lib_base/base/platform/base_platform_info.h b/Telegram/lib_base/base/platform/base_platform_info.h -index f5b319f..3051caf 100644 ---- a/Telegram/lib_base/base/platform/base_platform_info.h -+++ b/Telegram/lib_base/base/platform/base_platform_info.h -@@ -60,6 +60,8 @@ enum class OutdateReason { - [[nodiscard]] QString GetLibcName(); - [[nodiscard]] QString GetLibcVersion(); - -+[[nodiscard]] constexpr bool IsHaiku(); -+ - void Start(QJsonObject settings); - void Finish(); - -@@ -67,6 +69,8 @@ void Finish(); - - #ifdef Q_OS_MAC - #include "base/platform/mac/base_info_mac.h" -+#elif defined Q_OS_HAIKU -+#include "base/platform/haiku/base_info_haiku.h" - #elif defined Q_OS_UNIX // Q_OS_MAC - #include "base/platform/linux/base_info_linux.h" - #elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX -diff --git a/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.cpp -new file mode 100644 -index 0000000..0facb49 ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.cpp -@@ -0,0 +1,84 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "base/platform/haiku/base_file_utilities_haiku.h" -+ -+#include "base/platform/base_platform_file_utilities.h" -+#include "base/algorithm.h" -+ -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+namespace base::Platform { -+ -+bool ShowInFolder(const QString &filepath) { -+ const auto absolutePath = QFileInfo(filepath).absoluteFilePath(); -+ QProcess process; -+ auto command = QString("open"); -+ auto arguments = QStringList(); -+ arguments << QFileInfo(filepath).absoluteDir().absolutePath(); -+ return process.startDetached(command, arguments); -+} -+ -+QString CurrentExecutablePath(int argc, char *argv[]) { -+ return argc ? QFile::decodeName(argv[0]) : QString(); -+} -+ -+void RemoveQuarantine(const QString &path) { -+} -+ -+bool DeleteDirectory(QString path) { -+ if (path.endsWith('/')) { -+ path.chop(1); -+ } -+ const auto pathRaw = QFile::encodeName(path); -+ const auto d = opendir(pathRaw.constData()); -+ if (!d) { -+ return false; -+ } -+ -+ while (struct dirent *p = readdir(d)) { -+ if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, "..")) -+ continue; -+ const auto fname = path + '/' + p->d_name; -+ const auto encoded = QFile::encodeName(fname); -+ struct stat statbuf; -+ if (!stat(encoded.constData(), &statbuf)) { -+ if (S_ISDIR(statbuf.st_mode)) { -+ if (!DeleteDirectory(fname)) { -+ closedir(d); -+ return false; -+ } -+ } else { -+ if (unlink(encoded.constData())) { -+ closedir(d); -+ return false; -+ } -+ } -+ } -+ } -+ closedir(d); -+ -+ return !rmdir(pathRaw.constData()); -+} -+ -+void FlushFileData(QFile &file) { -+ file.flush(); -+ if (const auto descriptor = file.handle()) { -+ fsync(descriptor); -+ } -+} -+ -+} // namespace base::Platform -diff --git a/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.h b/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.h -new file mode 100644 -index 0000000..6700d58 ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_file_utilities_haiku.h -@@ -0,0 +1,27 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include -+#include -+ -+namespace base::Platform { -+ -+inline QString FileNameFromUserString(QString name) { -+ return name; -+} -+ -+inline bool RenameWithOverwrite(const QString &from, const QString &to) { -+ const auto fromPath = QFile::encodeName(from); -+ const auto toPath = QFile::encodeName(to); -+ return (rename(fromPath.constData(), toPath.constData()) == 0); -+} -+ -+} // namespace base::Platform -diff --git a/Telegram/lib_base/base/platform/haiku/base_global_shortcuts_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_global_shortcuts_haiku.cpp -new file mode 100644 -index 0000000..d08aa27 ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_global_shortcuts_haiku.cpp -@@ -0,0 +1,39 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "base/platform/haiku/base_global_shortcuts_haiku.h" -+ -+namespace base::Platform::GlobalShortcuts { -+namespace { -+ -+Fn ProcessCallback; -+ -+} // namespace -+ -+bool Available() { -+ return false; -+} -+ -+bool Allowed() { -+ return false; -+} -+ -+void Start(Fn process) { -+ ProcessCallback = nullptr; -+} -+ -+void Stop() { -+ ProcessCallback = nullptr; -+} -+ -+QString KeyName(GlobalShortcutKeyGeneric descriptor) { -+ return QString(); -+} -+ -+} // namespace base::Platform::GlobalShortcuts -diff --git a/Telegram/lib_base/base/platform/haiku/base_global_shortcuts_haiku.h b/Telegram/lib_base/base/platform/haiku/base_global_shortcuts_haiku.h -new file mode 100644 -index 0000000..465e668 ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_global_shortcuts_haiku.h -@@ -0,0 +1,13 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include "base/global_shortcuts.h" -+#include "base/platform/base_platform_global_shortcuts.h" -diff --git a/Telegram/lib_base/base/platform/haiku/base_info_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_info_haiku.cpp -new file mode 100644 -index 0000000..20dcf3e ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_info_haiku.cpp -@@ -0,0 +1,67 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "base/platform/haiku/base_info_haiku.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+namespace Platform { -+ -+QString DeviceModelPretty() { -+ const auto cpuArch = QSysInfo::buildCpuArchitecture(); -+ -+ if (cpuArch == qstr("x86_64")) { -+ return "PC 64bit"; -+ } else if (cpuArch == qstr("i386")) { -+ return "PC 32bit"; -+ } -+ -+ return "PC " + cpuArch; -+} -+ -+QString SystemVersionPretty() { -+ return "Haiku"; -+} -+ -+QString SystemCountry() { -+ return QLocale::system().name().split('_').last(); -+} -+ -+QString SystemLanguage() { -+ const auto system = QLocale::system(); -+ const auto languages = system.uiLanguages(); -+ return languages.isEmpty() -+ ? system.name().split('_').first() -+ : languages.front(); -+} -+ -+QDate WhenSystemBecomesOutdated() { -+ return QDate(); -+} -+ -+int AutoUpdateVersion() { -+ return 2; -+} -+ -+QString AutoUpdateKey() { -+ return "haiku"; -+} -+ -+void Start(QJsonObject options) { -+} -+ -+void Finish() { -+} -+ -+} // namespace Platform -diff --git a/Telegram/lib_base/base/platform/haiku/base_info_haiku.h b/Telegram/lib_base/base/platform/haiku/base_info_haiku.h -new file mode 100644 -index 0000000..9e49e7c ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_info_haiku.h -@@ -0,0 +1,45 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include "base/platform/base_platform_info.h" -+ -+namespace Platform { -+ -+inline constexpr bool IsHaiku() { return true;} -+ -+inline constexpr bool IsLinux() { return false;} -+inline constexpr bool IsLinux32Bit() { return false; } -+inline constexpr bool IsLinux64Bit() { return false; } -+inline constexpr bool IsWindows() { return false; } -+inline constexpr bool IsWindows32Bit() { return false; } -+inline constexpr bool IsWindows64Bit() { return false; } -+inline constexpr bool IsWindowsStoreBuild() { return false; } -+inline bool IsWindowsXPOrGreater() { return false; } -+inline bool IsWindowsVistaOrGreater() { return false; } -+inline bool IsWindows7OrGreater() { return false; } -+inline bool IsWindows8OrGreater() { return false; } -+inline bool IsWindows8Point1OrGreater() { return false; } -+inline bool IsWindows10OrGreater() { return false; } -+inline constexpr bool IsMac() { return false; } -+inline constexpr bool IsOSXBuild() { return false; } -+inline constexpr bool IsMacStoreBuild() { return false; } -+inline bool IsMac10_6OrGreater() { return false; } -+inline bool IsMac10_7OrGreater() { return false; } -+inline bool IsMac10_8OrGreater() { return false; } -+inline bool IsMac10_9OrGreater() { return false; } -+inline bool IsMac10_10OrGreater() { return false; } -+inline bool IsMac10_11OrGreater() { return false; } -+inline bool IsMac10_12OrGreater() { return false; } -+inline bool IsMac10_13OrGreater() { return false; } -+inline bool IsMac10_14OrGreater() { return false; } -+inline bool IsWayland() { return false; } -+ -+} // namespace Platform -diff --git a/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.cpp -new file mode 100644 -index 0000000..8fa3e9f ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.cpp -@@ -0,0 +1,20 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "base/platform/haiku/base_last_input_haiku.h" -+ -+#include -+ -+namespace base::Platform { -+ -+std::optional LastUserInputTime() { -+ return std::nullopt; -+} -+ -+} // namespace base::Platform -diff --git a/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.h b/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.h -new file mode 100644 -index 0000000..a24adad ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_last_input_haiku.h -@@ -0,0 +1,11 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -diff --git a/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.cpp -new file mode 100644 -index 0000000..533b8ea ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.cpp -@@ -0,0 +1,18 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "base/platform/haiku/base_layout_switch_haiku.h" -+ -+namespace base::Platform { -+ -+bool SwitchKeyboardLayoutToEnglish() { -+ return false; -+} -+ -+} // namespace base::Platform -diff --git a/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.h b/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.h -new file mode 100644 -index 0000000..a24adad ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_layout_switch_haiku.h -@@ -0,0 +1,11 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -diff --git a/Telegram/lib_base/base/platform/haiku/base_process_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_process_haiku.cpp -new file mode 100644 -index 0000000..6e88f99 ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_process_haiku.cpp -@@ -0,0 +1,20 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "base/platform/haiku/base_process_haiku.h" -+ -+namespace base::Platform { -+ -+void ActivateProcessWindow(int64 pid, WId windowId) { -+} -+ -+void ActivateThisProcessWindow(WId windowId) { -+} -+ -+} // namespace base::Platform -diff --git a/Telegram/lib_base/base/platform/haiku/base_process_haiku.h b/Telegram/lib_base/base/platform/haiku/base_process_haiku.h -new file mode 100644 -index 0000000..4d0bce3 ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_process_haiku.h -@@ -0,0 +1,12 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include "base/platform/base_platform_process.h" -diff --git a/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.cpp b/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.cpp -new file mode 100644 -index 0000000..ca200de ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.cpp -@@ -0,0 +1,21 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "base/platform/haiku/base_url_scheme_haiku.h" -+ -+namespace base::Platform { -+ -+bool CheckUrlScheme(const UrlSchemeDescriptor &descriptor) { -+ return false; -+} -+ -+void RegisterUrlScheme(const UrlSchemeDescriptor &descriptor) { } -+void UnregisterUrlScheme(const UrlSchemeDescriptor &descriptor) { } -+ -+} // namespace base::Platform -diff --git a/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.h b/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.h -new file mode 100644 -index 0000000..6402509 ---- /dev/null -+++ b/Telegram/lib_base/base/platform/haiku/base_url_scheme_haiku.h -@@ -0,0 +1,12 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2018-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include "base/platform/base_platform_url_scheme.h" -diff --git a/Telegram/lib_crl/CMakeLists.txt b/Telegram/lib_crl/CMakeLists.txt -index 91e32ec..7991e08 100644 ---- a/Telegram/lib_crl/CMakeLists.txt -+++ b/Telegram/lib_crl/CMakeLists.txt -@@ -33,6 +33,7 @@ PRIVATE - crl/dispatch/crl_dispatch_semaphore.h - crl/mac/crl_mac_time.cpp - crl/linux/crl_linux_time.cpp -+ crl/haiku/crl_haiku_time.cpp - crl/qt/crl_qt_async.cpp - crl/qt/crl_qt_async.h - crl/qt/crl_qt_guards.h -diff --git a/Telegram/lib_crl/crl/haiku/crl_haiku_time.cpp b/Telegram/lib_crl/crl/haiku/crl_haiku_time.cpp -new file mode 100644 -index 0000000..f682740 ---- /dev/null -+++ b/Telegram/lib_crl/crl/haiku/crl_haiku_time.cpp -@@ -0,0 +1,44 @@ -+// This file is part of Desktop App Toolkit, -+// a set of libraries for developing nice desktop applications. -+// -+// For license and copyright information please follow this link: -+// https://github.com/desktop-app/legal/blob/master/LEGAL -+// -+#include -+ -+#ifdef CRL_USE_LINUX_TIME -+ -+#include -+ -+namespace crl::details { -+ -+void init() { -+} -+ -+inner_time_type current_value() { -+ timespec ts; -+ clock_gettime(CLOCK_MONOTONIC, &ts); -+ const auto seconds = inner_time_type(ts.tv_sec); -+ const auto milliseconds = inner_time_type(ts.tv_nsec) / 1000000; -+ return seconds * 1000 + milliseconds; -+} -+ -+time convert(inner_time_type value) { -+ return time(value); -+} -+ -+inner_profile_type current_profile_value() { -+ timespec ts; -+ clock_gettime(CLOCK_MONOTONIC, &ts); -+ const auto seconds = inner_profile_type(ts.tv_sec); -+ const auto milliseconds = inner_profile_type(ts.tv_nsec) / 1000; -+ return seconds * 1000000 + milliseconds; -+} -+ -+profile_time convert_profile(inner_profile_type value) { -+ return profile_time(value); -+} -+ -+} // namespace crl::details -+ -+#endif // CRL_USE_LINUX_TIME -diff --git a/Telegram/lib_ui/CMakeLists.txt b/Telegram/lib_ui/CMakeLists.txt -index b48b8f9..579b66a 100644 ---- a/Telegram/lib_ui/CMakeLists.txt -+++ b/Telegram/lib_ui/CMakeLists.txt -@@ -97,6 +97,10 @@ PRIVATE - ui/platform/win/ui_window_win.h - ui/platform/win/ui_utility_win.cpp - ui/platform/win/ui_utility_win.h -+ ui/platform/haiku/ui_window_haiku.cpp -+ ui/platform/haiku/ui_window_haiku.h -+ ui/platform/haiku/ui_utility_haiku.cpp -+ ui/platform/haiku/ui_utility_haiku.h - ui/platform/ui_platform_window_title.cpp - ui/platform/ui_platform_window_title.h - ui/platform/ui_platform_window.cpp -diff --git a/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.cpp b/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.cpp -new file mode 100644 -index 0000000..62cdebf ---- /dev/null -+++ b/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.cpp -@@ -0,0 +1,41 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2019-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "ui/platform/haiku/ui_utility_haiku.h" -+#include "ui/platform/ui_platform_window_title.h" -+#include "base/platform/base_platform_info.h" -+ -+#include -+ -+namespace Ui { -+namespace Platform { -+ -+bool IsApplicationActive() { -+ return QApplication::activeWindow() != nullptr; -+} -+ -+bool TranslucentWindowsSupported(QPoint globalPosition) { -+ return false; -+} -+ -+void IgnoreAllActivation(not_null widget) { -+} -+ -+TitleControls::Layout TitleControlsLayout() { -+ return TitleControls::Layout{ -+ .right = { -+ TitleControls::Control::Minimize, -+ TitleControls::Control::Maximize, -+ TitleControls::Control::Close, -+ } -+ }; -+} -+ -+} // namespace Platform -+} // namespace Ui -diff --git a/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.h b/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.h -new file mode 100644 -index 0000000..97eab8f ---- /dev/null -+++ b/Telegram/lib_ui/ui/platform/haiku/ui_utility_haiku.h -@@ -0,0 +1,60 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2019-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+class QPainter; -+class QPaintEvent; -+ -+namespace Ui { -+namespace Platform { -+ -+inline void StartTranslucentPaint(QPainter &p, const QRegion ®ion) { -+} -+ -+inline void InitOnTopPanel(not_null panel) { -+} -+ -+inline void DeInitOnTopPanel(not_null panel) { -+} -+ -+inline void ReInitOnTopPanel(not_null panel) { -+} -+ -+inline void UpdateOverlayed(not_null widget) { -+} -+ -+inline void ShowOverAll(not_null widget, bool canFocus) { -+} -+ -+inline void BringToBack(not_null widget) { -+} -+ -+inline bool WindowExtentsSupported() { -+ return false; -+} -+ -+inline bool SetWindowExtents(QWindow *window, const QMargins &extents) { -+ return false; -+} -+ -+inline bool UnsetWindowExtents(QWindow *window) { -+ return false; -+} -+ -+inline bool ShowWindowMenu(QWindow *window) { -+ return false; -+} -+ -+inline constexpr bool UseMainQueueGeneric() { -+ return true; -+} -+ -+} // namespace Platform -+} // namespace Ui -diff --git a/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.cpp b/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.cpp -new file mode 100644 -index 0000000..bce8d37 ---- /dev/null -+++ b/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.cpp -@@ -0,0 +1,21 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2019-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#include "ui/platform/haiku/ui_window_haiku.h" -+ -+namespace Ui { -+namespace Platform { -+ -+std::unique_ptr CreateSpecialWindowHelper( -+ not_null window) { -+ return nullptr; -+} -+ -+} // namespace Platform -+} // namespace Ui -diff --git a/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.h b/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.h -new file mode 100644 -index 0000000..ecb1277 ---- /dev/null -+++ b/Telegram/lib_ui/ui/platform/haiku/ui_window_haiku.h -@@ -0,0 +1,12 @@ -+/* -+This file is part of Telegram Desktop for Haiku, -+ -+For license and copyright information please follow this link: -+https://github.com/desktop-app/legal/blob/master/LEGAL -+ -+Copyright (c) 2019-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+*/ -+ -+#pragma once -+ -+#include "ui/platform/ui_platform_window.h" -diff --git a/Telegram/lib_ui/ui/platform/ui_platform_utility.h b/Telegram/lib_ui/ui/platform/ui_platform_utility.h -index e8629a1..01cff34 100644 ---- a/Telegram/lib_ui/ui/platform/ui_platform_utility.h -+++ b/Telegram/lib_ui/ui/platform/ui_platform_utility.h -@@ -45,6 +45,8 @@ bool ShowWindowMenu(QWindow *window); - - #ifdef Q_OS_MAC - #include "ui/platform/mac/ui_utility_mac.h" -+#elif defined Q_OS_HAIKU -+#include "ui/platform/haiku/ui_utility_haiku.h" - #elif defined Q_OS_UNIX // Q_OS_MAC - #include "ui/platform/linux/ui_utility_linux.h" - #elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX -diff --git a/Telegram/lib_ui/ui/style/style_core_custom_font.cpp b/Telegram/lib_ui/ui/style/style_core_custom_font.cpp -index 570d169..8644d20 100644 ---- a/Telegram/lib_ui/ui/style/style_core_custom_font.cpp -+++ b/Telegram/lib_ui/ui/style/style_core_custom_font.cpp -@@ -44,7 +44,10 @@ QFont ResolveFont(uint32 flags, int size) { - const auto point = good.isEmpty() ? size : good.front(); - result = Database.font(custom.family, custom.style, point); - } else { -+// Don't override fonts for Haiku -+#ifndef __HAIKU__ - result.setFamily(GetFontOverride(flags)); -+#endif - if (bold) { - #ifdef DESKTOP_APP_USE_PACKAGED_FONTS - result.setWeight(QFont::DemiBold); -diff --git a/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp b/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp -index 410deb3..4ed5195 100644 ---- a/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp -+++ b/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp -@@ -4,6 +4,14 @@ - // For license and copyright information please follow this link: - // https://github.com/desktop-app/legal/blob/master/LEGAL - // -+ -+// Don't include SupportDefs.h -+#ifdef __HAIKU__ -+#define _SUPPORT_DEFS_H -+typedef int32 status_t; -+typedef uint32 type_code; -+#endif -+ - #include "webrtc/details/webrtc_openal_adm.h" - - #include "base/timer.h" -diff --git a/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp -index 092b667..a681b03 100644 ---- a/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp -+++ b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp -@@ -6,6 +6,13 @@ - // - #include "webrtc/webrtc_audio_input_tester.h" - -+// Don't include SupportDefs.h -+#ifdef __HAIKU__ -+#define _SUPPORT_DEFS_H -+typedef int32 status_t; -+typedef uint32 type_code; -+#endif -+ - #include "webrtc/webrtc_create_adm.h" - #include "media/engine/webrtc_media_engine.h" - #include "api/task_queue/default_task_queue_factory.h" -diff --git a/cmake/external/webrtc/CMakeLists.txt b/cmake/external/webrtc/CMakeLists.txt -index 477fc6f..2d93d07 100644 ---- a/cmake/external/webrtc/CMakeLists.txt -+++ b/cmake/external/webrtc/CMakeLists.txt -@@ -7,7 +7,7 @@ - add_library(external_webrtc INTERFACE IMPORTED GLOBAL) - add_library(desktop-app::external_webrtc ALIAS external_webrtc) - --if (DESKTOP_APP_USE_PACKAGED) -+if (DESKTOP_APP_USE_PACKAGED AND NOT HAIKU) - find_package(tg_owt REQUIRED) - target_link_libraries(external_webrtc INTERFACE tg_owt::tg_owt) - else() -@@ -43,6 +43,11 @@ else() - INTERFACE - WEBRTC_MAC - ) -+ elseif (HAIKU) -+ target_compile_definitions(external_webrtc -+ INTERFACE -+ WEBRTC_HAIKU -+ ) - else() - target_compile_definitions(external_webrtc - INTERFACE -diff --git a/cmake/nice_target_sources.cmake b/cmake/nice_target_sources.cmake -index 81f9a7b..3b55109 100644 ---- a/cmake/nice_target_sources.cmake -+++ b/cmake/nice_target_sources.cmake -@@ -15,6 +15,7 @@ function(nice_target_sources target_name src_loc) - set(not_win_sources "") - set(not_mac_sources "") - set(not_linux_sources "") -+ set(not_haiku_sources "") - foreach (entry ${list}) - if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") - set(writing_now ${entry}) -@@ -23,12 +24,19 @@ function(nice_target_sources target_name src_loc) - if (${entry} MATCHES "(^|/)win/" OR ${entry} MATCHES "(^|/)winrc/" OR ${entry} MATCHES "(^|/)windows/" OR ${entry} MATCHES "[_\\/]win\\.") - list(APPEND not_mac_sources ${full_name}) - list(APPEND not_linux_sources ${full_name}) -+ list(APPEND not_haiku_sources ${full_name}) - elseif (${entry} MATCHES "(^|/)mac/" OR ${entry} MATCHES "(^|/)darwin/" OR ${entry} MATCHES "(^|/)osx/" OR ${entry} MATCHES "[_\\/]mac\\." OR ${entry} MATCHES "[_\\/]darwin\\." OR ${entry} MATCHES "[_\\/]osx\\.") - list(APPEND not_win_sources ${full_name}) - list(APPEND not_linux_sources ${full_name}) -+ list(APPEND not_haiku_sources ${full_name}) - elseif (${entry} MATCHES "(^|/)linux/" OR ${entry} MATCHES "[_\\/]linux\\.") - list(APPEND not_win_sources ${full_name}) - list(APPEND not_mac_sources ${full_name}) -+ list(APPEND not_haiku_sources ${full_name}) -+ elseif (${entry} MATCHES "(^|/)haiku/" OR ${entry} MATCHES "[_\\/]haiku\\.") -+ list(APPEND not_win_sources ${full_name}) -+ list(APPEND not_mac_sources ${full_name}) -+ list(APPEND not_linux_sources ${full_name}) - elseif (${entry} MATCHES "(^|/)posix/" OR ${entry} MATCHES "[_\\/]posix\\.") - list(APPEND not_win_sources ${full_name}) - endif() -@@ -64,6 +72,9 @@ function(nice_target_sources target_name src_loc) - elseif (APPLE) - set_source_files_properties(${not_mac_sources} PROPERTIES HEADER_FILE_ONLY TRUE) - set_source_files_properties(${not_mac_sources} PROPERTIES SKIP_AUTOGEN TRUE) -+ elseif (HAIKU) -+ set_source_files_properties(${not_haiku_sources} PROPERTIES HEADER_FILE_ONLY TRUE) -+ set_source_files_properties(${not_haiku_sources} PROPERTIES SKIP_AUTOGEN TRUE) - elseif (LINUX) - set_source_files_properties(${not_linux_sources} PROPERTIES HEADER_FILE_ONLY TRUE) - set_source_files_properties(${not_linux_sources} PROPERTIES SKIP_AUTOGEN TRUE) -diff --git a/cmake/options.cmake b/cmake/options.cmake -index 28521b2..c162955 100644 ---- a/cmake/options.cmake -+++ b/cmake/options.cmake -@@ -79,6 +79,8 @@ if (WIN32) - include(cmake/options_win.cmake) - elseif (APPLE) - include(cmake/options_mac.cmake) -+elseif (HAIKU) -+ include(cmake/options_haiku.cmake) - elseif (LINUX) - include(cmake/options_linux.cmake) - else() -diff --git a/cmake/options_haiku.cmake b/cmake/options_haiku.cmake -new file mode 100644 -index 0000000..718f37a ---- /dev/null -+++ b/cmake/options_haiku.cmake -@@ -0,0 +1,34 @@ -+# This file is part of Telegram Desktop for Haiku -+# For license and copyright information please follow this link: -+# https://github.com/desktop-app/legal/blob/master/LEGAL -+# Copyright (c) 2019-2020 Gerasim Troeglazov, 3dEyes@gmail.com -+ -+target_compile_options(common_options -+INTERFACE -+ $,,-fno-strict-aliasing> -+ -fPIC -+ -mmmx -+ -msse2 -+ -Wno-unused-variable -+ -Wno-unused-parameter -+ -Wno-unused-function -+ -Wno-switch -+ -Wno-comment -+ -Wno-unused-but-set-variable -+ -Wno-missing-field-initializers -+ -Wno-sign-compare -+ -Wno-attributes -+ -Wno-parentheses -+ -Wno-stringop-overflow -+ -Wno-maybe-uninitialized -+ -Wno-error=class-memaccess -+ -Wno-deprecated-declarations -+) -+ -+target_link_libraries(common_options -+INTERFACE -+ be -+ network -+ media -+ translation -+) -diff --git a/cmake/validate_special_target.cmake b/cmake/validate_special_target.cmake -index 97f61be..f08430d 100644 ---- a/cmake/validate_special_target.cmake -+++ b/cmake/validate_special_target.cmake -@@ -31,7 +31,7 @@ elseif (APPLE) - AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "mac") - report_bad_special_target() - endif() --else() -+elseif (LINUX) - set(LINUX 1) - if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux" - AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux32") -diff --git a/cmake/variables.cmake b/cmake/variables.cmake -index e429c00..f2b6689 100644 ---- a/cmake/variables.cmake -+++ b/cmake/variables.cmake -@@ -62,6 +62,7 @@ set(build_winstore 0) # 32 or 64 bit - set(build_linux32 0) - set(build_win64 0) # normal or uwp - set(build_winstore64 0) -+set(build_haiku 0) - - if (WIN32) - if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "win64") -@@ -79,6 +80,12 @@ elseif (APPLE) - elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore") - set(build_macstore 1) - endif() -+elseif (HAIKU) -+ set(build_haiku 1) -+ set(DESKTOP_APP_USE_GLIBC_WRAPS OFF) -+ set(CMAKE_AR gcc-ar) -+ set(CMAKE_RANLIB gcc-ranlib) -+ set(CMAKE_NM gcc-nm) - else() - if (CMAKE_SIZEOF_VOID_P EQUAL 4) - set(build_linux32 1) --- -2.30.0 - diff --git a/net-im/telegram-desktop/patches/telegram_desktop-2.6.1.patchset b/net-im/telegram-desktop/patches/telegram_desktop-2.6.1.patchset new file mode 100644 index 000000000..da37d0d48 --- /dev/null +++ b/net-im/telegram-desktop/patches/telegram_desktop-2.6.1.patchset @@ -0,0 +1,742 @@ +From 5fff21fdc96b36c3eb24ca31b8ce3c81b3817029 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Thu, 25 Feb 2021 17:20:48 +1000 +Subject: Add haiku support + + +diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt +index c5ba8fd..19037d3 100644 +--- a/Telegram/CMakeLists.txt ++++ b/Telegram/CMakeLists.txt +@@ -1137,6 +1137,18 @@ if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION) + ) + endif() + ++if (HAIKU) ++ remove_target_sources(Telegram ${src_loc} ++ platform/linux/notifications_manager_linux.h ++ platform/linux/notifications_manager_linux_dummy.cpp ++ ) ++ nice_target_sources(Telegram ${src_loc} ++ PRIVATE ++ platform/linux/notifications_manager_haiku.h ++ platform/linux/notifications_manager_haiku.cpp ++ ) ++endif() ++ + if (DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) + remove_target_sources(Telegram ${src_loc} platform/linux/linux_wayland_integration.cpp) + nice_target_sources(Telegram ${src_loc} PRIVATE platform/linux/linux_wayland_integration_dummy.cpp) +@@ -1263,7 +1275,7 @@ elseif (build_osx) + else() + set(bundle_identifier "com.tdesktop.Telegram$<$:Debug>") + set(bundle_entitlements "Telegram.entitlements") +- if (LINUX AND DESKTOP_APP_USE_PACKAGED) ++ if (LINUX AND NOT HAIKU AND DESKTOP_APP_USE_PACKAGED) + set(output_name "telegram-desktop") + else() + set(output_name "Telegram") +diff --git a/Telegram/SourceFiles/core/core_settings.h b/Telegram/SourceFiles/core/core_settings.h +index 732f75b..138608f 100644 +--- a/Telegram/SourceFiles/core/core_settings.h ++++ b/Telegram/SourceFiles/core/core_settings.h +@@ -586,7 +586,7 @@ private: + rpl::variable _dialogsWidthRatio; // per-window + rpl::variable _thirdColumnWidth = kDefaultThirdColumnWidth; // p-w + bool _notifyFromAll = true; +- rpl::variable _nativeWindowFrame = false; ++ rpl::variable _nativeWindowFrame = true; + rpl::variable> _systemDarkMode = std::nullopt; + rpl::variable _systemDarkModeEnabled = false; + WindowPosition _windowPosition; // per-window +diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +index 9796164..947f7fc 100644 +--- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +@@ -620,14 +620,26 @@ bool MainWindow::hasTrayIcon() const { + + bool MainWindow::isActiveForTrayMenu() { + updateIsActive(); ++#ifdef Q_OS_HAIKU ++ return isVisible(); ++#else + return Platform::IsWayland() ? isVisible() : isActive(); ++#endif + } + + void MainWindow::psShowTrayMenu() { ++#ifndef Q_OS_HAIKU + _trayIconMenuXEmbed->popup(QCursor::pos()); ++#endif + } + + void MainWindow::psTrayMenuUpdated() { ++#ifdef Q_OS_HAIKU ++ if (trayIcon && trayIconMenu ++ && trayIcon->contextMenu() != trayIconMenu) { ++ trayIcon->setContextMenu(trayIconMenu); ++ } ++#endif + } + + #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION +@@ -893,8 +905,10 @@ void MainWindow::updateIconCounters() { + } + + void MainWindow::initTrayMenuHook() { ++#ifndef Q_OS_HAIKU + _trayIconMenuXEmbed.emplace(nullptr, trayIconMenu); + _trayIconMenuXEmbed->deleteOnHide(false); ++#endif + } + + #ifdef DESKTOP_APP_DISABLE_DBUS_INTEGRATION +diff --git a/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.cpp b/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.cpp +new file mode 100644 +index 0000000..d567f10 +--- /dev/null ++++ b/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.cpp +@@ -0,0 +1,64 @@ ++/* ++This file is part of Telegram Desktop for Haiku, ++ ++For license and copyright information please follow this link: ++https://github.com/desktop-app/legal/blob/master/LEGAL ++ ++Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com ++*/ ++ ++#include ++#include ++ ++#include ++#include ++ ++#define APPSIGNATURE "application/x-vnd.tg-notify-gate" ++#define NOTIFY_PORT_NAME "tg_notify" ++#define NOTIFY_MESSAGE 'TGNF' ++ ++typedef struct notify_msg ++{ ++ uint64 sessionId; ++ uint64 peerId; ++ int32 msgId; ++} notify_msg; ++ ++class SimpleLauncherApp : public BApplication { ++ public: ++ SimpleLauncherApp(int argc, char **argv); ++ void ArgvReceived(int32 argc, char **argv); ++ virtual void ReadyToRun(); ++}; ++ ++SimpleLauncherApp::SimpleLauncherApp(int argc, char **argv) : BApplication(APPSIGNATURE) ++{ ++} ++ ++void ++SimpleLauncherApp::ArgvReceived(int32 argc, char **argv) ++{ ++ if (argc == 2) { ++ notify_msg message; ++ sscanf(argv[1], "%lld %lld %d", &message.sessionId, &message.peerId, &message.msgId); ++ if (message.peerId != 0 && message.msgId != 0) { ++ port_id portId = find_port(NOTIFY_PORT_NAME); ++ if (portId > 0) { ++ write_port(portId, NOTIFY_MESSAGE, &message, sizeof(message)); ++ } ++ } ++ } ++} ++ ++void ++SimpleLauncherApp::ReadyToRun() ++{ ++ Quit(); ++} ++ ++int main(int argc, char **argv) ++{ ++ SimpleLauncherApp application(argc, argv); ++ application.Run(); ++ return 0; ++} +diff --git a/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.rdef b/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.rdef +new file mode 100644 +index 0000000..b6f3490 +--- /dev/null ++++ b/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.rdef +@@ -0,0 +1,13 @@ ++resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP; ++ ++resource app_version { ++ major = 0, ++ middle = 0, ++ minor = 1, ++ variety = B_APPV_FINAL, ++ internal = 0, ++ short_info = "tg-notify-gate", ++ long_info = "Telegram native notifications gate" ++}; ++ ++resource app_signature "application/x-vnd.tg-notify-gate"; +diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.cpp +new file mode 100644 +index 0000000..e36b747 +--- /dev/null ++++ b/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.cpp +@@ -0,0 +1,202 @@ ++/* ++This file is part of Telegram Desktop for Haiku, ++ ++For license and copyright information please follow this link: ++https://github.com/desktop-app/legal/blob/master/LEGAL ++ ++Copyright (c) 2018-2021 Gerasim Troeglazov, 3dEyes@gmail.com ++*/ ++ ++#ifdef __x86_64__ ++#define int64 __haiku_int64 ++#define uint64 __haiku_uint64 ++#else ++#define int32 __haiku_int32 ++#define uint32 __haiku_uint32 ++#endif ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "platform/linux/notifications_manager_haiku.h" ++ ++#include "window/notifications_utilities.h" ++#include "history/history.h" ++#include "lang/lang_keys.h" ++#include "core/application.h" ++#include "core/core_settings.h" ++#include "main/main_session.h" ++ ++#define DeclareReadOnlyVar(Type, Name) const Type &Name(); ++#define DeclareRefVar(Type, Name) DeclareReadOnlyVar(Type, Name) \ ++ Type &Ref##Name(); ++#define DeclareVar(Type, Name) DeclareRefVar(Type, Name) \ ++ void Set##Name(const Type &Name); ++ ++#include ++#include ++#include ++#include ++#include ++ ++namespace Platform { ++namespace Notifications { ++namespace { ++ ++} // namespace ++ ++bool Supported() { ++ return true; ++} ++ ++void Create(Window::Notifications::System *system) { ++ if (Core::App().settings().nativeNotifications() && Supported()) { ++ auto result = std::make_unique(system); ++ system->setManager(std::move(result)); ++ return; ++ } ++ system->setManager(nullptr); ++} ++ ++void Finish() { ++} ++ ++NotifyReader::NotifyReader() ++{ ++ portId = create_port(NOTIFY_MESSAGE_DEEP, NOTIFY_PORT_NAME); ++} ++ ++NotifyReader::~NotifyReader() ++{ ++ if (portId >= B_OK) ++ delete_port(portId); ++} ++ ++void NotifyReader::run() ++{ ++ notify_msg message; ++ int32 code; ++ ++ while (true) { ++ ssize_t bytesRead = read_port(portId, &code, &message, sizeof(message)); ++ if (bytesRead == B_BAD_PORT_ID) ++ break; ++ if (bytesRead < (ssize_t)sizeof(message) || code != NOTIFY_MESSAGE) ++ continue; ++ if (message.peerId != 0 && message.msgId != 0) ++ notificationActivated(message.sessionId, message.peerId, message.msgId); ++ } ++} ++ ++Manager::Private::Private(not_null manager, Type type) ++: _cachedUserpics(type) ++, _manager(manager) { ++ portReaderThread = new QThread; ++ portReader = new NotifyReader(); ++ portReader->moveToThread(portReaderThread); ++ connect(portReaderThread, SIGNAL(started()), portReader, SLOT(run())); ++ qRegisterMetaType("PeerId"); ++ qRegisterMetaType("MsgId"); ++ connect( ++ portReader, ++ SIGNAL(notificationActivated(PeerId, PeerId, MsgId)), ++ this, ++ SLOT(notificationActivatedSlot(PeerId, PeerId, MsgId))); ++ portReaderThread->start(); ++} ++ ++void Manager::Private::showNotification( ++ not_null peer, ++ std::shared_ptr &userpicView, ++ MsgId msgId, ++ const QString &title, ++ const QString &subtitle, ++ const QString &msg, ++ bool hideNameAndPhoto, ++ bool hideReplyButton) { ++ auto titleText = title; ++ auto subtitleText = subtitle; ++ auto msgText = msg; ++ ++ const auto key = hideNameAndPhoto ++ ? InMemoryKey() ++ : peer->userpicUniqueKey(userpicView); ++ ++ auto userpicPath = _cachedUserpics.get(key, peer, userpicView); ++ BBitmap *icon = BTranslationUtils::GetBitmapFile(userpicPath.toUtf8().data()); ++ QString args = QString("%1 %2 %3").arg(peer->session().uniqueId()).arg(peer->id).arg(msgId); ++ BNotification notify(B_INFORMATION_NOTIFICATION); ++ if (icon) ++ notify.SetIcon(icon); ++ notify.SetGroup("Telegram"); ++ notify.SetTitle(titleText.toUtf8().data()); ++ notify.SetContent(msgText.toUtf8().data()); ++ entry_ref ref; ++ BEntry entry(NOTIFY_GATE_NAME); ++ entry.GetRef(&ref); ++ notify.SetOnClickFile(&ref); ++ notify.AddOnClickArg(BString(args.toUtf8().data())); ++ notify.Send(); ++} ++ ++void ++Manager::Private::notificationActivatedSlot(PeerId _sessionId, PeerId _peerId, MsgId _msgId) { ++ const auto manager = _manager; ++ const auto my = Window::Notifications::Manager::NotificationId{ ++ .full = Manager::FullPeer{ ++ .sessionId = _sessionId, ++ .peerId = _peerId ++ }, ++ .msgId = _msgId ++ }; ++ crl::on_main(manager, [=] { ++ manager->notificationActivated(my); ++ }); ++} ++ ++Manager::Manager(Window::Notifications::System *system) : NativeManager(system) ++, _private(std::make_unique(this, Private::Type::Rounded)) { ++} ++ ++Manager::~Manager() = default; ++ ++void Manager::doShowNativeNotification( ++ not_null peer, ++ std::shared_ptr &userpicView, ++ MsgId msgId, ++ const QString &title, ++ const QString &subtitle, ++ const QString &msg, ++ bool hideNameAndPhoto, ++ bool hideReplyButton) { ++ _private->showNotification( ++ peer, ++ userpicView, ++ msgId, ++ title, ++ subtitle, ++ msg, ++ hideNameAndPhoto, ++ hideReplyButton); ++} ++ ++void Manager::doClearAllFast() { ++} ++ ++void Manager::doClearFromHistory(not_null history) { ++} ++ ++void Manager::doClearFromSession(not_null session) { ++} ++ ++} // namespace Notifications ++} // namespace Platform +diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.h b/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.h +new file mode 100644 +index 0000000..1f80b62 +--- /dev/null ++++ b/Telegram/SourceFiles/platform/linux/notifications_manager_haiku.h +@@ -0,0 +1,123 @@ ++/* ++This file is part of Telegram Desktop for Haiku, ++ ++For license and copyright information please follow this link: ++https://github.com/desktop-app/legal/blob/master/LEGAL ++ ++Copyright (c) 2018-2021 Gerasim Troeglazov, 3dEyes@gmail.com ++*/ ++ ++#pragma once ++ ++#include "platform/platform_notifications_manager.h" ++#include "window/notifications_utilities.h" ++ ++#include ++#include ++#include ++ ++#define NOTIFY_MESSAGE_DEEP 16 ++#define NOTIFY_PORT_NAME "tg_notify" ++#define NOTIFY_GATE_NAME "/bin/tg-notify-gate" ++#define NOTIFY_MESSAGE 'TGNF' ++ ++typedef struct notify_msg ++{ ++ uint64 sessionId; ++ uint64 peerId; ++ int32 msgId; ++} notify_msg; ++ ++namespace Platform { ++namespace Notifications { ++ ++inline bool SkipAudio() { ++ return false; ++} ++ ++inline bool SkipToast() { ++ return false; ++} ++ ++inline bool SkipFlashBounce() { ++ return false; ++} ++ ++inline bool Enforced() { ++ return false; ++} ++ ++inline bool ByDefault() { ++ return true; ++} ++ ++void Finish(); ++ ++class NotifyReader:public QObject { ++ Q_OBJECT ++public: ++ NotifyReader(); ++ ~NotifyReader(); ++public slots: ++ void run(); ++signals: ++ void notificationActivated(PeerId sessionId, PeerId peerId, MsgId msgId); ++private: ++ int32 portId; ++}; ++ ++ ++class Manager : public Window::Notifications::NativeManager, public base::has_weak_ptr { ++public: ++ Manager(Window::Notifications::System *system); ++ ~Manager(); ++ ++protected: ++ void doShowNativeNotification( ++ not_null peer, ++ std::shared_ptr &userpicView, ++ MsgId msgId, ++ const QString &title, ++ const QString &subtitle, ++ const QString &msg, ++ bool hideNameAndPhoto, ++ bool hideReplyButton) override; ++ void doClearAllFast() override; ++ void doClearFromHistory(not_null history) override; ++ void doClearFromSession(not_null session) override; ++ ++private: ++ class Private; ++ const std::unique_ptr _private; ++}; ++ ++class Manager::Private : public QObject { ++ Q_OBJECT ++ ++public: ++ using Type = Window::Notifications::CachedUserpics::Type; ++ explicit Private(not_null manager, Type type); ++ ++ void showNotification( ++ not_null peer, ++ std::shared_ptr &userpicView, ++ MsgId msgId, ++ const QString &title, ++ const QString &subtitle, ++ const QString &msg, ++ bool hideNameAndPhoto, ++ bool hideReplyButton); ++ ++public slots: ++ void notificationActivatedSlot(PeerId sessionId, PeerId peerId, MsgId msgId); ++ ++private: ++ Window::Notifications::CachedUserpics _cachedUserpics; ++ base::weak_ptr _manager; ++ ++ QThread *portReaderThread; ++ NotifyReader *portReader; ++}; ++ ++} // namespace Notifications ++} // namespace Platform +diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp +index 386de2e..7bd4dff 100644 +--- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp ++++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp +@@ -618,7 +618,7 @@ QString GetHomeDir() { + return home; + } + +-#ifdef __HAIKU__ ++#ifdef Q_OS_HAIKU + void HaikuAutostart(bool start) { + const auto home = GetHomeDir(); + if (home.isEmpty()) { +@@ -643,7 +643,7 @@ void HaikuAutostart(bool start) { + file.remove(); + } + } +-#endif // __HAIKU__ ++#endif // Q_OS_HAIKU + + } // namespace + +@@ -660,8 +660,11 @@ QString psAppDataPath() { + return oldPath; + } + } +- ++#ifdef Q_OS_HAIKU ++ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + '/'; ++#else + return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + '/'; ++#endif + } + + void psDoCleanup() { +@@ -895,7 +898,7 @@ bool OpenSystemSettings(SystemSettingsType type) { + } else if (DesktopEnvironment::IsMATE()) { + add("mate-volume-control"); + } +-#ifdef __HAIKU__ ++#ifdef Q_OS_HAIKU + add("Media"); + #endif // __ HAIKU__ + add("pavucontrol-qt"); +@@ -958,17 +961,17 @@ void finish() { + } // namespace Platform + + void psNewVersion() { +-#ifndef __HAIKU__ ++#ifndef Q_OS_HAIKU + Platform::InstallLauncher(); +-#endif // __HAIKU__ ++#endif // Q_OS_HAIKU + Platform::RegisterCustomScheme(); + } + + void psAutoStart(bool start, bool silent) { +-#ifdef __HAIKU__ ++#ifdef Q_OS_HAIKU + HaikuAutostart(start); + return; +-#endif // __HAIKU__ ++#endif // Q_OS_HAIKU + + if (InFlatpak()) { + #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION +diff --git a/Telegram/SourceFiles/platform/platform_notifications_manager.h b/Telegram/SourceFiles/platform/platform_notifications_manager.h +index eb3efbd..2cd3ca1 100644 +--- a/Telegram/SourceFiles/platform/platform_notifications_manager.h ++++ b/Telegram/SourceFiles/platform/platform_notifications_manager.h +@@ -28,8 +28,10 @@ void Create(Window::Notifications::System *system); + + #ifdef Q_OS_MAC + #include "platform/mac/notifications_manager_mac.h" +-#elif defined Q_OS_UNIX // Q_OS_MAC ++#elif defined Q_OS_HAIKU // Q_OS_MAC ++#include "platform/linux/notifications_manager_haiku.h" ++#elif defined Q_OS_UNIX // Q_OS_MAC || Q_OS_HAIKU + #include "platform/linux/notifications_manager_linux.h" +-#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX ++#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX || Q_OS_HAIKU + #include "platform/win/notifications_manager_win.h" +-#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN ++#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN || Q_OS_HAIKU +diff --git a/Telegram/cmake/lib_tgvoip.cmake b/Telegram/cmake/lib_tgvoip.cmake +index 79f5023..b1f82ab 100644 +--- a/Telegram/cmake/lib_tgvoip.cmake ++++ b/Telegram/cmake/lib_tgvoip.cmake +@@ -181,7 +181,6 @@ if (NOT TGVOIP_FOUND) + ) + target_link_libraries(lib_tgvoip_bundled + PRIVATE +- be + network + media + ) +diff --git a/Telegram/lib_ui/ui/platform/linux/ui_utility_linux.cpp b/Telegram/lib_ui/ui/platform/linux/ui_utility_linux.cpp +index 80f2ffa..268a0bd 100644 +--- a/Telegram/lib_ui/ui/platform/linux/ui_utility_linux.cpp ++++ b/Telegram/lib_ui/ui/platform/linux/ui_utility_linux.cpp +@@ -296,7 +296,7 @@ TitleControls::Layout TitleControlsLayout() { + return *gtkResult; + } + +-#ifdef __HAIKU__ ++#ifdef Q_OS_HAIKU + return TitleControls::Layout{ + .left = { + TitleControls::Control::Close, +@@ -306,7 +306,7 @@ TitleControls::Layout TitleControlsLayout() { + TitleControls::Control::Maximize, + } + }; +-#else // __HAIKU__ ++#else // Q_OS_HAIKU + return TitleControls::Layout{ + .right = { + TitleControls::Control::Minimize, +@@ -314,7 +314,7 @@ TitleControls::Layout TitleControlsLayout() { + TitleControls::Control::Close, + } + }; +-#endif // !__HAIKU__ ++#endif // !Q_OS_HAIKU + } + + } // namespace Platform +diff --git a/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp b/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp +index 410deb3..e0ec769 100644 +--- a/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp ++++ b/Telegram/lib_webrtc/webrtc/details/webrtc_openal_adm.cpp +@@ -4,6 +4,13 @@ + // For license and copyright information please follow this link: + // https://github.com/desktop-app/legal/blob/master/LEGAL + // ++ ++#ifdef __HAIKU__ ++#define _SUPPORT_DEFS_H ++typedef int32 status_t; ++typedef uint32 type_code; ++#endif ++ + #include "webrtc/details/webrtc_openal_adm.h" + + #include "base/timer.h" +diff --git a/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp +index 092b667..e594a22 100644 +--- a/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp ++++ b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp +@@ -4,6 +4,13 @@ + // For license and copyright information please follow this link: + // https://github.com/desktop-app/legal/blob/master/LEGAL + // ++ ++#ifdef __HAIKU__ ++#define _SUPPORT_DEFS_H ++typedef int32 status_t; ++typedef uint32 type_code; ++#endif ++ + #include "webrtc/webrtc_audio_input_tester.h" + + #include "webrtc/webrtc_create_adm.h" +diff --git a/cmake/nice_target_sources.cmake b/cmake/nice_target_sources.cmake +index 81f9a7b..38d81f9 100644 +--- a/cmake/nice_target_sources.cmake ++++ b/cmake/nice_target_sources.cmake +@@ -15,6 +15,7 @@ function(nice_target_sources target_name src_loc) + set(not_win_sources "") + set(not_mac_sources "") + set(not_linux_sources "") ++ set(not_haiku_sources "") + foreach (entry ${list}) + if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE") + set(writing_now ${entry}) +@@ -23,12 +24,18 @@ function(nice_target_sources target_name src_loc) + if (${entry} MATCHES "(^|/)win/" OR ${entry} MATCHES "(^|/)winrc/" OR ${entry} MATCHES "(^|/)windows/" OR ${entry} MATCHES "[_\\/]win\\.") + list(APPEND not_mac_sources ${full_name}) + list(APPEND not_linux_sources ${full_name}) ++ list(APPEND not_haiku_sources ${full_name}) + elseif (${entry} MATCHES "(^|/)mac/" OR ${entry} MATCHES "(^|/)darwin/" OR ${entry} MATCHES "(^|/)osx/" OR ${entry} MATCHES "[_\\/]mac\\." OR ${entry} MATCHES "[_\\/]darwin\\." OR ${entry} MATCHES "[_\\/]osx\\.") + list(APPEND not_win_sources ${full_name}) + list(APPEND not_linux_sources ${full_name}) ++ list(APPEND not_haiku_sources ${full_name}) + elseif (${entry} MATCHES "(^|/)linux/" OR ${entry} MATCHES "[_\\/]linux\\.") + list(APPEND not_win_sources ${full_name}) + list(APPEND not_mac_sources ${full_name}) ++ elseif (${entry} MATCHES "(^|/)haiku/" OR ${entry} MATCHES "[_\\/]haiku\\.") ++ list(APPEND not_win_sources ${full_name}) ++ list(APPEND not_mac_sources ${full_name}) ++ list(APPEND not_linux_sources ${full_name}) + elseif (${entry} MATCHES "(^|/)posix/" OR ${entry} MATCHES "[_\\/]posix\\.") + list(APPEND not_win_sources ${full_name}) + endif() +@@ -64,6 +71,9 @@ function(nice_target_sources target_name src_loc) + elseif (APPLE) + set_source_files_properties(${not_mac_sources} PROPERTIES HEADER_FILE_ONLY TRUE) + set_source_files_properties(${not_mac_sources} PROPERTIES SKIP_AUTOGEN TRUE) ++ elseif (HAIKU) ++ set_source_files_properties(${not_haiku_sources} PROPERTIES HEADER_FILE_ONLY TRUE) ++ set_source_files_properties(${not_haiku_sources} PROPERTIES SKIP_AUTOGEN TRUE) + elseif (LINUX) + set_source_files_properties(${not_linux_sources} PROPERTIES HEADER_FILE_ONLY TRUE) + set_source_files_properties(${not_linux_sources} PROPERTIES SKIP_AUTOGEN TRUE) +diff --git a/cmake/options_linux.cmake b/cmake/options_linux.cmake +index d586e79..ef8b213 100644 +--- a/cmake/options_linux.cmake ++++ b/cmake/options_linux.cmake +@@ -60,3 +60,11 @@ if (ATOMIC_LIBRARY) + ${ATOMIC_LIBRARY} + ) + endif() ++ ++if (HAIKU) ++ target_link_libraries(common_options ++ INTERFACE ++ be ++ translation ++ ) ++endif() +-- +2.30.0 + diff --git a/net-im/telegram-desktop/telegram_desktop-2.5.9.recipe b/net-im/telegram-desktop/telegram_desktop-2.6.1.recipe similarity index 64% rename from net-im/telegram-desktop/telegram_desktop-2.5.9.recipe rename to net-im/telegram-desktop/telegram_desktop-2.6.1.recipe index 2d7615876..1ba0a0dce 100644 --- a/net-im/telegram-desktop/telegram_desktop-2.5.9.recipe +++ b/net-im/telegram-desktop/telegram_desktop-2.6.1.recipe @@ -5,32 +5,18 @@ COPYRIGHT="2013-2021 Telegram" LICENSE="GNU GPL v3" REVISION="1" SOURCE_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v$portVersion/tdesktop-$portVersion-full.tar.gz" -CHECKSUM_SHA256="82eefd342d8ba380e08a8606ac59a34bfacfb2f501408a0385884696966a218c" +CHECKSUM_SHA256="c7878c4d7c621a175b3b27895b3fb8c20a56319214d5030d734b2768390a8b73" SOURCE_FILENAME="tdesktop-$portVersion-full.tar.gz" SOURCE_DIR="tdesktop-$portVersion-full" -srcGitRev_2="be23804afce3bb2e80a1d57a7c1318c71b82b7de" -SOURCE_URI_2="https://github.com/desktop-app/tg_owt/archive/$srcGitRev_2.tar.gz" -CHECKSUM_SHA256_2="b0bcf4f982fe955d41d30c2d2ccab65a9f7fc587dc334c03219aba0c4dd3d13e" -SOURCE_FILENAME_2="tg_owt-$srcGitRev_2.tar.gz" -srcGitRev_3="ebb5ffc1d462c70dfb2283a5c7afcb75288c7692" -SOURCE_URI_3="https://github.com/webmproject/libvpx/archive/$srcGitRev_3.tar.gz" -CHECKSUM_SHA256_3="a7adf6a905fe7e51caf45ef16c2c4b80fff253db08d49633a045310e0fd3793c" -SOURCE_FILENAME_3="libvpx-$srcGitRev_3.tar.gz" -srcGitRev_4="19d71f6b351fe992ae34b114eebd872c383a6bdb" -SOURCE_URI_4="https://github.com/lemenkov/libyuv/archive/$srcGitRev_4.tar.gz" -CHECKSUM_SHA256_4="64a277a20a85f38ac963a9434ec7faa261bf66d2f9268c24461476c8b3d9b39f" -SOURCE_FILENAME_4="libyuv-$srcGitRev_4.tar.gz" -srcGitRev_5="2b383fe05f8ae78ac99470b9a2b9ea22b3ee5a92" -SOURCE_URI_5="https://salsa.debian.org/debian/telegram-desktop/-/raw/$srcGitRev_5/debian/rules#noarchive" -CHECKSUM_SHA256_5="613e7e357518739e1f7d035337f37c344b248283fd4d916ddc95df73c2ff84ad" +srcGitRev_2="2b383fe05f8ae78ac99470b9a2b9ea22b3ee5a92" +SOURCE_URI_2="https://salsa.debian.org/debian/telegram-desktop/-/raw/$srcGitRev_2/debian/rules#noarchive" +CHECKSUM_SHA256_2="613e7e357518739e1f7d035337f37c344b248283fd4d916ddc95df73c2ff84ad" -PATCHES="telegram_desktop-$portVersion.patchset" -PATCHES_2="telegram_desktop-$portVersion-owt.patchset" - -ADDITIONAL_FILES=" - telegram_desktop.rdef.in - logo_256_no_margin.png +PATCHES=" + libtgvoip-$portVersion.patchset + telegram_desktop-$portVersion.patchset " +ADDITIONAL_FILES="telegram_desktop.rdef.in" ARCHITECTURES="!x86_gcc2 x86_64" SECONDARY_ARCHITECTURES="x86" @@ -42,6 +28,7 @@ PROVIDES=" " REQUIRES=" haiku$secondaryArchSuffix + lib:libatomic$secondaryArchSuffix lib:libavcodec$secondaryArchSuffix lib:libavformat$secondaryArchSuffix lib:libavutil$secondaryArchSuffix @@ -49,6 +36,7 @@ REQUIRES=" lib:libglib_2.0$secondaryArchSuffix lib:libgthread_2.0$secondaryArchSuffix lib:libhunspell_1.7$secondaryArchSuffix + lib:libintl$secondaryArchSuffix lib:libjpeg$secondaryArchSuffix lib:liblz4$secondaryArchSuffix lib:liblzma$secondaryArchSuffix @@ -88,6 +76,7 @@ BUILD_REQUIRES=" devel:librapidjson$secondaryArchSuffix devel:libswresample$secondaryArchSuffix devel:libswscale$secondaryArchSuffix + devel:libtg_owt$secondaryArchSuffix devel:libxxhash$secondaryArchSuffix devel:libz$secondaryArchSuffix devel:range_v3$secondaryArchSuffix @@ -103,38 +92,13 @@ BUILD_PREREQUIRES=" cmd:yasm " -PATCH() -{ - cp -f $sourceDir/../../../additional-files/logo_256_no_margin.png Telegram/Resources/art -} - BUILD() { export DISABLE_ASLR=1 - #link submodules - mkdir -p $sourceDir/../Libraries - ln -sfn $sourceDir2/tg_owt-$srcGitRev_2 $sourceDir/../Libraries/tg_owt - rm -rf $sourceDir2/tg_owt-$srcGitRev_2/src/third_party/libvpx/source/libvpx - ln -sfn $sourceDir3/libvpx-$srcGitRev_3 $sourceDir2/tg_owt-$srcGitRev_2/src/third_party/libvpx/source/libvpx - rm -rf $sourceDir2/tg_owt-$srcGitRev_2/src/third_party/libyuv - ln -sfn $sourceDir4/libyuv-$srcGitRev_4 $sourceDir2/tg_owt-$srcGitRev_2/src/third_party/libyuv - - # build webrtc - mkdir -p $sourceDir/../Libraries/tg_owt/out/Release - cd $sourceDir/../Libraries/tg_owt/out/Release - cmake ../.. \ - -DCMAKE_BUILD_TYPE=Release \ - -DTG_OWT_SPECIAL_TARGET=haiku \ - -DTG_OWT_LIBJPEG_INCLUDE_PATH=/system/$relativeIncludeDir \ - -DTG_OWT_OPENSSL_INCLUDE_PATH=/system/$relativeIncludeDir \ - -DTG_OWT_OPUS_INCLUDE_PATH=/system/$relativeIncludeDir/opus \ - -DTG_OWT_FFMPEG_INCLUDE_PATH=/system/$relativeIncludeDir - make $jobArgs - # get API_ID and API_HASH from Debian - local TELEGRAM_API_ID=`sed -n 's/TELEGRAM_API_ID = \(.*\)/\1/p' < $sourceDir5/rules` - local TELEGRAM_API_HASH=`sed -n 's/TELEGRAM_API_HASH = \(.*\)/\1/p' < $sourceDir5/rules` + local TELEGRAM_API_ID=`sed -n "/TDESKTOP_API_ID/p" $sourceDir2/rules | cut -d'=' -f2 | cut -d' ' -f1` + local TELEGRAM_API_HASH=`sed -n "/TDESKTOP_API_HASH/p" $sourceDir2/rules | cut -d'=' -f2 | cut -d' ' -f1` if [ -z $TELEGRAM_API_ID ] || [ -z $TELEGRAM_API_HASH ]; then TELEGRAM_API_ID="17349" @@ -149,26 +113,30 @@ BUILD() fi # build telegram - mkdir -p $sourceDir/build - cd $sourceDir/build + mkdir -p build + cd build cmake .. \ -DCMAKE_BUILD_TYPE=Release \ - -DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON \ -DTDESKTOP_API_TEST=OFF \ -DTDESKTOP_DISABLE_GTK_INTEGRATION=ON \ - -DDESKTOP_APP_DISABLE_AUTOUPDATE=ON \ + -DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON \ -DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=ON \ - -DDESKTOP_APP_USE_PACKAGED_FONTS=ON \ + -DDESKTOP_APP_DISABLE_GTK_INTEGRATION=ON \ + -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=ON \ + -DDESKTOP_APP_DISABLE_X11_INTEGRATION=ON \ + -DDESKTOP_APP_DISABLE_AUTOUPDATE=ON \ + -DDESKTOP_APP_USE_PACKAGED_FONTS=OFF \ -DDESKTOP_APP_USE_HUNSPELL_ONLY=ON \ -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF \ -DTDESKTOP_API_ID=$TELEGRAM_API_ID \ -DTDESKTOP_API_HASH=$TELEGRAM_API_HASH + make $jobArgs #build notify gate tool - gcc -o tg-notify-gate $sourceDir/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp -lbe - rc -o tg-notify-gate.rsrc $sourceDir/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef + gcc -o tg-notify-gate $sourceDir/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.cpp -lbe + rc -o tg-notify-gate.rsrc $sourceDir/Telegram/SourceFiles/platform/linux/notifications_haiku_gate.rdef xres -o tg-notify-gate tg-notify-gate.rsrc mimeset --all tg-notify-gate }