Exemplo n.º 1
0
    static void
gtk_form_realize(GtkWidget *widget)
{
    GList *tmp_list;
    GtkForm *form;
    GdkWindowAttr attributes;
    gint attributes_mask;

    g_return_if_fail(GTK_IS_FORM(widget));

    form = GTK_FORM(widget);
    GTK_WIDGET_SET_FLAGS(form, 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;
    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);

    form->bin_window = gdk_window_new(widget->window,
				      &attributes, attributes_mask);
    gdk_window_set_user_data(form->bin_window, widget);

    gtk_form_set_static_gravity(form->bin_window, TRUE);

    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, form->bin_window, GTK_STATE_NORMAL);

    gdk_window_add_filter(widget->window, gtk_form_main_filter, form);
    gdk_window_add_filter(form->bin_window, gtk_form_filter, form);

    for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
    {
	GtkFormChild *child = tmp_list->data;

	gtk_form_attach_child_window(form, child);

	if (GTK_WIDGET_VISIBLE(child->widget))
	    gtk_form_realize_child(form, child);
    }
}
Exemplo n.º 2
0
static void
gtk_pizza_style_set(GtkWidget *widget, GtkStyle  *previous_style)
{
    if (GTK_WIDGET_REALIZED(widget))
    {
        gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL);
        gtk_style_set_background(widget->style, GTK_PIZZA(widget)->bin_window, GTK_STATE_NORMAL );
    }

    (* GTK_WIDGET_CLASS (pizza_parent_class)->style_set) (widget, previous_style);
}
Exemplo n.º 3
0
static void _slider_realize(GtkWidget *widget)
{
  g_return_if_fail(widget != NULL);
  g_return_if_fail(DTGTK_IS_SLIDER(widget));

  GdkWindowAttr attributes;
  guint attributes_mask;
  GtkWidgetClass* klass = GTK_WIDGET_CLASS (_slider_parent_class);

  if (klass->realize)
    klass->realize (widget);

  gtk_widget_set_realized(widget, TRUE);

  GtkAllocation allocation;
  gtk_widget_get_allocation(widget, &allocation);
  attributes.window_type = GDK_WINDOW_CHILD;
  attributes.x = allocation.x;
  attributes.y = allocation.y;
  attributes.width = 100;
  attributes.height = DTGTK_SLIDER_CONTROL_MIN_HEIGHT;

  attributes.wclass = GDK_INPUT_OUTPUT;
  attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK;

  attributes_mask = GDK_WA_X | GDK_WA_Y;

  gtk_widget_set_window(widget, gdk_window_new( gtk_widget_get_parent_window (gtk_widget_get_parent(widget)),& attributes, attributes_mask));
  gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
  gtk_widget_set_style(widget, gtk_style_attach(gtk_widget_get_style(widget), gtk_widget_get_window(widget)));
  gtk_style_set_background(gtk_widget_get_style(widget), gtk_widget_get_window(widget), GTK_STATE_NORMAL);

}
Exemplo n.º 4
0
static void selectcolor_realize(GtkWidget *widget) {
	GdkWindowAttr attributes;
	guint attributes_mask;

	g_return_if_fail(widget != NULL);
	g_return_if_fail(IS_SELECT_COLOR(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;

	attributes.wclass = GDK_INPUT_OUTPUT;
	attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK;

	attributes_mask = GDK_WA_X | GDK_WA_Y;

	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);

	GtkWidget * parent = gtk_widget_get_parent(widget);
	widget->window = parent->window;
}
Exemplo n.º 5
0
static void _gradient_slider_realize(GtkWidget *widget)
{
  GdkWindowAttr attributes;
  guint attributes_mask;

  g_return_if_fail(widget != NULL);
  g_return_if_fail(DTGTK_IS_GRADIENT_SLIDER(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 = 100;
  attributes.height = 17;

  attributes.wclass = GDK_INPUT_OUTPUT;
  attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK |  GDK_LEAVE_NOTIFY_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
  attributes_mask = GDK_WA_X | GDK_WA_Y;

  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);
}
Exemplo n.º 6
0
static void
pp_layout_nup_pageview_realize (GtkWidget *widget)
{
  pp_Layout_NUp_PageView *pageview;
  GdkWindowAttr attributes;
  gint attributes_mask;

  g_return_if_fail (widget != NULL);
  g_return_if_fail (PP_IS_PAGEVIEW (widget));

  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
  pageview = PP_LAYOUT_NUP_PAGEVIEW (widget);

  attributes.x = widget->allocation.x;
  attributes.y = widget->allocation.y;
  attributes.width = widget->allocation.width;
  attributes.height = widget->allocation.height;
  attributes.wclass = GDK_INPUT_OUTPUT;
  attributes.window_type = GDK_WINDOW_CHILD;
  attributes.event_mask = gtk_widget_get_events (widget) | 
    GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | 
    GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK |
    GDK_POINTER_MOTION_HINT_MASK;
  attributes.visual = gtk_widget_get_visual (widget);
  attributes.colormap = gtk_widget_get_colormap (widget);

  attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
  widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);

  widget->style = gtk_style_attach (widget->style, widget->window);

  gdk_window_set_user_data (widget->window, widget);

  gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
}
Exemplo n.º 7
0
static void matenu_menu_bar_reset_bg_pixmap (MatenuMenuBar* self) {
	GdkPixmap* pixmap;
	cairo_t* cairo;
	cairo_pattern_t* pattern;
	GtkStyle* style;
	GdkPixmap* _tmp0_;
	g_return_if_fail (self != NULL);
	if (matenu_menu_bar_get_background (self)->type != MATENU_BACKGROUND_TYPE_PIXMAP) {
		return;
	}
	if (!GTK_WIDGET_REALIZED ((GtkWidget*) self)) {
		return;
	}
	g_assert (GDK_IS_DRAWABLE (((GtkWidget*) self)->window));
	g_assert (GDK_IS_DRAWABLE (self->priv->_background->pixmap));
	pixmap = gdk_pixmap_new ((GdkDrawable*) ((GtkWidget*) self)->window, ((GtkWidget*) self)->allocation.width, ((GtkWidget*) self)->allocation.height, -1);
	g_assert (GDK_IS_DRAWABLE (pixmap));
	cairo = gdk_cairo_create ((GdkDrawable*) pixmap);
	g_assert (cairo != NULL);
	gdk_cairo_set_source_pixmap (cairo, self->priv->_background->pixmap, (double) (-self->priv->_background->offset_x), (double) (-self->priv->_background->offset_y));
	pattern = cairo_get_source (cairo);
	cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
	cairo_rectangle (cairo, (double) 0, (double) 0, (double) ((GtkWidget*) self)->allocation.width, (double) ((GtkWidget*) self)->allocation.height);
	cairo_fill (cairo);
	style = _g_object_ref0 (gtk_widget_get_style ((GtkWidget*) self));
	style->bg_pixmap[(gint) GTK_STATE_NORMAL] = (_tmp0_ = _g_object_ref0 (pixmap), _g_object_unref0 (style->bg_pixmap[(gint) GTK_STATE_NORMAL]), _tmp0_);
	gtk_style_set_background (style, ((GtkWidget*) self)->window, GTK_STATE_NORMAL);
	gtk_widget_queue_draw ((GtkWidget*) self);
	_g_object_unref0 (style);
	_cairo_destroy0 (cairo);
	_g_object_unref0 (pixmap);
}
Exemplo n.º 8
0
static void
set_app_window(HippoWindowGtk *window_gtk,
               gboolean        app_window)
{
    GtkWindow *window = GTK_WINDOW(window_gtk);
    GtkWidget *widget = GTK_WIDGET(window_gtk);

    app_window = app_window != FALSE;

    if (window_gtk->app_window == app_window)
        return;
    
    window_gtk->app_window = app_window;

    gtk_window_set_skip_taskbar_hint(window, !app_window);
    gtk_window_set_skip_pager_hint(window, !app_window);
    if (app_window) {
        gtk_window_set_type_hint(window, GDK_WINDOW_TYPE_HINT_NORMAL);
        gtk_window_set_accept_focus(window, TRUE);
    } else {
        /* NOTIFICATION is the right type hint, but that's new in GTK+-2.10 */
        gtk_window_set_type_hint(window, GDK_WINDOW_TYPE_HINT_DOCK);
        gtk_window_set_accept_focus(window, FALSE);
    }
   
    /* See note about "background none" in hippo_window_gtk_realize() */
    if (GTK_WIDGET_REALIZED(widget)) {
        if (app_window) {
            /* This should cause the right pixel to be set, replacing background-none */
            gtk_style_set_background (widget->style, widget->window, widget->state);
        } else {
            gdk_window_set_back_pixmap(widget->window, NULL, FALSE);
        }
    }
}
Exemplo n.º 9
0
static void
uni_image_view_realize (GtkWidget * widget)
{
    UniImageView *view = UNI_IMAGE_VIEW (widget);
    gtk_widget_set_realized(widget, TRUE);

    GdkWindowAttr attrs;
    attrs.window_type = GDK_WINDOW_CHILD;
    attrs.x = widget->allocation.x;
    attrs.y = widget->allocation.y;
    attrs.width = widget->allocation.width;
    attrs.height = widget->allocation.height;
    attrs.wclass = GDK_INPUT_OUTPUT;
    attrs.visual = gtk_widget_get_visual (widget);
    attrs.colormap = gtk_widget_get_colormap (widget);
    attrs.event_mask = (gtk_widget_get_events (widget)
                        | GDK_EXPOSURE_MASK
                        | GDK_BUTTON_MOTION_MASK
                        | GDK_BUTTON_PRESS_MASK
                        | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK);

    int attr_mask = (GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP);
    GdkWindow *parent = gtk_widget_get_parent_window (widget);
    widget->window = gdk_window_new (parent, &attrs, attr_mask);
    gdk_window_set_user_data (widget->window, view);

    widget->style = gtk_style_attach (widget->style, widget->window);
    gtk_style_set_background (widget->style, widget->window,
                              GTK_STATE_NORMAL);

    view->void_cursor = gdk_cursor_new (GDK_ARROW);
}
Exemplo n.º 10
0
static VALUE
style_set_background(VALUE self, VALUE win, VALUE state_type)
{
    gtk_style_set_background(_SELF(self), GDK_WINDOW(RVAL2GOBJ(win)),
                             RVAL2STATE(state_type));
    return self;
}
Exemplo n.º 11
0
void gtk_codegraph_realize(GtkWidget *widget){
    GdkWindowAttr attributes;
    guint attributes_mask;

    g_return_if_fail(widget != NULL);
    g_return_if_fail(GTK_IS_CODEGRAPH(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;
    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);

   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);

    gtk_codegraph_create_backing_pixmap(GTK_CODEGRAPH(widget));

}
Exemplo n.º 12
0
/* Called when the widget is realized. This usually happens when you call
 * gtk_widget_show() on the widget. */
static void lcd_realize (GtkWidget *widget)
{
	Lcd *lcd;
	GdkWindowAttr attributes;
	gint attr_mask;

	g_return_if_fail (widget != NULL);
	g_return_if_fail (IS_LCD (widget));

	/* Set the GTK_REALIZED flag so it is marked as realized. */
	GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
	lcd = LCD (widget);

	/* Create a new GtkWindowAttr object that will hold info about the GdkWindow. */
	attributes.x = widget->allocation.x;
	attributes.y = widget->allocation.y;
	attributes.width = widget->allocation.width;
	attributes.height = widget->allocation.height;
	attributes.wclass = GDK_INPUT_OUTPUT;
	attributes.window_type = GDK_WINDOW_CHILD;
	attributes.event_mask = gtk_widget_get_events (widget);
	attributes.event_mask |= (GDK_EXPOSURE_MASK);
	attributes.visual = gtk_widget_get_visual (widget);
	attributes.colormap = gtk_widget_get_colormap (widget);

	/* Create a new GdkWindow for the widget. */
	attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
	widget->window = gdk_window_new (widget->parent->window, &attributes, attr_mask);
	gdk_window_set_user_data (widget->window, lcd);

	/* Attach a style to the GdkWindow and draw a background color. */
	widget->style = gtk_style_attach (widget->style, widget->window);
	gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
	gdk_window_show (widget->window);
}
static void
cvImageWidget_realize (GtkWidget *widget)
{
  CvImageWidget *image_widget;
  GdkWindowAttr attributes;
  gint attributes_mask;

  //printf("cvImageWidget_realize\n");
  g_return_if_fail (widget != NULL);
  g_return_if_fail (CV_IS_IMAGE_WIDGET (widget));

  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
  image_widget = CV_IMAGE_WIDGET (widget);

  attributes.x = widget->allocation.x;
  attributes.y = widget->allocation.y;
  attributes.width = widget->allocation.width;
  attributes.height = widget->allocation.height;
  attributes.wclass = GDK_INPUT_OUTPUT;
  attributes.window_type = GDK_WINDOW_CHILD;
  attributes.event_mask = gtk_widget_get_events (widget) |
    GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
    GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
  attributes.visual = gtk_widget_get_visual (widget);
  attributes.colormap = gtk_widget_get_colormap (widget);

  attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
  widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);

  widget->style = gtk_style_attach (widget->style, widget->window);

  gdk_window_set_user_data (widget->window, widget);

  gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
}
Exemplo n.º 14
0
static void gtk_xournal_realize(GtkWidget* widget)
{
	GdkWindowAttr attributes;
	guint attributes_mask;

	g_return_if_fail(widget != NULL);
	g_return_if_fail(GTK_IS_XOURNAL(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;

	attributes.wclass = GDK_INPUT_OUTPUT;
	attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK;

	attributes_mask = GDK_WA_X | GDK_WA_Y;

	widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
	                                &attributes, attributes_mask);
	gtk_widget_modify_bg(widget, GTK_STATE_NORMAL,
	                     &widget->style->dark[GTK_STATE_NORMAL]);

	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);

	gtk_xournal_update_xevent(widget);
}
Exemplo n.º 15
0
/* It updates controls from values of variables, and connects control
 * signals to callback functions */
void
init_diagram (GladeXML *xml)
{
  GtkStyle *style;
  GtkWidget *canvas;

  /* Creates trees */
  canvas_nodes = g_tree_new_full ( (GCompareDataFunc)canvas_node_compare, 
                            NULL, NULL, (GDestroyNotify)canvas_node_delete);
  canvas_links = g_tree_new_full( (GCompareDataFunc)canvas_link_compare,
                            NULL, NULL, (GDestroyNotify)canvas_link_delete);

  initialize_pref_controls();
  
  /* Sets canvas background to black */
  canvas = glade_xml_get_widget (appdata.xml, "canvas1");

  gdk_color_parse ("black", &black_color);
  gdk_colormap_alloc_color (gdk_colormap_get_system (), &black_color,
			    TRUE, TRUE);
  style = gtk_style_new ();
  style->bg[GTK_STATE_NORMAL] = black_color;
  style->base[GTK_STATE_NORMAL] = black_color;

  gtk_widget_set_style (canvas, style);
  gtk_style_set_background (canvas->style, canvas->window, GTK_STATE_NORMAL);

  /* Initialize the known_protocols table */
  delete_gui_protocols ();

  /* Set the already_updating global flag */
  already_updating = FALSE;
  stop_requested = FALSE;
}				/* init_diagram */
Exemplo n.º 16
0
static void
moz_web_view_realize(GtkWidget *widget)
{
    g_return_if_fail(widget != NULL);
    g_return_if_fail(MOZ_IS_WEB_VIEW(widget));

    MozWebView *view = MOZ_WEB_VIEW(widget);

    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);

    GdkWindowAttr attributes;
    gint attributes_mask;

    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;
    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) | GDK_EXPOSURE_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, view);

    gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL);
    widget->style = gtk_style_attach (widget->style, widget->window);
}
static void
gtk_experiment_transcript_realize(GtkWidget *widget)
{
	GdkWindowAttr attributes;
	gint attributes_mask;

	gtk_widget_set_realized(widget, TRUE);

	attributes.x = widget->allocation.x;
	attributes.y = widget->allocation.y;
	attributes.width = widget->allocation.width;
	attributes.height = widget->allocation.height;
	attributes.wclass = GDK_INPUT_OUTPUT;
	attributes.window_type = GDK_WINDOW_CHILD;
	attributes.event_mask = gtk_widget_get_events(widget)
			      | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
	attributes.visual = gtk_widget_get_visual(widget);
	attributes.colormap = gtk_widget_get_colormap(widget);

	gtk_widget_set_has_window(widget, TRUE);

	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);

	widget->style = gtk_style_attach(widget->style, widget->window);

	gdk_window_set_user_data(widget->window, widget);

	gtk_style_set_background(widget->style, widget->window, GTK_STATE_ACTIVE);

	gtk_experiment_transcript_reconfigure(GTK_EXPERIMENT_TRANSCRIPT(widget));
}
Exemplo n.º 18
0
static void
polygon_view_realize (GtkWidget *widget)
{
    GdkWindowAttr attributes;

    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;
    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) |
	                    GDK_BUTTON_PRESS_MASK |
	                    GDK_BUTTON_RELEASE_MASK |
	                    GDK_KEY_PRESS_MASK |
	                    GDK_KEY_RELEASE_MASK |
			    GDK_POINTER_MOTION_MASK |
			    GDK_BUTTON_MOTION_MASK |
	                    GDK_EXPOSURE_MASK;

    widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
				     &attributes,
				     GDK_WA_X | GDK_WA_Y |
				     GDK_WA_VISUAL | GDK_WA_COLORMAP);
    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);
}
Exemplo n.º 19
0
static void scope_realize(GtkWidget *widget)
{
	Scope *scope;
	GdkWindowAttr attributes;
	gint attributes_mask;
	GdkGCValues gc_values;
	GtkAllocation allocation;
	GdkWindow *window;
	GtkStyle *style;

	g_return_if_fail(widget != NULL);
	g_return_if_fail(IS_SCOPE(widget));

	scope = SCOPE(widget);
	gtk_widget_set_realized(widget, TRUE);
	gtk_widget_get_allocation(widget, &allocation);

	attributes.window_type = GDK_WINDOW_CHILD;
	attributes.x = allocation.x;
	attributes.y = allocation.y;
	attributes.width = allocation.width;
	attributes.height = allocation.height;
	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) | GDK_EXPOSURE_MASK;

	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;

	gtk_widget_set_has_window(widget, TRUE);
	window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
	gtk_widget_set_window(widget, window);
	gdk_window_set_user_data(window, scope);

	gtk_widget_style_attach(widget);
	style = gtk_widget_get_style(widget);
	gtk_style_set_background(style, window, GTK_STATE_NORMAL);

	/* gc's if necessary */
	if (!gdk_colormap_alloc_color(style->colormap, &scope->tracecol,
				      FALSE, TRUE))
		g_warning("unable to allocate color: ( %d %d %d )",
			  scope->tracecol.red, scope->tracecol.green, scope->tracecol.blue);
	gc_values.foreground = scope->tracecol;
	scope->trace_gc = gtk_gc_get(style->depth, 
				    style->colormap,
				    &gc_values, GDK_GC_FOREGROUND);
	if (!gdk_colormap_alloc_color(style->colormap, &scope->gridcol,
				      FALSE, TRUE))
		g_warning("unable to allocate color: ( %d %d %d )",
			  scope->gridcol.red, scope->gridcol.green, scope->gridcol.blue);
	gc_values.foreground = scope->gridcol;
	scope->grid_gc = gtk_gc_get(style->depth,
				   style->colormap,
				   &gc_values, GDK_GC_FOREGROUND);
	/* create backing store */
	scope->pixmap = gdk_pixmap_new(window, SCOPE_WIDTH, SCOPE_HEIGHT, -1);

	scope_send_configure(SCOPE(widget));
}
Exemplo n.º 20
0
static void
hand_display_realize (GtkWidget *widget)
{
	GdkWindowAttr attributes;
	gint attributes_mask;

	g_return_if_fail (widget != NULL);
	g_return_if_fail (IS_HAND_DISPLAY (widget));

	gtk_widget_set_realized (widget, TRUE);

	GtkAllocation allocation;
	gtk_widget_get_allocation (widget, &allocation);
	attributes.x = allocation.x;
	attributes.y = allocation.y;
	attributes.width = allocation.width;
	attributes.height = allocation.height;
	attributes.wclass = GDK_INPUT_OUTPUT;
	attributes.window_type = GDK_WINDOW_CHILD;
	attributes.event_mask = gtk_widget_get_events (widget) |
		GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK |
		GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
		GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK;
	attributes.visual = gtk_widget_get_visual (widget);
	attributes.colormap = gtk_widget_get_colormap (widget);

	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
	GdkWindow *window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
	gtk_widget_set_window (widget, window);
	gtk_widget_style_attach (widget);

	gdk_window_set_user_data (window, widget);

	gtk_style_set_background (gtk_widget_get_style (widget), window, GTK_STATE_ACTIVE);
}
Exemplo n.º 21
0
static void browwidgetgtk_realize( GtkWidget *widget)
{
  GdkWindowAttr attr;
  gint attr_mask;
  BrowWidgetGtk *brow;

  g_return_if_fail (widget != NULL);
  g_return_if_fail (IS_BROWWIDGETGTK( widget));

  GTK_WIDGET_SET_FLAGS( widget, GTK_REALIZED);
  brow = BROWWIDGETGTK( widget);

  attr.x = widget->allocation.x;
  attr.y = widget->allocation.y;
  attr.width = widget->allocation.width;
  attr.height = widget->allocation.height;
  attr.wclass = GDK_INPUT_OUTPUT;
  attr.window_type = GDK_WINDOW_CHILD;
  attr.event_mask = gtk_widget_get_events( widget) |
    GDK_EXPOSURE_MASK | 
    GDK_BUTTON_PRESS_MASK | 
    GDK_BUTTON_RELEASE_MASK | 
    GDK_KEY_PRESS_MASK |
    GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
    GDK_BUTTON_MOTION_MASK |
    GDK_ENTER_NOTIFY_MASK |
    GDK_LEAVE_NOTIFY_MASK | 
    GDK_SCROLL_MASK;
  attr.visual = gtk_widget_get_visual( widget);
  attr.colormap = gtk_widget_get_colormap( widget);

  attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
  widget->window = gdk_window_new( widget->parent->window, &attr, attr_mask);
  widget->style = gtk_style_attach( widget->style, widget->window);
  gdk_window_set_user_data( widget->window, widget);
  gtk_style_set_background( widget->style, widget->window, GTK_STATE_ACTIVE);

  GTK_WIDGET_SET_FLAGS( widget, GTK_CAN_FOCUS);

  if ( brow->is_navigator) {
    if ( !brow->brow_ctx) {
      BrowWidgetGtk *main_brow = (BrowWidgetGtk *) brow->main_brow_widget;

      brow->brow_ctx = main_brow->brow_ctx;
      brow->draw_ctx = main_brow->draw_ctx;
      ((FlowDrawGtk *)brow->draw_ctx)->init_nav( widget, brow->brow_ctx);
    }
  }
  else {
    if ( !brow->brow_ctx) {
      brow->draw_ctx = new FlowDrawGtk( widget, 
					&brow->brow_ctx, 
					brow_init_proc, 
					brow->client_data,
					flow_eCtxType_Brow);
    }
  }

}
Exemplo n.º 22
0
static void
gwy_color_axis_realize(GtkWidget *widget)
{
    GwyColorAxis *axis;
    GdkWindowAttr attributes;
    gint attributes_mask;
    GtkStyle *s;

    gwy_debug("");

    g_return_if_fail(widget != NULL);
    g_return_if_fail(GWY_IS_COLOR_AXIS(widget));

    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
    axis = GWY_COLOR_AXIS(widget);

    attributes.x = widget->allocation.x;
    attributes.y = widget->allocation.y;
    attributes.width = widget->allocation.width;
    attributes.height = widget->allocation.height;
    attributes.wclass = GDK_INPUT_OUTPUT;
    attributes.window_type = GDK_WINDOW_CHILD;
    attributes.event_mask = gtk_widget_get_events(widget)
                            | GDK_EXPOSURE_MASK
                            | GDK_BUTTON_PRESS_MASK
                            | GDK_BUTTON_RELEASE_MASK
                            | GDK_POINTER_MOTION_MASK
                            | GDK_POINTER_MOTION_HINT_MASK;
    attributes.visual = gtk_widget_get_visual(widget);
    attributes.colormap = gtk_widget_get_colormap(widget);

    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);

    /*set backgroun for white forever*/
    s = gtk_style_copy(widget->style);
    s->bg_gc[0] =
    s->bg_gc[1] =
    s->bg_gc[2] =
    s->bg_gc[3] =
    s->bg_gc[4] = widget->style->white_gc;
    s->bg[0] =
    s->bg[1] =
    s->bg[2] =
    s->bg[3] =
    s->bg[4] = widget->style->white;

    gtk_style_set_background(s, widget->window, GTK_STATE_NORMAL);

    /*compute axis*/
    gwy_color_axis_update(axis);
}
Exemplo n.º 23
0
static void
ddb_tabstrip_realize (GtkWidget *widget) {
    DdbTabStrip *darea = DDB_TABSTRIP (widget);
    GdkWindowAttr attributes;
    gint attributes_mask;

    if (!gtk_widget_get_has_window (widget))
    {
        GTK_WIDGET_CLASS (ddb_tabstrip_parent_class)->realize (widget);
    }
    else
    {
        gtk_widget_set_realized (widget, TRUE);

        attributes.window_type = GDK_WINDOW_CHILD;
        GtkAllocation a;
        gtk_widget_get_allocation (widget, &a);
        attributes.x = a.x;
        attributes.y = a.y;
        attributes.width = a.width;
        attributes.height = a.height;
        attributes.wclass = GDK_INPUT_OUTPUT;
        attributes.visual = gtk_widget_get_visual (widget);
#if !GTK_CHECK_VERSION(3,0,0)
        attributes.colormap = gtk_widget_get_colormap (widget);
#endif
        attributes.event_mask = gtk_widget_get_events (widget);
        attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;

        attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
#if !GTK_CHECK_VERSION(3,0,0)
        attributes_mask |= GDK_WA_COLORMAP;
#endif

        GdkWindow *window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
        gtk_widget_set_window(widget, window);
        gdk_window_set_user_data (gtk_widget_get_window(widget), darea);

#if !GTK_CHECK_VERSION(3,0,0)
        widget->style = gtk_style_attach (widget->style, widget->window);
        gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
#else
        gtk_style_context_set_background (gtk_widget_get_style_context (widget), window);
#endif
    }

    ddb_tabstrip_send_configure (DDB_TABSTRIP (widget));
    GtkTargetEntry entry = {
        .target = TARGET_PLAYITEMS,
        .flags = GTK_TARGET_SAME_APP,
        .info = TARGET_SAMEWIDGET
    };
    gtk_drag_dest_set (widget, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, &entry, 1, GDK_ACTION_COPY | GDK_ACTION_MOVE);
    gtk_drag_dest_add_uri_targets (widget);
    gtk_drag_dest_set_track_motion (widget, TRUE);
}
Exemplo n.º 24
0
static void
ViewOvBoxSetBackground(ViewOvBox *that) // IN
{
   GtkWidget *widget = GTK_WIDGET(that);

#if GTK_CHECK_VERSION(3, 0, 0)
   GtkStyleContext *stylecontext;

   stylecontext = gtk_widget_get_style_context(widget);
   gtk_style_context_set_background(stylecontext, gtk_widget_get_window(widget));
   gtk_style_context_set_background(stylecontext, that->priv->underWin);
   gtk_style_context_set_background(stylecontext, that->priv->overWin);
#else
   GtkStyle *style;

   style = gtk_widget_get_style (widget);
   gtk_style_set_background(style, gtk_widget_get_window(widget), GTK_STATE_NORMAL);
   gtk_style_set_background(style, that->priv->underWin, GTK_STATE_NORMAL);
   gtk_style_set_background(style, that->priv->overWin, GTK_STATE_NORMAL);
#endif
}
Exemplo n.º 25
0
static void
gtk_hex_entry_realize (GtkWidget *widget)
{
	GtkHexEntry *hex_entry;
	GtkRequisition requisition;
	GdkWindowAttr attributes;
	gint attributes_mask;

	g_return_if_fail (widget != NULL);
	g_return_if_fail (GTK_IS_HEX_ENTRY (widget));

	GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
	hex_entry = GTK_HEX_ENTRY (widget);

	gtk_widget_get_child_requisition (widget, &requisition);

	attributes.x = widget->allocation.x;
	attributes.y = widget->allocation.y;
	attributes.width = requisition.width;
	attributes.height = requisition.height;

	attributes.window_type = GDK_WINDOW_CHILD;
	attributes.wclass = GDK_INPUT_OUTPUT;
	attributes.visual = gtk_widget_get_visual (widget);
	attributes.colormap = gtk_widget_get_colormap (widget);

	attributes.cursor = hex_entry->cursor = gdk_cursor_new (GDK_XTERM);

	attributes.event_mask = gtk_widget_get_events (widget)
	| GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK
	| GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK
	| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK
	| GDK_POINTER_MOTION_HINT_MASK;

	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP |
		GDK_WA_CURSOR;
  
	widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
		&attributes, attributes_mask);
	gdk_window_set_user_data (widget->window, hex_entry);

	widget->style = gtk_style_attach (widget->style, widget->window);

	gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);

	gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
	gdk_window_set_back_pixmap (widget->window, NULL, TRUE);

	gdk_color_alloc (gtk_widget_get_colormap (widget),&hex_entry->cursor_color);

	hex_entry->gc = gdk_gc_new (widget->window);	
	gdk_gc_set_foreground (hex_entry->gc,&hex_entry->cursor_color);
}
Exemplo n.º 26
0
static void
mb_gtk_keyboard_realize (GtkWidget *widget)
{
  MbGtkKeyboard        *kbd = MB_GTK_KEYBOARD (widget);
  MbGtkKeyboardPrivate *priv = kbd->priv;
  MBKeyboard           *kb;
  GdkWindow            *parent;
  Display              *xdpy;
  int                   argc;
  char                **p;
  char                **argv_dummy = {NULL};
  char                **argv;

  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);

  if (priv->argv)
    argv = priv->argv;
  else
    argv = argv_dummy;

  for (argc = 0, p = argv; *p; ++p, ++argc);

  DBG ("Intial allocation %d,%d;%dx%d",
       widget->allocation.x,
       widget->allocation.y,
       widget->allocation.width,
       widget->allocation.height);

  xdpy   = GDK_DISPLAY();
  parent = gtk_widget_get_parent_window (widget);

  priv->kb = kb =
    mb_keyboard_new (xdpy, parent,
                     widget->allocation.x,
                     widget->allocation.y,
                     widget->allocation.width,
                     widget->allocation.height,
                     argc, argv);

  DBG ("Wrapping xid 0x%x in GdkWindow",
           (unsigned int)mb_keyboard_get_xwindow (kb));

  widget->window = g_object_ref (mb_kbd_ui_gdk_win (kb->ui));

  DBG ("GdkWindow %p", widget->window);
  gdk_window_add_filter (widget->window, xevent_handler, widget);

  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);
}
Exemplo n.º 27
0
void
ags_indicator_realize(GtkWidget *widget)
{
  AgsIndicator *indicator;
  GdkWindowAttr attributes;
  gint attributes_mask;
  gint buttons_width;
  gint border_left, border_top;

  g_return_if_fail (widget != NULL);
  g_return_if_fail (AGS_IS_INDICATOR (widget));

  indicator = AGS_INDICATOR(widget);

  gtk_widget_set_realized (widget, TRUE);

  /*  */
  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;

  attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;

  attributes.window_type = GDK_WINDOW_CHILD;

  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_BUTTON_PRESS_MASK |
                            GDK_BUTTON_RELEASE_MASK |
                            GDK_BUTTON1_MOTION_MASK |
                            GDK_BUTTON3_MOTION_MASK |
                            GDK_POINTER_MOTION_HINT_MASK |
                            GDK_POINTER_MOTION_MASK |
                            GDK_ENTER_NOTIFY_MASK |
                            GDK_LEAVE_NOTIFY_MASK);

  widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
				   &attributes, attributes_mask);
  gdk_window_set_user_data (widget->window, indicator);

  widget->style = gtk_style_attach (widget->style, widget->window);
  gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);

  gtk_widget_queue_resize (widget);
}
Exemplo n.º 28
0
    static void
gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child)
{
    if (child->window != NULL)
	return; /* been there, done that */

    if (GTK_WIDGET_NO_WINDOW(child->widget))
    {
	GtkWidget	*widget;
	GdkWindowAttr	attributes;
	gint		attributes_mask;

	widget = GTK_WIDGET(form);

	attributes.window_type = GDK_WINDOW_CHILD;
	attributes.x = child->x;
	attributes.y = child->y;
	attributes.width = child->widget->requisition.width;
	attributes.height = child->widget->requisition.height;
	attributes.wclass = GDK_INPUT_OUTPUT;
	attributes.visual = gtk_widget_get_visual(widget);
	attributes.colormap = gtk_widget_get_colormap(widget);
	attributes.event_mask = GDK_EXPOSURE_MASK;

	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
	child->window = gdk_window_new(form->bin_window,
				       &attributes, attributes_mask);
	gdk_window_set_user_data(child->window, widget);

	gtk_style_set_background(widget->style,
				 child->window,
				 GTK_STATE_NORMAL);

	gtk_widget_set_parent_window(child->widget, child->window);
	gtk_form_set_static_gravity(child->window, TRUE);
	/*
	 * Install signal handlers to map/unmap child->window
	 * alongside with the actual widget.
	 */
	gtk_signal_connect(GTK_OBJECT(child->widget), "map",
			   GTK_SIGNAL_FUNC(&gtk_form_child_map), child);
	gtk_signal_connect(GTK_OBJECT(child->widget), "unmap",
			   GTK_SIGNAL_FUNC(&gtk_form_child_unmap), child);
    }
    else if (!GTK_WIDGET_REALIZED(child->widget))
    {
	gtk_widget_set_parent_window(child->widget, form->bin_window);
    }
}
Exemplo n.º 29
0
static void keyboardwidgetgtk_realize(GtkWidget* widget)
{
  GdkWindowAttr attr;
  gint attr_mask;
  KeyboardWidgetGtk* keyboard;

  g_return_if_fail(widget != NULL);
  g_return_if_fail(IS_KEYBOARDWIDGETGTK(widget));

  GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
  keyboard = KEYBOARDWIDGETGTK(widget);

  attr.x = widget->allocation.x;
  attr.y = widget->allocation.y;
  attr.width = widget->allocation.width;
  attr.height = widget->allocation.height;
  attr.wclass = GDK_INPUT_OUTPUT;
  attr.window_type = GDK_WINDOW_CHILD;
  attr.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK
      | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK
      | GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK | GDK_ENTER_NOTIFY_MASK
      | GDK_LEAVE_NOTIFY_MASK;
  attr.visual = gtk_widget_get_visual(widget);
  attr.colormap = gtk_widget_get_colormap(widget);

  attr_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
  widget->window = gdk_window_new(widget->parent->window, &attr, attr_mask);
  widget->style = gtk_style_attach(widget->style, widget->window);
  gdk_window_set_user_data(widget->window, widget);
  gtk_style_set_background(widget->style, widget->window, GTK_STATE_ACTIVE);

  GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);

  if (keyboard->is_navigator) {
    if (!keyboard->keyboard_ctx) {
      KeyboardWidgetGtk* main_keyboard
          = (KeyboardWidgetGtk*)keyboard->main_keyboard_widget;

      keyboard->keyboard_ctx = main_keyboard->keyboard_ctx;
      keyboard->draw_ctx = main_keyboard->draw_ctx;
      ((GlowDrawGtk*)keyboard->draw_ctx)->init_nav(widget);
    }
  } else {
    if (!keyboard->keyboard_ctx) {
      keyboard->draw_ctx = new GlowDrawGtk(widget, &keyboard->keyboard_ctx,
          keyboard_init_proc, keyboard->client_data, glow_eCtxType_Keyboard);
    }
  }
}
Exemplo n.º 30
0
static void
gwy_data_view_realize(GtkWidget *widget)
{
    GwyDataView *data_view;
    GdkWindowAttr attributes;
    gint attributes_mask;

    gwy_debug("realizing a GwyDataView (%ux%u)",
              widget->allocation.width, widget->allocation.height);

    g_return_if_fail(widget != NULL);

    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
    data_view = GWY_DATA_VIEW(widget);

    attributes.x = widget->allocation.x;
    attributes.y = widget->allocation.y;
    attributes.width = widget->allocation.width;
    attributes.height = widget->allocation.height;
    attributes.wclass = GDK_INPUT_OUTPUT;
    attributes.window_type = GDK_WINDOW_CHILD;
    attributes.event_mask = gtk_widget_get_events(widget)
                            | GDK_EXPOSURE_MASK
                            | GDK_BUTTON_PRESS_MASK
                            | GDK_BUTTON_RELEASE_MASK
                            | GDK_KEY_PRESS_MASK
                            | GDK_KEY_RELEASE_MASK
                            | GDK_POINTER_MOTION_MASK
                            | GDK_POINTER_MOTION_HINT_MASK;
    attributes.visual = gtk_widget_get_visual(widget);
    attributes.colormap = gtk_widget_get_colormap(widget);

    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);

    gwy_data_view_make_pixmap(data_view);
}