+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
+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
+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
+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
+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
+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
+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
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);
}
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);
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;
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;
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
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);
{
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);
}