Skip to content

Commit

Permalink
gdesktopappinfo.h not excluded on macOS
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=248727

Reviewed by Carlos Garcia Campos.

Although macOS has most of the gio-unix-2.0 functionality, this
particular header is an exception and just needs to be handled
specially.

MacPorts has a patch to sometimes build with GDesktopAppInfo enabled, so
it's best to just detect the presence of the header instead of trying to
enable this code on OS(UNIX_BUT_NOT_MACOS_EXCEPT_SOMETIMES).

* Source/WTF/wtf/PlatformHave.h:
* Source/WebKit/UIProcess/Notifications/glib/NotificationService.cpp:
(WebKit::applicationIcon):

Canonical link: https://commits.webkit.org/258260@main
  • Loading branch information
mcatanzaro committed Dec 22, 2022
1 parent 90a9fbb commit 1446ba2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Source/WTF/wtf/PlatformHave.h
Expand Up @@ -1382,3 +1382,9 @@
|| PLATFORM(APPLETV)
#define HAVE_MEDIAPLAYBACKD 1
#endif

#if (PLATFORM(GTK) || PLATFORM(WPE)) && defined(__has_include)
#if __has_include(<gio/gdesktopappinfo.h>)
#define HAVE_GDESKTOPAPPINFO 1
#endif
#endif
Expand Up @@ -31,7 +31,6 @@
#include <WebCore/NotificationResources.h>
#include <WebCore/RefPtrCairo.h>
#include <cairo.h>
#include <gio/gdesktopappinfo.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <mutex>
Expand All @@ -51,6 +50,10 @@
#include <WebCore/GtkVersioning.h>
#endif

#if HAVE(GDESKTOPAPPINFO)
#include <gio/gdesktopappinfo.h>
#endif

namespace WebKit {

static const Seconds s_dbusCallTimeout = 20_ms;
Expand Down Expand Up @@ -294,6 +297,7 @@ void NotificationService::processCapabilities(GVariant* variant)
static const char* applicationIcon(const char* applicationID)
{
static std::optional<CString> appIcon;
#if HAVE(GDESKTOPAPPINFO)
if (!appIcon) {
appIcon = [applicationID]() -> CString {
if (!applicationID)
Expand Down Expand Up @@ -328,6 +332,7 @@ static const char* applicationIcon(const char* applicationID)
return { };
}();
}
#endif // HAVE(GDESKTOPAPPINFO)

return appIcon->data();
}
Expand Down

0 comments on commit 1446ba2

Please sign in to comment.