1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Drop access to native window.

The new NFD library is not using this information, and the old one was using
it only on Windows. Oh well.

Removal of this functionality also removes some build-time decisions.
This commit is contained in:
Bartosz Taudul
2022-08-12 21:44:24 +02:00
parent baea6ddf11
commit 7dbfed9aea
8 changed files with 15 additions and 67 deletions
-9
View File
@@ -4,15 +4,6 @@ DEFINES += -DIMGUI_ENABLE_FREETYPE
INCLUDES := $(shell pkg-config --cflags glfw3 freetype2 capstone) -I../../../imgui
LIBS := $(shell pkg-config --libs glfw3 freetype2 capstone) -lpthread -ldl
DISPLAY_SERVER := X11
ifdef TRACY_USE_WAYLAND
DISPLAY_SERVER := WAYLAND
LIBS += $(shell pkg-config --libs wayland-client)
endif
CXXFLAGS += -D"DISPLAY_SERVER_$(DISPLAY_SERVER)"
PROJECT := Tracy
IMAGE := $(PROJECT)-$(BUILD)
-1
View File
@@ -24,7 +24,6 @@ public:
void SetTitle( const char* title );
float GetDpiScale();
void* GetNativeWindow();
private:
WindowPosition m_winPos;
-29
View File
@@ -8,20 +8,6 @@
#include <stdlib.h>
#include <thread>
#ifdef _WIN32
# define GLFW_EXPOSE_NATIVE_WIN32
# include <GLFW/glfw3native.h>
#elif defined __linux__
# ifdef DISPLAY_SERVER_X11
# define GLFW_EXPOSE_NATIVE_X11
# elif defined DISPLAY_SERVER_WAYLAND
# define GLFW_EXPOSE_NATIVE_WAYLAND
# else
# error "unsupported linux display server"
# endif
# include <GLFW/glfw3native.h>
#endif
#include "Backend.hpp"
#include "RunQueue.hpp"
@@ -195,18 +181,3 @@ float Backend::GetDpiScale()
#endif
return 1;
}
void* Backend::GetNativeWindow()
{
#ifdef _WIN32
return (void*)glfwGetWin32Window( s_window );
#elif defined __linux__
# ifdef DISPLAY_SERVER_X11
return (void*)glfwGetX11Window( s_window );
# elif defined DISPLAY_SERVER_WAYLAND
return (void*)glfwGetWaylandWindow( s_window );
# endif
#else
return nullptr;
#endif
}
+7 -12
View File
@@ -108,11 +108,6 @@ static void SetWindowTitleCallback( const char* title )
s_customTitle = true;
}
static void* GetMainWindowNative()
{
return bptr->GetNativeWindow();
}
static void DrawContents();
void RunOnMainThread( std::function<void()> cb, bool forceDelay = false )
@@ -236,12 +231,12 @@ int main( int argc, char** argv )
if( initFileOpen )
{
view = std::make_unique<tracy::View>( RunOnMainThread, *initFileOpen, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, GetMainWindowNative, SetupScaleCallback );
view = std::make_unique<tracy::View>( RunOnMainThread, *initFileOpen, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback );
initFileOpen.reset();
}
else if( connectTo )
{
view = std::make_unique<tracy::View>( RunOnMainThread, connectTo, port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, GetMainWindowNative, SetupScaleCallback );
view = std::make_unique<tracy::View>( RunOnMainThread, connectTo, port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback );
}
#ifndef TRACY_NO_FILESELECTOR
@@ -522,11 +517,11 @@ static void DrawContents()
{
std::string addrPart = std::string( addr, ptr );
uint16_t portPart = (uint16_t)atoi( ptr+1 );
view = std::make_unique<tracy::View>( RunOnMainThread, addrPart.c_str(), portPart, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, GetMainWindowNative, SetupScaleCallback );
view = std::make_unique<tracy::View>( RunOnMainThread, addrPart.c_str(), portPart, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback );
}
else
{
view = std::make_unique<tracy::View>( RunOnMainThread, addr, port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, GetMainWindowNative, SetupScaleCallback );
view = std::make_unique<tracy::View>( RunOnMainThread, addr, port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback );
}
}
ImGui::SameLine( 0, ImGui::GetTextLineHeight() * 2 );
@@ -547,7 +542,7 @@ static void DrawContents()
loadThread = std::thread( [f] {
try
{
view = std::make_unique<tracy::View>( RunOnMainThread, *f, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, GetMainWindowNative, SetupScaleCallback );
view = std::make_unique<tracy::View>( RunOnMainThread, *f, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback );
}
catch( const tracy::UnsupportedVersion& e )
{
@@ -671,7 +666,7 @@ static void DrawContents()
}
if( selected && !loadThread.joinable() )
{
view = std::make_unique<tracy::View>( RunOnMainThread, v.second.address.c_str(), v.second.port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, GetMainWindowNative, SetupScaleCallback );
view = std::make_unique<tracy::View>( RunOnMainThread, v.second.address.c_str(), v.second.port, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback );
}
ImGui::NextColumn();
const auto acttime = ( v.second.activeTime + ( time - v.second.time ) / 1000 ) * 1000000000ll;
@@ -840,7 +835,7 @@ static void DrawContents()
viewShutdown.store( ViewShutdown::False, std::memory_order_relaxed );
if( reconnect )
{
view = std::make_unique<tracy::View>( RunOnMainThread, reconnectAddr.c_str(), reconnectPort, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, GetMainWindowNative, SetupScaleCallback );
view = std::make_unique<tracy::View>( RunOnMainThread, reconnectAddr.c_str(), reconnectPort, s_fixedWidth, s_smallFont, s_bigFont, SetWindowTitleCallback, SetupScaleCallback );
}
break;
default: