From 270a8c70e9c6aec526eba562e6918ad59c9f072d Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 31 Dec 2020 14:10:17 +0200 Subject: [PATCH] ggwave-gui : add focus argument to addFile --- examples/ggwave-gui/common.cpp | 18 ++++++++++-------- examples/ggwave-gui/common.h | 6 ++++-- examples/ggwave-gui/interface-unix.cpp | 2 +- examples/ggwave-gui/main.cpp | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/examples/ggwave-gui/common.cpp b/examples/ggwave-gui/common.cpp index ecbfe42..53caca4 100644 --- a/examples/ggwave-gui/common.cpp +++ b/examples/ggwave-gui/common.cpp @@ -320,7 +320,8 @@ void addFile( const char * uri, const char * filename, const char * dataBuffer, - size_t dataSize) { + size_t dataSize, + bool focus) { GGSock::FileServer::FileData file; file.info.uri = uri; file.info.filename = filename; @@ -329,15 +330,16 @@ void addFile( g_fileServer.addFile(std::move(file)); -#ifndef IOS - g_focusFileSend = true; -#endif + if (focus) { + g_focusFileSend = true; + } } void addFile( const char * uri, const char * filename, - std::vector && data) { + std::vector && data, + bool focus) { GGSock::FileServer::FileData file; file.info.uri = uri; file.info.filename = filename; @@ -345,9 +347,9 @@ void addFile( g_fileServer.addFile(std::move(file)); -#ifndef IOS - g_focusFileSend = true; -#endif + if (focus) { + g_focusFileSend = true; + } } std::string generateFileBroadcastMessage() { diff --git a/examples/ggwave-gui/common.h b/examples/ggwave-gui/common.h index d3d965a..a3d37de 100644 --- a/examples/ggwave-gui/common.h +++ b/examples/ggwave-gui/common.h @@ -53,9 +53,11 @@ void addFile( const char * uri, const char * filename, const char * dataBuffer, - size_t dataSize); + size_t dataSize, + bool focus); void addFile( const char * uri, const char * filename, - std::vector && data); + std::vector && data, + bool focus); diff --git a/examples/ggwave-gui/interface-unix.cpp b/examples/ggwave-gui/interface-unix.cpp index d1132ee..ad34f85 100644 --- a/examples/ggwave-gui/interface-unix.cpp +++ b/examples/ggwave-gui/interface-unix.cpp @@ -41,7 +41,7 @@ void interface_receiveFile( const char * filename, const char * dataBuffer, size_t dataSize) { - addFile(uri, filename, dataBuffer, dataSize); + addFile(uri, filename, dataBuffer, dataSize, false); } bool interface_needReloadFiles() { diff --git a/examples/ggwave-gui/main.cpp b/examples/ggwave-gui/main.cpp index 02f832d..52a0d0c 100644 --- a/examples/ggwave-gui/main.cpp +++ b/examples/ggwave-gui/main.cpp @@ -47,7 +47,7 @@ bool ImGui_BeginFrame(SDL_Window * window) { if (uri.find("/") || uri.find("\\")) { filename = uri.substr(uri.find_last_of("/\\") + 1); } - addFile(uri.c_str(), filename.c_str(), std::move(data)); + addFile(uri.c_str(), filename.c_str(), std::move(data), true); break; } }