Skip to content

Commit

Permalink
gtkui: Set parent window for infopopup
Browse files Browse the repository at this point in the history
This allows to position the popup correctly on Wayland.
  • Loading branch information
radioactiveman authored and jlindgren90 committed Jun 5, 2024
1 parent 296c1e2 commit 5a0e6bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/gtkui/gtkui.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ extern Playlist menu_tab_playlist;
extern const PluginPreferences gtkui_prefs;

/* ui_gtk.c */
GtkWindow * get_main_window ();
void show_hide_menu ();
void show_hide_infoarea ();
void show_hide_infoarea_art ();
Expand Down
5 changes: 5 additions & 0 deletions src/gtkui/ui_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,11 @@ void GtkUI::cleanup ()
audgui_cleanup ();
}

GtkWindow * get_main_window ()
{
return (GtkWindow *) window;
}

#ifndef USE_GTK3
static void menu_position_cb (GtkMenu *, int * x, int * y, int * push, void * button)
{
Expand Down
5 changes: 4 additions & 1 deletion src/gtkui/ui_playlist_widget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ struct PlaylistWidgetData
QueuedFunc popup_timer;

void show_popup ()
{ audgui_infopopup_show (list, popup_pos); }
{
GtkWindow * parent = get_main_window ();
audgui_infopopup_show (parent, list, popup_pos);
}
};

static void set_int_from_tuple (GValue * value, const Tuple & tuple, Tuple::Field field)
Expand Down

2 comments on commit 5a0e6bb

@mschwendt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit causes a new build failure on Fedora.

../src/gtkui/ui_playlist_widget.cc: In member function ‘void PlaylistWidgetData::show_popup()’:
../src/gtkui/ui_playlist_widget.cc:131:32: error: could not convert ‘parent’ from ‘GtkWindow’ {aka ‘_GtkWindow’} to ‘Playlist’
131 | audgui_infopopup_show (parent, list, popup_pos);
| ^~~~~~
| |
| GtkWindow* {aka _GtkWindow*}

@radioactiveman
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit requires Audacious 4.4 which includes audacious-media-player/audacious@c684358. You probably still have the 4.4-beta1 version installed.

Please sign in to comment.