Fix GtkApplicationWindow menubar placement

Since the menubar is part of the content, we need to give
it the content_window as parent window, to make things
work again.
https://bugzilla.gnome.org/show_bug.cgi?id=696561
This commit is contained in:
Matthias Clasen 2013-03-27 00:23:19 -04:00
parent bdfd0d4638
commit 93efaa5ebe
3 changed files with 14 additions and 0 deletions

View File

@ -258,6 +258,9 @@ gtk_application_window_update_menubar (GtkApplicationWindow *window)
window->priv->menubar = gtk_menu_bar_new_from_model (G_MENU_MODEL (combined));
gtk_widget_set_parent (window->priv->menubar, GTK_WIDGET (window));
if (_gtk_window_get_content_window (GTK_WINDOW (window)) != NULL)
gtk_widget_set_parent_window (window->priv->menubar,
_gtk_window_get_content_window (GTK_WINDOW (window)));
gtk_widget_show_all (window->priv->menubar);
g_object_unref (combined);
@ -760,6 +763,10 @@ gtk_application_window_real_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_application_window_parent_class)
->realize (widget);
if (window->priv->menubar != NULL)
gtk_widget_set_parent_window (window->priv->menubar,
_gtk_window_get_content_window (GTK_WINDOW (window)));
#ifdef GDK_WINDOWING_X11
{
GdkWindow *gdkwindow;

View File

@ -11271,3 +11271,9 @@ ensure_state_flag_backdrop (GtkWidget *widget)
gtk_widget_queue_draw (widget);
}
GdkWindow *
_gtk_window_get_content_window (GtkWindow *window)
{
return window->priv->content_window;
}

View File

@ -69,6 +69,7 @@ void _gtk_window_get_wmclass (GtkWindow *window,
void _gtk_window_set_allocation (GtkWindow *window,
const GtkAllocation *allocation,
GtkAllocation *allocation_out);
GdkWindow * _gtk_window_get_content_window (GtkWindow *window);
typedef void (*GtkWindowKeysForeachFunc) (GtkWindow *window,
guint keyval,