Skip to content

Commit ceef753

Browse files
committed
premake4: I've found an issue with 4.4-beta5 when changing the soname it needs to have the .so. premake 4.3 seem to add it automatically and if it's present it does work the same.
Some minor adjustment in UISceneNode::loadLayout* functions.
1 parent 5968ea0 commit ceef753

4 files changed

Lines changed: 27 additions & 16 deletions

File tree

premake4.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,7 @@ function fix_shared_lib_linking_path( package_name, libname )
468468
if ( "4.4-beta5" == _PREMAKE_VERSION or "HEAD" == _PREMAKE_VERSION ) and not _OPTIONS["with-static-eepp"] and package_name == "eepp" then
469469
if os.is("macosx") then
470470
linkoptions { "-install_name " .. libname .. ".dylib" }
471-
elseif os.is("linux") or os.is("freebsd") then
472-
linkoptions { "-Wl,-soname=\"" .. libname .. "\"" }
473-
elseif os.is("haiku") then
471+
elseif os.is("linux") or os.is("freebsd") or os.is("haiku") then
474472
linkoptions { "-Wl,-soname=\"" .. libname .. ".so" .. "\"" }
475473
end
476474
end

src/eepp/ui/css/stylesheetspecification.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void StyleSheetSpecification::registerDefaultProperties() {
150150
.addAlias( "layout-margin-bottom" )
151151
.addAlias( "layout_marginbottom" )
152152
.setRelativeTarget( PropertyRelativeTarget::ContainingBlockHeight );
153-
registerProperty( "tooltip", "" ).setType( PropertyType::String );
153+
registerProperty( "tooltip", "" ).setType( PropertyType::String ).addAlias( "alt" );
154154
registerProperty( "layout-weight", "" )
155155
.addAlias( "layout_weight" )
156156
.addAlias( "lw8" )

src/eepp/ui/uiscenenode.cpp

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,11 @@ UIWidget* UISceneNode::loadLayoutFromString( const char* layoutString, Node* par
475475

476476
pugi::xml_document doc;
477477
pugi::xml_parse_result result;
478+
std::string fixedLayout;
479+
bool needsReplacements = voidTagsRegex.matches( layoutString );
478480

479-
if ( voidTagsRegex.matches( layoutString ) ) {
480-
std::string fixedLayout = voidTagsRegex.gsub( layoutString, "%1 />" );
481+
if ( needsReplacements ) {
482+
fixedLayout = voidTagsRegex.gsub( layoutString, "%1 />" );
481483
result =
482484
doc.load_string( fixedLayout.c_str(), pugi::parse_default | pugi::parse_ws_pcdata );
483485
} else {
@@ -487,7 +489,8 @@ UIWidget* UISceneNode::loadLayoutFromString( const char* layoutString, Node* par
487489
if ( result ) {
488490
return loadLayoutNodes( doc.first_child(), NULL != parent ? parent : this, marker );
489491
} else {
490-
Log::error( "Couldn't load UI Layout from string: %s", layoutString );
492+
Log::error( "Couldn't load UI Layout from string: %s",
493+
needsReplacements ? fixedLayout.c_str() : layoutString );
491494
Log::error( "Error description: %s", result.description() );
492495
Log::error( "Error offset: %d", result.offset );
493496
}
@@ -506,10 +509,13 @@ UIWidget* UISceneNode::loadLayoutFromMemory( const void* buffer, Int32 bufferSiz
506509

507510
pugi::xml_document doc;
508511
pugi::xml_parse_result result;
512+
std::string_view layoutString( static_cast<const char*>( buffer ), bufferSize );
513+
std::string fixedLayout;
514+
bool needsReplacements =
515+
voidTagsRegex.matches( static_cast<const char*>( buffer ), 0, nullptr, bufferSize );
509516

510-
if ( voidTagsRegex.matches( static_cast<const char*>( buffer ), 0, nullptr, bufferSize ) ) {
511-
std::string strBuffer( static_cast<const char*>( buffer ), bufferSize );
512-
std::string fixedLayout = voidTagsRegex.gsub( strBuffer, "%1 />" );
517+
if ( needsReplacements ) {
518+
fixedLayout = voidTagsRegex.gsub( layoutString.data(), "%1 />" );
513519
result = doc.load_buffer( fixedLayout.c_str(), fixedLayout.size(),
514520
pugi::parse_default | pugi::parse_ws_pcdata );
515521
} else {
@@ -519,7 +525,8 @@ UIWidget* UISceneNode::loadLayoutFromMemory( const void* buffer, Int32 bufferSiz
519525
if ( result ) {
520526
return loadLayoutNodes( doc.first_child(), NULL != parent ? parent : this, marker );
521527
} else {
522-
Log::error( "Couldn't load UI Layout from buffer" );
528+
Log::error( "Couldn't load UI Layout from memory: %s",
529+
needsReplacements ? fixedLayout.c_str() : layoutString.data() );
523530
Log::error( "Error description: %s", result.description() );
524531
Log::error( "Error offset: %d", result.offset );
525532
}
@@ -540,10 +547,13 @@ UIWidget* UISceneNode::loadLayoutFromStream( IOStream& stream, Node* parent,
540547

541548
pugi::xml_document doc;
542549
pugi::xml_parse_result result;
550+
std::string_view layoutString( scopedBuffer.get(), scopedBuffer.length() );
551+
std::string fixedLayout;
552+
bool needsReplacements =
553+
voidTagsRegex.matches( scopedBuffer.get(), 0, nullptr, scopedBuffer.length() );
543554

544-
if ( voidTagsRegex.matches( scopedBuffer.get(), 0, nullptr, scopedBuffer.length() ) ) {
545-
std::string strBuffer( scopedBuffer.get(), scopedBuffer.length() );
546-
std::string fixedLayout = voidTagsRegex.gsub( strBuffer, "%1 />" );
555+
if ( needsReplacements ) {
556+
fixedLayout = voidTagsRegex.gsub( layoutString.data(), "%1 />" );
547557
result = doc.load_buffer( fixedLayout.c_str(), fixedLayout.size(),
548558
pugi::parse_default | pugi::parse_ws_pcdata );
549559
} else {
@@ -554,8 +564,8 @@ UIWidget* UISceneNode::loadLayoutFromStream( IOStream& stream, Node* parent,
554564
if ( result ) {
555565
return loadLayoutNodes( doc.first_child(), NULL != parent ? parent : this, marker );
556566
} else {
557-
// Preserves the unique stream error log
558-
Log::error( "Couldn't load UI Layout from stream" );
567+
Log::error( "Couldn't load UI Layout from stream: %s",
568+
needsReplacements ? fixedLayout.c_str() : layoutString.data() );
559569
Log::error( "Error description: %s", result.description() );
560570
Log::error( "Error offset: %d", result.offset );
561571
}

src/eepp/ui/uiwidgetcreator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ void UIWidgetCreator::createBaseWidgetList() {
157157
registeredWidget["pre"] = UIRichText::NewPre;
158158
registeredWidget["img"] = [] { return UIImage::NewWithTag( "img" ); };
159159
registeredWidget["input"] = UITextInput::New;
160+
registeredWidget["article"] = [] {
161+
return UILinearLayout::NewVerticalWidthMatchParent( "article" );
162+
};
160163
registeredWidget["center"] = [] {
161164
return UILinearLayout::NewVerticalWidthMatchParent( "center" );
162165
};

0 commit comments

Comments
 (0)