Esempio n. 1
0
void
queue_join (queue *q, queue *r)
{
    int c;

    if (q->size < q->length + r->length)
        queue_resize(q, q->length + r->length);

    for (c = 0; c < r->length; c++)
    {
        pos e = queue_dequeue(r);
        queue_enqueue(q, e);
        queue_enqueue(r, e);
    }
}
static void queue_multipush(struct queue *queue, struct slot *slots, size_t count)
{
	for (size_t i = 0; i < count; i++) {
		if (queue->in == (queue->out + queue->capacity - 1) % queue->capacity) {
			queue_resize(queue, queue->capacity * 2);
		}

		queue->data[queue->in] = slots[i];
		queue->in = (queue->in + 1) % queue->capacity;
	}

	if (pthread_cond_broadcast(&queue->nonempty_cond) != 0) {
		err(EXIT_FAILURE, "Error signaling condition variable");
	}
}
Esempio n. 3
0
/**
 * gtk_source_completion_info_set_sizing:
 * @info: A #GtkSourceCompletionInfo
 * @width: The maximum/requested width of the window (-1 to default)
 * @height: The maximum/requested height of the window (-1 to default)
 * @shrink_width: Whether to shrink the width of the window to fit its contents
 * @shrink_height: Whether to shrink the height of the window to fit its
 *                 contents
 *
 * Set sizing information for the info window. If @shrink_width or
 * @shrink_height is %TRUE, the info window will try to resize to fit the
 * window contents, with a maximum size given by @width and @height. Setting
 * @width or @height to -1 removes the maximum size of respectively the width
 * and height of the window.
 *
 */
void
gtk_source_completion_info_set_sizing (GtkSourceCompletionInfo *info,
				       gint                     width,
				       gint                     height,
				       gboolean                 shrink_width,
				       gboolean                 shrink_height)
{
	g_return_if_fail  (GTK_IS_SOURCE_COMPLETION_INFO (info));

	if (info->priv->max_width == width &&
	    info->priv->max_height == height &&
	    info->priv->shrink_width == shrink_width &&
	    info->priv->shrink_height == shrink_height)
	{
		return;
	}

	info->priv->max_width = width;
	info->priv->max_height = height;
	info->priv->shrink_width = shrink_width;
	info->priv->shrink_height = shrink_height;
	
	queue_resize (info);
}
Esempio n. 4
0
/**
 * gtk_source_completion_info_set_widget:
 * @info: A #GtkSourceCompletionInfo
 * @widget: A #GtkWidget
 *
 * Sets the content widget of the info window. If @widget does not fit within
 * the size requirements of the window, a #GtkScrolledWindow will automatically
 * be created and added to the window.
 *
 */
void
gtk_source_completion_info_set_widget (GtkSourceCompletionInfo *info,
				       GtkWidget               *widget)
{
	GtkWidget *child;

	g_return_if_fail (GTK_IS_SOURCE_COMPLETION_INFO (info));
	g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));

	if (info->priv->widget == widget)
	{
		return;
	}
	
	if (info->priv->widget != NULL)
	{
		g_signal_handler_disconnect (info->priv->widget, info->priv->request_id);
		
		gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (info->priv->widget)),
		                      info->priv->widget);

		if (info->priv->scroll != NULL)
		{
			gtk_widget_destroy (info->priv->scroll);
			info->priv->scroll = NULL;
		}
	}
	
	info->priv->widget = widget;
	
	if (widget != NULL)
	{
		/* Keep it alive */
		if (g_object_is_floating (widget))
		{
			g_object_ref (widget);
		}
		
		info->priv->request_id = g_signal_connect_after (widget, 
                                                                 "size-request", 
                                                                 G_CALLBACK (widget_size_request_cb), 
                                                                 info);
		
		/* See if it needs a viewport */
		if (use_scrolled_window (info, widget))
		{
			create_scrolled_window (info);
			child = widget;
			
			if (needs_viewport (widget))
			{
				child = gtk_viewport_new (NULL, NULL);
				gtk_viewport_set_shadow_type (GTK_VIEWPORT (child), GTK_SHADOW_NONE);
				gtk_widget_show (child);

				gtk_container_add (GTK_CONTAINER (child), widget);
			}
			
			gtk_container_add (GTK_CONTAINER (info->priv->scroll), child);
		}
		else
		{
			gtk_container_add (GTK_CONTAINER (info), widget);
		}
		
		gtk_widget_show (widget);
	}

	queue_resize (info);
}
Esempio n. 5
0
void NumericalEntry::adjustment_changed()
{
	queue_resize();	// TODO: override size()
}
Esempio n. 6
0
void Gui_Display::setShowDeco(bool show,double line_width){
    m_deco.setLineWidthMult(line_width);
    m_draw_result = show;
    queue_resize();
}