gtkbutton.c gtkclist.c gtkdrawingarea.c gtkentry.c gtkeventbox.c

Sun Jan 18 09:57:00 1998  Owen Taylor  <owt1@cornell.edu>
* gtkbutton.c gtkclist.c gtkdrawingarea.c gtkentry.c gtkeventbox.c
  gtkfixed.c gtkhandlebox.c gtkhscale.c gtkhscrollbar.c gtkitem.c
  gtklist.c gtkmenushell.c gtkmisc.c gtknotebook.c gtkpaned.c
  gtkpreview.c gtkprogressbar.c gtkruler.c gtktext.c gtktree.c
  gtkviewport.c gtkvscale.c gtkvscrollbar.c gtkwidget.{c,h}

  Added gtk_widget_set_parent and gtk_widget_get_parent. All
  widgets should use:

   gtk_widget_get_parent() instead of widget->parent->window.

  Any widget that wants to have children not in the parent window,
  should use gtk_widget_set_parent () in their realize() and
  add () routines.

  CList and Viewport widgets changed to do this. (Viewport
  widget using code from gtk-fortier-980117-0.patch.)
This commit is contained in:
Owen Taylor 1998-01-18 15:09:10 +00:00 committed by Owen Taylor
parent 1e34b9ba8d
commit 11d37c5067
32 changed files with 334 additions and 96 deletions

View File

@ -1,3 +1,27 @@
Sun Jan 18 09:57:00 1998 Owen Taylor <owt1@cornell.edu>
* gtkbutton.c gtkclist.c gtkdrawingarea.c gtkentry.c gtkeventbox.c
gtkfixed.c gtkhandlebox.c gtkhscale.c gtkhscrollbar.c gtkitem.c
gtklist.c gtkmenushell.c gtkmisc.c gtknotebook.c gtkpaned.c
gtkpreview.c gtkprogressbar.c gtkruler.c gtktext.c gtktree.c
gtkviewport.c gtkvscale.c gtkvscrollbar.c gtkwidget.{c,h}
Added gtk_widget_set_parent and gtk_widget_get_parent. All
widgets should use:
gtk_widget_get_parent() instead of widget->parent->window.
Any widget that wants to have children not in the parent window,
should use gtk_widget_set_parent () in their realize() and
add () routines.
CList and Viewport widgets changed to do this. (Viewport
widget using code from gtk-fortier-980117-0.patch.)
Sat Jan 17 23:56:02 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c:
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
Sun Jan 18 03:57:52 1998 Tim Janik <timj@psynet.net>
* gtk/gtkframe.c: gtk_*_get_arg() and gtk_*_set_arg() implementations.

View File

@ -1,3 +1,27 @@
Sun Jan 18 09:57:00 1998 Owen Taylor <owt1@cornell.edu>
* gtkbutton.c gtkclist.c gtkdrawingarea.c gtkentry.c gtkeventbox.c
gtkfixed.c gtkhandlebox.c gtkhscale.c gtkhscrollbar.c gtkitem.c
gtklist.c gtkmenushell.c gtkmisc.c gtknotebook.c gtkpaned.c
gtkpreview.c gtkprogressbar.c gtkruler.c gtktext.c gtktree.c
gtkviewport.c gtkvscale.c gtkvscrollbar.c gtkwidget.{c,h}
Added gtk_widget_set_parent and gtk_widget_get_parent. All
widgets should use:
gtk_widget_get_parent() instead of widget->parent->window.
Any widget that wants to have children not in the parent window,
should use gtk_widget_set_parent () in their realize() and
add () routines.
CList and Viewport widgets changed to do this. (Viewport
widget using code from gtk-fortier-980117-0.patch.)
Sat Jan 17 23:56:02 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c:
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
Sun Jan 18 03:57:52 1998 Tim Janik <timj@psynet.net>
* gtk/gtkframe.c: gtk_*_get_arg() and gtk_*_set_arg() implementations.

View File

@ -1,3 +1,27 @@
Sun Jan 18 09:57:00 1998 Owen Taylor <owt1@cornell.edu>
* gtkbutton.c gtkclist.c gtkdrawingarea.c gtkentry.c gtkeventbox.c
gtkfixed.c gtkhandlebox.c gtkhscale.c gtkhscrollbar.c gtkitem.c
gtklist.c gtkmenushell.c gtkmisc.c gtknotebook.c gtkpaned.c
gtkpreview.c gtkprogressbar.c gtkruler.c gtktext.c gtktree.c
gtkviewport.c gtkvscale.c gtkvscrollbar.c gtkwidget.{c,h}
Added gtk_widget_set_parent and gtk_widget_get_parent. All
widgets should use:
gtk_widget_get_parent() instead of widget->parent->window.
Any widget that wants to have children not in the parent window,
should use gtk_widget_set_parent () in their realize() and
add () routines.
CList and Viewport widgets changed to do this. (Viewport
widget using code from gtk-fortier-980117-0.patch.)
Sat Jan 17 23:56:02 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c:
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
Sun Jan 18 03:57:52 1998 Tim Janik <timj@psynet.net>
* gtk/gtkframe.c: gtk_*_get_arg() and gtk_*_set_arg() implementations.

View File

@ -1,3 +1,27 @@
Sun Jan 18 09:57:00 1998 Owen Taylor <owt1@cornell.edu>
* gtkbutton.c gtkclist.c gtkdrawingarea.c gtkentry.c gtkeventbox.c
gtkfixed.c gtkhandlebox.c gtkhscale.c gtkhscrollbar.c gtkitem.c
gtklist.c gtkmenushell.c gtkmisc.c gtknotebook.c gtkpaned.c
gtkpreview.c gtkprogressbar.c gtkruler.c gtktext.c gtktree.c
gtkviewport.c gtkvscale.c gtkvscrollbar.c gtkwidget.{c,h}
Added gtk_widget_set_parent and gtk_widget_get_parent. All
widgets should use:
gtk_widget_get_parent() instead of widget->parent->window.
Any widget that wants to have children not in the parent window,
should use gtk_widget_set_parent () in their realize() and
add () routines.
CList and Viewport widgets changed to do this. (Viewport
widget using code from gtk-fortier-980117-0.patch.)
Sat Jan 17 23:56:02 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c:
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
Sun Jan 18 03:57:52 1998 Tim Janik <timj@psynet.net>
* gtk/gtkframe.c: gtk_*_get_arg() and gtk_*_set_arg() implementations.

View File

@ -1,3 +1,27 @@
Sun Jan 18 09:57:00 1998 Owen Taylor <owt1@cornell.edu>
* gtkbutton.c gtkclist.c gtkdrawingarea.c gtkentry.c gtkeventbox.c
gtkfixed.c gtkhandlebox.c gtkhscale.c gtkhscrollbar.c gtkitem.c
gtklist.c gtkmenushell.c gtkmisc.c gtknotebook.c gtkpaned.c
gtkpreview.c gtkprogressbar.c gtkruler.c gtktext.c gtktree.c
gtkviewport.c gtkvscale.c gtkvscrollbar.c gtkwidget.{c,h}
Added gtk_widget_set_parent and gtk_widget_get_parent. All
widgets should use:
gtk_widget_get_parent() instead of widget->parent->window.
Any widget that wants to have children not in the parent window,
should use gtk_widget_set_parent () in their realize() and
add () routines.
CList and Viewport widgets changed to do this. (Viewport
widget using code from gtk-fortier-980117-0.patch.)
Sat Jan 17 23:56:02 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c:
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
Sun Jan 18 03:57:52 1998 Tim Janik <timj@psynet.net>
* gtk/gtkframe.c: gtk_*_get_arg() and gtk_*_set_arg() implementations.

View File

@ -1,3 +1,27 @@
Sun Jan 18 09:57:00 1998 Owen Taylor <owt1@cornell.edu>
* gtkbutton.c gtkclist.c gtkdrawingarea.c gtkentry.c gtkeventbox.c
gtkfixed.c gtkhandlebox.c gtkhscale.c gtkhscrollbar.c gtkitem.c
gtklist.c gtkmenushell.c gtkmisc.c gtknotebook.c gtkpaned.c
gtkpreview.c gtkprogressbar.c gtkruler.c gtktext.c gtktree.c
gtkviewport.c gtkvscale.c gtkvscrollbar.c gtkwidget.{c,h}
Added gtk_widget_set_parent and gtk_widget_get_parent. All
widgets should use:
gtk_widget_get_parent() instead of widget->parent->window.
Any widget that wants to have children not in the parent window,
should use gtk_widget_set_parent () in their realize() and
add () routines.
CList and Viewport widgets changed to do this. (Viewport
widget using code from gtk-fortier-980117-0.patch.)
Sat Jan 17 23:56:02 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c:
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
Sun Jan 18 03:57:52 1998 Tim Janik <timj@psynet.net>
* gtk/gtkframe.c: gtk_*_get_arg() and gtk_*_set_arg() implementations.

View File

@ -1,3 +1,27 @@
Sun Jan 18 09:57:00 1998 Owen Taylor <owt1@cornell.edu>
* gtkbutton.c gtkclist.c gtkdrawingarea.c gtkentry.c gtkeventbox.c
gtkfixed.c gtkhandlebox.c gtkhscale.c gtkhscrollbar.c gtkitem.c
gtklist.c gtkmenushell.c gtkmisc.c gtknotebook.c gtkpaned.c
gtkpreview.c gtkprogressbar.c gtkruler.c gtktext.c gtktree.c
gtkviewport.c gtkvscale.c gtkvscrollbar.c gtkwidget.{c,h}
Added gtk_widget_set_parent and gtk_widget_get_parent. All
widgets should use:
gtk_widget_get_parent() instead of widget->parent->window.
Any widget that wants to have children not in the parent window,
should use gtk_widget_set_parent () in their realize() and
add () routines.
CList and Viewport widgets changed to do this. (Viewport
widget using code from gtk-fortier-980117-0.patch.)
Sat Jan 17 23:56:02 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkobject.c:
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
Sun Jan 18 03:57:52 1998 Tim Janik <timj@psynet.net>
* gtk/gtkframe.c: gtk_*_get_arg() and gtk_*_set_arg() implementations.

View File

@ -366,7 +366,7 @@ gtk_button_realize (GtkWidget *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->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, button);
widget->style = gtk_style_attach (widget->style, widget->window);

View File

@ -173,8 +173,6 @@ static void gtk_clist_foreach (GtkContainer * container,
/* Buttons */
static void gtk_clist_column_button_realize (GtkWidget * widget,
gpointer data);
static void gtk_clist_column_button_clicked (GtkWidget * widget,
gpointer data);
@ -428,11 +426,6 @@ gtk_clist_new (int columns,
clist->column[i].button = gtk_button_new ();
gtk_widget_set_parent (clist->column[i].button, GTK_WIDGET (clist));
gtk_signal_connect_after (GTK_OBJECT (clist->column[i].button),
"realize",
(GtkSignalFunc) gtk_clist_column_button_realize,
(gpointer) clist);
gtk_signal_connect (GTK_OBJECT (clist->column[i].button),
"clicked",
(GtkSignalFunc) gtk_clist_column_button_clicked,
@ -1283,6 +1276,7 @@ gtk_clist_realize (GtkWidget * widget)
GdkWindowAttr attributes;
gint attributes_mask;
GdkGCValues values;
gint i;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CLIST (widget));
@ -1308,7 +1302,7 @@ gtk_clist_realize (GtkWidget * widget)
/* main window */
widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, clist);
widget->style = gtk_style_attach (widget->style, widget->window);
@ -1322,6 +1316,10 @@ gtk_clist_realize (GtkWidget * widget)
gtk_style_set_background (widget->style, clist->title_window, GTK_STATE_SELECTED);
gdk_window_show (clist->title_window);
/* set things up so column buttons are drawn in title window */
for (i = 0; i < clist->columns; i++)
gtk_widget_set_parent_window (clist->column[i].button, clist->title_window);
/* clist-window */
clist->clist_window = gdk_window_new (widget->window, &attributes, attributes_mask);
gdk_window_set_user_data (clist->clist_window, clist);
@ -2351,21 +2349,6 @@ gtk_clist_foreach (GtkContainer * container,
}
/* BUTTONS */
static void
gtk_clist_column_button_realize (GtkWidget * widget,
gpointer data)
{
GtkCList *clist;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CLIST (data));
clist = GTK_CLIST (data);
if (widget->window && clist->title_window)
gdk_window_reparent (widget->window, clist->title_window,
widget->allocation.x, 0);
}
static void
gtk_clist_column_button_clicked (GtkWidget * widget,

View File

@ -110,7 +110,7 @@ gtk_drawing_area_realize (GtkWidget *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->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, darea);
widget->style = gtk_style_attach (widget->style, widget->window);

View File

@ -585,7 +585,7 @@ gtk_entry_realize (GtkWidget *widget)
GDK_KEY_PRESS_MASK);
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->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, entry);
attributes.x = widget->style->klass->xthickness + INNER_BORDER;

View File

@ -112,7 +112,7 @@ gtk_event_box_realize (GtkWidget *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->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);

View File

@ -271,7 +271,7 @@ gtk_fixed_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (widget->parent->window, &attributes,
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
attributes_mask);
gdk_window_set_user_data (widget->window, widget);

View File

@ -231,7 +231,7 @@ gtk_handle_box_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
hb->steady_window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
hb->steady_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (hb->steady_window, widget);
attributes.x = 0;
@ -601,10 +601,13 @@ gtk_handle_box_motion (GtkWidget *widget,
hb->is_onroot = TRUE;
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gtk_widget_show (hb->float_window);
if (!GTK_WIDGET_REALIZED (hb->float_window))
gtk_widget_realize (hb->float_window);
gtk_widget_set_uposition (hb->float_window, newx, newy);
gdk_window_reparent (widget->window, hb->float_window->window, 0, 0);
gtk_widget_show (hb->float_window);
while (gdk_pointer_grab (widget->window,
FALSE,
@ -628,10 +631,10 @@ gtk_handle_box_delete_float (GtkWidget *widget,
{
GtkHandleBox *hb;
g_return_if_fail (widget != NULL);
g_return_if_fail (event != NULL);
g_return_if_fail (data != NULL);
g_return_if_fail (GTK_IS_HANDLE_BOX (data));
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (data != NULL, FALSE);
g_return_val_if_fail (GTK_IS_HANDLE_BOX (data), FALSE);
hb = GTK_HANDLE_BOX (data);

View File

@ -138,7 +138,7 @@ gtk_hscale_realize (GtkWidget *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->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gtk_hscale_pos_trough (GTK_HSCALE (widget), &x, &y, &w, &h);
attributes.x = x;

View File

@ -147,7 +147,7 @@ gtk_hscrollbar_realize (GtkWidget *widget)
GDK_LEAVE_NOTIFY_MASK);
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->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
range->trough = widget->window;
gdk_window_ref (range->trough);

View File

@ -184,7 +184,7 @@ gtk_item_realize (GtkWidget *widget)
GDK_LEAVE_NOTIFY_MASK);
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->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);

View File

@ -578,7 +578,7 @@ gtk_list_realize (GtkWidget *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->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);

View File

@ -298,7 +298,7 @@ gtk_menu_shell_realize (GtkWidget *widget)
GDK_LEAVE_NOTIFY_MASK);
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->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);

View File

@ -157,7 +157,7 @@ gtk_misc_realize (GtkWidget *widget)
if (GTK_WIDGET_NO_WINDOW (widget))
{
widget->window = widget->parent->window;
widget->window = gtk_widget_get_parent_window (widget);
widget->style = gtk_style_attach (widget->style, widget->window);
}
else
@ -173,7 +173,7 @@ gtk_misc_realize (GtkWidget *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 (widget->parent->window, &attributes, attributes_mask);
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);

View File

@ -536,7 +536,7 @@ gtk_notebook_realize (GtkWidget *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->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, notebook);
widget->style = gtk_style_attach (widget->style, widget->window);

View File

@ -168,12 +168,12 @@ gtk_paned_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP |
GDK_WA_CURSOR;
paned->handle = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
paned->handle = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (paned->handle, widget);
gdk_window_show (paned->handle);
gdk_window_raise (paned->handle);
widget->window = widget->parent->window;
widget->window = gtk_widget_get_parent_window (widget);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, paned->handle, GTK_STATE_NORMAL);

View File

@ -676,7 +676,7 @@ gtk_preview_realize (GtkWidget *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 (widget->parent->window, &attributes, attributes_mask);
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);

View File

@ -133,7 +133,7 @@ gtk_progress_bar_realize (GtkWidget *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->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, pbar);
widget->style = gtk_style_attach (widget->style, widget->window);

View File

@ -176,7 +176,7 @@ gtk_ruler_realize (GtkWidget *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->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, ruler);
widget->style = gtk_style_attach (widget->style, widget->window);

View File

@ -643,7 +643,7 @@ gtk_text_realize (GtkWidget *widget)
GDK_KEY_PRESS_MASK);
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->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, text);
attributes.x = (widget->style->klass->xthickness + TEXT_BORDER_ROOM);

View File

@ -603,7 +603,7 @@ gtk_tree_realize (GtkWidget *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->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);

View File

@ -31,6 +31,8 @@ static void gtk_viewport_draw (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_viewport_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_viewport_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_viewport_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_viewport_size_allocate (GtkWidget *widget,
@ -41,7 +43,6 @@ static void gtk_viewport_adjustment_changed (GtkAdjustment *adjustment,
static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
gpointer data);
guint
gtk_viewport_get_type ()
{
@ -84,6 +85,7 @@ gtk_viewport_class_init (GtkViewportClass *class)
widget_class->size_request = gtk_viewport_size_request;
widget_class->size_allocate = gtk_viewport_size_allocate;
container_class->add = gtk_viewport_add;
container_class->need_resize = gtk_viewport_need_resize;
}
@ -94,8 +96,8 @@ gtk_viewport_init (GtkViewport *viewport)
GTK_WIDGET_SET_FLAGS (viewport, GTK_BASIC);
viewport->shadow_type = GTK_SHADOW_IN;
viewport->main_window = NULL;
viewport->view_window = NULL;
viewport->bin_window = NULL;
viewport->hadjustment = NULL;
viewport->vadjustment = NULL;
}
@ -223,17 +225,15 @@ gtk_viewport_set_shadow_type (GtkViewport *viewport,
static void
gtk_viewport_map (GtkWidget *widget)
{
GtkViewport *viewport;
GtkBin *bin;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_VIEWPORT (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
viewport = GTK_VIEWPORT (widget);
bin = GTK_BIN (widget);
gdk_window_show (viewport->main_window);
gdk_window_show (widget->window);
if (bin->child &&
GTK_WIDGET_VISIBLE (bin->child) &&
@ -244,20 +244,18 @@ gtk_viewport_map (GtkWidget *widget)
static void
gtk_viewport_unmap (GtkWidget *widget)
{
GtkViewport *viewport;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_VIEWPORT (widget));
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
viewport = GTK_VIEWPORT (widget);
gdk_window_hide (viewport->main_window);
gdk_window_hide (widget->window);
}
static void
gtk_viewport_realize (GtkWidget *widget)
{
GtkBin *bin;
GtkViewport *viewport;
GdkWindowAttr attributes;
GtkRequisition *child_requisition;
@ -266,6 +264,7 @@ gtk_viewport_realize (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_VIEWPORT (widget));
bin = GTK_BIN (widget);
viewport = GTK_VIEWPORT (widget);
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
@ -281,35 +280,38 @@ gtk_viewport_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
viewport->main_window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
gdk_window_set_user_data (viewport->main_window, viewport);
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (widget->window, viewport);
attributes.x += widget->style->klass->xthickness;
attributes.y += widget->style->klass->ythickness;
attributes.width -= widget->style->klass->xthickness * 2;
attributes.height -= widget->style->klass->ythickness * 2;
viewport->view_window = gdk_window_new (viewport->main_window, &attributes, attributes_mask);
viewport->view_window = gdk_window_new (widget->window, &attributes, attributes_mask);
gdk_window_set_user_data (viewport->view_window, viewport);
attributes.x = 0;
attributes.y = 0;
if (GTK_BIN (viewport)->child)
viewport->bin_window = gdk_window_new (viewport->view_window, &attributes, attributes_mask);
gdk_window_set_user_data (viewport->bin_window, viewport);
if (bin->child)
{
child_requisition = &GTK_WIDGET (GTK_BIN (viewport)->child)->requisition;
attributes.width = child_requisition->width;
attributes.height = child_requisition->height;
gtk_widget_set_parent_window (bin->child, viewport->bin_window);
}
widget->window = gdk_window_new (viewport->view_window, &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, viewport);
widget->style = gtk_style_attach (widget->style, viewport->main_window);
gtk_style_set_background (widget->style, viewport->main_window, GTK_STATE_NORMAL);
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, viewport->bin_window, GTK_STATE_NORMAL);
gdk_window_show (widget->window);
gdk_window_show (viewport->bin_window);
gdk_window_show (viewport->view_window);
}
@ -328,11 +330,11 @@ gtk_viewport_unrealize (GtkWidget *widget)
gdk_window_destroy (widget->window);
gdk_window_destroy (viewport->view_window);
gdk_window_destroy (viewport->main_window);
gdk_window_destroy (viewport->bin_window);
widget->window = NULL;
viewport->view_window = NULL;
viewport->main_window = NULL;
viewport->bin_window = NULL;
}
static void
@ -340,8 +342,6 @@ gtk_viewport_paint (GtkWidget *widget,
GdkRectangle *area)
{
GtkViewport *viewport;
GtkStateType state;
gint x, y;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_VIEWPORT (widget));
@ -351,14 +351,7 @@ gtk_viewport_paint (GtkWidget *widget,
{
viewport = GTK_VIEWPORT (widget);
state = widget->state;
if (!GTK_WIDGET_IS_SENSITIVE (widget))
state = GTK_STATE_INSENSITIVE;
x = GTK_CONTAINER (viewport)->border_width;
y = GTK_CONTAINER (viewport)->border_width;
gtk_draw_shadow (widget->style, viewport->main_window,
gtk_draw_shadow (widget->style, widget->window,
GTK_STATE_NORMAL, viewport->shadow_type,
0, 0, -1, -1);
}
@ -413,7 +406,7 @@ gtk_viewport_expose (GtkWidget *widget,
viewport = GTK_VIEWPORT (widget);
bin = GTK_BIN (widget);
if (event->window == viewport->main_window)
if (event->window == widget->window)
gtk_viewport_paint (widget, &event->area);
child_event = *event;
@ -426,6 +419,36 @@ gtk_viewport_expose (GtkWidget *widget,
return FALSE;
}
static void
gtk_viewport_add (GtkContainer *container,
GtkWidget *widget)
{
GtkBin *bin;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_VIEWPORT (container));
g_return_if_fail (widget != NULL);
bin = GTK_BIN (container);
if (!bin->child)
{
gtk_widget_set_parent (widget, GTK_WIDGET (container));
gtk_widget_set_parent_window (widget, GTK_VIEWPORT (container)->bin_window);
if (GTK_WIDGET_VISIBLE (widget->parent))
{
if (GTK_WIDGET_MAPPED (widget->parent) &&
!GTK_WIDGET_MAPPED (widget))
gtk_widget_map (widget);
}
bin->child = widget;
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (widget);
}
}
static void
gtk_viewport_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@ -481,7 +504,7 @@ gtk_viewport_size_allocate (GtkWidget *widget,
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_move_resize (viewport->main_window,
gdk_window_move_resize (widget->window,
allocation->x + GTK_CONTAINER (viewport)->border_width,
allocation->y + GTK_CONTAINER (viewport)->border_width,
allocation->width - GTK_CONTAINER (viewport)->border_width * 2,
@ -535,7 +558,7 @@ gtk_viewport_size_allocate (GtkWidget *widget,
if (!GTK_WIDGET_REALIZED (widget))
gtk_widget_realize (widget);
gdk_window_resize (widget->window,
gdk_window_resize (viewport->bin_window,
child_allocation.width,
child_allocation.height);
@ -624,7 +647,7 @@ gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
child_allocation.y = viewport->vadjustment->lower - viewport->vadjustment->value;
if (GTK_WIDGET_REALIZED (viewport))
gdk_window_move (GTK_WIDGET (viewport)->window,
gdk_window_move (viewport->bin_window,
child_allocation.x,
child_allocation.y);
}

View File

@ -139,7 +139,7 @@ gtk_vscale_realize (GtkWidget *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->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gtk_vscale_pos_trough (GTK_VSCALE (widget), &x, &y, &w, &h);
attributes.x = x;

View File

@ -146,7 +146,7 @@ gtk_vscrollbar_realize (GtkWidget *widget)
GDK_LEAVE_NOTIFY_MASK);
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->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
range->trough = widget->window;
gdk_window_ref (range->trough);

View File

@ -200,6 +200,7 @@ static const char *visual_key = "visual";
static const char *event_key = "event_mask";
static const char *resize_widgets_key = "resize_widgets";
static const char *extension_event_key = "extension_event_mode";
static const char *parent_window_key = "parent_window";
static const char *redraw_handler_key = "redraw_handler_tag";
static const char *resize_handler_key = "resize_handler_tag";
static const char *shape_info_key = "shape_info";
@ -1801,19 +1802,18 @@ static void
gtk_widget_reparent_container_child(GtkWidget *widget,
gpointer client_data)
{
GtkWidget *new_parent = GTK_WIDGET (client_data);
g_return_if_fail (widget != NULL);
g_return_if_fail (client_data != NULL);
if (!GTK_WIDGET_NO_WINDOW (widget))
gdk_window_reparent (widget->window, new_parent->window, 0, 0);
gdk_window_reparent (widget->window,
(GdkWindow *)client_data, 0, 0);
else if (GTK_IS_CONTAINER (widget))
gtk_container_foreach (GTK_CONTAINER (widget),
gtk_widget_reparent_container_child,
new_parent);
client_data);
else
widget->window = new_parent->window;
widget->window = (GdkWindow *)client_data;
}
@ -1841,12 +1841,12 @@ gtk_widget_reparent (GtkWidget *widget,
if (GTK_IS_CONTAINER (widget))
gtk_container_foreach (GTK_CONTAINER(widget),
gtk_widget_reparent_container_child,
new_parent);
gtk_widget_get_parent_window (widget));
else
widget->window = widget->parent->window;
widget->window = gtk_widget_get_parent_window (widget);
}
else
gdk_window_reparent (widget->window, widget->parent->window, 0, 0);
gdk_window_reparent (widget->window, gtk_widget_get_parent_window (widget), 0, 0);
}
else
gtk_widget_unrealize (widget);
@ -2214,6 +2214,64 @@ gtk_widget_set_parent (GtkWidget *widget,
}
}
/*************************************************************
* gtk_widget_set_parent_window:
* Set a non default parent window for widget
*
* arguments:
* widget:
* parent_window
*
* results:
*************************************************************/
void
gtk_widget_set_parent_window (GtkWidget *widget,
GdkWindow *parent_window)
{
GdkWindow *old_parent_window;
g_return_if_fail (widget != NULL);
old_parent_window = gtk_object_get_data (GTK_OBJECT (widget),
parent_window_key);
if (parent_window != old_parent_window)
{
gtk_object_set_data (GTK_OBJECT (widget), parent_window_key,
parent_window);
if (old_parent_window)
gdk_window_unref (old_parent_window);
if (parent_window)
gdk_window_ref (parent_window);
}
}
/*************************************************************
* gtk_widget_get_parent_window:
* Get widget's parent window
*
* arguments:
* widget:
*
* results:
* parent window
*************************************************************/
GdkWindow *
gtk_widget_get_parent_window (GtkWidget *widget)
{
GdkWindow *parent_window;
g_return_val_if_fail (widget != NULL, NULL);
parent_window = gtk_object_get_data (GTK_OBJECT (widget),
parent_window_key);
return (parent_window != NULL) ? parent_window : widget->parent->window;
}
/*****************************************
* gtk_widget_set_style:
*
@ -3115,7 +3173,7 @@ gtk_real_widget_realize (GtkWidget *widget)
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
if(widget->parent)
widget->window = widget->parent->window;
widget->window = gtk_widget_get_parent_window (widget);
widget->style = gtk_style_attach (widget->style, widget->window);
}

View File

@ -423,6 +423,9 @@ void gtk_widget_set_sensitive (GtkWidget *widget,
gint sensitive);
void gtk_widget_set_parent (GtkWidget *widget,
GtkWidget *parent);
void gtk_widget_set_parent_window (GtkWidget *widget,
GdkWindow *parent_window);
GdkWindow *gtk_widget_get_parent_window (GtkWidget *widget);
void gtk_widget_set_style (GtkWidget *widget,
GtkStyle *style);
void gtk_widget_set_uposition (GtkWidget *widget,