Esempio n. 1
0
/**
 * gtk_tool_item_set_use_drag_window:
 * @tool_item: a #GtkToolItem
 * @use_drag_window: Whether @tool_item has a drag window.
 *
 * Sets whether @tool_item has a drag window. When %TRUE the
 * toolitem can be used as a drag source through gtk_drag_source_set().
 * When @tool_item has a drag window it will intercept all events,
 * even those that would otherwise be sent to a child of @tool_item.
 *
 * Since: 2.4
 **/
void
gtk_tool_item_set_use_drag_window (GtkToolItem *toolitem,
                                   gboolean     use_drag_window)
{
    g_return_if_fail (GTK_IS_TOOL_ITEM (toolitem));

    use_drag_window = use_drag_window != FALSE;

    if (toolitem->priv->use_drag_window != use_drag_window)
    {
        toolitem->priv->use_drag_window = use_drag_window;

        if (use_drag_window)
        {
            if (!toolitem->priv->drag_window &&
                    gtk_widget_get_realized (GTK_WIDGET (toolitem)))
            {
                create_drag_window(toolitem);
                if (gtk_widget_get_mapped (GTK_WIDGET (toolitem)))
                    gdk_window_show (toolitem->priv->drag_window);
            }
        }
        else
        {
            destroy_drag_window (toolitem);
        }
    }
}
Esempio n. 2
0
File: DragBS.c Progetto: att/uwin
/*
 * fetch and/or set the ATOM_PAIRS.  This is triggered at least once
 * by the first call to XmInternAtom().
 */
extern void
_XmInitAtomPairs(Display *display)
{
    Window win;
    char *dstr;
    Display *d;

    DEBUGOUT(_LtDebug0(__FILE__, NULL, "%s:_XmInitAtomPairs(%d)\n",
		      __FILE__, __LINE__));

    if ((win = read_drag_window(display)) == None)
    {
	dstr = XDisplayString(display);

	d = XOpenDisplay(dstr);

	if (d == NULL)
	{
	    _XmWarning((Widget)XmGetXmDisplay(display),
		       "Where's your display?");

	    return;
	}

	XGrabServer(d);

	if ((win = read_drag_window(d)) == None)
	{
	    XSetCloseDownMode(d, RetainPermanent);

	    win = create_drag_window(d);

	    write_drag_window(d, &win);
	}

	XCloseDisplay(d);
    }

    set_drag_window(display, win);

    if (!read_atom_pairs(display))
    {
	XGrabServer(display);

	if (!read_atom_pairs(display))
	{
	    write_atom_pairs(display);
	}

	XUngrabServer(display);

	XFlush(display);
    }
}
Esempio n. 3
0
static void
gtk_tool_item_realize (GtkWidget *widget)
{
    GtkToolItem *toolitem;

    toolitem = GTK_TOOL_ITEM (widget);
    gtk_widget_set_realized (widget, TRUE);

    widget->window = gtk_widget_get_parent_window (widget);
    g_object_ref (widget->window);

    if (toolitem->priv->use_drag_window)
        create_drag_window(toolitem);

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