1
0
Fork 0

Don't use glib in gtk/wayland helpers

This commit is contained in:
Ilya Fedin 2021-09-10 22:27:46 +04:00 committed by John Preston
parent fb97c14bf7
commit c390b046f0
4 changed files with 6 additions and 13 deletions

View file

@ -12,11 +12,8 @@ PRIVATE
linux_gtk_helper.cpp linux_gtk_helper.cpp
) )
target_compile_definitions(linux_gtk_helper PRIVATE G_LOG_DOMAIN="GtkHelper")
target_link_libraries(linux_gtk_helper target_link_libraries(linux_gtk_helper
PUBLIC PUBLIC
desktop-app::external_glib
${CMAKE_DL_LIBS} ${CMAKE_DL_LIBS}
) )

View file

@ -5,11 +5,10 @@
// https://github.com/desktop-app/legal/blob/master/LEGAL // https://github.com/desktop-app/legal/blob/master/LEGAL
// //
#include <dlfcn.h> #include <dlfcn.h>
#include <errno.h>
#include <glib.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <memory> #include <memory>
#include <iostream>
#define LOAD_SYMBOL(handle, func) LoadSymbol(handle, #func, func) #define LOAD_SYMBOL(handle, func) LoadSymbol(handle, #func, func)
@ -218,7 +217,7 @@ bool LoadLibrary(Handle &handle, const char *name) {
if (handle) { if (handle) {
return true; return true;
} }
g_warning("Could not load library '%s': %s", name, dlerror()); std::cerr << dlerror() << std::endl;
return false; return false;
} }
@ -228,7 +227,7 @@ inline bool LoadSymbol(const Handle &handle, const char *name, Function &func) {
? reinterpret_cast<Function>(dlsym(handle.get(), name)) ? reinterpret_cast<Function>(dlsym(handle.get(), name))
: nullptr; : nullptr;
if (const auto error = dlerror()) { if (const auto error = dlerror()) {
g_warning("Failed to load function '%s': %s", name, error); std::cerr << error << std::endl;
} }
return (func != nullptr); return (func != nullptr);
} }

View file

@ -12,11 +12,8 @@ PRIVATE
linux_wayland_helper.cpp linux_wayland_helper.cpp
) )
target_compile_definitions(linux_wayland_helper PRIVATE G_LOG_DOMAIN="WaylandHelper")
target_link_libraries(linux_wayland_helper target_link_libraries(linux_wayland_helper
PUBLIC PUBLIC
desktop-app::external_glib
desktop-app::external_gsl desktop-app::external_gsl
${CMAKE_DL_LIBS} ${CMAKE_DL_LIBS}
) )

View file

@ -7,9 +7,9 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <errno.h> #include <errno.h>
#include <gsl/gsl> #include <gsl/gsl>
#include <glib.h>
#include <wayland-egl.h> #include <wayland-egl.h>
#include <wayland-cursor.h> #include <wayland-cursor.h>
#include <iostream>
#define LOAD_SYMBOL(handle, func) LoadSymbol(handle, #func, func) #define LOAD_SYMBOL(handle, func) LoadSymbol(handle, #func, func)
@ -184,7 +184,7 @@ bool LoadLibrary(Handle &handle, const char *name) {
if (handle) { if (handle) {
return true; return true;
} }
g_warning("Could not load library '%s': %s", name, dlerror()); std::cerr << dlerror() << std::endl;
return false; return false;
} }
@ -194,7 +194,7 @@ inline bool LoadSymbol(const Handle &handle, const char *name, Function &func) {
? reinterpret_cast<Function>(dlsym(handle.get(), name)) ? reinterpret_cast<Function>(dlsym(handle.get(), name))
: nullptr; : nullptr;
if (const auto error = dlerror()) { if (const auto error = dlerror()) {
g_warning("Failed to load function '%s': %s", name, error); std::cerr << error << std::endl;
} }
return (func != nullptr); return (func != nullptr);
} }