Fix length of some lines in specific_linux and main_window_linux

This commit is contained in:
Ilya Fedin 2020-08-04 09:32:04 +04:00 committed by John Preston
parent 7bb4e5e4a9
commit 1de1747c38
2 changed files with 59 additions and 26 deletions

View File

@ -240,8 +240,10 @@ QIcon TrayIconGen(int counter, bool muted) {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
bool IsIndicatorApplication() { bool IsIndicatorApplication() {
// Hack for indicator-application, which doesn't handle icons sent across D-Bus: // Hack for indicator-application,
// save the icon to a temp file and set the icon name to that filename. // which doesn't handle icons sent across D-Bus:
// save the icon to a temp file
// and set the icon name to that filename.
static const auto Result = [] { static const auto Result = [] {
const auto interface = QDBusConnection::sessionBus().interface(); const auto interface = QDBusConnection::sessionBus().interface();
@ -416,7 +418,8 @@ MainWindow::MainWindow(not_null<Window::Controller*> controller)
: Window::MainWindow(controller) { : Window::MainWindow(controller) {
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION #ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
if (GtkClipboardSupported()) { 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
} }
@ -724,10 +727,20 @@ void MainWindow::updateIconCounters() {
} }
void MainWindow::updateWaylandDecorationColors() { void MainWindow::updateWaylandDecorationColors() {
windowHandle()->setProperty("__material_decoration_backgroundColor", st::titleBgActive->c); windowHandle()->setProperty(
windowHandle()->setProperty("__material_decoration_foregroundColor", st::titleFgActive->c); "__material_decoration_backgroundColor",
windowHandle()->setProperty("__material_decoration_backgroundInactiveColor", st::titleBg->c); st::titleBgActive->c);
windowHandle()->setProperty("__material_decoration_foregroundInactiveColor", st::titleFg->c);
windowHandle()->setProperty(
"__material_decoration_foregroundColor",
st::titleFgActive->c);
windowHandle()->setProperty(
"__material_decoration_backgroundInactiveColor",
st::titleBg->c);
windowHandle()->setProperty(
"__material_decoration_foregroundInactiveColor",
st::titleFg->c);
// Trigger a QtWayland client-side decoration update // Trigger a QtWayland client-side decoration update
windowHandle()->resize(windowHandle()->size()); windowHandle()->resize(windowHandle()->size());

View File

@ -126,7 +126,8 @@ uint FileChooserPortalVersion() {
qsl("version") qsl("version")
}); });
const QDBusReply<uint> reply = QDBusConnection::sessionBus().call(message); const QDBusReply<uint> reply = QDBusConnection::sessionBus().call(
message);
if (reply.isValid()) { if (reply.isValid()) {
return reply.value(); return reply.value();
@ -345,8 +346,14 @@ std::optional<crl::time> XCBLastUserInputTime() {
return std::nullopt; return std::nullopt;
} }
const auto cookie = xcb_screensaver_query_info(connection, screen->root); const auto cookie = xcb_screensaver_query_info(
auto info = xcb_screensaver_query_info_reply(connection, cookie, nullptr); connection,
screen->root);
auto info = xcb_screensaver_query_info_reply(
connection,
cookie,
nullptr);
if (!info) { if (!info) {
return std::nullopt; return std::nullopt;
@ -515,7 +522,8 @@ bool StartXCBMoveResize(QWindow *window, int edges) {
return false; return false;
} }
const auto moveResizeCookie = xcb_intern_atom(connection, const auto moveResizeCookie = xcb_intern_atom(
connection,
0, 0,
strlen("_NET_WM_MOVERESIZE"), strlen("_NET_WM_MOVERESIZE"),
"_NET_WM_MOVERESIZE"); "_NET_WM_MOVERESIZE");
@ -549,17 +557,20 @@ bool StartXCBMoveResize(QWindow *window, int edges) {
xev.data.data32[4] = 0; xev.data.data32[4] = 0;
xcb_ungrab_pointer(connection, XCB_CURRENT_TIME); xcb_ungrab_pointer(connection, XCB_CURRENT_TIME);
xcb_send_event(connection, xcb_send_event(
connection,
false, false,
screen->root, screen->root,
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY, XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT
| XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY,
reinterpret_cast<const char*>(&xev)); reinterpret_cast<const char*>(&xev));
return true; return true;
} }
bool StartWaylandMove(QWindow *window) { bool StartWaylandMove(QWindow *window) {
if (const auto waylandWindow = static_cast<QWaylandWindow*>(window->handle())) { if (const auto waylandWindow = static_cast<QWaylandWindow*>(
window->handle())) {
if (const auto seat = waylandWindow->display()->lastInputDevice()) { if (const auto seat = waylandWindow->display()->lastInputDevice()) {
if (const auto shellSurface = waylandWindow->shellSurface()) { if (const auto shellSurface = waylandWindow->shellSurface()) {
return shellSurface->move(seat); return shellSurface->move(seat);
@ -571,7 +582,8 @@ bool StartWaylandMove(QWindow *window) {
} }
bool StartWaylandResize(QWindow *window, Qt::Edges edges) { bool StartWaylandResize(QWindow *window, Qt::Edges edges) {
if (const auto waylandWindow = static_cast<QWaylandWindow*>(window->handle())) { if (const auto waylandWindow = static_cast<QWaylandWindow*>(
window->handle())) {
if (const auto seat = waylandWindow->display()->lastInputDevice()) { if (const auto seat = waylandWindow->display()->lastInputDevice()) {
if (const auto shellSurface = waylandWindow->shellSurface()) { if (const auto shellSurface = waylandWindow->shellSurface()) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) || defined DESKTOP_APP_QT_PATCHED #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) || defined DESKTOP_APP_QT_PATCHED
@ -794,7 +806,10 @@ QString GetLauncherBasename() {
.toUtf8(); .toUtf8();
char md5Hash[33] = { 0 }; char md5Hash[33] = { 0 };
hashMd5Hex(appimagePath.constData(), appimagePath.size(), md5Hash); hashMd5Hex(
appimagePath.constData(),
appimagePath.size(),
md5Hash);
return qsl("appimagekit_%1-%2") return qsl("appimagekit_%1-%2")
.arg(md5Hash) .arg(md5Hash)
@ -865,7 +880,8 @@ QImage GetImageFromClipboard() {
if (gsel) { if (gsel) {
if (Libs::gtk_selection_data_targets_include_image(gsel, false)) { if (Libs::gtk_selection_data_targets_include_image(gsel, false)) {
auto img = Libs::gtk_clipboard_wait_for_image(App::wnd()->gtkClipboard()); auto img = Libs::gtk_clipboard_wait_for_image(
App::wnd()->gtkClipboard());
if (img) { if (img) {
data = QImage( data = QImage(
@ -913,11 +929,14 @@ std::optional<bool> IsDarkMode() {
if (Libs::GtkSettingSupported() && Libs::GtkLoaded()) { if (Libs::GtkSettingSupported() && Libs::GtkLoaded()) {
if (Libs::gtk_check_version != nullptr if (Libs::gtk_check_version != nullptr
&& !Libs::gtk_check_version(3, 0, 0) && !Libs::gtk_check_version(3, 0, 0)
&& Libs::GtkSetting<gboolean>("gtk-application-prefer-dark-theme")) { && Libs::GtkSetting<gboolean>(
"gtk-application-prefer-dark-theme")) {
return true; return true;
} }
if (Libs::GtkSetting("gtk-theme-name").toLower().endsWith(qsl("-dark"))) { const auto themeName = Libs::GtkSetting("gtk-theme-name").toLower();
if (themeName.endsWith(qsl("-dark"))) {
return true; return true;
} }
@ -929,7 +948,8 @@ std::optional<bool> IsDarkMode() {
} }
bool AutostartSupported() { bool AutostartSupported() {
// snap sandbox doesn't allow creating files in folders with names started with a dot // snap sandbox doesn't allow creating files
// in folders with names started with a dot
// and doesn't provide any api to add an app to autostart // and doesn't provide any api to add an app to autostart
// thus, autostart isn't supported in snap // thus, autostart isn't supported in snap
return !InSnap(); return !InSnap();
@ -990,7 +1010,8 @@ Window::ControlsLayout WindowControlsLayout() {
&& Libs::GtkLoaded() && Libs::GtkLoaded()
&& Libs::gtk_check_version != nullptr && Libs::gtk_check_version != nullptr
&& !Libs::gtk_check_version(3, 12, 0)) { && !Libs::gtk_check_version(3, 12, 0)) {
const auto decorationLayout = Libs::GtkSetting("gtk-decoration-layout").split(':'); const auto decorationLayout = Libs::GtkSetting(
"gtk-decoration-layout").split(':');
std::vector<Window::Control> controlsLeft; std::vector<Window::Control> controlsLeft;
ranges::transform( ranges::transform(
@ -1225,7 +1246,8 @@ void start() {
|| IsQtPluginsBundled()) || IsQtPluginsBundled())
&& !InFlatpak()) { && !InFlatpak()) {
LOG(("Checking for XDG Desktop Portal...")); LOG(("Checking for XDG Desktop Portal..."));
// this can give us a chance to use a proper file dialog for current session // this can give us a chance to use
// a proper file dialog for current session
if (IsXDGDesktopPortalPresent()) { if (IsXDGDesktopPortalPresent()) {
LOG(("XDG Desktop Portal is present!")); LOG(("XDG Desktop Portal is present!"));
if (UseXDGDesktopPortal()) { if (UseXDGDesktopPortal()) {
@ -1262,10 +1284,8 @@ void RegisterCustomScheme(bool force) {
GenerateDesktopFile(applicationsPath, qsl("-- %u")); GenerateDesktopFile(applicationsPath, qsl("-- %u"));
const auto icons = const auto icons = QStandardPaths::writableLocation(
QStandardPaths::writableLocation( QStandardPaths::GenericDataLocation) + qsl("/icons/");
QStandardPaths::GenericDataLocation)
+ qsl("/icons/");
if (!QDir(icons).exists()) QDir().mkpath(icons); if (!QDir(icons).exists()) QDir().mkpath(icons);