- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MYFIXED (widget));
-
- myfixed = GTK_MYFIXED (widget);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- attributes.window_type = GDK_WINDOW_CHILD;
-
-#if (GTK_MINOR_VERSION > 0)
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
-
- if (myfixed->shadow_type != GTK_SHADOW_NONE)
- {
- attributes.x += 2;
- attributes.y += 2;
- attributes.width -= 4;
- attributes.height -= 4;
- }
-
- if (attributes.width < 2) attributes.width = 2;
- if (attributes.height < 2) attributes.height = 2;
-#else
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = 32000;
- attributes.height = 32000;
-#endif
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |=
- GDK_EXPOSURE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON_MOTION_MASK |
- GDK_BUTTON1_MOTION_MASK |
- GDK_BUTTON2_MOTION_MASK |
- GDK_BUTTON3_MOTION_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_KEY_PRESS_MASK |
- GDK_KEY_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK |
- GDK_FOCUS_CHANGE_MASK;
-
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
- attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_PIZZA (widget));
+
+ pizza = GTK_PIZZA (widget);
+
+ GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+
+ attributes.window_type = GDK_WINDOW_CHILD;
+
+ attributes.x = widget->allocation.x;
+ attributes.y = widget->allocation.y;
+ attributes.width = widget->allocation.width;
+ attributes.height = widget->allocation.height;
+
+ if (pizza->shadow_type == GTK_MYSHADOW_NONE)
+ {
+ /* no border, no changes to sizes */
+ } else
+ if (pizza->shadow_type == GTK_MYSHADOW_THIN)
+ {
+ /* GTK_MYSHADOW_THIN == wxSIMPLE_BORDER */
+ attributes.x += 1;
+ attributes.y += 1;
+ attributes.width -= 2;
+ attributes.height -= 2;
+ } else
+ {
+ /* GTK_MYSHADOW_IN == wxSUNKEN_BORDER */
+ /* GTK_MYSHADOW_OUT == wxRAISED_BORDER */
+ attributes.x += 2;
+ attributes.y += 2;
+ attributes.width -= 4;
+ attributes.height -= 4;
+ }
+
+ /* minimal size */
+ if (attributes.width < 2) attributes.width = 2;
+ if (attributes.height < 2) attributes.height = 2;
+
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.visual = gtk_widget_get_visual (widget);
+ attributes.colormap = gtk_widget_get_colormap (widget);
+ attributes.event_mask =
+ GDK_VISIBILITY_NOTIFY_MASK;
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+
+ widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes, attributes_mask);
+ gdk_window_set_user_data (widget->window, widget);
+
+ attributes.x = 0;
+ attributes.y = 0;
+
+ attributes.event_mask = gtk_widget_get_events (widget);
+ attributes.event_mask |=
+ GDK_EXPOSURE_MASK |
+ GDK_POINTER_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK |
+ GDK_BUTTON_MOTION_MASK |
+ GDK_BUTTON1_MOTION_MASK |
+ GDK_BUTTON2_MOTION_MASK |
+ GDK_BUTTON3_MOTION_MASK |
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_KEY_PRESS_MASK |
+ GDK_KEY_RELEASE_MASK |
+ GDK_ENTER_NOTIFY_MASK |
+ GDK_LEAVE_NOTIFY_MASK |
+ GDK_FOCUS_CHANGE_MASK;
+
+ pizza->bin_window = gdk_window_new (widget->window,
+ &attributes, attributes_mask);
+ gdk_window_set_user_data (pizza->bin_window, widget);
+
+ widget->style = gtk_style_attach (widget->style, widget->window);
+ gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ gtk_style_set_background (widget->style, pizza->bin_window, GTK_STATE_NORMAL);
+
+ /* add filters for intercepting visibility and expose events */
+ gdk_window_add_filter (widget->window, gtk_pizza_main_filter, pizza);
+ gdk_window_add_filter (pizza->bin_window, gtk_pizza_filter, pizza);
+
+ /* we NEED gravity or we'll give up */
+ gravity_works = gdk_window_set_static_gravities (pizza->bin_window, TRUE);
+
+ /* cannot be done before realisation */
+ children = pizza->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ gtk_widget_set_parent_window (child->widget, pizza->bin_window);
+ }