gdk: store the visual in the GdkWindowObject

This commit is contained in:
Benjamin Otte 2010-08-29 01:05:59 +02:00
parent 894d402c0f
commit eee6c002d1
6 changed files with 25 additions and 25 deletions

View File

@ -191,6 +191,7 @@ struct _GdkWindowObject
GdkDrawable *impl; /* window-system-specific delegate object */
GdkWindowObject *parent;
GdkVisual *visual;
gpointer user_data;
@ -324,7 +325,6 @@ cairo_surface_t * _gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
void _gdk_window_impl_new (GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkVisual *visual,
GdkEventMask event_mask,
GdkWindowAttr *attributes,
gint attributes_mask);
@ -555,7 +555,6 @@ GdkWindow *_gdk_window_get_input_window_for_event (GdkWindow *native_window,
GType gdk_offscreen_window_get_type (void);
void _gdk_offscreen_window_new (GdkWindow *window,
GdkScreen *screen,
GdkVisual *visual,
GdkWindowAttr *attributes,
gint attributes_mask);

View File

@ -175,7 +175,6 @@ gdk_offscreen_window_get_visual (GdkDrawable *drawable)
void
_gdk_offscreen_window_new (GdkWindow *window,
GdkScreen *screen,
GdkVisual *visual,
GdkWindowAttr *attributes,
gint attributes_mask)
{
@ -202,13 +201,13 @@ _gdk_offscreen_window_new (GdkWindow *window,
offscreen->colormap = g_object_ref (attributes->colormap);
else
{
if (gdk_screen_get_system_visual (screen) == visual)
if (gdk_screen_get_system_visual (screen) == private->visual)
{
offscreen->colormap = gdk_screen_get_system_colormap (screen);
g_object_ref (offscreen->colormap);
}
else
offscreen->colormap = gdk_colormap_new (visual, FALSE);
offscreen->colormap = gdk_colormap_new (private->visual, FALSE);
}
offscreen->surface = gdk_window_create_similar_surface ((GdkWindow *)private->parent,

View File

@ -1257,7 +1257,6 @@ gdk_window_new (GdkWindow *parent,
GdkWindow *window;
GdkWindowObject *private;
GdkScreen *screen;
GdkVisual *visual;
int x, y;
gboolean native;
GdkEventMask event_mask;
@ -1367,16 +1366,16 @@ gdk_window_new (GdkWindow *parent,
}
if (attributes_mask & GDK_WA_VISUAL)
visual = attributes->visual;
private->visual = attributes->visual;
else
visual = gdk_screen_get_system_visual (screen);
private->visual = gdk_screen_get_system_visual (screen);
private->event_mask = attributes->event_mask;
if (attributes->wclass == GDK_INPUT_OUTPUT)
{
private->input_only = FALSE;
private->depth = visual->depth;
private->depth = private->visual->depth;
/* XXX: Cache this somehow? */
private->background = cairo_pattern_create_rgb (0, 0, 0);
@ -1402,7 +1401,7 @@ gdk_window_new (GdkWindow *parent,
if (gdk_window_is_offscreen (private))
{
_gdk_offscreen_window_new (window, screen, visual, attributes, attributes_mask);
_gdk_offscreen_window_new (window, screen, attributes, attributes_mask);
private->impl_window = private;
}
else if (native)
@ -1410,7 +1409,7 @@ gdk_window_new (GdkWindow *parent,
event_mask = get_native_event_mask (private);
/* Create the impl */
_gdk_window_impl_new (window, real_parent, screen, visual, event_mask, attributes, attributes_mask);
_gdk_window_impl_new (window, real_parent, screen, event_mask, attributes, attributes_mask);
private->impl_window = private;
/* This will put the native window topmost in the native parent, which may
@ -1774,7 +1773,6 @@ gdk_window_ensure_native (GdkWindow *window)
GdkWindowObject *impl_window;
GdkDrawable *new_impl, *old_impl;
GdkScreen *screen;
GdkVisual *visual;
GdkWindowAttr attributes;
GdkWindowObject *above;
GList listhead;
@ -1809,13 +1807,12 @@ gdk_window_ensure_native (GdkWindow *window)
gdk_window_drop_cairo_surface (private);
screen = gdk_drawable_get_screen (window);
visual = gdk_drawable_get_visual (window);
attributes.colormap = gdk_drawable_get_colormap (window);
old_impl = private->impl;
_gdk_window_impl_new (window, (GdkWindow *)private->parent,
screen, visual,
screen,
get_native_event_mask (private),
&attributes, GDK_WA_COLORMAP);
new_impl = private->impl;

View File

@ -802,7 +802,6 @@ void
_gdk_window_impl_new (GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkVisual *visual,
GdkEventMask event_mask,
GdkWindowAttr *attributes,
gint attributes_mask)
@ -843,19 +842,19 @@ _gdk_window_impl_new (GdkWindow *window,
}
else
{
if (visual == gdk_screen_get_system_visual (_gdk_screen))
if (private->visual == gdk_screen_get_system_visual (_gdk_screen))
{
draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
g_object_ref (draw_impl->colormap);
}
else if (visual == gdk_screen_get_rgba_visual (_gdk_screen))
else if (private->visual == gdk_screen_get_rgba_visual (_gdk_screen))
{
draw_impl->colormap = gdk_screen_get_rgba_colormap (_gdk_screen);
g_object_ref (draw_impl->colormap);
}
else
{
draw_impl->colormap = gdk_colormap_new (visual, FALSE);
draw_impl->colormap = gdk_colormap_new (private->visual, FALSE);
}
}
}
@ -1043,6 +1042,7 @@ _gdk_windowing_window_init (void)
private = (GdkWindowObject *)_gdk_root;
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
private->impl_window = private;
private->visual = gdk_screen_get_system_visual (_gdk_screen);
impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (_gdk_root)->impl);

View File

@ -236,6 +236,7 @@ _gdk_windowing_window_init (GdkScreen *screen)
private = (GdkWindowObject *)_gdk_root;
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
private->impl_window = private;
private->visual = gdk_screen_get_system_visual (screen);
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
@ -428,7 +429,6 @@ void
_gdk_window_impl_new (GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkVisual *visual,
GdkEventMask event_mask,
GdkWindowAttr *attributes,
gint attributes_mask)
@ -486,7 +486,6 @@ _gdk_window_impl_new (GdkWindow *window,
dwExStyle = 0;
private->input_only = FALSE;
private->depth = visual->depth;
if (attributes_mask & GDK_WA_COLORMAP)
{
@ -679,6 +678,7 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
window = g_object_new (GDK_TYPE_WINDOW, NULL);
private = (GdkWindowObject *)window;
private->visual = gdk_screen_get_system_visual (_gdk_screen);
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);

View File

@ -470,6 +470,7 @@ _gdk_windowing_window_init (GdkScreen * screen)
private = (GdkWindowObject *) screen_x11->root_window;
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
private->impl_window = private;
private->visual = gdk_screen_get_system_visual (screen);
draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl);
@ -689,7 +690,6 @@ void
_gdk_window_impl_new (GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
GdkVisual *visual,
GdkEventMask event_mask,
GdkWindowAttr *attributes,
gint attributes_mask)
@ -728,7 +728,7 @@ _gdk_window_impl_new (GdkWindow *window,
xattributes_mask = 0;
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
xvisual = ((GdkVisualPrivate*) private->visual)->xvisual;
if (attributes_mask & GDK_WA_NOREDIR)
{
@ -770,14 +770,14 @@ _gdk_window_impl_new (GdkWindow *window,
}
else
{
if ((((GdkVisualPrivate *)gdk_screen_get_system_visual (screen))->xvisual) == xvisual)
if ((((GdkVisualPrivate *)gdk_screen_get_system_visual (screen))->xvisual) == xvisual)
{
draw_impl->colormap = gdk_screen_get_system_colormap (screen);
g_object_ref (draw_impl->colormap);
}
else
{
draw_impl->colormap = gdk_colormap_new (visual, FALSE);
draw_impl->colormap = gdk_colormap_new (private->visual, FALSE);
}
}
@ -917,6 +917,7 @@ GdkWindow *
gdk_window_foreign_new_for_display (GdkDisplay *display,
GdkNativeWindow anid)
{
GdkScreen *screen;
GdkWindow *window;
GdkWindowObject *private;
GdkWindowImplX11 *impl;
@ -950,16 +951,20 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
if (children)
XFree (children);
screen = _gdk_x11_display_screen_for_xrootwin (display, root);
window = g_object_new (GDK_TYPE_WINDOW, NULL);
private = (GdkWindowObject *) window;
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
private->impl_window = private;
private->visual = gdk_x11_screen_lookup_visual (screen,
XVisualIDFromVisual (attrs.visual));
impl = GDK_WINDOW_IMPL_X11 (private->impl);
draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl);
draw_impl->wrapper = GDK_DRAWABLE (window);
draw_impl->screen = _gdk_x11_display_screen_for_xrootwin (display, root);
draw_impl->screen = screen;
private->parent = gdk_xid_table_lookup_for_display (display, parent);