Skip to content

fix(linux): cast notification callback with NOTIFY_ACTION_CALLBACK#56

Merged
ReenigneArcher merged 1 commit into
LizardByte:masterfrom
chewi:notification-cb-cast
Jul 1, 2025
Merged

fix(linux): cast notification callback with NOTIFY_ACTION_CALLBACK#56
ReenigneArcher merged 1 commit into
LizardByte:masterfrom
chewi:notification-cb-cast

Conversation

@chewi

@chewi chewi commented Jul 1, 2025

Copy link
Copy Markdown

Description

This fixes an incompatible pointer type error with GCC 15.

third-party/tray/src/tray_linux.c: In function ‘tray_update_internal’:
third-party/tray/src/tray_linux.c:103:87: error: passing argument 4 of ‘notify_notification_add_action’ from incompatible pointer type [-Wincompatible-pointer-types]
  103 |         notify_notification_add_action(currentNotification, "default", "Default", tray->notification_cb, NULL, NULL);
      |                                                                                   ~~~~^~~~~~~~~~~~~~~~~
      |                                                                                       |
      |                                                                                       void (*)(void)
In file included from /usr/include/libnotify/notify.h:27,
                 from third-party/tray/src/tray_linux.c:19:
/usr/include/libnotify/notification.h:202:85: note: expected ‘NotifyActionCallback’ {aka ‘void (*)(NotifyNotification *, char *, void *)’} but argument is of type ‘void (*)(void)’
  202 |                                                                NotifyActionCallback callback,
      |                                                                ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/usr/include/libnotify/notification.h:120:19: note: ‘NotifyActionCallback’ declared here
  120 | typedef void    (*NotifyActionCallback) (NotifyNotification *notification,
      |                   ^~~~~~~~~~~~~~~~~~~~

/**
 * NOTIFY_ACTION_CALLBACK:
 * @func: The function to cast.
 *
 * A convenience macro for casting a function to a [callback@ActionCallback].
 *
 * This is much like [func@GObject.CALLBACK].
 */
#define NOTIFY_ACTION_CALLBACK(func) ((NotifyActionCallback)(func))

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

This fixes an incompatible pointer type error with GCC 15.
@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2025

Copy link
Copy Markdown

@ReenigneArcher ReenigneArcher merged commit db96aea into LizardByte:master Jul 1, 2025
20 of 24 checks passed
@chewi chewi deleted the notification-cb-cast branch July 2, 2025 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants