gdk: Create windows via _gdk_display_create_window()

THe use of this function will become visible in the next commits. But
wrapping g_object_new() is a generally a good idea anyway.
This commit is contained in:
Benjamin Otte 2010-12-21 03:06:59 +01:00 committed by Matthias Clasen
parent 503087dfc9
commit 3036922b3d
6 changed files with 16 additions and 7 deletions

View File

@ -2498,6 +2498,12 @@ _gdk_display_create_window_impl (GdkDisplay *display,
attributes_mask);
}
GdkWindow *
_gdk_display_create_window (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_WINDOW, NULL);
}
/**
* gdk_keymap_get_for_display:
* @display: the #GdkDisplay.

View File

@ -287,6 +287,7 @@ void _gdk_display_create_window_impl (GdkDisplay *display
GdkEventMask event_mask,
GdkWindowAttr *attributes,
gint attributes_mask);
GdkWindow * _gdk_display_create_window (GdkDisplay *display);
G_END_DECLS

View File

@ -1307,7 +1307,9 @@ gdk_window_new (GdkWindow *parent,
return NULL;
}
window = g_object_new (GDK_TYPE_WINDOW, NULL);
display = gdk_screen_get_display (screen);
window = _gdk_display_create_window (display);
/* Windows with a foreign parent are treated as if they are children
* of the root window, except for actual creation.
@ -1409,7 +1411,6 @@ gdk_window_new (GdkWindow *parent,
}
else if (native)
{
display = gdk_screen_get_display (screen);
event_mask = get_native_event_mask (window);
/* Create the impl */

View File

@ -1041,7 +1041,7 @@ _gdk_windowing_window_init (void)
g_assert (_gdk_root == NULL);
_gdk_root = g_object_new (GDK_TYPE_WINDOW, NULL);
_gdk_root = _gdk_display_create_window (_gdk_display);
_gdk_root->impl = g_object_new (_gdk_root_window_impl_quartz_get_type (), NULL);
_gdk_root->impl_window = _gdk_root;

View File

@ -203,7 +203,8 @@ _gdk_windowing_window_init (GdkScreen *screen)
g_assert (_gdk_root == NULL);
_gdk_root = g_object_new (GDK_TYPE_WINDOW, NULL);
_gdk_root = _gdk_display_create_window (_gdk_display);
private = (GdkWindowObject *)_gdk_root;
private->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
private->impl_window = private;
@ -632,7 +633,7 @@ gdk_win32_window_foreign_new_for_display (GdkDisplay *display,
g_return_val_if_fail (display == _gdk_display, NULL);
window = g_object_new (GDK_TYPE_WINDOW, NULL);
window = _gdk_display_create_window (display);
private = (GdkWindowObject *)window;
private->visual = gdk_screen_get_system_visual (_gdk_screen);
private->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);

View File

@ -460,7 +460,7 @@ _gdk_x11_screen_init_root_window (GdkScreen *screen)
g_assert (x11_screen->root_window == NULL);
window = x11_screen->root_window = g_object_new (GDK_TYPE_WINDOW, NULL);
window = x11_screen->root_window = _gdk_display_create_window (gdk_screen_get_display (screen));
window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL);
window->impl_window = window;
@ -906,7 +906,7 @@ gdk_x11_window_foreign_new_for_display (GdkDisplay *display,
screen = _gdk_x11_display_screen_for_xrootwin (display, root);
win = g_object_new (GDK_TYPE_WINDOW, NULL);
win = _gdk_display_create_window (display);
win->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL);
win->impl_window = win;
win->visual = gdk_x11_screen_lookup_visual (screen,