[gtk+/gdk-backend] gdk: Create windows via _gdk_display_create_window()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gdk-backend] gdk: Create windows via _gdk_display_create_window()
- Date: Tue, 21 Dec 2010 02:59:37 +0000 (UTC)
commit e6783da4b088dafa13ec65e5ed036d6b69249ea8
Author: Benjamin Otte <otte redhat com>
Date: Tue Dec 21 03:06:59 2010 +0100
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.
gdk/gdkdisplay.c | 6 ++++++
gdk/gdkdisplayprivate.h | 1 +
gdk/gdkwindow.c | 5 +++--
gdk/quartz/gdkwindow-quartz.c | 2 +-
gdk/win32/gdkwindow-win32.c | 5 +++--
gdk/x11/gdkwindow-x11.c | 4 ++--
6 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 113a468..b833eac 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -2496,6 +2496,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.
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index 4885b18..608e7b1 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -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
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 3a3d39a..6e91942 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -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 */
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 284ed8a..f1bcda2 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -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;
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 2f67f35..c9130bc 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -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);
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index bf07ece..de7c691 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]