]> Pileus Git - ~andy/gtk/commitdiff
/home/otaylor/commit
authorOwen Taylor <otaylor@src.gnome.org>
Tue, 24 Mar 1998 01:43:21 +0000 (01:43 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Tue, 24 Mar 1998 01:43:21 +0000 (01:43 +0000)
17 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkbutton.c
gtk/gtkclist.c
gtk/gtkeventbox.c
gtk/gtkfilesel.c
gtk/gtklist.c
gtk/gtkmenu.c
gtk/gtkmenushell.c
gtk/gtktext.c
gtk/gtktree.c
gtk/gtkviewport.c

index 4af4ed8a6ed9a03e6fc9f4e035323fc30902f65d..03f65d6e641c68c643a740f91e8befc23fb5540e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+Mon Mar 23 18:19:42 1998  Owen Taylor  <owt1@cornell.edu>
+
+       * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
+       an X grab when the button is released, grab immediately.
+       This solves a problem where menus wouldn't pop down
+       if the caller didn't have the BUTTON_RELEASE mask on
+       their window, and and another where the X grab would
+       be released prematurely.
+
+       * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
+       button presses to make sure they occurred in a child item.
+       (From: "Damon Chaplin" <DAChaplin@email.msn.com>)
+
+       * gtk/gtkmenushell.c: Do sanity checking on button
+       press/releases. Handle button events on window widget
+       descendents of menu items correctly.
+       
+       * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c 
+         gtk/gtkeventbox.c:
+
+       Make the window size allocated in _realize() match that
+       in _size_allocate(). Take into account the border width
+       in the draw() handler.
+
 Mon Mar 23 15:26:25 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
index 4af4ed8a6ed9a03e6fc9f4e035323fc30902f65d..03f65d6e641c68c643a740f91e8befc23fb5540e 100644 (file)
@@ -1,3 +1,27 @@
+Mon Mar 23 18:19:42 1998  Owen Taylor  <owt1@cornell.edu>
+
+       * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
+       an X grab when the button is released, grab immediately.
+       This solves a problem where menus wouldn't pop down
+       if the caller didn't have the BUTTON_RELEASE mask on
+       their window, and and another where the X grab would
+       be released prematurely.
+
+       * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
+       button presses to make sure they occurred in a child item.
+       (From: "Damon Chaplin" <DAChaplin@email.msn.com>)
+
+       * gtk/gtkmenushell.c: Do sanity checking on button
+       press/releases. Handle button events on window widget
+       descendents of menu items correctly.
+       
+       * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c 
+         gtk/gtkeventbox.c:
+
+       Make the window size allocated in _realize() match that
+       in _size_allocate(). Take into account the border width
+       in the draw() handler.
+
 Mon Mar 23 15:26:25 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
index 4af4ed8a6ed9a03e6fc9f4e035323fc30902f65d..03f65d6e641c68c643a740f91e8befc23fb5540e 100644 (file)
@@ -1,3 +1,27 @@
+Mon Mar 23 18:19:42 1998  Owen Taylor  <owt1@cornell.edu>
+
+       * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
+       an X grab when the button is released, grab immediately.
+       This solves a problem where menus wouldn't pop down
+       if the caller didn't have the BUTTON_RELEASE mask on
+       their window, and and another where the X grab would
+       be released prematurely.
+
+       * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
+       button presses to make sure they occurred in a child item.
+       (From: "Damon Chaplin" <DAChaplin@email.msn.com>)
+
+       * gtk/gtkmenushell.c: Do sanity checking on button
+       press/releases. Handle button events on window widget
+       descendents of menu items correctly.
+       
+       * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c 
+         gtk/gtkeventbox.c:
+
+       Make the window size allocated in _realize() match that
+       in _size_allocate(). Take into account the border width
+       in the draw() handler.
+
 Mon Mar 23 15:26:25 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
index 4af4ed8a6ed9a03e6fc9f4e035323fc30902f65d..03f65d6e641c68c643a740f91e8befc23fb5540e 100644 (file)
@@ -1,3 +1,27 @@
+Mon Mar 23 18:19:42 1998  Owen Taylor  <owt1@cornell.edu>
+
+       * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
+       an X grab when the button is released, grab immediately.
+       This solves a problem where menus wouldn't pop down
+       if the caller didn't have the BUTTON_RELEASE mask on
+       their window, and and another where the X grab would
+       be released prematurely.
+
+       * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
+       button presses to make sure they occurred in a child item.
+       (From: "Damon Chaplin" <DAChaplin@email.msn.com>)
+
+       * gtk/gtkmenushell.c: Do sanity checking on button
+       press/releases. Handle button events on window widget
+       descendents of menu items correctly.
+       
+       * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c 
+         gtk/gtkeventbox.c:
+
+       Make the window size allocated in _realize() match that
+       in _size_allocate(). Take into account the border width
+       in the draw() handler.
+
 Mon Mar 23 15:26:25 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
index 4af4ed8a6ed9a03e6fc9f4e035323fc30902f65d..03f65d6e641c68c643a740f91e8befc23fb5540e 100644 (file)
@@ -1,3 +1,27 @@
+Mon Mar 23 18:19:42 1998  Owen Taylor  <owt1@cornell.edu>
+
+       * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
+       an X grab when the button is released, grab immediately.
+       This solves a problem where menus wouldn't pop down
+       if the caller didn't have the BUTTON_RELEASE mask on
+       their window, and and another where the X grab would
+       be released prematurely.
+
+       * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
+       button presses to make sure they occurred in a child item.
+       (From: "Damon Chaplin" <DAChaplin@email.msn.com>)
+
+       * gtk/gtkmenushell.c: Do sanity checking on button
+       press/releases. Handle button events on window widget
+       descendents of menu items correctly.
+       
+       * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c 
+         gtk/gtkeventbox.c:
+
+       Make the window size allocated in _realize() match that
+       in _size_allocate(). Take into account the border width
+       in the draw() handler.
+
 Mon Mar 23 15:26:25 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
index 4af4ed8a6ed9a03e6fc9f4e035323fc30902f65d..03f65d6e641c68c643a740f91e8befc23fb5540e 100644 (file)
@@ -1,3 +1,27 @@
+Mon Mar 23 18:19:42 1998  Owen Taylor  <owt1@cornell.edu>
+
+       * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
+       an X grab when the button is released, grab immediately.
+       This solves a problem where menus wouldn't pop down
+       if the caller didn't have the BUTTON_RELEASE mask on
+       their window, and and another where the X grab would
+       be released prematurely.
+
+       * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
+       button presses to make sure they occurred in a child item.
+       (From: "Damon Chaplin" <DAChaplin@email.msn.com>)
+
+       * gtk/gtkmenushell.c: Do sanity checking on button
+       press/releases. Handle button events on window widget
+       descendents of menu items correctly.
+       
+       * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c 
+         gtk/gtkeventbox.c:
+
+       Make the window size allocated in _realize() match that
+       in _size_allocate(). Take into account the border width
+       in the draw() handler.
+
 Mon Mar 23 15:26:25 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
index 4af4ed8a6ed9a03e6fc9f4e035323fc30902f65d..03f65d6e641c68c643a740f91e8befc23fb5540e 100644 (file)
@@ -1,3 +1,27 @@
+Mon Mar 23 18:19:42 1998  Owen Taylor  <owt1@cornell.edu>
+
+       * gtk/gtkmenu.c gtk/gtkmenushell.c: Instead of making
+       an X grab when the button is released, grab immediately.
+       This solves a problem where menus wouldn't pop down
+       if the caller didn't have the BUTTON_RELEASE mask on
+       their window, and and another where the X grab would
+       be released prematurely.
+
+       * gtk/gtklist.c gtk/gtktree.c: Do sanity checking on
+       button presses to make sure they occurred in a child item.
+       (From: "Damon Chaplin" <DAChaplin@email.msn.com>)
+
+       * gtk/gtkmenushell.c: Do sanity checking on button
+       press/releases. Handle button events on window widget
+       descendents of menu items correctly.
+       
+       * gtk/gtkclist.c gtk/gtkbutton.c gtk/gtkviewport.c 
+         gtk/gtkeventbox.c:
+
+       Make the window size allocated in _realize() match that
+       in _size_allocate(). Take into account the border width
+       in the draw() handler.
+
 Mon Mar 23 15:26:25 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkentry.c (gtk_entry_append_text): check for text!=NULL.
index ea303e09626d90203e9fe102492bc85e0173a327..5de521d7333adb6dc567c05eb33c83b606dd56b2 100644 (file)
@@ -324,6 +324,7 @@ gtk_button_realize (GtkWidget *widget)
   GtkButton *button;
   GdkWindowAttr attributes;
   gint attributes_mask;
+  gint border_width;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_BUTTON (widget));
@@ -331,11 +332,13 @@ gtk_button_realize (GtkWidget *widget)
   button = GTK_BUTTON (widget);
   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
 
+  border_width = GTK_CONTAINER (widget)->border_width;
+
   attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.x = widget->allocation.x;
-  attributes.y = widget->allocation.y;
-  attributes.width = widget->allocation.width;
-  attributes.height = widget->allocation.height;
+  attributes.x = widget->allocation.x + border_width;
+  attributes.y = widget->allocation.y + border_width;
+  attributes.width = widget->allocation.width - border_width * 2;
+  attributes.height = widget->allocation.height - border_width * 2;
   attributes.wclass = GDK_INPUT_OUTPUT;
   attributes.visual = gtk_widget_get_visual (widget);
   attributes.colormap = gtk_widget_get_colormap (widget);
@@ -482,6 +485,7 @@ gtk_button_draw (GtkWidget    *widget,
 {
   GtkButton *button;
   GdkRectangle child_area;
+  GdkRectangle tmp_area;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_BUTTON (widget));
@@ -491,9 +495,13 @@ gtk_button_draw (GtkWidget    *widget,
     {
       button = GTK_BUTTON (widget);
 
-      gtk_button_paint (widget, area);
+      tmp_area = *area;
+      tmp_area.x -= GTK_CONTAINER (button)->border_width;
+      tmp_area.y -= GTK_CONTAINER (button)->border_width;
+
+      gtk_button_paint (widget, &tmp_area);
 
-      if (button->child && gtk_widget_intersect (button->child, area, &child_area))
+      if (button->child && gtk_widget_intersect (button->child, &tmp_area, &child_area))
        gtk_widget_draw (button->child, &child_area);
 
       gtk_widget_draw_default (widget);
index 64f8f8322b4513e32a7a3cad9d1f6f66909844b8..bfef6fc743b536c7a8844bc054dbcd0009d73af2 100644 (file)
@@ -1729,6 +1729,7 @@ gtk_clist_realize (GtkWidget * widget)
   GdkWindowAttr attributes;
   gint attributes_mask;
   GdkGCValues values;
+  gint border_width;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_CLIST (widget));
@@ -1737,11 +1738,13 @@ gtk_clist_realize (GtkWidget * widget)
 
   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
 
+  border_width = GTK_CONTAINER (widget)->border_width;
+  
   attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.x = widget->allocation.x;
-  attributes.y = widget->allocation.y;
-  attributes.width = widget->allocation.width;
-  attributes.height = widget->allocation.height;
+  attributes.x = widget->allocation.x + border_width;
+  attributes.y = widget->allocation.y + border_width;
+  attributes.width = widget->allocation.width - border_width * 2;
+  attributes.height = widget->allocation.height - border_width * 2;
   attributes.wclass = GDK_INPUT_OUTPUT;
   attributes.visual = gtk_widget_get_visual (widget);
   attributes.colormap = gtk_widget_get_colormap (widget);
@@ -1951,6 +1954,7 @@ gtk_clist_draw (GtkWidget * widget,
                GdkRectangle * area)
 {
   GtkCList *clist;
+  gint border_width;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_CLIST (widget));
@@ -1959,9 +1963,11 @@ gtk_clist_draw (GtkWidget * widget,
   if (GTK_WIDGET_DRAWABLE (widget))
     {
       clist = GTK_CLIST (widget);
+      border_width = GTK_CONTAINER (widget)->border_width;
 
       gdk_window_clear_area (widget->window,
-                            area->x, area->y,
+                            area->x - border_width, 
+                            area->y - border_width,
                             area->width, area->height);
 
       /* draw list shadow/border */
index ac9d8746daa64e95cbb3eadafbcd4ea7a46ad481..b18e1646ae721e5d60b2c9d3d9f43c950625b431 100644 (file)
@@ -88,16 +88,19 @@ gtk_event_box_realize (GtkWidget *widget)
 {
   GdkWindowAttr attributes;
   gint attributes_mask;
+  gint border_width;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_EVENT_BOX (widget));
 
   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
 
-  attributes.x = widget->allocation.x;
-  attributes.y = widget->allocation.y;
-  attributes.width = widget->allocation.width;
-  attributes.height = widget->allocation.height;
+  border_width = GTK_CONTAINER (widget)->border_width;
+  
+  attributes.x = widget->allocation.x + border_width;
+  attributes.y = widget->allocation.y + border_width;
+  attributes.width = widget->allocation.width - 2*border_width;
+  attributes.height = widget->allocation.height - 2*border_width;
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.wclass = GDK_INPUT_OUTPUT;
   attributes.visual = gtk_widget_get_visual (widget);
@@ -182,19 +185,22 @@ gtk_event_box_draw (GtkWidget    *widget,
                   GdkRectangle *area)
 {
   GtkBin *bin;
+  GdkRectangle tmp_area;
   GdkRectangle child_area;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_EVENT_BOX (widget));
-  g_return_if_fail (area != NULL);
 
   if (GTK_WIDGET_DRAWABLE (widget))
     {
       bin = GTK_BIN (widget);
-
+      tmp_area = *area;
+      tmp_area.x -= GTK_CONTAINER (widget)->border_width;
+      tmp_area.y -= GTK_CONTAINER (widget)->border_width;
+      
       if (bin->child)
        {
-         if (gtk_widget_intersect (bin->child, area, &child_area))
+         if (gtk_widget_intersect (bin->child, &tmp_area, &child_area))
            gtk_widget_draw (bin->child, &child_area);
        }
     }
index 871f988d01f5efd9449defacf312aaee60b0db5a..1328f7e980662eb63d092f3e5a1d29fa9fa1b1b7 100644 (file)
@@ -1278,7 +1278,7 @@ gtk_file_selection_populate (GtkFileSelection *fs,
         {
           possible_count += 1;
 
-          filename = g_strdup (cmpl_this_completion (poss));
+          filename = cmpl_this_completion (poss);
 
          text[0] = filename;
          
index 063041c60dacd6b793dca6b9b796e265a689e77e..ead9f98a9747a3d93f853d9ea3a5687f9c8f4d13 100644 (file)
@@ -698,12 +698,12 @@ gtk_list_button_press (GtkWidget      *widget,
   list = GTK_LIST (widget);
   item = gtk_get_event_widget ((GdkEvent*) event);
   
-  if (!item)
-    return FALSE;
-  
-  while (!gtk_type_is_a (GTK_WIDGET_TYPE (item), gtk_list_item_get_type ()))
+  while (item && !GTK_IS_LIST_ITEM (item))
     item = item->parent;
 
+  if (!item || (item->parent != widget))
+    return FALSE;
+  
   gtk_list_select_child (list, item);
 
   return FALSE;
index 2e2e098223f2bebeef4c458fc68116387f1b96a2..12a804ec8bc105766f15aef2c7936b6cf3bfdc5d 100644 (file)
@@ -279,6 +279,9 @@ gtk_menu_popup (GtkMenu             *menu,
                guint                button,
                guint32              activate_time)
 {
+  GtkWidget *xgrab_shell;
+  GtkWidget *parent;
+
   g_return_if_fail (menu != NULL);
   g_return_if_fail (GTK_IS_MENU (menu));
 
@@ -292,6 +295,41 @@ gtk_menu_popup (GtkMenu             *menu,
   GTK_MENU_SHELL (menu)->activate_time = activate_time;
 
   gtk_widget_show (GTK_WIDGET (menu));
+
+  /* Find the last viewable ancestor, and make an X grab on it
+   */
+  parent = GTK_WIDGET (menu);
+  xgrab_shell = NULL;
+  while (parent)
+    {
+      gboolean viewable = TRUE;
+      GtkWidget *tmp = parent;
+      
+      while (tmp)
+       {
+         if (!GTK_WIDGET_MAPPED (tmp))
+           {
+             viewable = FALSE;
+             break;
+           }
+         tmp = tmp->parent;
+       }
+
+      if (viewable)
+       xgrab_shell = parent;
+
+      parent = GTK_MENU_SHELL (parent)->parent_menu_shell;
+    }
+
+  if (xgrab_shell && (!GTK_MENU_SHELL (xgrab_shell)->have_xgrab))
+    {
+      GTK_MENU_SHELL (xgrab_shell)->have_xgrab = 
+       (gdk_pointer_grab (xgrab_shell->window, TRUE,
+                          GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
+                          GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK,
+                          NULL, NULL, activate_time) == 0);
+    }
+
   gtk_grab_add (GTK_WIDGET (menu));
 }
 
@@ -315,7 +353,11 @@ gtk_menu_popdown (GtkMenu *menu)
       menu_shell->active_menu_item = NULL;
     }
 
+  /* The X Grab, if present, will automatically be removed when we hide
+   * the window */
   gtk_widget_hide (GTK_WIDGET (menu));
+  menu_shell->have_xgrab = FALSE;
+
   gtk_grab_remove (GTK_WIDGET (menu));
 }
 
index eb9d731d90870f6b650bb9b074383af0c8d0fe73..7fd467ff95a787936939dcbe59c317639dcb3f67 100644 (file)
@@ -53,6 +53,8 @@ static void gtk_menu_shell_foreach           (GtkContainer      *container,
 static void gtk_real_menu_shell_deactivate   (GtkMenuShell      *menu_shell);
 static gint gtk_menu_shell_is_item           (GtkMenuShell      *menu_shell,
                                              GtkWidget         *child);
+static GtkWidget *gtk_menu_shell_get_item    (GtkMenuShell      *menu_shell,
+                                             GdkEvent          *event);
 
 
 static GtkContainerClass *parent_class = NULL;
@@ -302,14 +304,11 @@ gtk_menu_shell_button_press (GtkWidget      *widget,
          menu_shell->active = TRUE;
        }
       menu_shell->button = event->button;
-      
-      menu_item = gtk_get_event_widget ((GdkEvent*) event);
 
-      if (!GTK_WIDGET_IS_SENSITIVE (menu_item))
-       return TRUE;
+      menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent *)event);
 
-      if (menu_item && GTK_IS_MENU_ITEM (menu_item) &&
-         gtk_menu_shell_is_item (menu_shell, menu_item))
+      if (menu_item &&
+         GTK_WIDGET_IS_SENSITIVE (menu_item))
        {
          if ((menu_item->parent == widget) &&
              (menu_item != menu_shell->active_menu_item))
@@ -358,16 +357,13 @@ gtk_menu_shell_button_release (GtkWidget      *widget,
        }
       
       menu_shell->button = 0;
-      menu_item = gtk_get_event_widget ((GdkEvent*) event);
-      
-      if (!GTK_WIDGET_IS_SENSITIVE (menu_item))
-       return TRUE;
+      menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent*) event);
 
       deactivate = TRUE;
 
       if ((event->time - menu_shell->activate_time) > MENU_SHELL_TIMEOUT)
        {
-         if (menu_shell->active_menu_item == menu_item)
+         if (menu_item && (menu_shell->active_menu_item == menu_item))
            {
              if (GTK_MENU_ITEM (menu_item)->submenu == NULL)
                {
@@ -385,15 +381,14 @@ gtk_menu_shell_button_release (GtkWidget      *widget,
        }
       else
        deactivate = FALSE;
-
-      if ((!deactivate || (menu_shell->active_menu_item == menu_item)) &&
-         (gdk_pointer_grab (widget->window, TRUE,
-                            GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
-                            GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK,
-                            NULL, NULL, event->time) == 0))
+      
+      /* If the button click was very fast, or we ended up on a submenu,
+       * leave the menu up
+       */
+      if (!deactivate || 
+         (menu_item && (menu_shell->active_menu_item == menu_item)))
        {
          deactivate = FALSE;
-         menu_shell->have_xgrab = TRUE;
          menu_shell->ignore_leave = TRUE;
        }
       else
@@ -607,3 +602,21 @@ gtk_menu_shell_is_item (GtkMenuShell *menu_shell,
 
   return FALSE;
 }
+
+static GtkWidget *
+gtk_menu_shell_get_item (GtkMenuShell *menu_shell,
+                        GdkEvent     *event)
+{
+  GtkWidget *menu_item;
+
+  menu_item = gtk_get_event_widget ((GdkEvent*) event);
+  
+  while (menu_item && !GTK_IS_MENU_ITEM (menu_item))
+    menu_item = menu_item->parent;
+
+  if (menu_item && gtk_menu_shell_is_item (menu_shell, menu_item))
+    return menu_item;
+  else
+    return NULL;
+}
+
index e7ff57e1293c2a122de06f3964fa8b319186b988..5b77794e0a47a5a1e00b70427359e1302d8c9f8d 100644 (file)
@@ -497,6 +497,7 @@ gtk_text_init (GtkText *text)
   text->tab_stops = g_list_prepend (text->tab_stops, (void*)8);
 
   text->line_wrap = TRUE;
+  text->word_wrap = FALSE;
   
   text->timer = 0;
   text->button = 0;
index b501486ad0cd4a8d7448298935d720d5c3705038..f4c9e78608ef05b10530cbaeb268a2a8b04b56e1 100644 (file)
@@ -299,9 +299,12 @@ gtk_tree_button_press (GtkWidget      *widget,
   tree = GTK_TREE (widget);
   item = gtk_get_event_widget ((GdkEvent*) event);
 
-  while (!gtk_type_is_a (GTK_WIDGET_TYPE (item), gtk_tree_item_get_type ()))
+  while (item && !GTK_IS_TREE_ITEM (item))
     item = item->parent;
 
+  if (!item || (item->parent != widget))
+    return FALSE;
+  
   switch(event->button) 
     {
     case 1:
index 08e5d27a28305e59c090993cc643455a3f6ab9ac..ed8c202b2f2402856d2d8ea6f71ce82023ac74d5 100644 (file)
@@ -391,6 +391,7 @@ gtk_viewport_draw (GtkWidget    *widget,
   GtkBin *bin;
   GdkRectangle tmp_area;
   GdkRectangle child_area;
+  gint border_width;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_VIEWPORT (widget));
@@ -401,13 +402,18 @@ gtk_viewport_draw (GtkWidget    *widget,
       viewport = GTK_VIEWPORT (widget);
       bin = GTK_BIN (widget);
 
-      gtk_viewport_paint (widget, area);
+      border_width = GTK_CONTAINER (widget)->border_width;
+      
+      tmp_area = *area;
+      tmp_area.x -= border_width;
+      tmp_area.y -= border_width;
+      
+      gtk_viewport_paint (widget, &tmp_area);
 
       if (bin->child)
        {
-         tmp_area = *area;
-         tmp_area.x += viewport->hadjustment->value;
-         tmp_area.y += viewport->vadjustment->value;
+         tmp_area.x += viewport->hadjustment->value - widget->style->klass->xthickness;
+         tmp_area.y += viewport->vadjustment->value - widget->style->klass->ythickness;
 
          if (gtk_widget_intersect (bin->child, &tmp_area, &child_area))
            gtk_widget_draw (bin->child, &child_area);
@@ -508,6 +514,7 @@ gtk_viewport_size_allocate (GtkWidget     *widget,
   GtkBin *bin;
   GtkAllocation child_allocation;
   gint hval, vval;
+  gint border_width;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_VIEWPORT (widget));
@@ -517,6 +524,8 @@ gtk_viewport_size_allocate (GtkWidget     *widget,
   viewport = GTK_VIEWPORT (widget);
   bin = GTK_BIN (widget);
 
+  border_width = GTK_CONTAINER (widget)->border_width;
+
   child_allocation.x = 0;
   child_allocation.y = 0;
 
@@ -526,16 +535,16 @@ gtk_viewport_size_allocate (GtkWidget     *widget,
       child_allocation.y = GTK_WIDGET (viewport)->style->klass->ythickness;
     }
 
-  child_allocation.width = allocation->width - child_allocation.x * 2;
-  child_allocation.height = allocation->height - child_allocation.y * 2;
+  child_allocation.width = allocation->width - child_allocation.x * 2 - border_width * 2;
+  child_allocation.height = allocation->height - child_allocation.y * 2 - border_width * 2;
 
   if (GTK_WIDGET_REALIZED (widget))
     {
       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,
-                             allocation->height - GTK_CONTAINER (viewport)->border_width * 2);
+                             allocation->x + border_width,
+                             allocation->y + border_width,
+                             allocation->width - border_width * 2,
+                             allocation->height - border_width * 2);
 
       gdk_window_move_resize (viewport->view_window,
                              child_allocation.x,