mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 08:04:08 +02:00
Check for all needed gtk functions for gtk clipboard
This commit is contained in:
parent
d319c85c57
commit
806f2e0b50
4 changed files with 24 additions and 7 deletions
|
@ -130,11 +130,6 @@ bool setupGtkBase(QLibrary &lib_gtk) {
|
||||||
if (!load(lib_gtk, "g_log_default_handler", g_log_default_handler)) return false;
|
if (!load(lib_gtk, "g_log_default_handler", g_log_default_handler)) return false;
|
||||||
|
|
||||||
if (!load(lib_gtk, "gdk_atom_intern", gdk_atom_intern)) return false;
|
if (!load(lib_gtk, "gdk_atom_intern", gdk_atom_intern)) return false;
|
||||||
if (!load(lib_gtk, "gdk_pixbuf_get_has_alpha", gdk_pixbuf_get_has_alpha)) return false;
|
|
||||||
if (!load(lib_gtk, "gdk_pixbuf_get_pixels", gdk_pixbuf_get_pixels)) return false;
|
|
||||||
if (!load(lib_gtk, "gdk_pixbuf_get_width", gdk_pixbuf_get_width)) return false;
|
|
||||||
if (!load(lib_gtk, "gdk_pixbuf_get_height", gdk_pixbuf_get_height)) return false;
|
|
||||||
if (!load(lib_gtk, "gdk_pixbuf_get_rowstride", gdk_pixbuf_get_rowstride)) return false;
|
|
||||||
|
|
||||||
if (load(lib_gtk, "gdk_set_allowed_backends", gdk_set_allowed_backends)) {
|
if (load(lib_gtk, "gdk_set_allowed_backends", gdk_set_allowed_backends)) {
|
||||||
// We work only with X11 GDK backend.
|
// We work only with X11 GDK backend.
|
||||||
|
@ -262,6 +257,11 @@ void start() {
|
||||||
|
|
||||||
if (gtkLoaded) {
|
if (gtkLoaded) {
|
||||||
load(lib_gtk, "gdk_pixbuf_new_from_file_at_size", gdk_pixbuf_new_from_file_at_size);
|
load(lib_gtk, "gdk_pixbuf_new_from_file_at_size", gdk_pixbuf_new_from_file_at_size);
|
||||||
|
load(lib_gtk, "gdk_pixbuf_get_has_alpha", gdk_pixbuf_get_has_alpha);
|
||||||
|
load(lib_gtk, "gdk_pixbuf_get_pixels", gdk_pixbuf_get_pixels);
|
||||||
|
load(lib_gtk, "gdk_pixbuf_get_width", gdk_pixbuf_get_width);
|
||||||
|
load(lib_gtk, "gdk_pixbuf_get_height", gdk_pixbuf_get_height);
|
||||||
|
load(lib_gtk, "gdk_pixbuf_get_rowstride", gdk_pixbuf_get_rowstride);
|
||||||
|
|
||||||
internal::GdkHelperLoad(lib_gtk);
|
internal::GdkHelperLoad(lib_gtk);
|
||||||
|
|
||||||
|
|
|
@ -414,7 +414,7 @@ void ForceDisabled(QAction *action, bool disabled) {
|
||||||
MainWindow::MainWindow(not_null<Window::Controller*> controller)
|
MainWindow::MainWindow(not_null<Window::Controller*> controller)
|
||||||
: Window::MainWindow(controller) {
|
: Window::MainWindow(controller) {
|
||||||
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
||||||
if (Libs::gtk_clipboard_get != nullptr) {
|
if (GtkClipboardSupported()) {
|
||||||
_gtkClipboard = Libs::gtk_clipboard_get(Libs::gdk_atom_intern("CLIPBOARD", true));
|
_gtkClipboard = Libs::gtk_clipboard_get(Libs::gdk_atom_intern("CLIPBOARD", true));
|
||||||
}
|
}
|
||||||
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
||||||
|
|
|
@ -520,11 +520,26 @@ QString GetIconName() {
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GtkClipboardSupported() {
|
||||||
|
return (Libs::gtk_clipboard_get != nullptr)
|
||||||
|
&& (Libs::gtk_clipboard_wait_for_contents != nullptr)
|
||||||
|
&& (Libs::gtk_clipboard_wait_for_image != nullptr)
|
||||||
|
&& (Libs::gtk_selection_data_targets_include_image != nullptr)
|
||||||
|
&& (Libs::gtk_selection_data_free != nullptr)
|
||||||
|
&& (Libs::gdk_pixbuf_get_pixels != nullptr)
|
||||||
|
&& (Libs::gdk_pixbuf_get_width != nullptr)
|
||||||
|
&& (Libs::gdk_pixbuf_get_height != nullptr)
|
||||||
|
&& (Libs::gdk_pixbuf_get_rowstride != nullptr)
|
||||||
|
&& (Libs::gdk_pixbuf_get_has_alpha != nullptr)
|
||||||
|
&& (Libs::gdk_atom_intern != nullptr)
|
||||||
|
&& (Libs::g_object_unref != nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
QImage GetImageFromClipboard() {
|
QImage GetImageFromClipboard() {
|
||||||
QImage data;
|
QImage data;
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
||||||
if (!App::wnd()->gtkClipboard()) {
|
if (!GtkClipboardSupported() || !App::wnd()->gtkClipboard()) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,8 @@ inline void IgnoreApplicationActivationRightNow() {
|
||||||
void FallbackFontConfigCheckBegin();
|
void FallbackFontConfigCheckBegin();
|
||||||
void FallbackFontConfigCheckEnd();
|
void FallbackFontConfigCheckEnd();
|
||||||
|
|
||||||
|
bool GtkClipboardSupported();
|
||||||
|
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
||||||
inline void psCheckLocalSocket(const QString &serverName) {
|
inline void psCheckLocalSocket(const QString &serverName) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue