/*
 * Strategy to painting a Widget:
 *  1.) do not paint if there is no GtkWidget set
 *  2.) We assume that GTK_NO_WINDOW is set and that geometryChanged positioned
 *      the widget correctly. ATM we do not honor the GraphicsContext translation.
 */
void Widget::paint(GraphicsContext* context, const IntRect&)
{
    if (!gtkWidget())
        return;

    GtkWidget* widget = gtkWidget();
    ASSERT(GTK_WIDGET_NO_WINDOW(widget));

    GdkEvent* event = gdk_event_new(GDK_EXPOSE);
    event->expose = *context->gdkExposeEvent();
    event->expose.region = gtk_widget_region_intersect(widget, event->expose.region);

    /*
     * This will be unref'ed by gdk_event_free.
     */
    g_object_ref(event->expose.window);

    /*
     * If we are going to paint do the translation and GtkAllocation manipulation.
     */
    if (!gdk_region_empty(event->expose.region)) {
        gdk_region_get_clipbox(event->expose.region, &event->expose.area);
        gtk_widget_send_expose(widget, event);
    }

    gdk_event_free(event);
}
Exemple #2
0
/*
 From gtkcontainer.c
 */
void
_container_propagate_expose (GtkContainer   *container,
                                GtkWidget      *child,
                                GdkEventExpose *event)
{
  GdkEvent *child_event;

  g_return_if_fail (GTK_IS_CONTAINER (container));
  g_return_if_fail (GTK_IS_WIDGET (child));
  g_return_if_fail (event != NULL);

  g_assert (child->parent == GTK_WIDGET (container));
  
  if (GTK_WIDGET_DRAWABLE (child) &&
      GTK_WIDGET_NO_WINDOW (child) &&
      (child->window == event->window)&&
      AWN_IS_CAIRO_MENU_ITEM(child))
    {
      child_event = gdk_event_new (GDK_EXPOSE);
      child_event->expose = *event;
      g_object_ref (child_event->expose.window);

      child_event->expose.region = gtk_widget_region_intersect (child, event->region);
      if (!gdk_region_empty (child_event->expose.region))
        {
          gdk_region_get_clipbox (child_event->expose.region, &child_event->expose.area);
          gtk_widget_send_expose (child, child_event);
        }
      gdk_event_free (child_event);
    }
}
Exemple #3
0
    static gint
gtk_form_expose(GtkWidget *widget, GdkEventExpose *event)
{
    GList   *tmp_list;
    GtkForm *form;

    g_return_val_if_fail(GTK_IS_FORM(widget), FALSE);

    form = GTK_FORM(widget);

    if (event->window == form->bin_window)
	return FALSE;

    for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
    {
#ifdef HAVE_GTK2
	GtkFormChild	*formchild = tmp_list->data;
	GtkWidget	*child	   = formchild->widget;
	/*
	 * The following chunk of code is taken from gtkcontainer.c.  The
	 * gtk1.x code synthesized expose events directly on the child widgets,
	 * which can't be done in gtk2
	 */
	if (GTK_WIDGET_DRAWABLE(child) && GTK_WIDGET_NO_WINDOW(child)
		&& child->window == event->window)
	{
	    GdkEventExpose child_event;
	    child_event = *event;

	    child_event.region = gtk_widget_region_intersect(child, event->region);
	    if (!gdk_region_empty(child_event.region))
	    {
		gdk_region_get_clipbox(child_event.region, &child_event.area);
		gtk_widget_send_expose(child, (GdkEvent *)&child_event);
	    }
	}
#else /* !HAVE_GTK2 */
	GtkFormChild *child = tmp_list->data;

	if (event->window == child->window)
	    return gtk_widget_event(child->widget, (GdkEvent *) event);
#endif /* !HAVE_GTK2 */
    }

    return FALSE;
}
inline void 
inline_limited_expose                           (HildonColorChooser *sel)
{
    GTimeVal curr_time, result;
    GdkEventExpose event;
    HildonColorChooserPrivate *priv; 
   
    if (! GTK_WIDGET_REALIZED (GTK_WIDGET (sel))) {
        return;
    }

    priv = HILDON_COLOR_CHOOSER_GET_PRIVATE (sel);
    g_assert (priv);

    if(priv->currhue == priv->expose_info.last_expose_hue) {
        return; /* no need to redraw */
    }

    priv->expose_info.last_expose_hue = priv->currhue;

    g_get_current_time (&curr_time);

    inline_sub_times (&result, &curr_time, &priv->expose_info.last_expose_time);

    if(result.tv_sec != 0 || result.tv_usec >= EXPOSE_INTERVAL) {

        priv->expose_info.expose_queued = 1;

        event.type = GDK_EXPOSE;
        event.area.width = 0;
        event.area.height = 0;
        event.window = GTK_WIDGET(sel)->window;

        gtk_widget_send_expose(GTK_WIDGET(sel), (GdkEvent *)&event);

    } else if(! priv->expose_info.expose_queued) {
        priv->expose_info.expose_queued = 1;
        g_timeout_add ((EXPOSE_INTERVAL - result.tv_usec) / 1000, hildon_color_chooser_expose_timer, sel);
    }
}
void GtkPluginWidget::paint(GraphicsContext* context, const IntRect& rect)
{
    if (!context->gdkExposeEvent())
        return;

    /* only paint widgets with NO_WINDOW this way */
    if (!GTK_WIDGET_NO_WINDOW(platformWidget()))
        return;

    GtkWidget* widget = platformWidget();
    ASSERT(GTK_WIDGET_NO_WINDOW(widget));

    GdkEvent* event = gdk_event_new(GDK_EXPOSE);
    event->expose = *context->gdkExposeEvent();
    event->expose.area = static_cast<GdkRectangle>(rect);

    IntPoint loc = parent()->contentsToWindow(rect.location());

    event->expose.area.x = loc.x();
    event->expose.area.y = loc.y();

    event->expose.region = gdk_region_rectangle(&event->expose.area);

    /*
     * This will be unref'ed by gdk_event_free.
     */
    g_object_ref(event->expose.window);

    /*
     * If we are going to paint do the translation and GtkAllocation manipulation.
     */
    if (!gdk_region_empty(event->expose.region))
        gtk_widget_send_expose(widget, event);

    gdk_event_free(event);
}
Exemple #6
0
static VALUE
rg_send_expose(VALUE self, VALUE event)
{
    return INT2NUM(gtk_widget_send_expose(_SELF(self), RVAL2GEV(event)));
}