Allow the user to use the popup list like a menu.

Thu Apr 30 11:18:00 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkcombo.[ch]: Allow the user to use the popup list
	like a menu.

	* gtk/gtkmenuitem.c gtk/gtkitem.c: Moved enter/leave handlers
	to gtkitem.c so dragging can also work in lists.

	* gtk/gtklist.[ch]: Track child enter events and use
	those to allow dragging the selection.

Thu Apr 30 11:16:06 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtktext.c: Try enabling background pixmaps for editable text
	widgets.  There is a bit of flashing, but not too bad. If you
	don't want the flashing, you can always not set a background
	pixmap.

Wed Apr 29 15:46:13 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtktext.c: Fixed a bug where the drawn level
	was being messed up when the text was scrolled
	during a deletion.
This commit is contained in:
Owen Taylor 1998-04-30 15:18:19 +00:00 committed by Owen Taylor
parent 32e8dc45b0
commit 8850ce814d
14 changed files with 415 additions and 104 deletions

View File

@ -1,3 +1,27 @@
Thu Apr 30 11:18:00 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.[ch]: Allow the user to use the popup list
like a menu.
* gtk/gtkmenuitem.c gtk/gtkitem.c: Moved enter/leave handlers
to gtkitem.c so dragging can also work in lists.
* gtk/gtklist.[ch]: Track child enter events and use
those to allow dragging the selection.
Thu Apr 30 11:16:06 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Try enabling background pixmaps for editable text
widgets. There is a bit of flashing, but not too bad. If you
don't want the flashing, you can always not set a background
pixmap.
Wed Apr 29 15:46:13 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Fixed a bug where the drawn level
was being messed up when the text was scrolled
during a deletion.
1998-04-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): Random debugging fixed this

View File

@ -1,3 +1,27 @@
Thu Apr 30 11:18:00 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.[ch]: Allow the user to use the popup list
like a menu.
* gtk/gtkmenuitem.c gtk/gtkitem.c: Moved enter/leave handlers
to gtkitem.c so dragging can also work in lists.
* gtk/gtklist.[ch]: Track child enter events and use
those to allow dragging the selection.
Thu Apr 30 11:16:06 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Try enabling background pixmaps for editable text
widgets. There is a bit of flashing, but not too bad. If you
don't want the flashing, you can always not set a background
pixmap.
Wed Apr 29 15:46:13 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Fixed a bug where the drawn level
was being messed up when the text was scrolled
during a deletion.
1998-04-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): Random debugging fixed this

View File

@ -1,3 +1,27 @@
Thu Apr 30 11:18:00 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.[ch]: Allow the user to use the popup list
like a menu.
* gtk/gtkmenuitem.c gtk/gtkitem.c: Moved enter/leave handlers
to gtkitem.c so dragging can also work in lists.
* gtk/gtklist.[ch]: Track child enter events and use
those to allow dragging the selection.
Thu Apr 30 11:16:06 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Try enabling background pixmaps for editable text
widgets. There is a bit of flashing, but not too bad. If you
don't want the flashing, you can always not set a background
pixmap.
Wed Apr 29 15:46:13 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Fixed a bug where the drawn level
was being messed up when the text was scrolled
during a deletion.
1998-04-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): Random debugging fixed this

View File

@ -1,3 +1,27 @@
Thu Apr 30 11:18:00 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.[ch]: Allow the user to use the popup list
like a menu.
* gtk/gtkmenuitem.c gtk/gtkitem.c: Moved enter/leave handlers
to gtkitem.c so dragging can also work in lists.
* gtk/gtklist.[ch]: Track child enter events and use
those to allow dragging the selection.
Thu Apr 30 11:16:06 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Try enabling background pixmaps for editable text
widgets. There is a bit of flashing, but not too bad. If you
don't want the flashing, you can always not set a background
pixmap.
Wed Apr 29 15:46:13 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Fixed a bug where the drawn level
was being messed up when the text was scrolled
during a deletion.
1998-04-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): Random debugging fixed this

View File

@ -1,3 +1,27 @@
Thu Apr 30 11:18:00 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.[ch]: Allow the user to use the popup list
like a menu.
* gtk/gtkmenuitem.c gtk/gtkitem.c: Moved enter/leave handlers
to gtkitem.c so dragging can also work in lists.
* gtk/gtklist.[ch]: Track child enter events and use
those to allow dragging the selection.
Thu Apr 30 11:16:06 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Try enabling background pixmaps for editable text
widgets. There is a bit of flashing, but not too bad. If you
don't want the flashing, you can always not set a background
pixmap.
Wed Apr 29 15:46:13 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Fixed a bug where the drawn level
was being messed up when the text was scrolled
during a deletion.
1998-04-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): Random debugging fixed this

View File

@ -1,3 +1,27 @@
Thu Apr 30 11:18:00 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.[ch]: Allow the user to use the popup list
like a menu.
* gtk/gtkmenuitem.c gtk/gtkitem.c: Moved enter/leave handlers
to gtkitem.c so dragging can also work in lists.
* gtk/gtklist.[ch]: Track child enter events and use
those to allow dragging the selection.
Thu Apr 30 11:16:06 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Try enabling background pixmaps for editable text
widgets. There is a bit of flashing, but not too bad. If you
don't want the flashing, you can always not set a background
pixmap.
Wed Apr 29 15:46:13 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Fixed a bug where the drawn level
was being messed up when the text was scrolled
during a deletion.
1998-04-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): Random debugging fixed this

View File

@ -1,3 +1,27 @@
Thu Apr 30 11:18:00 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkcombo.[ch]: Allow the user to use the popup list
like a menu.
* gtk/gtkmenuitem.c gtk/gtkitem.c: Moved enter/leave handlers
to gtkitem.c so dragging can also work in lists.
* gtk/gtklist.[ch]: Track child enter events and use
those to allow dragging the selection.
Thu Apr 30 11:16:06 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Try enabling background pixmaps for editable text
widgets. There is a bit of flashing, but not too bad. If you
don't want the flashing, you can always not set a background
pixmap.
Wed Apr 29 15:46:13 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtktext.c: Fixed a bug where the drawn level
was being messed up when the text was scrolled
during a deletion.
1998-04-28 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): Random debugging fixed this

View File

@ -52,8 +52,15 @@ static void gtk_combo_get_pos (GtkCombo *combo,
gint *y,
gint *height,
gint *width);
static void gtk_combo_popup_list (GtkButton *button,
GtkCombo *combo);
static void gtk_combo_popup_list (GtkCombo *combo);
static void gtk_combo_activate (GtkWidget *widget,
GtkCombo *combo);
static void gtk_combo_popup_button_press (GtkWidget *button,
GdkEventButton *event,
GtkCombo *combo);
static void gtk_combo_popup_button_leave (GtkWidget *button,
GdkEventCrossing *event,
GtkCombo *combo);
static void gtk_combo_update_entry (GtkList *list,
GtkCombo *combo);
static void gtk_combo_update_list (GtkEntry *entry,
@ -61,6 +68,9 @@ static void gtk_combo_update_list (GtkEntry *entry,
static gint gtk_combo_button_press (GtkWidget *widget,
GdkEvent *event,
GtkCombo *combo);
static gint gtk_combo_button_release (GtkWidget *widget,
GdkEvent *event,
GtkCombo *combo);
static gint gtk_combo_list_key_press (GtkWidget *widget,
GdkEventKey *event,
GtkCombo *combo);
@ -315,7 +325,7 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
}
static void
gtk_combo_popup_list (GtkButton * button, GtkCombo * combo)
gtk_combo_popup_list (GtkCombo * combo)
{
gint height, width, x, y;
gint old_width, old_height;
@ -342,6 +352,14 @@ gtk_combo_popup_list (GtkButton * button, GtkCombo * combo)
gtk_widget_show (combo->popwin);
gtk_widget_grab_focus (combo->popwin);
}
static void
gtk_combo_activate (GtkWidget *widget,
GtkCombo *combo)
{
gtk_combo_popup_list (combo);
gtk_grab_add (combo->popwin);
gdk_pointer_grab (combo->popwin->window, TRUE,
GDK_BUTTON_PRESS_MASK |
@ -350,15 +368,28 @@ gtk_combo_popup_list (GtkButton * button, GtkCombo * combo)
NULL, NULL, GDK_CURRENT_TIME);
}
#if 0
static void
prelight_bug (GtkButton * b, GtkCombo * combo)
static void
gtk_combo_popup_button_press (GtkWidget *button,
GdkEventButton *event,
GtkCombo *combo)
{
/* avoid prelight state... */
gtk_widget_set_state (combo->button, GTK_STATE_NORMAL);
if (!combo->current_button && (event->button == 1))
gtk_combo_popup_list (combo);
gtk_widget_event (combo->list, (GdkEvent *)event);
combo->current_button = event->button;
}
#endif
static void
gtk_combo_popup_button_leave (GtkWidget *button,
GdkEventCrossing *event,
GtkCombo *combo)
{
if (combo->current_button)
gtk_signal_emit_stop_by_name (GTK_OBJECT (button), "leave_notify_event");
}
static void
gtk_combo_update_entry (GtkList * list, GtkCombo * combo)
@ -374,9 +405,6 @@ gtk_combo_update_entry (GtkList * list, GtkCombo * combo)
text = "";
gtk_entry_set_text (GTK_ENTRY (combo->entry), text);
}
gtk_widget_hide (combo->popwin);
gtk_grab_remove (combo->popwin);
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gtk_signal_handler_unblock (GTK_OBJECT (list), combo->list_change_id);
}
@ -424,7 +452,59 @@ gtk_combo_button_press (GtkWidget * widget, GdkEvent * event, GtkCombo * combo)
gtk_widget_hide (combo->popwin);
gtk_grab_remove (combo->popwin);
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gdk_pointer_ungrab (event->button.time);
return TRUE;
}
static gint
gtk_combo_button_release (GtkWidget * widget, GdkEvent * event, GtkCombo * combo)
{
GtkWidget *child;
if ((combo->current_button != 0) && (event->button.button == 1))
{
GdkEventCrossing tmp_event;
combo->current_button = 0;
gtk_widget_event (combo->button, event);
/* Un-pre-hightlight */
tmp_event.type = GDK_LEAVE_NOTIFY;
tmp_event.window = combo->button->window;
tmp_event.send_event = TRUE;
tmp_event.subwindow = NULL;
tmp_event.detail = GDK_NOTIFY_ANCESTOR;
gtk_widget_event (combo->button, (GdkEvent *)&tmp_event);
/* Check to see if we released inside the button */
child = gtk_get_event_widget ((GdkEvent*) event);
while (child && child != (combo->button))
child = child->parent;
if (child == combo->button)
{
gtk_grab_add (combo->popwin);
gdk_pointer_grab (combo->popwin->window, TRUE,
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK,
NULL, NULL, GDK_CURRENT_TIME);
return FALSE;
}
}
else
{
gtk_grab_remove (combo->popwin);
gdk_pointer_ungrab (event->button.time);
}
gtk_widget_hide (combo->popwin);
return TRUE;
}
@ -457,6 +537,7 @@ gtk_combo_init (GtkCombo * combo)
combo->use_arrows_always = 0;
combo->entry = gtk_entry_new ();
combo->button = gtk_button_new ();
combo->current_button = 0;
arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
gtk_widget_show (arrow);
gtk_container_add (GTK_CONTAINER (combo->button), arrow);
@ -471,9 +552,11 @@ gtk_combo_init (GtkCombo * combo)
gtk_signal_connect_after (GTK_OBJECT (combo->entry), "focus_out_event",
(GtkSignalFunc) gtk_combo_entry_focus_out, combo);
combo->activate_id = gtk_signal_connect (GTK_OBJECT (combo->entry), "activate",
(GtkSignalFunc) gtk_combo_popup_list, combo);
gtk_signal_connect (GTK_OBJECT (combo->button), "clicked",
(GtkSignalFunc) gtk_combo_popup_list, combo);
(GtkSignalFunc) gtk_combo_activate, combo);
gtk_signal_connect_after (GTK_OBJECT (combo->button), "button_press_event",
(GtkSignalFunc) gtk_combo_popup_button_press, combo);
gtk_signal_connect (GTK_OBJECT (combo->button), "leave_notify_event",
(GtkSignalFunc) gtk_combo_popup_button_leave, combo);
/*gtk_signal_connect(GTK_OBJECT(combo->button), "clicked",
(GtkSignalFunc)prelight_bug, combo); */
@ -514,7 +597,8 @@ gtk_combo_init (GtkCombo * combo)
(GtkSignalFunc) gtk_combo_list_key_press, combo);
gtk_signal_connect (GTK_OBJECT (combo->popwin), "button_press_event",
GTK_SIGNAL_FUNC (gtk_combo_button_press), combo);
gtk_signal_connect (GTK_OBJECT (combo->popwin), "button_release_event",
GTK_SIGNAL_FUNC (gtk_combo_button_release), combo);
}
guint

View File

@ -53,6 +53,7 @@ struct _GtkCombo {
guint use_arrows:1;
guint use_arrows_always:1;
guint16 current_button;
guint activate_id;
};

View File

@ -28,11 +28,15 @@ enum {
};
static void gtk_item_class_init (GtkItemClass *klass);
static void gtk_item_init (GtkItem *item);
static void gtk_item_map (GtkWidget *widget);
static void gtk_item_unmap (GtkWidget *widget);
static void gtk_item_realize (GtkWidget *widget);
static void gtk_item_class_init (GtkItemClass *klass);
static void gtk_item_init (GtkItem *item);
static void gtk_item_map (GtkWidget *widget);
static void gtk_item_unmap (GtkWidget *widget);
static void gtk_item_realize (GtkWidget *widget);
static gint gtk_item_enter (GtkWidget *widget,
GdkEventCrossing *event);
static gint gtk_item_leave (GtkWidget *widget,
GdkEventCrossing *event);
static guint item_signals[LAST_SIGNAL] = { 0 };
@ -99,6 +103,8 @@ gtk_item_class_init (GtkItemClass *class)
widget_class->map = gtk_item_map;
widget_class->unmap = gtk_item_unmap;
widget_class->realize = gtk_item_realize;
widget_class->enter_notify_event = gtk_item_enter;
widget_class->leave_notify_event = gtk_item_leave;
class->select = NULL;
class->deselect = NULL;
@ -192,3 +198,26 @@ gtk_item_realize (GtkWidget *widget)
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
}
static gint
gtk_item_enter (GtkWidget *widget,
GdkEventCrossing *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_ITEM (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
return gtk_widget_event (widget->parent, (GdkEvent*) event);
}
static gint
gtk_item_leave (GtkWidget *widget,
GdkEventCrossing *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_ITEM (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
return gtk_widget_event (widget->parent, (GdkEvent*) event);
}

View File

@ -45,8 +45,8 @@ static void gtk_list_draw (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_list_expose (GtkWidget *widget,
GdkEventExpose *event);
static gint gtk_list_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
static gint gtk_list_enter_notify (GtkWidget *widget,
GdkEventCrossing *event);
static gint gtk_list_button_press (GtkWidget *widget,
GdkEventButton *event);
static gint gtk_list_button_release (GtkWidget *widget,
@ -148,9 +148,9 @@ gtk_list_class_init (GtkListClass *class)
widget_class->realize = gtk_list_realize;
widget_class->draw = gtk_list_draw;
widget_class->expose_event = gtk_list_expose;
widget_class->motion_notify_event = gtk_list_motion_notify;
widget_class->button_press_event = gtk_list_button_press;
widget_class->button_release_event = gtk_list_button_release;
widget_class->enter_notify_event = gtk_list_enter_notify;
widget_class->size_request = gtk_list_size_request;
widget_class->size_allocate = gtk_list_size_allocate;
@ -173,7 +173,7 @@ gtk_list_init (GtkList *list)
list->selection_end_pos = 0;
list->selection_mode = GTK_SELECTION_SINGLE;
list->scroll_direction = 0;
list->have_grab = FALSE;
list->button = 0;
}
GtkWidget*
@ -673,14 +673,27 @@ gtk_list_expose (GtkWidget *widget,
}
static gint
gtk_list_motion_notify (GtkWidget *widget,
GdkEventMotion *event)
gtk_list_enter_notify (GtkWidget *widget,
GdkEventCrossing *event)
{
GtkList *list;
GtkWidget *item;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_LIST (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
/* g_print ("gtk_list_motion_notify\n"); */
list = GTK_LIST (widget);
item = gtk_get_event_widget ((GdkEvent*) event);
if (!list->button)
return FALSE;
while (item && !GTK_IS_LIST_ITEM (item))
item = item->parent;
if (item && (item->parent == widget))
gtk_list_select_child (list, item);
return FALSE;
}
@ -698,14 +711,22 @@ gtk_list_button_press (GtkWidget *widget,
list = GTK_LIST (widget);
item = gtk_get_event_widget ((GdkEvent*) event);
if (list->button && (list->button != event->button))
return FALSE;
list->button = event->button;
while (item && !GTK_IS_LIST_ITEM (item))
item = item->parent;
if (!item || (item->parent != widget))
return FALSE;
gtk_list_select_child (list, item);
if (item && (item->parent == widget))
gtk_list_select_child (list, item);
gdk_pointer_grab (widget->window, TRUE,
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time);
gtk_grab_add (widget);
return FALSE;
}
@ -724,6 +745,13 @@ gtk_list_button_release (GtkWidget *widget,
list = GTK_LIST (widget);
item = gtk_get_event_widget ((GdkEvent*) event);
if (list->button != event->button)
return FALSE;
list->button = 0;
gtk_grab_remove (widget);
gdk_pointer_ungrab (event->time);
return FALSE;
}

View File

@ -51,6 +51,7 @@ struct _GtkList
guint selection_mode : 2;
guint scroll_direction : 1;
guint have_grab : 1;
guint16 button;
};
struct _GtkListClass

View File

@ -55,10 +55,6 @@ static void gtk_menu_item_draw (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_menu_item_expose (GtkWidget *widget,
GdkEventExpose *event);
static gint gtk_menu_item_enter (GtkWidget *widget,
GdkEventCrossing *event);
static gint gtk_menu_item_leave (GtkWidget *widget,
GdkEventCrossing *event);
static void gtk_real_menu_item_select (GtkItem *item);
static void gtk_real_menu_item_deselect (GtkItem *item);
static gint gtk_menu_item_select_timeout (gpointer data);
@ -129,8 +125,6 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
widget_class->remove_accelerator = gtk_menu_item_remove_accel;
widget_class->draw = gtk_menu_item_draw;
widget_class->expose_event = gtk_menu_item_expose;
widget_class->enter_notify_event = gtk_menu_item_enter;
widget_class->leave_notify_event = gtk_menu_item_leave;
widget_class->show_all = gtk_menu_item_show_all;
widget_class->hide_all = gtk_menu_item_hide_all;
@ -595,28 +589,6 @@ gtk_menu_item_expose (GtkWidget *widget,
return FALSE;
}
static gint
gtk_menu_item_enter (GtkWidget *widget,
GdkEventCrossing *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_MENU_ITEM (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
return gtk_widget_event (widget->parent, (GdkEvent*) event);
}
static gint
gtk_menu_item_leave (GtkWidget *widget,
GdkEventCrossing *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_MENU_ITEM (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
return gtk_widget_event (widget->parent, (GdkEvent*) event);
}
static void
gtk_real_menu_item_select (GtkItem *item)
{

View File

@ -551,13 +551,6 @@ gtk_text_set_editable (GtkText *text,
draw_cursor (text, TRUE);
else
undraw_cursor (text, TRUE);
if (GTK_WIDGET_DRAWABLE (widget) &&
widget->style->bg_pixmap[GTK_STATE_NORMAL])
{
gdk_window_clear (widget->window); /* just the border */
gtk_widget_queue_draw (widget);
}
}
void
@ -1182,8 +1175,7 @@ gtk_text_draw_focus (GtkWidget *widget)
width -= 2 * xthick;
height -= 2 * ythick;
if (widget->style->bg_pixmap[GTK_STATE_NORMAL] &&
!GTK_EDITABLE (text)->editable)
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
{
/* top rect */
clear_focus_area (text, x, y, width, yextra);
@ -2244,6 +2236,8 @@ correct_cache_delete (GtkText* text, gint nchars, gint lines)
static void
delete_expose (GtkText* text, guint nchars, guint old_lines, guint old_pixels)
{
GtkWidget *widget = GTK_WIDGET (text);
gint pixel_height;
guint new_pixels = 0;
GdkRectangle rect;
@ -2278,16 +2272,18 @@ delete_expose (GtkText* text, guint nchars, guint old_lines, guint old_pixels)
if (old_pixels != new_pixels)
{
gdk_draw_pixmap (text->text_area,
text->gc,
text->text_area,
0,
pixel_height + old_pixels,
0,
pixel_height + new_pixels,
width,
height);
if (!widget->style->bg_pixmap[GTK_STATE_NORMAL])
{
gdk_draw_pixmap (text->text_area,
text->gc,
text->text_area,
0,
pixel_height + old_pixels,
0,
pixel_height + new_pixels,
width,
height);
}
text->vadj->upper += new_pixels;
text->vadj->upper -= old_pixels;
adjust_adj (text, text->vadj);
@ -2308,7 +2304,19 @@ delete_expose (GtkText* text, guint nchars, guint old_lines, guint old_pixels)
draw_cursor (text, FALSE);
if (old_pixels != new_pixels)
process_exposes (text);
{
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
{
rect.x = 0;
rect.y = pixel_height + new_pixels;
rect.width = width;
rect.height = height - rect.y;
expose_text (text, &rect, FALSE);
}
else
process_exposes (text);
}
TEXT_ASSERT (text);
TEXT_SHOW(text);
@ -2357,6 +2365,8 @@ static void
insert_expose (GtkText* text, guint old_pixels, gint nchars,
guint new_line_count)
{
GtkWidget *widget = GTK_WIDGET (text);
gint pixel_height;
guint new_pixels = 0;
GdkRectangle rect;
@ -2390,16 +2400,19 @@ insert_expose (GtkText* text, guint old_pixels, gint nchars,
if (old_pixels != new_pixels)
{
gdk_draw_pixmap (text->text_area,
text->gc,
text->text_area,
0,
pixel_height + old_pixels,
0,
pixel_height + new_pixels,
width,
height + (old_pixels - new_pixels) - pixel_height);
if (!widget->style->bg_pixmap[GTK_STATE_NORMAL])
{
gdk_draw_pixmap (text->text_area,
text->gc,
text->text_area,
0,
pixel_height + old_pixels,
0,
pixel_height + new_pixels,
width,
height + (old_pixels - new_pixels) - pixel_height);
}
text->vadj->upper += new_pixels;
text->vadj->upper -= old_pixels;
adjust_adj (text, text->vadj);
@ -2409,19 +2422,31 @@ insert_expose (GtkText* text, guint old_pixels, gint nchars,
rect.y = pixel_height;
rect.width = width;
rect.height = new_pixels;
expose_text (text, &rect, FALSE);
gtk_text_draw_focus ( (GtkWidget *) text);
text->cursor_mark = text->point;
find_cursor (text, TRUE);
draw_cursor (text, FALSE);
if (old_pixels != new_pixels)
process_exposes (text);
{
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
{
rect.x = 0;
rect.y = pixel_height + new_pixels;
rect.width = width;
rect.height = height - rect.y;
expose_text (text, &rect, FALSE);
}
else
process_exposes (text);
}
TEXT_SHOW_ADJ (text, text->vadj, "vadj");
TEXT_ASSERT (text);
TEXT_SHOW(text);
@ -4122,8 +4147,7 @@ draw_line (GtkText* text,
pixel_start_height,
running_offset,
LINE_HEIGHT (*lp));
else if (!editable->editable &&
GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL])
else if (GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL])
{
GdkRectangle rect;
@ -4174,8 +4198,7 @@ draw_line (GtkText* text,
pixel_start_height,
pixel_width,
LINE_HEIGHT(*lp));
else if (!editable->editable &&
GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL])
else if (GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL])
{
GdkRectangle rect;
@ -4319,8 +4342,7 @@ undraw_cursor (GtkText* text, gint absolute)
font = MARK_CURRENT_FONT(&text->cursor_mark);
if (GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL] &&
!editable->editable)
if (GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL])
{
GdkRectangle rect;
@ -4426,8 +4448,7 @@ clear_area (GtkText *text, GdkRectangle *area)
{
GtkWidget *widget = GTK_WIDGET (text);
if (widget->style->bg_pixmap[GTK_STATE_NORMAL] &&
!GTK_EDITABLE(text)->editable)
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
{
gint width, height;
gint x = area->x, y = area->y;
@ -4497,7 +4518,14 @@ expose_text (GtkText* text, GdkRectangle *area, gboolean cursor)
{
if (CACHE_DATA(cache).start.index <= text->cursor_mark.index &&
CACHE_DATA(cache).end.index >= text->cursor_mark.index)
draw_cursor (text, TRUE);
{
/* We undraw and draw the cursor here to get the drawn
* level right ... FIXME - maybe the second parameter
* of draw_cursor should work differently
*/
undraw_cursor (text, FALSE);
draw_cursor (text, FALSE);
}
}
pixels += LINE_HEIGHT(CACHE_DATA(cache));