[gtk+/rendering-cleanup: 132/141] API: Remove colormap member from GdkWindowAttr
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup: 132/141] API: Remove colormap member from GdkWindowAttr
- Date: Sat, 11 Sep 2010 03:11:43 +0000 (UTC)
commit afbdd8a27660c0f0a7d1f02a5eb94a8b94d74262
Author: Benjamin Otte <otte redhat com>
Date: Sun Aug 29 02:30:33 2010 +0200
API: Remove colormap member from GdkWindowAttr
Also remove all code that cares about differing colormaps for child
windows.
gdk/gdkoffscreenwindow.c | 15 +++-----
gdk/gdkwindow.c | 13 ++-----
gdk/gdkwindow.h | 12 ++----
gdk/quartz/gdkwindow-quartz.c | 34 +++++++-----------
gdk/win32/gdkwindow-win32.c | 12 +-----
gdk/x11/gdkwindow-x11.c | 77 ++++-------------------------------------
6 files changed, 35 insertions(+), 128 deletions(-)
---
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index 78b92d5..3994235 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -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,
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 657b735..024e8ee 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -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;
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index b99af20..a8c4448 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -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;
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index de351a7..22af170 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -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
{
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 23e525b..fdae033 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -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
{
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 4ad77e6..f31d4a4 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -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;
}
@@ -3350,51 +3332,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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]