- window->user_data = NULL;
-
- if (attributes_mask & GDK_WA_VISUAL)
- visual = attributes->visual;
- else
- visual = gdk_visual_get_system ();
- xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
- xattributes.event_mask = StructureNotifyMask;
- for (i = 0; i < nevent_masks; i++)
- {
- if (attributes->event_mask & (1 << (i + 1)))
- xattributes.event_mask |= event_mask_table[i];
- }
-
- if (xattributes.event_mask)
- xattributes_mask |= CWEventMask;
-
- if(attributes_mask & GDK_WA_NOREDIR) {
- xattributes.override_redirect =
- (attributes->override_redirect == FALSE)?False:True;
- xattributes_mask |= CWOverrideRedirect;
- } else
- xattributes.override_redirect = False;
-
- if (attributes->wclass == GDK_INPUT_OUTPUT)
- {
- class = InputOutput;
- depth = visual->depth;
-
- if (attributes_mask & GDK_WA_COLORMAP)
- colormap = attributes->colormap;
- else
- colormap = gdk_colormap_get_system ();
-
- xattributes.background_pixel = BlackPixel (gdk_display, gdk_screen);
- xattributes.border_pixel = BlackPixel (gdk_display, gdk_screen);
- xattributes_mask |= CWBorderPixel | CWBackPixel;
-
- switch (private->window_type)
- {
- case GDK_WINDOW_TOPLEVEL:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
-
- xparent = gdk_root_window;
- break;
-
- case GDK_WINDOW_CHILD:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
- break;
-
- case GDK_WINDOW_DIALOG:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
-
- xparent = gdk_root_window;
- break;
-
- case GDK_WINDOW_TEMP:
- xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
- xattributes_mask |= CWColormap;
-
- xparent = gdk_root_window;
-
- xattributes.save_under = True;
- xattributes.override_redirect = True;
- xattributes.cursor = None;
- xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
- break;
- case GDK_WINDOW_ROOT:
- g_error ("cannot make windows of type GDK_WINDOW_ROOT");
- break;
- case GDK_WINDOW_PIXMAP:
- g_error ("cannot make windows of type GDK_WINDOW_PIXMAP (use gdk_pixmap_new)");
- break;
- }
- }
- else
- {
- depth = 0;
- class = InputOnly;
- colormap = NULL;
- }
-
- private->xwindow = XCreateWindow (private->xdisplay, xparent,
- x, y, private->width, private->height,
- 0, depth, class, xvisual,
- xattributes_mask, &xattributes);
- gdk_window_ref (window);
- gdk_xid_table_insert (&private->xwindow, window);
-
- switch (private->window_type)
- {
- case GDK_WINDOW_DIALOG:
- XSetTransientForHint (private->xdisplay, private->xwindow, xparent);
- case GDK_WINDOW_TOPLEVEL:
- case GDK_WINDOW_TEMP:
- XSetWMProtocols (private->xdisplay, private->xwindow, gdk_wm_window_protocols, 2);
- break;
- case GDK_WINDOW_CHILD:
- if ((attributes->wclass == GDK_INPUT_OUTPUT) &&
- (colormap != gdk_colormap_get_system ()) &&
- (colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
- {
- g_print ("adding colormap window\n");
- gdk_window_add_colormap_windows (window);
- }
- break;
- default:
- break;
- }
-
- size_hints.flags = PSize | PBaseSize;
- size_hints.width = private->width;
- size_hints.height = private->height;
- size_hints.base_width = private->width;
- size_hints.base_height = private->height;
-
- wm_hints.flags = InputHint | StateHint | WindowGroupHint;
- wm_hints.window_group = gdk_leader_window;
- wm_hints.input = True;
- wm_hints.initial_state = NormalState;