Skip to content

Commit

Permalink
statusicon: Don't use deprecated method gtk_menu_popup() for GTK3
Browse files Browse the repository at this point in the history
Also replace void* with proper parameter types.
  • Loading branch information
radioactiveman committed Dec 31, 2023
1 parent 9dbbf3f commit 58cd04f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/statusicon/statusicon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ enum {

static void si_popup_timer_start (GtkStatusIcon * icon);
static void si_popup_timer_stop (GtkStatusIcon * icon);
static void si_menu_show (int x, int y, unsigned button, uint32_t time, void *);
static void si_popup_hide (void * icon);
static void si_menu_show (GtkStatusIcon * icon, GdkEventButton * event);
static void si_popup_hide (GtkStatusIcon * icon);

const char * const StatusIcon::defaults[] = {
"scroll_action", aud::numeric_string<SI_CFG_SCROLL_ACTION_VOLUME>::str,
Expand Down Expand Up @@ -125,7 +125,7 @@ static gboolean si_cb_btpress (GtkStatusIcon * icon, GdkEventButton * event)
if (event->state & GDK_SHIFT_MASK)
aud_drct_pl_prev ();
else
si_menu_show (event->x_root, event->y_root, event->button, event->time, icon);
si_menu_show (icon, event);
break;
}

Expand Down Expand Up @@ -212,7 +212,7 @@ static gboolean si_popup_show (void * icon)
return true;
}

static void si_popup_hide (void * icon)
static void si_popup_hide (GtkStatusIcon * icon)
{
if (POPUP_IS_ACTIVE)
{
Expand Down Expand Up @@ -259,10 +259,14 @@ static gboolean si_cb_tooltip (GtkStatusIcon * icon, int x, int y, gboolean keyb
return false;
}

static void si_menu_show (int x, int y, unsigned button, uint32_t time, void * evbox)
static void si_menu_show (GtkStatusIcon * icon, GdkEventButton * event)
{
GtkWidget * si_menu = (GtkWidget *) g_object_get_data ((GObject *) evbox, "menu");
gtk_menu_popup ((GtkMenu *) si_menu, nullptr, nullptr, nullptr, nullptr, button, time);
GtkMenu * si_menu = (GtkMenu *) g_object_get_data ((GObject *) icon, "menu");
#ifdef USE_GTK3
gtk_menu_popup_at_pointer (si_menu, (const GdkEvent *) event);
#else
gtk_menu_popup (si_menu, nullptr, nullptr, nullptr, nullptr, event->button, event->time);
#endif
}

static void open_files ()
Expand Down

0 comments on commit 58cd04f

Please sign in to comment.