API: Remove colormap member from GdkWindowAttr

Also remove all code that cares about differing colormaps for child
windows.
This commit is contained in:
Benjamin Otte 2010-08-29 02:30:33 +02:00
parent eac72ec830
commit f08254074c
6 changed files with 35 additions and 128 deletions

View File

@ -173,18 +173,13 @@ _gdk_offscreen_window_new (GdkWindow *window,
offscreen->screen = screen;
if (attributes_mask & GDK_WA_COLORMAP)
offscreen->colormap = g_object_ref (attributes->colormap);
else
if (gdk_screen_get_system_visual (screen) == private->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 (private->visual, FALSE);
offscreen->colormap = gdk_screen_get_system_colormap (screen);
g_object_ref (offscreen->colormap);
}
else
offscreen->colormap = gdk_colormap_new (private->visual, FALSE);
offscreen->surface = gdk_window_create_similar_surface ((GdkWindow *)private->parent,
CAIRO_CONTENT_COLOR,

View File

@ -1387,11 +1387,9 @@ gdk_window_new (GdkWindow *parent,
if (private->parent->window_type == GDK_WINDOW_ROOT)
native = TRUE; /* Always use native windows for toplevels */
else if (!private->input_only &&
((attributes_mask & GDK_WA_COLORMAP &&
attributes->colormap != gdk_drawable_get_colormap ((GdkDrawable *)private->parent)) ||
(attributes_mask & GDK_WA_VISUAL &&
attributes->visual != gdk_window_get_visual (GDK_WINDOW (private->parent)))))
native = TRUE; /* InputOutput window with different colormap or visual than parent, needs native window */
(attributes_mask & GDK_WA_VISUAL &&
attributes->visual != gdk_window_get_visual (GDK_WINDOW (private->parent))))
native = TRUE; /* InputOutput window with different visual than parent, needs native window */
if (gdk_window_is_offscreen (private))
{
@ -1767,7 +1765,6 @@ gdk_window_ensure_native (GdkWindow *window)
GdkWindowObject *impl_window;
GdkDrawable *new_impl, *old_impl;
GdkScreen *screen;
GdkWindowAttr attributes;
GdkWindowObject *above;
GList listhead;
GdkWindowImplIface *impl_iface;
@ -1802,13 +1799,11 @@ gdk_window_ensure_native (GdkWindow *window)
screen = gdk_window_get_screen (window);
attributes.colormap = gdk_drawable_get_colormap (window);
old_impl = private->impl;
_gdk_window_impl_new (window, (GdkWindow *)private->parent,
screen,
get_native_event_mask (private),
&attributes, GDK_WA_COLORMAP);
NULL, 0);
new_impl = private->impl;
private->impl = old_impl;

View File

@ -89,7 +89,6 @@ typedef enum
* @GDK_WA_X: Honor the X coordinate field
* @GDK_WA_Y: Honor the Y coordinate field
* @GDK_WA_CURSOR: Honor the cursor field
* @GDK_WA_COLORMAP: Honor the colormap field
* @GDK_WA_VISUAL: Honor the visual field
* @GDK_WA_WMCLASS: Honor the wmclass_class and wmclass_name fields
* @GDK_WA_NOREDIR: Honor the override_redirect field
@ -108,11 +107,10 @@ typedef enum
GDK_WA_X = 1 << 2,
GDK_WA_Y = 1 << 3,
GDK_WA_CURSOR = 1 << 4,
GDK_WA_COLORMAP = 1 << 5,
GDK_WA_VISUAL = 1 << 6,
GDK_WA_WMCLASS = 1 << 7,
GDK_WA_NOREDIR = 1 << 8,
GDK_WA_TYPE_HINT = 1 << 9
GDK_WA_VISUAL = 1 << 5,
GDK_WA_WMCLASS = 1 << 6,
GDK_WA_NOREDIR = 1 << 7,
GDK_WA_TYPE_HINT = 1 << 8
} GdkWindowAttributesType;
/* Size restriction enumeration.
@ -332,7 +330,6 @@ typedef enum
* @wclass: #GDK_INPUT_OUTPUT (normal window) or #GDK_INPUT_ONLY (invisible
* window that receives events)
* @visual: #GdkVisual for window
* @colormap: #GdkColormap for window
* @window_type: type of window
* @cursor: cursor for the window (see gdk_window_set_cursor())
* @wmclass_name: don't use (see gtk_window_set_wmclass())
@ -351,7 +348,6 @@ struct _GdkWindowAttr
gint height;
GdkWindowClass wclass;
GdkVisual *visual;
GdkColormap *colormap;
GdkWindowType window_type;
GdkCursor *cursor;
gchar *wmclass_name;

View File

@ -835,28 +835,20 @@ _gdk_window_impl_new (GdkWindow *window,
if (!private->input_only)
{
if (attributes_mask & GDK_WA_COLORMAP)
{
draw_impl->colormap = attributes->colormap;
g_object_ref (attributes->colormap);
}
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 (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
{
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 (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 (private->visual, FALSE);
}
}
{
draw_impl->colormap = gdk_colormap_new (private->visual, FALSE);
}
}
else
{

View File

@ -487,16 +487,8 @@ _gdk_window_impl_new (GdkWindow *window,
private->input_only = FALSE;
if (attributes_mask & GDK_WA_COLORMAP)
{
draw_impl->colormap = attributes->colormap;
g_object_ref (attributes->colormap);
}
else
{
draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
g_object_ref (draw_impl->colormap);
}
draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
g_object_ref (draw_impl->colormap);
}
else
{

View File

@ -103,7 +103,6 @@ const int _gdk_nenvent_masks = sizeof (_gdk_event_mask_table) / sizeof (int);
static void gdk_window_set_static_win_gravity (GdkWindow *window,
gboolean on);
static gboolean gdk_window_icon_name_set (GdkWindow *window);
static void gdk_window_add_colormap_windows (GdkWindow *window);
static void set_wm_name (GdkDisplay *display,
Window xwindow,
const gchar *name);
@ -763,24 +762,16 @@ _gdk_window_impl_new (GdkWindow *window,
{
class = InputOutput;
if (attributes_mask & GDK_WA_COLORMAP)
if ((((GdkVisualPrivate *)gdk_screen_get_system_visual (screen))->xvisual) == xvisual)
{
draw_impl->colormap = attributes->colormap;
g_object_ref (attributes->colormap);
draw_impl->colormap = gdk_screen_get_system_colormap (screen);
g_object_ref (draw_impl->colormap);
}
else
{
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 (private->visual, FALSE);
}
}
{
draw_impl->colormap = gdk_colormap_new (private->visual, FALSE);
}
xattributes.background_pixel = BlackPixel (xdisplay, screen_x11->screen_num);
xattributes.border_pixel = BlackPixel (xdisplay, screen_x11->screen_num);
@ -858,15 +849,6 @@ _gdk_window_impl_new (GdkWindow *window,
break;
case GDK_WINDOW_CHILD:
if (!private->input_only &&
(draw_impl->colormap != gdk_screen_get_system_colormap (screen)) &&
(draw_impl->colormap != gdk_drawable_get_colormap (gdk_window_get_toplevel (window))))
{
GDK_NOTE (MISC, g_message ("adding colormap window\n"));
gdk_window_add_colormap_windows (window);
}
break;
default:
break;
}
@ -3347,51 +3329,6 @@ gdk_window_x11_set_events (GdkWindow *window,
}
}
static void
gdk_window_add_colormap_windows (GdkWindow *window)
{
GdkWindow *toplevel;
Window *old_windows;
Window *new_windows;
int i, count;
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
return;
toplevel = gdk_window_get_toplevel (window);
old_windows = NULL;
if (!XGetWMColormapWindows (GDK_WINDOW_XDISPLAY (toplevel),
GDK_WINDOW_XID (toplevel),
&old_windows, &count))
{
count = 0;
}
for (i = 0; i < count; i++)
if (old_windows[i] == GDK_WINDOW_XID (window))
{
XFree (old_windows);
return;
}
new_windows = g_new (Window, count + 1);
for (i = 0; i < count; i++)
new_windows[i] = old_windows[i];
new_windows[count] = GDK_WINDOW_XID (window);
XSetWMColormapWindows (GDK_WINDOW_XDISPLAY (toplevel),
GDK_WINDOW_XID (toplevel),
new_windows, count + 1);
g_free (new_windows);
if (old_windows)
XFree (old_windows);
}
static inline void
do_shape_combine_region (GdkWindow *window,
const cairo_region_t *shape_region,