2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-10-05 13:36:18 +00:00

Use custom gtk file dialog only on gtk-based DEs

This commit is contained in:
Ilya Fedin
2020-06-01 12:33:24 +04:00
committed by John Preston
parent 1fb1d57a27
commit 7f29f57c3d
4 changed files with 21 additions and 15 deletions

View File

@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/linux/linux_libs.h"
#include "platform/linux/linux_gdk_helper.h"
#include "platform/linux/linux_desktop_environment.h"
#include "platform/linux/specific_linux.h"
#include "core/application.h"
#include "mainwindow.h"
@@ -124,10 +125,15 @@ using Type = ::FileDialog::internal::Type;
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
bool NativeSupported(Type type = Type::ReadFile) {
#ifndef TDESKTOP_FORCE_GTK_FILE_DIALOG
return false;
#endif // TDESKTOP_FORCE_GTK_FILE_DIALOG
return (!Platform::UseXDGDesktopPortal() || type == Type::ReadFolder)
// use gtk file dialog on gtk-based desktop environments
// or if QT_QPA_PLATFORMTHEME=(gtk2|gtk3)
// or if portals is used and operation is not to open folder
// (it isn't supported by portals yet)
return Platform::UseGtkFileDialog()
&& (Platform::DesktopEnvironment::IsGtkBased()
|| Platform::IsGtkIntegrationForced()
|| Platform::UseXDGDesktopPortal())
&& (!Platform::UseXDGDesktopPortal() || type == Type::ReadFolder)
&& Platform::internal::GdkHelperLoaded()
&& (Libs::gtk_widget_hide_on_delete != nullptr)
&& (Libs::gtk_clipboard_store != nullptr)