mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Revert "Use gtk not only to get image from clipboard, but also to set"
This reverts commit f88c132c96
.
Fixes #9885.
This commit is contained in:
parent
cc35653c2c
commit
df420e4ccf
15 changed files with 21 additions and 112 deletions
|
@ -80,7 +80,7 @@ auto ListFromMimeData(not_null<const QMimeData*> data) {
|
||||||
if (result.error == Error::None) {
|
if (result.error == Error::None) {
|
||||||
return result;
|
return result;
|
||||||
} else if (data->hasImage()) {
|
} else if (data->hasImage()) {
|
||||||
auto image = Platform::GetClipboardImage();
|
auto image = Platform::GetImageFromClipboard();
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
image = qvariant_cast<QImage>(data->imageData());
|
image = qvariant_cast<QImage>(data->imageData());
|
||||||
}
|
}
|
||||||
|
|
|
@ -767,7 +767,7 @@ bool SendFilesBox::addFiles(not_null<const QMimeData*> data) {
|
||||||
if (result.error == Ui::PreparedList::Error::None) {
|
if (result.error == Ui::PreparedList::Error::None) {
|
||||||
return result;
|
return result;
|
||||||
} else if (data->hasImage()) {
|
} else if (data->hasImage()) {
|
||||||
auto image = Platform::GetClipboardImage();
|
auto image = Platform::GetImageFromClipboard();
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
image = qvariant_cast<QImage>(data->imageData());
|
image = qvariant_cast<QImage>(data->imageData());
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "chat_helpers/message_field.h"
|
#include "chat_helpers/message_field.h"
|
||||||
#include "boxes/sticker_set_box.h"
|
#include "boxes/sticker_set_box.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "platform/platform_specific.h"
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
@ -1220,9 +1219,7 @@ void InnerWidget::copyContextImage(not_null<PhotoData*> photo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto image = media->image(Data::PhotoSize::Large)->original();
|
const auto image = media->image(Data::PhotoSize::Large)->original();
|
||||||
if (!Platform::SetClipboardImage(image)) {
|
QGuiApplication::clipboard()->setImage(image);
|
||||||
QGuiApplication::clipboard()->setImage(image);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::copySelectedText() {
|
void InnerWidget::copySelectedText() {
|
||||||
|
|
|
@ -38,7 +38,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/sticker_set_box.h"
|
#include "boxes/sticker_set_box.h"
|
||||||
#include "chat_helpers/message_field.h"
|
#include "chat_helpers/message_field.h"
|
||||||
#include "history/history_widget.h"
|
#include "history/history_widget.h"
|
||||||
#include "platform/platform_specific.h"
|
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
@ -1900,9 +1899,7 @@ void HistoryInner::copyContextImage(not_null<PhotoData*> photo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto image = media->image(Data::PhotoSize::Large)->original();
|
const auto image = media->image(Data::PhotoSize::Large)->original();
|
||||||
if (!Platform::SetClipboardImage(image)) {
|
QGuiApplication::clipboard()->setImage(image);
|
||||||
QGuiApplication::clipboard()->setImage(image);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryInner::showStickerPackInfo(not_null<DocumentData*> document) {
|
void HistoryInner::showStickerPackInfo(not_null<DocumentData*> document) {
|
||||||
|
|
|
@ -4321,7 +4321,7 @@ bool HistoryWidget::confirmSendingFiles(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasImage) {
|
if (hasImage) {
|
||||||
auto image = Platform::GetClipboardImage();
|
auto image = Platform::GetImageFromClipboard();
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
image = qvariant_cast<QImage>(data->imageData());
|
image = qvariant_cast<QImage>(data->imageData());
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_scheduled_messages.h"
|
#include "data/data_scheduled_messages.h"
|
||||||
#include "core/file_utilities.h"
|
#include "core/file_utilities.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "platform/platform_specific.h"
|
|
||||||
#include "window/window_peer_menu.h"
|
#include "window/window_peer_menu.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
@ -126,9 +125,7 @@ void CopyImage(not_null<PhotoData*> photo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto image = media->image(Data::PhotoSize::Large)->original();
|
const auto image = media->image(Data::PhotoSize::Large)->original();
|
||||||
if (!Platform::SetClipboardImage(image)) {
|
QGuiApplication::clipboard()->setImage(image);
|
||||||
QGuiApplication::clipboard()->setImage(image);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowStickerPackInfo(
|
void ShowStickerPackInfo(
|
||||||
|
|
|
@ -603,7 +603,7 @@ bool RepliesWidget::confirmSendingFiles(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasImage) {
|
if (hasImage) {
|
||||||
auto image = Platform::GetClipboardImage();
|
auto image = Platform::GetImageFromClipboard();
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
image = qvariant_cast<QImage>(data->imageData());
|
image = qvariant_cast<QImage>(data->imageData());
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,7 +335,7 @@ bool ScheduledWidget::confirmSendingFiles(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasImage) {
|
if (hasImage) {
|
||||||
auto image = Platform::GetClipboardImage();
|
auto image = Platform::GetImageFromClipboard();
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
image = qvariant_cast<QImage>(data->imageData());
|
image = qvariant_cast<QImage>(data->imageData());
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "window/window_peer_menu.h"
|
#include "window/window_peer_menu.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
#include "platform/platform_specific.h"
|
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
#include "main/main_account.h"
|
#include "main/main_account.h"
|
||||||
|
@ -1645,18 +1644,13 @@ void OverlayWidget::onOverview() {
|
||||||
void OverlayWidget::onCopy() {
|
void OverlayWidget::onCopy() {
|
||||||
_dropdown->hideAnimated(Ui::DropdownMenu::HideOption::IgnoreShow);
|
_dropdown->hideAnimated(Ui::DropdownMenu::HideOption::IgnoreShow);
|
||||||
if (_document) {
|
if (_document) {
|
||||||
const auto image = videoShown()
|
QGuiApplication::clipboard()->setImage(videoShown()
|
||||||
? transformVideoFrame(videoFrame())
|
? transformVideoFrame(videoFrame())
|
||||||
: transformStaticContent(_staticContent);
|
: transformStaticContent(_staticContent));
|
||||||
if (!Platform::SetClipboardImage(image)) {
|
|
||||||
QGuiApplication::clipboard()->setImage(image);
|
|
||||||
}
|
|
||||||
} else if (_photo && _photoMedia->loaded()) {
|
} else if (_photo && _photoMedia->loaded()) {
|
||||||
const auto image = _photoMedia->image(
|
const auto image = _photoMedia->image(
|
||||||
Data::PhotoSize::Large)->original();
|
Data::PhotoSize::Large)->original();
|
||||||
if (!Platform::SetClipboardImage(image)) {
|
QGuiApplication::clipboard()->setImage(image);
|
||||||
QGuiApplication::clipboard()->setImage(image);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,10 @@ bool setupGtkBase(QLibrary &lib_gtk) {
|
||||||
if (!LOAD_SYMBOL(lib_gtk, "gtk_widget_get_type", gtk_widget_get_type)) return false;
|
if (!LOAD_SYMBOL(lib_gtk, "gtk_widget_get_type", gtk_widget_get_type)) return false;
|
||||||
if (!LOAD_SYMBOL(lib_gtk, "gtk_clipboard_get", gtk_clipboard_get)) return false;
|
if (!LOAD_SYMBOL(lib_gtk, "gtk_clipboard_get", gtk_clipboard_get)) return false;
|
||||||
if (!LOAD_SYMBOL(lib_gtk, "gtk_clipboard_store", gtk_clipboard_store)) return false;
|
if (!LOAD_SYMBOL(lib_gtk, "gtk_clipboard_store", gtk_clipboard_store)) return false;
|
||||||
|
if (!LOAD_SYMBOL(lib_gtk, "gtk_clipboard_wait_for_contents", gtk_clipboard_wait_for_contents)) return false;
|
||||||
|
if (!LOAD_SYMBOL(lib_gtk, "gtk_clipboard_wait_for_image", gtk_clipboard_wait_for_image)) return false;
|
||||||
|
if (!LOAD_SYMBOL(lib_gtk, "gtk_selection_data_targets_include_image", gtk_selection_data_targets_include_image)) return false;
|
||||||
|
if (!LOAD_SYMBOL(lib_gtk, "gtk_selection_data_free", gtk_selection_data_free)) return false;
|
||||||
if (!LOAD_SYMBOL(lib_gtk, "gtk_file_chooser_dialog_new", gtk_file_chooser_dialog_new)) return false;
|
if (!LOAD_SYMBOL(lib_gtk, "gtk_file_chooser_dialog_new", gtk_file_chooser_dialog_new)) return false;
|
||||||
if (!LOAD_SYMBOL(lib_gtk, "gtk_file_chooser_get_type", gtk_file_chooser_get_type)) return false;
|
if (!LOAD_SYMBOL(lib_gtk, "gtk_file_chooser_get_type", gtk_file_chooser_get_type)) return false;
|
||||||
if (!LOAD_SYMBOL(lib_gtk, "gtk_image_get_type", gtk_image_get_type)) return false;
|
if (!LOAD_SYMBOL(lib_gtk, "gtk_image_get_type", gtk_image_get_type)) return false;
|
||||||
|
@ -235,7 +239,6 @@ f_gtk_widget_destroy gtk_widget_destroy = nullptr;
|
||||||
f_gtk_widget_get_type gtk_widget_get_type = nullptr;
|
f_gtk_widget_get_type gtk_widget_get_type = nullptr;
|
||||||
f_gtk_clipboard_get gtk_clipboard_get = nullptr;
|
f_gtk_clipboard_get gtk_clipboard_get = nullptr;
|
||||||
f_gtk_clipboard_store gtk_clipboard_store = nullptr;
|
f_gtk_clipboard_store gtk_clipboard_store = nullptr;
|
||||||
f_gtk_clipboard_set_image gtk_clipboard_set_image = nullptr;
|
|
||||||
f_gtk_clipboard_wait_for_contents gtk_clipboard_wait_for_contents = nullptr;
|
f_gtk_clipboard_wait_for_contents gtk_clipboard_wait_for_contents = nullptr;
|
||||||
f_gtk_clipboard_wait_for_image gtk_clipboard_wait_for_image = nullptr;
|
f_gtk_clipboard_wait_for_image gtk_clipboard_wait_for_image = nullptr;
|
||||||
f_gtk_selection_data_targets_include_image gtk_selection_data_targets_include_image = nullptr;
|
f_gtk_selection_data_targets_include_image gtk_selection_data_targets_include_image = nullptr;
|
||||||
|
@ -278,7 +281,6 @@ f_gdk_window_focus gdk_window_focus = nullptr;
|
||||||
f_gtk_dialog_get_type gtk_dialog_get_type = nullptr;
|
f_gtk_dialog_get_type gtk_dialog_get_type = nullptr;
|
||||||
f_gtk_dialog_run gtk_dialog_run = nullptr;
|
f_gtk_dialog_run gtk_dialog_run = nullptr;
|
||||||
f_gdk_atom_intern gdk_atom_intern = nullptr;
|
f_gdk_atom_intern gdk_atom_intern = nullptr;
|
||||||
f_gdk_pixbuf_new_from_data gdk_pixbuf_new_from_data = nullptr;
|
|
||||||
f_gdk_pixbuf_new_from_file_at_size gdk_pixbuf_new_from_file_at_size = nullptr;
|
f_gdk_pixbuf_new_from_file_at_size gdk_pixbuf_new_from_file_at_size = nullptr;
|
||||||
f_gdk_pixbuf_get_has_alpha gdk_pixbuf_get_has_alpha = nullptr;
|
f_gdk_pixbuf_get_has_alpha gdk_pixbuf_get_has_alpha = nullptr;
|
||||||
f_gdk_pixbuf_get_pixels gdk_pixbuf_get_pixels = nullptr;
|
f_gdk_pixbuf_get_pixels gdk_pixbuf_get_pixels = nullptr;
|
||||||
|
@ -318,7 +320,6 @@ void start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gtkLoaded) {
|
if (gtkLoaded) {
|
||||||
LOAD_SYMBOL(lib_gtk, "gdk_pixbuf_new_from_data", gdk_pixbuf_new_from_data);
|
|
||||||
LOAD_SYMBOL(lib_gtk, "gdk_pixbuf_new_from_file_at_size", gdk_pixbuf_new_from_file_at_size);
|
LOAD_SYMBOL(lib_gtk, "gdk_pixbuf_new_from_file_at_size", gdk_pixbuf_new_from_file_at_size);
|
||||||
LOAD_SYMBOL(lib_gtk, "gdk_pixbuf_get_has_alpha", gdk_pixbuf_get_has_alpha);
|
LOAD_SYMBOL(lib_gtk, "gdk_pixbuf_get_has_alpha", gdk_pixbuf_get_has_alpha);
|
||||||
LOAD_SYMBOL(lib_gtk, "gdk_pixbuf_get_pixels", gdk_pixbuf_get_pixels);
|
LOAD_SYMBOL(lib_gtk, "gdk_pixbuf_get_pixels", gdk_pixbuf_get_pixels);
|
||||||
|
@ -328,12 +329,6 @@ void start() {
|
||||||
|
|
||||||
internal::GdkHelperLoad(lib_gtk);
|
internal::GdkHelperLoad(lib_gtk);
|
||||||
|
|
||||||
LOAD_SYMBOL(lib_gtk, "gtk_clipboard_set_image", gtk_clipboard_set_image);
|
|
||||||
LOAD_SYMBOL(lib_gtk, "gtk_clipboard_wait_for_contents", gtk_clipboard_wait_for_contents);
|
|
||||||
LOAD_SYMBOL(lib_gtk, "gtk_clipboard_wait_for_image", gtk_clipboard_wait_for_image);
|
|
||||||
LOAD_SYMBOL(lib_gtk, "gtk_selection_data_targets_include_image", gtk_selection_data_targets_include_image);
|
|
||||||
LOAD_SYMBOL(lib_gtk, "gtk_selection_data_free", gtk_selection_data_free);
|
|
||||||
|
|
||||||
LOAD_SYMBOL(lib_gtk, "gtk_dialog_get_widget_for_response", gtk_dialog_get_widget_for_response);
|
LOAD_SYMBOL(lib_gtk, "gtk_dialog_get_widget_for_response", gtk_dialog_get_widget_for_response);
|
||||||
LOAD_SYMBOL(lib_gtk, "gtk_button_set_label", gtk_button_set_label);
|
LOAD_SYMBOL(lib_gtk, "gtk_button_set_label", gtk_button_set_label);
|
||||||
LOAD_SYMBOL(lib_gtk, "gtk_button_get_type", gtk_button_get_type);
|
LOAD_SYMBOL(lib_gtk, "gtk_button_get_type", gtk_button_get_type);
|
||||||
|
|
|
@ -88,9 +88,6 @@ extern f_gtk_clipboard_get gtk_clipboard_get;
|
||||||
typedef void (*f_gtk_clipboard_store)(::GtkClipboard *clipboard);
|
typedef void (*f_gtk_clipboard_store)(::GtkClipboard *clipboard);
|
||||||
extern f_gtk_clipboard_store gtk_clipboard_store;
|
extern f_gtk_clipboard_store gtk_clipboard_store;
|
||||||
|
|
||||||
typedef void (*f_gtk_clipboard_set_image)(::GtkClipboard *clipboard, GdkPixbuf *pixbuf);
|
|
||||||
extern f_gtk_clipboard_set_image gtk_clipboard_set_image;
|
|
||||||
|
|
||||||
typedef GtkSelectionData* (*f_gtk_clipboard_wait_for_contents)(::GtkClipboard *clipboard, GdkAtom target);
|
typedef GtkSelectionData* (*f_gtk_clipboard_wait_for_contents)(::GtkClipboard *clipboard, GdkAtom target);
|
||||||
extern f_gtk_clipboard_wait_for_contents gtk_clipboard_wait_for_contents;
|
extern f_gtk_clipboard_wait_for_contents gtk_clipboard_wait_for_contents;
|
||||||
|
|
||||||
|
@ -271,9 +268,6 @@ extern f_gtk_dialog_run gtk_dialog_run;
|
||||||
typedef GdkAtom (*f_gdk_atom_intern)(const gchar *atom_name, gboolean only_if_exists);
|
typedef GdkAtom (*f_gdk_atom_intern)(const gchar *atom_name, gboolean only_if_exists);
|
||||||
extern f_gdk_atom_intern gdk_atom_intern;
|
extern f_gdk_atom_intern gdk_atom_intern;
|
||||||
|
|
||||||
typedef GdkPixbuf* (*f_gdk_pixbuf_new_from_data)(const guchar *data, GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height, int rowstride, GdkPixbufDestroyNotify destroy_fn, gpointer destroy_fn_data);
|
|
||||||
extern f_gdk_pixbuf_new_from_data gdk_pixbuf_new_from_data;
|
|
||||||
|
|
||||||
typedef GdkPixbuf* (*f_gdk_pixbuf_new_from_file_at_size)(const gchar *filename, int width, int height, GError **error);
|
typedef GdkPixbuf* (*f_gdk_pixbuf_new_from_file_at_size)(const gchar *filename, int width, int height, GError **error);
|
||||||
extern f_gdk_pixbuf_new_from_file_at_size gdk_pixbuf_new_from_file_at_size;
|
extern f_gdk_pixbuf_new_from_file_at_size gdk_pixbuf_new_from_file_at_size;
|
||||||
|
|
||||||
|
|
|
@ -325,7 +325,7 @@ bool GenerateDesktopFile(
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
||||||
bool GetClipboardImageSupported() {
|
bool GetImageFromClipboardSupported() {
|
||||||
return (Libs::gtk_clipboard_wait_for_contents != nullptr)
|
return (Libs::gtk_clipboard_wait_for_contents != nullptr)
|
||||||
&& (Libs::gtk_clipboard_wait_for_image != nullptr)
|
&& (Libs::gtk_clipboard_wait_for_image != nullptr)
|
||||||
&& (Libs::gtk_selection_data_targets_include_image != nullptr)
|
&& (Libs::gtk_selection_data_targets_include_image != nullptr)
|
||||||
|
@ -337,11 +337,6 @@ bool GetClipboardImageSupported() {
|
||||||
&& (Libs::gdk_pixbuf_get_has_alpha != nullptr)
|
&& (Libs::gdk_pixbuf_get_has_alpha != nullptr)
|
||||||
&& (Libs::gdk_atom_intern != nullptr);
|
&& (Libs::gdk_atom_intern != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetClipboardImageSupported() {
|
|
||||||
return (Libs::gtk_clipboard_set_image != nullptr)
|
|
||||||
&& (Libs::gdk_pixbuf_new_from_data != nullptr);
|
|
||||||
}
|
|
||||||
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
||||||
|
|
||||||
uint XCBMoveResizeFromEdges(Qt::Edges edges) {
|
uint XCBMoveResizeFromEdges(Qt::Edges edges) {
|
||||||
|
@ -734,11 +729,11 @@ QString GetIconName() {
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage GetClipboardImage() {
|
QImage GetImageFromClipboard() {
|
||||||
QImage data;
|
QImage data;
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
||||||
if (!GetClipboardImageSupported() || !Libs::GtkClipboard()) {
|
if (!GetImageFromClipboardSupported() || !Libs::GtkClipboard()) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -772,57 +767,6 @@ QImage GetClipboardImage() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetClipboardImage(const QImage &image) {
|
|
||||||
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
|
||||||
if (!SetClipboardImageSupported()
|
|
||||||
|| !Libs::GtkClipboard()
|
|
||||||
|| image.isNull()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto convertedImage = [&] {
|
|
||||||
if (image.hasAlphaChannel()) {
|
|
||||||
if (image.format() != QImage::Format_RGBA8888) {
|
|
||||||
return image.convertToFormat(QImage::Format_RGBA8888);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (image.format() != QImage::Format_RGB888) {
|
|
||||||
return image.convertToFormat(QImage::Format_RGB888);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return image;
|
|
||||||
}();
|
|
||||||
|
|
||||||
auto imageBuf = reinterpret_cast<guchar*>(
|
|
||||||
malloc(convertedImage.sizeInBytes()));
|
|
||||||
|
|
||||||
memcpy(
|
|
||||||
imageBuf,
|
|
||||||
convertedImage.constBits(),
|
|
||||||
convertedImage.sizeInBytes());
|
|
||||||
|
|
||||||
auto imagePixbuf = Libs::gdk_pixbuf_new_from_data(
|
|
||||||
imageBuf,
|
|
||||||
GDK_COLORSPACE_RGB,
|
|
||||||
convertedImage.hasAlphaChannel(),
|
|
||||||
8,
|
|
||||||
convertedImage.width(),
|
|
||||||
convertedImage.height(),
|
|
||||||
convertedImage.bytesPerLine(),
|
|
||||||
[](guchar *pixels, gpointer data) {
|
|
||||||
free(pixels);
|
|
||||||
},
|
|
||||||
nullptr);
|
|
||||||
|
|
||||||
Libs::gtk_clipboard_set_image(Libs::GtkClipboard(), imagePixbuf);
|
|
||||||
g_object_unref(imagePixbuf);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
#else // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
|
||||||
return false;
|
|
||||||
#endif // TDESKTOP_DISABLE_GTK_INTEGRATION
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> IsDarkMode() {
|
std::optional<bool> IsDarkMode() {
|
||||||
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
||||||
if (Libs::GtkSettingSupported() && Libs::GtkLoaded()) {
|
if (Libs::GtkSettingSupported() && Libs::GtkLoaded()) {
|
||||||
|
|
|
@ -18,14 +18,10 @@ namespace Platform {
|
||||||
|
|
||||||
[[nodiscard]] bool IsDarkMenuBar();
|
[[nodiscard]] bool IsDarkMenuBar();
|
||||||
|
|
||||||
inline QImage GetClipboardImage() {
|
inline QImage GetImageFromClipboard() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool SetClipboardImage(const QImage &image) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool StartSystemMove(QWindow *window) {
|
inline bool StartSystemMove(QWindow *window) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,7 @@ void IgnoreApplicationActivationRightNow();
|
||||||
bool AutostartSupported();
|
bool AutostartSupported();
|
||||||
bool TrayIconSupported();
|
bool TrayIconSupported();
|
||||||
bool SkipTaskbarSupported();
|
bool SkipTaskbarSupported();
|
||||||
QImage GetClipboardImage();
|
QImage GetImageFromClipboard();
|
||||||
bool SetClipboardImage(const QImage &image);
|
|
||||||
bool StartSystemMove(QWindow *window);
|
bool StartSystemMove(QWindow *window);
|
||||||
bool StartSystemResize(QWindow *window, Qt::Edges edges);
|
bool StartSystemResize(QWindow *window, Qt::Edges edges);
|
||||||
bool ShowWindowMenu(QWindow *window);
|
bool ShowWindowMenu(QWindow *window);
|
||||||
|
|
|
@ -22,14 +22,10 @@ inline void SetWatchingMediaKeys(bool watching) {
|
||||||
inline void IgnoreApplicationActivationRightNow() {
|
inline void IgnoreApplicationActivationRightNow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QImage GetClipboardImage() {
|
inline QImage GetImageFromClipboard() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool SetClipboardImage(const QImage &image) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool StartSystemMove(QWindow *window) {
|
inline bool StartSystemMove(QWindow *window) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue