forked from wxWidgets/wxWidgets
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GTK: Add conditional debug logging infrastructure to src/gtk/debughlp…
….cpp and log all gdk_window_invalidate_rect(), gtk_widget_queue_draw() and gtk_widget_queue_draw_area(). The logging will be available when GDK_DEBUG env is defined.
- Loading branch information
徐扬斌
committed
Jan 2, 2025
1 parent
942cadd
commit 00d4cf5
Showing
13 changed files
with
87 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef _WX_GTK_PRIVATE_DEBUGHLP_H_ | ||
#define _WX_GTK_PRIVATE_DEBUGHLP_H_ | ||
|
||
#include "wx/defs.h" | ||
|
||
bool wxGtkDebugLog(const char* format, const char* function_name, int line_num, const char* src_file ...); | ||
|
||
#define DO_GTK_DEBUG_LOG(format, ...) \ | ||
wxGtkDebugLog("%s:%d:%s--->" format, __func__, __LINE__, __FILE__, __VA_ARGS__) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "wx/gtk/private/debughlp.h" | ||
|
||
bool wxGtkDebugLog(const char* format, const char* function_name, int line_num, const char* src_file, ...){ | ||
const static auto GDK_DEBUG_defined = wxGetEnv("GDK_DEBUG", nullptr); | ||
if (!GDK_DEBUG_defined) | ||
return false; | ||
::FILE* logfile_ = std::fopen("/tmp/cmclient_gtk.log", "a"); | ||
timespec nano_now; | ||
clock_gettime(CLOCK_REALTIME, &nano_now); | ||
if (logfile_ != nullptr){ | ||
va_list argptr; | ||
va_start(argptr,line_num); | ||
fprintf(logfile_, "PreciseTime:%ld,%ld. ", nano_now.tv_sec, nano_now.tv_nsec); | ||
fprintf(logfile_, format, src_file, line_num, function_name, argptr); | ||
va_end(argptr); | ||
std::fclose(logfile_); | ||
return true; | ||
} | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters