Get rid of gtk2 header compatibility
This commit is contained in:
parent
f011c84ce8
commit
257f2086d1
|
@ -125,7 +125,7 @@ if (LINUX)
|
||||||
target_link_libraries(Telegram PRIVATE PkgConfig::X11)
|
target_link_libraries(Telegram PRIVATE PkgConfig::X11)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
pkg_search_module(GTK REQUIRED gtk+-3.0 gtk+-2.0)
|
pkg_check_modules(GTK REQUIRED gtk+-3.0)
|
||||||
target_include_directories(Telegram PRIVATE ${GTK_INCLUDE_DIRS})
|
target_include_directories(Telegram PRIVATE ${GTK_INCLUDE_DIRS})
|
||||||
|
|
||||||
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
|
if (NOT DESKTOP_APP_DISABLE_X11_INTEGRATION)
|
||||||
|
|
|
@ -20,13 +20,11 @@ extern "C" {
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
|
|
||||||
// CentOS 7 seem to be too old for needed definitions,
|
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
||||||
// so don't include until we link to gtk directly.
|
|
||||||
#if !defined DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION && defined LINK_TO_GTK
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <gdk/gdkwayland.h>
|
#include <gdk/gdkwayland.h>
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION && LINK_TO_GTK
|
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
@ -36,7 +34,7 @@ using base::Platform::GtkIntegration;
|
||||||
using namespace Platform::Gtk;
|
using namespace Platform::Gtk;
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION
|
||||||
// To be able to compile with gtk-3.0 headers as well
|
// To be able to compile with gtk-3.0 headers
|
||||||
#define GdkDrawable GdkWindow
|
#define GdkDrawable GdkWindow
|
||||||
|
|
||||||
// Gtk 2
|
// Gtk 2
|
||||||
|
@ -50,12 +48,6 @@ f_gdk_x11_drawable_get_xid gdk_x11_drawable_get_xid = nullptr;
|
||||||
using f_gdk_x11_window_get_type = GType (*)(void);
|
using f_gdk_x11_window_get_type = GType (*)(void);
|
||||||
f_gdk_x11_window_get_type gdk_x11_window_get_type = nullptr;
|
f_gdk_x11_window_get_type gdk_x11_window_get_type = nullptr;
|
||||||
|
|
||||||
// To be able to compile with gtk-2.0 headers as well
|
|
||||||
template <typename Object>
|
|
||||||
inline bool gdk_is_x11_window_check(Object *obj) {
|
|
||||||
return g_type_cit_helper(obj, gdk_x11_window_get_type());
|
|
||||||
}
|
|
||||||
|
|
||||||
using f_gdk_window_get_display = GdkDisplay*(*)(GdkWindow *window);
|
using f_gdk_window_get_display = GdkDisplay*(*)(GdkWindow *window);
|
||||||
f_gdk_window_get_display gdk_window_get_display = nullptr;
|
f_gdk_window_get_display gdk_window_get_display = nullptr;
|
||||||
|
|
||||||
|
@ -70,11 +62,6 @@ f_gdk_x11_window_get_xid gdk_x11_window_get_xid = nullptr;
|
||||||
using f_gdk_wayland_window_get_type = GType (*)(void);
|
using f_gdk_wayland_window_get_type = GType (*)(void);
|
||||||
f_gdk_wayland_window_get_type gdk_wayland_window_get_type = nullptr;
|
f_gdk_wayland_window_get_type gdk_wayland_window_get_type = nullptr;
|
||||||
|
|
||||||
template <typename Object>
|
|
||||||
inline bool gdk_is_wayland_window_check(Object *obj) {
|
|
||||||
return g_type_cit_helper(obj, gdk_wayland_window_get_type());
|
|
||||||
}
|
|
||||||
|
|
||||||
using f_gdk_wayland_window_set_transient_for_exported = gboolean(*)(GdkWindow *window, char *parent_handle_str);
|
using f_gdk_wayland_window_set_transient_for_exported = gboolean(*)(GdkWindow *window, char *parent_handle_str);
|
||||||
f_gdk_wayland_window_set_transient_for_exported gdk_wayland_window_set_transient_for_exported = nullptr;
|
f_gdk_wayland_window_set_transient_for_exported gdk_wayland_window_set_transient_for_exported = nullptr;
|
||||||
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
||||||
|
@ -115,7 +102,7 @@ void GdkSetTransientFor(GdkWindow *window, QWindow *parent) {
|
||||||
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
|
||||||
if (gdk_wayland_window_get_type != nullptr
|
if (gdk_wayland_window_get_type != nullptr
|
||||||
&& gdk_wayland_window_set_transient_for_exported != nullptr
|
&& gdk_wayland_window_set_transient_for_exported != nullptr
|
||||||
&& gdk_is_wayland_window_check(window)) {
|
&& GDK_IS_WAYLAND_WINDOW(window)) {
|
||||||
if (const auto integration = WaylandIntegration::Instance()) {
|
if (const auto integration = WaylandIntegration::Instance()) {
|
||||||
if (const auto handle = integration->nativeHandle(parent)
|
if (const auto handle = integration->nativeHandle(parent)
|
||||||
; !handle.isEmpty()) {
|
; !handle.isEmpty()) {
|
||||||
|
@ -134,7 +121,7 @@ void GdkSetTransientFor(GdkWindow *window, QWindow *parent) {
|
||||||
&& gdk_x11_display_get_xdisplay != nullptr
|
&& gdk_x11_display_get_xdisplay != nullptr
|
||||||
&& gdk_x11_window_get_xid != nullptr
|
&& gdk_x11_window_get_xid != nullptr
|
||||||
&& gdk_window_get_display != nullptr
|
&& gdk_window_get_display != nullptr
|
||||||
&& gdk_is_x11_window_check(window)) {
|
&& GDK_IS_X11_WINDOW(window)) {
|
||||||
XSetTransientForHint(
|
XSetTransientForHint(
|
||||||
gdk_x11_display_get_xdisplay(gdk_window_get_display(window)),
|
gdk_x11_display_get_xdisplay(gdk_window_get_display(window)),
|
||||||
gdk_x11_window_get_xid(window),
|
gdk_x11_window_get_xid(window),
|
||||||
|
|
|
@ -12,10 +12,6 @@ extern "C" {
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
// To be able to compile with gtk-2.0 headers as well
|
|
||||||
typedef struct _GdkMonitor GdkMonitor;
|
|
||||||
typedef struct _GtkAppChooser GtkAppChooser;
|
|
||||||
|
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace Gtk {
|
namespace Gtk {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue