diff --git a/include/eepp/ui/uicodeeditor.hpp b/include/eepp/ui/uicodeeditor.hpp index 87ef38388..afdcf7d39 100644 --- a/include/eepp/ui/uicodeeditor.hpp +++ b/include/eepp/ui/uicodeeditor.hpp @@ -658,6 +658,8 @@ class EE_API UICodeEditor : public UIWidget, public TextDocument::Client { Float getViewportWidth( const bool& forceVScroll = false ) const; + Float getTopAreaWidth() const; + bool getShowIndentationGuides() const; void setShowIndentationGuides( bool showIndentationGuides ); diff --git a/premake4.lua b/premake4.lua index d7041a699..880f2ac69 100644 --- a/premake4.lua +++ b/premake4.lua @@ -756,7 +756,7 @@ function add_static_links() links { "mojoal-static"} end - if not _OPTIONS["with-openssl"] then + if not _OPTIONS["with-openssl"] and not os.is_real("emscripten") then links { "mbedtls-static" } end @@ -890,25 +890,27 @@ function select_backend() end function check_ssl_support() - if _OPTIONS["with-openssl"] then - if os.is("windows") then - table.insert( link_list, get_backend_link_name( "libssl" ) ) - table.insert( link_list, get_backend_link_name( "libcrypto" ) ) + if not os.is_real("emscripten") then + if _OPTIONS["with-openssl"] then + if os.is("windows") then + table.insert( link_list, get_backend_link_name( "libssl" ) ) + table.insert( link_list, get_backend_link_name( "libcrypto" ) ) + else + table.insert( link_list, get_backend_link_name( "ssl" ) ) + table.insert( link_list, get_backend_link_name( "crypto" ) ) + end + + files { "src/eepp/network/ssl/backend/openssl/*.cpp" } + + defines { "EE_OPENSSL" } else - table.insert( link_list, get_backend_link_name( "ssl" ) ) - table.insert( link_list, get_backend_link_name( "crypto" ) ) + files { "src/eepp/network/ssl/backend/mbedtls/*.cpp" } + + defines { "EE_MBEDTLS" } end - files { "src/eepp/network/ssl/backend/openssl/*.cpp" } - - defines { "EE_OPENSSL" } - else - files { "src/eepp/network/ssl/backend/mbedtls/*.cpp" } - - defines { "EE_MBEDTLS" } + defines { "EE_SSL_SUPPORT" } end - - defines { "EE_SSL_SUPPORT" } end function set_macos_and_ios_config() diff --git a/src/eepp/network/http.cpp b/src/eepp/network/http.cpp index 64defd6a1..41f8d918c 100644 --- a/src/eepp/network/http.cpp +++ b/src/eepp/network/http.cpp @@ -654,7 +654,7 @@ void Http::setHost( const std::string& host, unsigned short port, bool useSSL, U mPort = ( port != 0 ? port : 80 ); } else if ( String::toLower( host.substr( 0, 8 ) ) == "https://" ) { // HTTPS protocol -#ifdef EE_SSL_SUPPORT +#if defined( EE_SSL_SUPPORT ) || EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN mIsSSL = true; mHostName = host.substr( 8 ); mPort = ( port != 0 ? port : 443 ); @@ -667,7 +667,7 @@ void Http::setHost( const std::string& host, unsigned short port, bool useSSL, U mHostName = host; mPort = ( port != 0 ? port : 80 ); -#ifdef EE_SSL_SUPPORT +#if defined( EE_SSL_SUPPORT ) || EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN mPort = useSSL ? ( port != 0 ? port : 443 ) : mPort; mIsSSL = useSSL || mPort == 443; #endif diff --git a/src/eepp/network/ssl/sslsocket.cpp b/src/eepp/network/ssl/sslsocket.cpp index 938a8a9c1..907934007 100644 --- a/src/eepp/network/ssl/sslsocket.cpp +++ b/src/eepp/network/ssl/sslsocket.cpp @@ -115,7 +115,7 @@ bool SSLSocket::end() { } bool SSLSocket::isSupported() { -#ifdef EE_SSL_SUPPORT +#if defined( EE_SSL_SUPPORT ) || EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN return true; #else return false; diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp index b4ff011a5..3b20017f4 100644 --- a/src/eepp/ui/uicodeeditor.cpp +++ b/src/eepp/ui/uicodeeditor.cpp @@ -700,6 +700,14 @@ Float UICodeEditor::getViewportWidth( const bool& forceVScroll ) const { return eemax( 0.f, viewWidth ); } +Float UICodeEditor::getTopAreaWidth() const { + Float vScrollWidth = mVScrollBar->isVisible() ? mVScrollBar->getPixelsSize().getWidth() : 0.f; + if ( mMinimapEnabled ) + vScrollWidth += getMinimapWidth(); + Float viewWidth = eefloor( mSize.getWidth() - vScrollWidth ); + return eemax( 0.f, viewWidth ); +} + bool UICodeEditor::getShowIndentationGuides() const { return mShowIndentationGuides; } diff --git a/src/tools/ecode/plugins/lsp/lspclientplugin.cpp b/src/tools/ecode/plugins/lsp/lspclientplugin.cpp index 14eb4c9b1..cccf10260 100644 --- a/src/tools/ecode/plugins/lsp/lspclientplugin.cpp +++ b/src/tools/ecode/plugins/lsp/lspclientplugin.cpp @@ -609,11 +609,10 @@ bool LSPClientPlugin::onMouseClick( UICodeEditor* editor, const Vector2i& pos, const Vector2f localPos( breadcrumbClick ? editor->convertToNodeSpace( pos.asFloat() ) : Vector2f::Zero ); if ( breadcrumbClick && localPos.y < mPluginTopSpace && - localPos.x < editor->getPixelsSize().getWidth() - editor->getMinimapWidth() ) { + localPos.x < editor->getTopAreaWidth() ) { const Vector2f downLocalPos( editor->convertToNodeSpace( editor->getEventDispatcher()->getMouseDownPos().asFloat() ) ); - if ( downLocalPos.y < mPluginTopSpace && - downLocalPos.x < editor->getPixelsSize().getWidth() - editor->getMinimapWidth() ) { + if ( downLocalPos.y < mPluginTopSpace && downLocalPos.x < editor->getTopAreaWidth() ) { editor->getDocument().execute( "lsp-show-document-symbols", editor ); return true; } @@ -1794,8 +1793,7 @@ bool LSPClientPlugin::onMouseMove( UICodeEditor* editor, const Vector2i& positio const Uint32& flags ) { if ( mBreadcrumb ) { auto localPos( editor->convertToNodeSpace( position.asFloat() ) ); - if ( localPos.y < mPluginTopSpace && - localPos.x < editor->getPixelsSize().getWidth() - editor->getMinimapWidth() ) { + if ( localPos.y < mPluginTopSpace && localPos.x < editor->getTopAreaWidth() ) { if ( !mHoveringBreadcrumb ) { mHoveringBreadcrumb = true; editor->invalidateDraw(); @@ -1885,7 +1883,7 @@ void LSPClientPlugin::onVersionUpgrade( Uint32 oldVersion, Uint32 ) { void LSPClientPlugin::drawTop( UICodeEditor* editor, const Vector2f& screenStart, const Sizef& size, const Float& /*fontSize*/ ) { - Float width = size.getWidth() - editor->getMinimapWidth(); + Float width = editor->getTopAreaWidth(); Primitives p; Color backColor( editor->getColorScheme().getEditorColor( SyntaxStyleTypes::Background ) ); p.setColor( backColor );