I found a solution to fix the pop-up menu will not hide problems in Windows.
Just add the following code (my code is in C, but you can change it to python or something else) before appearing in the menu:
GtkWidget *hidden_window; hidden_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_resizable (GTK_WINDOW (hidden_window), FALSE); gtk_window_set_decorated (GTK_WINDOW (hidden_window), FALSE); gtk_window_set_skip_taskbar_hint (GTK_WINDOW (hidden_window), TRUE); gtk_window_set_skip_pager_hint (GTK_WINDOW (hidden_window), TRUE); gtk_widget_set_size_request (hidden_window, 0, 0); gtk_window_set_transient_for (GTK_WINDOW (hidden_window), GTK_WINDOW (widget)); //widget is your main window, this is to hide dummy window from taskbar gtk_window_set_position (GTK_WINDOW (hidden_window), GTK_WIN_POS_MOUSE); gtk_widget_set_events (hidden_window, GDK_FOCUS_CHANGE_MASK); g_signal_connect (G_OBJECT (hidden_window), "focus-out-event", G_CALLBACK (on_hidden_window_focus_out), NULL); gtk_widget_show_all (hidden_window); gtk_widget_grab_focus (hidden_window);
also add this function:
static void on_hidden_window_focus_out(GtkWidget *widget, GdkEventFocus *event, gpointer data) { gtk_widget_destroy (widget); }
The idea is to create a 1x1 top-level window at the mouse position and capture the focus and add the kill function when focusing.
source share