]> Pileus Git - ~andy/gtk/commitdiff
When redrawing the under-cursor character, don't redraw the terminating
authorOwen Taylor <otaylor@redhat.com>
Tue, 5 Jan 1999 23:46:49 +0000 (23:46 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Tue, 5 Jan 1999 23:46:49 +0000 (23:46 +0000)
Tue Jan  5 11:51:32 1999  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
When redrawing the under-cursor character, don't
redraw the terminating NULL.
[ From: dov@imagic.weizmann.ac.il (Dov Grobgeld) ]

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/gtkentry.c
gtk/gtkpreview.c

index 8c6aea934836d08c0507360b87ff25a3e9f04728..051eedb289996af3cbcdaa4a4ed4e440ce3c9ba6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,45 @@
+Tue Jan  5 15:03:47 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_propagate_event): Make 
+       gtk_propagate_event() non-static, we need it in gtkdnd.c 
+       so that the button-release we synthesize gets propagated
+       correctly.
+
+       * gtk/gtkdnd.c: Use gtk_propagate_event() so
+       release gets to a GtkList. But we can't really
+       get this right without access to the windows
+       event masks and doing X-style propagation ourselves.
+
+Tue Jan  5 12:40:57 1999  Owen Taylor  <otaylor@redhat.com>
+
+        * gtk/gtkpreview.c: Add a size_allocate() routine 
+       and set the size of the preview window equal
+       to the area we are going to draw on, instead 
+       of the entire allocation. Do this to avoid having 
+       to set a parent-relative background.
+       
+Tue Jan  5 11:51:32 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
+       When redrawing the under-cursor character, don't
+       redraw the terminating NULL.
+       [ From: dov@imagic.weizmann.ac.il (Dov Grobgeld) ]
+
+Tue Jan  5 11:31:55 1999  Owen Taylor  <otaylor@redhat.com>
+        
+       * gtk/gtkselection.c (gtk_target_list_unref): Free
+       memory allocated for target lists.
+
+       * gtk/gtkdnd.c (gtk_drag_drop_finished): Release
+       selections before destroying info structure.
+
+       * gdk/gdkdnd.c gdktypes.h (gdk_drag_get_protocol): Add
+       new value GDK_DRAG_PROTO_NONE, use it for non-drag
+       targets, to quiet Purify.
+
+       * gdk/gdkdnd.c (gdk_window_register_dnd): Set size
+       of property properly.
+
 Mon Jan  4 03:45:42 CST 1999 Shawn T. Amundson <amundson@gtk.org>
 
        * Released GTK+ 1.1.12
index 8c6aea934836d08c0507360b87ff25a3e9f04728..051eedb289996af3cbcdaa4a4ed4e440ce3c9ba6 100644 (file)
@@ -1,3 +1,45 @@
+Tue Jan  5 15:03:47 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_propagate_event): Make 
+       gtk_propagate_event() non-static, we need it in gtkdnd.c 
+       so that the button-release we synthesize gets propagated
+       correctly.
+
+       * gtk/gtkdnd.c: Use gtk_propagate_event() so
+       release gets to a GtkList. But we can't really
+       get this right without access to the windows
+       event masks and doing X-style propagation ourselves.
+
+Tue Jan  5 12:40:57 1999  Owen Taylor  <otaylor@redhat.com>
+
+        * gtk/gtkpreview.c: Add a size_allocate() routine 
+       and set the size of the preview window equal
+       to the area we are going to draw on, instead 
+       of the entire allocation. Do this to avoid having 
+       to set a parent-relative background.
+       
+Tue Jan  5 11:51:32 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
+       When redrawing the under-cursor character, don't
+       redraw the terminating NULL.
+       [ From: dov@imagic.weizmann.ac.il (Dov Grobgeld) ]
+
+Tue Jan  5 11:31:55 1999  Owen Taylor  <otaylor@redhat.com>
+        
+       * gtk/gtkselection.c (gtk_target_list_unref): Free
+       memory allocated for target lists.
+
+       * gtk/gtkdnd.c (gtk_drag_drop_finished): Release
+       selections before destroying info structure.
+
+       * gdk/gdkdnd.c gdktypes.h (gdk_drag_get_protocol): Add
+       new value GDK_DRAG_PROTO_NONE, use it for non-drag
+       targets, to quiet Purify.
+
+       * gdk/gdkdnd.c (gdk_window_register_dnd): Set size
+       of property properly.
+
 Mon Jan  4 03:45:42 CST 1999 Shawn T. Amundson <amundson@gtk.org>
 
        * Released GTK+ 1.1.12
index 8c6aea934836d08c0507360b87ff25a3e9f04728..051eedb289996af3cbcdaa4a4ed4e440ce3c9ba6 100644 (file)
@@ -1,3 +1,45 @@
+Tue Jan  5 15:03:47 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_propagate_event): Make 
+       gtk_propagate_event() non-static, we need it in gtkdnd.c 
+       so that the button-release we synthesize gets propagated
+       correctly.
+
+       * gtk/gtkdnd.c: Use gtk_propagate_event() so
+       release gets to a GtkList. But we can't really
+       get this right without access to the windows
+       event masks and doing X-style propagation ourselves.
+
+Tue Jan  5 12:40:57 1999  Owen Taylor  <otaylor@redhat.com>
+
+        * gtk/gtkpreview.c: Add a size_allocate() routine 
+       and set the size of the preview window equal
+       to the area we are going to draw on, instead 
+       of the entire allocation. Do this to avoid having 
+       to set a parent-relative background.
+       
+Tue Jan  5 11:51:32 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
+       When redrawing the under-cursor character, don't
+       redraw the terminating NULL.
+       [ From: dov@imagic.weizmann.ac.il (Dov Grobgeld) ]
+
+Tue Jan  5 11:31:55 1999  Owen Taylor  <otaylor@redhat.com>
+        
+       * gtk/gtkselection.c (gtk_target_list_unref): Free
+       memory allocated for target lists.
+
+       * gtk/gtkdnd.c (gtk_drag_drop_finished): Release
+       selections before destroying info structure.
+
+       * gdk/gdkdnd.c gdktypes.h (gdk_drag_get_protocol): Add
+       new value GDK_DRAG_PROTO_NONE, use it for non-drag
+       targets, to quiet Purify.
+
+       * gdk/gdkdnd.c (gdk_window_register_dnd): Set size
+       of property properly.
+
 Mon Jan  4 03:45:42 CST 1999 Shawn T. Amundson <amundson@gtk.org>
 
        * Released GTK+ 1.1.12
index 8c6aea934836d08c0507360b87ff25a3e9f04728..051eedb289996af3cbcdaa4a4ed4e440ce3c9ba6 100644 (file)
@@ -1,3 +1,45 @@
+Tue Jan  5 15:03:47 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_propagate_event): Make 
+       gtk_propagate_event() non-static, we need it in gtkdnd.c 
+       so that the button-release we synthesize gets propagated
+       correctly.
+
+       * gtk/gtkdnd.c: Use gtk_propagate_event() so
+       release gets to a GtkList. But we can't really
+       get this right without access to the windows
+       event masks and doing X-style propagation ourselves.
+
+Tue Jan  5 12:40:57 1999  Owen Taylor  <otaylor@redhat.com>
+
+        * gtk/gtkpreview.c: Add a size_allocate() routine 
+       and set the size of the preview window equal
+       to the area we are going to draw on, instead 
+       of the entire allocation. Do this to avoid having 
+       to set a parent-relative background.
+       
+Tue Jan  5 11:51:32 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
+       When redrawing the under-cursor character, don't
+       redraw the terminating NULL.
+       [ From: dov@imagic.weizmann.ac.il (Dov Grobgeld) ]
+
+Tue Jan  5 11:31:55 1999  Owen Taylor  <otaylor@redhat.com>
+        
+       * gtk/gtkselection.c (gtk_target_list_unref): Free
+       memory allocated for target lists.
+
+       * gtk/gtkdnd.c (gtk_drag_drop_finished): Release
+       selections before destroying info structure.
+
+       * gdk/gdkdnd.c gdktypes.h (gdk_drag_get_protocol): Add
+       new value GDK_DRAG_PROTO_NONE, use it for non-drag
+       targets, to quiet Purify.
+
+       * gdk/gdkdnd.c (gdk_window_register_dnd): Set size
+       of property properly.
+
 Mon Jan  4 03:45:42 CST 1999 Shawn T. Amundson <amundson@gtk.org>
 
        * Released GTK+ 1.1.12
index 8c6aea934836d08c0507360b87ff25a3e9f04728..051eedb289996af3cbcdaa4a4ed4e440ce3c9ba6 100644 (file)
@@ -1,3 +1,45 @@
+Tue Jan  5 15:03:47 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_propagate_event): Make 
+       gtk_propagate_event() non-static, we need it in gtkdnd.c 
+       so that the button-release we synthesize gets propagated
+       correctly.
+
+       * gtk/gtkdnd.c: Use gtk_propagate_event() so
+       release gets to a GtkList. But we can't really
+       get this right without access to the windows
+       event masks and doing X-style propagation ourselves.
+
+Tue Jan  5 12:40:57 1999  Owen Taylor  <otaylor@redhat.com>
+
+        * gtk/gtkpreview.c: Add a size_allocate() routine 
+       and set the size of the preview window equal
+       to the area we are going to draw on, instead 
+       of the entire allocation. Do this to avoid having 
+       to set a parent-relative background.
+       
+Tue Jan  5 11:51:32 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
+       When redrawing the under-cursor character, don't
+       redraw the terminating NULL.
+       [ From: dov@imagic.weizmann.ac.il (Dov Grobgeld) ]
+
+Tue Jan  5 11:31:55 1999  Owen Taylor  <otaylor@redhat.com>
+        
+       * gtk/gtkselection.c (gtk_target_list_unref): Free
+       memory allocated for target lists.
+
+       * gtk/gtkdnd.c (gtk_drag_drop_finished): Release
+       selections before destroying info structure.
+
+       * gdk/gdkdnd.c gdktypes.h (gdk_drag_get_protocol): Add
+       new value GDK_DRAG_PROTO_NONE, use it for non-drag
+       targets, to quiet Purify.
+
+       * gdk/gdkdnd.c (gdk_window_register_dnd): Set size
+       of property properly.
+
 Mon Jan  4 03:45:42 CST 1999 Shawn T. Amundson <amundson@gtk.org>
 
        * Released GTK+ 1.1.12
index 8c6aea934836d08c0507360b87ff25a3e9f04728..051eedb289996af3cbcdaa4a4ed4e440ce3c9ba6 100644 (file)
@@ -1,3 +1,45 @@
+Tue Jan  5 15:03:47 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_propagate_event): Make 
+       gtk_propagate_event() non-static, we need it in gtkdnd.c 
+       so that the button-release we synthesize gets propagated
+       correctly.
+
+       * gtk/gtkdnd.c: Use gtk_propagate_event() so
+       release gets to a GtkList. But we can't really
+       get this right without access to the windows
+       event masks and doing X-style propagation ourselves.
+
+Tue Jan  5 12:40:57 1999  Owen Taylor  <otaylor@redhat.com>
+
+        * gtk/gtkpreview.c: Add a size_allocate() routine 
+       and set the size of the preview window equal
+       to the area we are going to draw on, instead 
+       of the entire allocation. Do this to avoid having 
+       to set a parent-relative background.
+       
+Tue Jan  5 11:51:32 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
+       When redrawing the under-cursor character, don't
+       redraw the terminating NULL.
+       [ From: dov@imagic.weizmann.ac.il (Dov Grobgeld) ]
+
+Tue Jan  5 11:31:55 1999  Owen Taylor  <otaylor@redhat.com>
+        
+       * gtk/gtkselection.c (gtk_target_list_unref): Free
+       memory allocated for target lists.
+
+       * gtk/gtkdnd.c (gtk_drag_drop_finished): Release
+       selections before destroying info structure.
+
+       * gdk/gdkdnd.c gdktypes.h (gdk_drag_get_protocol): Add
+       new value GDK_DRAG_PROTO_NONE, use it for non-drag
+       targets, to quiet Purify.
+
+       * gdk/gdkdnd.c (gdk_window_register_dnd): Set size
+       of property properly.
+
 Mon Jan  4 03:45:42 CST 1999 Shawn T. Amundson <amundson@gtk.org>
 
        * Released GTK+ 1.1.12
index 8c6aea934836d08c0507360b87ff25a3e9f04728..051eedb289996af3cbcdaa4a4ed4e440ce3c9ba6 100644 (file)
@@ -1,3 +1,45 @@
+Tue Jan  5 15:03:47 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkmain.c (gtk_propagate_event): Make 
+       gtk_propagate_event() non-static, we need it in gtkdnd.c 
+       so that the button-release we synthesize gets propagated
+       correctly.
+
+       * gtk/gtkdnd.c: Use gtk_propagate_event() so
+       release gets to a GtkList. But we can't really
+       get this right without access to the windows
+       event masks and doing X-style propagation ourselves.
+
+Tue Jan  5 12:40:57 1999  Owen Taylor  <otaylor@redhat.com>
+
+        * gtk/gtkpreview.c: Add a size_allocate() routine 
+       and set the size of the preview window equal
+       to the area we are going to draw on, instead 
+       of the entire allocation. Do this to avoid having 
+       to set a parent-relative background.
+       
+Tue Jan  5 11:51:32 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable):
+       When redrawing the under-cursor character, don't
+       redraw the terminating NULL.
+       [ From: dov@imagic.weizmann.ac.il (Dov Grobgeld) ]
+
+Tue Jan  5 11:31:55 1999  Owen Taylor  <otaylor@redhat.com>
+        
+       * gtk/gtkselection.c (gtk_target_list_unref): Free
+       memory allocated for target lists.
+
+       * gtk/gtkdnd.c (gtk_drag_drop_finished): Release
+       selections before destroying info structure.
+
+       * gdk/gdkdnd.c gdktypes.h (gdk_drag_get_protocol): Add
+       new value GDK_DRAG_PROTO_NONE, use it for non-drag
+       targets, to quiet Purify.
+
+       * gdk/gdkdnd.c (gdk_window_register_dnd): Set size
+       of property properly.
+
 Mon Jan  4 03:45:42 CST 1999 Shawn T. Amundson <amundson@gtk.org>
 
        * Released GTK+ 1.1.12
index 7271156b0a4ad6645253c9622bb51648bea90e67..cdb06877f054fd81eb5f933a2dddc6e08a464387 100644 (file)
@@ -1454,12 +1454,14 @@ gtk_entry_draw_cursor_on_drawable (GtkEntry *entry, GdkDrawable *drawable)
                              NULL, widget, "entry_bg", 
                              xoffset, INNER_BORDER, 
                              1, text_area_height - INNER_BORDER);
-         /* Draw the character under the cursor again */
-
-         gdk_draw_text_wc (drawable, widget->style->font,
-                           widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
-                           xoffset, yoffset,
-                           entry->text + editable->current_pos, 1);
+         
+         /* Draw the character under the cursor again
+          */
+         if (editable->current_pos < entry->text_length)
+           gdk_draw_text_wc (drawable, widget->style->font,
+                             widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+                             xoffset, yoffset,
+                             entry->text + editable->current_pos, 1);
     }
 
 
index 05df6d98367687494e318f950b8e96c3342d57fb..ef546c7784387d3482eec2729ada85398b3ddf02 100644 (file)
@@ -34,6 +34,8 @@ static void   gtk_preview_class_init    (GtkPreviewClass  *klass);
 static void   gtk_preview_init          (GtkPreview       *preview);
 static void   gtk_preview_finalize      (GtkObject        *object);
 static void   gtk_preview_realize       (GtkWidget        *widget);
+static void   gtk_preview_size_allocate (GtkWidget        *widget,
+                                        GtkAllocation    *allocation);
 static gint   gtk_preview_expose        (GtkWidget        *widget,
                                         GdkEventExpose   *event);
 static void   gtk_preview_make_buffer   (GtkPreview       *preview);
@@ -84,6 +86,7 @@ gtk_preview_class_init (GtkPreviewClass *klass)
   object_class->finalize = gtk_preview_finalize;
 
   widget_class->realize = gtk_preview_realize;
+  widget_class->size_allocate = gtk_preview_size_allocate;
   widget_class->expose_event = gtk_preview_expose;
 
   klass->info.visual = NULL;
@@ -406,10 +409,21 @@ gtk_preview_realize (GtkWidget *widget)
   preview = GTK_PREVIEW (widget);
 
   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;
+
+  if (preview->expand)
+    {
+      attributes.width = widget->allocation.width;
+      attributes.height = widget->allocation.height;
+    }
+  else
+    {
+      attributes.width = MIN (widget->requisition.width, widget->allocation.width);
+      attributes.height = MIN (widget->requisition.height, widget->allocation.height);
+    }
+
+  attributes.x = widget->allocation.x + (widget->allocation.width - attributes.width) / 2;
+  attributes.y = widget->allocation.y + (widget->allocation.height - attributes.height) / 2;;
+
   attributes.wclass = GDK_INPUT_OUTPUT;
   attributes.visual = preview_class->info.visual;
   attributes.colormap = preview_class->info.cmap;
@@ -421,7 +435,39 @@ gtk_preview_realize (GtkWidget *widget)
 
   widget->style = gtk_style_attach (widget->style, widget->window);
   gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-  gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
+}
+
+static void   
+gtk_preview_size_allocate (GtkWidget        *widget,
+                          GtkAllocation    *allocation)
+{
+  GtkPreview *preview;
+  gint width, height;
+
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail (GTK_IS_PREVIEW (widget));
+
+  preview = GTK_PREVIEW (widget);
+  widget->allocation = *allocation;
+
+  if (GTK_WIDGET_REALIZED (widget))
+    {
+      if (preview->expand)
+       {
+         width = widget->allocation.width;
+         height = widget->allocation.height;
+       }
+      else
+       {
+         width = MIN (widget->allocation.width, widget->requisition.width);
+         height = MIN (widget->allocation.height, widget->requisition.height);
+       }
+
+      gdk_window_move_resize (widget->window,
+                             widget->allocation.x + (widget->allocation.width - width) / 2,
+                             widget->allocation.y + (widget->allocation.height - height) / 2,
+                             width, height);
+    }
 }
 
 static gint
@@ -429,6 +475,7 @@ gtk_preview_expose (GtkWidget      *widget,
                    GdkEventExpose *event)
 {
   GtkPreview *preview;
+  gint width, height;
 
   g_return_val_if_fail (widget != NULL, FALSE);
   g_return_val_if_fail (GTK_IS_PREVIEW (widget), FALSE);
@@ -438,12 +485,12 @@ gtk_preview_expose (GtkWidget      *widget,
     {
       preview = GTK_PREVIEW (widget);
       
+      gdk_window_get_size (widget->window, &width, &height);
+
       gtk_preview_put (GTK_PREVIEW (widget),
                       widget->window, widget->style->black_gc,
-                      event->area.x -
-                      (widget->allocation.width - preview->buffer_width)/2,
-                      event->area.y -
-                      (widget->allocation.height - preview->buffer_height)/2,
+                      event->area.x - (width - preview->buffer_width)/2,
+                      event->area.y - (height - preview->buffer_height)/2,
                       event->area.x, event->area.y,
                       event->area.width, event->area.height);
     }