Commit 0516fcea authored by Elliot Lee's avatar Elliot Lee

handlebox now lets you set in_root flag (and if you set that, its location as well)

parent f872397c
......@@ -43,16 +43,16 @@ struct _GtkEntry
GdkWindow *text_area;
gchar *text;
guint16 text_size;
guint16 text_length;
gint16 current_pos;
gint16 selection_start_pos;
gint16 selection_end_pos;
gint16 scroll_offset;
guint have_selection : 1;
guint visible : 1;
guint32 timer;
GdkIC ic;
guint16 text_size;
guint16 text_length;
gint16 current_pos;
gint16 selection_start_pos;
gint16 selection_end_pos;
gint16 scroll_offset;
gboolean have_selection : 1;
gboolean visible : 1;
guint32 timer;
GdkIC ic;
gchar *clipboard_text;
};
......@@ -86,7 +86,7 @@ void gtk_entry_set_position (GtkEntry *entry,
gint position);
gchar* gtk_entry_get_text (GtkEntry *entry);
void gtk_entry_set_visibility (GtkEntry *entry,
gint visible);
gint visible);
#ifdef __cplusplus
......
......@@ -350,21 +350,23 @@ gtk_handle_box_button_changed(GtkWidget *widget,
return TRUE;
}
static void
gtk_handle_box_reparent (GtkWidget *widget,
gboolean in_root)
void
gtk_handle_box_set_location (GtkWidget *widget,
gboolean in_root,
gint x, gint y)
{
GtkHandleBox *hb;
hb = GTK_HANDLE_BOX(widget);
if(in_root)
if(in_root != FALSE)
{
GTK_HANDLE_BOX(widget)->is_onroot = TRUE;
if(x < 0) x = parentx;
if(y < 0) y = parenty;
gdk_window_set_override_redirect(widget->window, TRUE);
gdk_window_reparent(widget->window, GDK_ROOT_PARENT(),
parentx,
parenty);
x, y);
gdk_window_raise(widget->window);
widget->requisition = hb->real_requisition;
gtk_widget_queue_resize(widget->parent);
......@@ -409,12 +411,12 @@ gtk_handle_box_motion (GtkWidget *widget,
&& abs(parenty - newy) < 10)
{
if(hb->is_onroot == TRUE)
gtk_handle_box_reparent(widget, FALSE);
gtk_handle_box_set_location(widget, FALSE, 0, 0);
}
else
{
if(hb->is_onroot == FALSE)
gtk_handle_box_reparent(widget, TRUE);
gtk_handle_box_set_location(widget, TRUE, parentx, parenty);
gdk_window_move(widget->window, newx, newy);
}
}
......
......@@ -53,6 +53,11 @@ struct _GtkHandleBoxClass
guint gtk_handle_box_get_type (void);
GtkWidget* gtk_handle_box_new (void);
/* the x and y coordinates (relative to root window, of course)
are only needed if you pass in_root = TRUE */
void gtk_handle_box_set_location (GtkWidget *widget,
gboolean in_root,
gint x, gint y);
#ifdef __cplusplus
}
......
......@@ -869,7 +869,7 @@ gtk_widget_destroy (GtkWidget *widget)
gtk_object_unref (GTK_OBJECT (widget));
tag = (gint) gtk_object_get_data (GTK_OBJECT (widget), redraw_handler_key);
gtk_idle_remove (tag);
gtk_object_set_data (GTK_OBJECT (widget), redraw_handler_key, (gpointer) 0);
gtk_object_remove_data (GTK_OBJECT (widget), redraw_handler_key);
}
if (GTK_WIDGET_ANCHORED (widget) &&
......@@ -879,7 +879,7 @@ gtk_widget_destroy (GtkWidget *widget)
gtk_object_unref (GTK_OBJECT (widget));
tag = (gint) gtk_object_get_data (GTK_OBJECT (widget), resize_handler_key);
gtk_idle_remove (tag);
gtk_object_set_data (GTK_OBJECT (widget), resize_handler_key, (gpointer) 0);
gtk_object_remove_data (GTK_OBJECT (widget), resize_handler_key);
resize_widgets = gtk_object_get_data (GTK_OBJECT (widget), resize_widgets_key);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment