Commit b613a74c authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Fix idles and timeouts to be properly surrounded by

Wed Jul 18 18:23:05 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkbutton.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtktextview.c
	gtktreeview.c: Fix idles and timeouts to be properly surrounded by
	GDK_THREADS_ENTER()/LEAVE() pairs.

	* gtk/gtkdialog.c gtk/gtkclipboard.c: Surround calls
	to g_main_loop_run() with GDK_THREADS_LEAVE()/ENTER()
	pairs. (Problem found by M. Meeks)
parent f500db33
Wed Jul 18 18:23:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbutton.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtktextview.c
gtktreeview.c: Fix idles and timeouts to be properly surrounded by
GDK_THREADS_ENTER()/LEAVE() pairs.
* gtk/gtkdialog.c gtk/gtkclipboard.c: Surround calls
to g_main_loop_run() with GDK_THREADS_LEAVE()/ENTER()
pairs. (Problem found by M. Meeks)
2001-07-18 Darin Adler <darin@bentspoon.com> 2001-07-18 Darin Adler <darin@bentspoon.com>
* gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so * gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so
......
Wed Jul 18 18:23:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbutton.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtktextview.c
gtktreeview.c: Fix idles and timeouts to be properly surrounded by
GDK_THREADS_ENTER()/LEAVE() pairs.
* gtk/gtkdialog.c gtk/gtkclipboard.c: Surround calls
to g_main_loop_run() with GDK_THREADS_LEAVE()/ENTER()
pairs. (Problem found by M. Meeks)
2001-07-18 Darin Adler <darin@bentspoon.com> 2001-07-18 Darin Adler <darin@bentspoon.com>
* gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so * gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so
......
Wed Jul 18 18:23:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbutton.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtktextview.c
gtktreeview.c: Fix idles and timeouts to be properly surrounded by
GDK_THREADS_ENTER()/LEAVE() pairs.
* gtk/gtkdialog.c gtk/gtkclipboard.c: Surround calls
to g_main_loop_run() with GDK_THREADS_LEAVE()/ENTER()
pairs. (Problem found by M. Meeks)
2001-07-18 Darin Adler <darin@bentspoon.com> 2001-07-18 Darin Adler <darin@bentspoon.com>
* gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so * gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so
......
Wed Jul 18 18:23:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbutton.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtktextview.c
gtktreeview.c: Fix idles and timeouts to be properly surrounded by
GDK_THREADS_ENTER()/LEAVE() pairs.
* gtk/gtkdialog.c gtk/gtkclipboard.c: Surround calls
to g_main_loop_run() with GDK_THREADS_LEAVE()/ENTER()
pairs. (Problem found by M. Meeks)
2001-07-18 Darin Adler <darin@bentspoon.com> 2001-07-18 Darin Adler <darin@bentspoon.com>
* gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so * gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so
......
Wed Jul 18 18:23:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbutton.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtktextview.c
gtktreeview.c: Fix idles and timeouts to be properly surrounded by
GDK_THREADS_ENTER()/LEAVE() pairs.
* gtk/gtkdialog.c gtk/gtkclipboard.c: Surround calls
to g_main_loop_run() with GDK_THREADS_LEAVE()/ENTER()
pairs. (Problem found by M. Meeks)
2001-07-18 Darin Adler <darin@bentspoon.com> 2001-07-18 Darin Adler <darin@bentspoon.com>
* gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so * gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so
......
Wed Jul 18 18:23:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbutton.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtktextview.c
gtktreeview.c: Fix idles and timeouts to be properly surrounded by
GDK_THREADS_ENTER()/LEAVE() pairs.
* gtk/gtkdialog.c gtk/gtkclipboard.c: Surround calls
to g_main_loop_run() with GDK_THREADS_LEAVE()/ENTER()
pairs. (Problem found by M. Meeks)
2001-07-18 Darin Adler <darin@bentspoon.com> 2001-07-18 Darin Adler <darin@bentspoon.com>
* gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so * gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so
......
Wed Jul 18 18:23:05 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkbutton.c gtk/gtkentry.c gtk/gtkmenu.c gtk/gtktextview.c
gtktreeview.c: Fix idles and timeouts to be properly surrounded by
GDK_THREADS_ENTER()/LEAVE() pairs.
* gtk/gtkdialog.c gtk/gtkclipboard.c: Surround calls
to g_main_loop_run() with GDK_THREADS_LEAVE()/ENTER()
pairs. (Problem found by M. Meeks)
2001-07-18 Darin Adler <darin@bentspoon.com> 2001-07-18 Darin Adler <darin@bentspoon.com>
* gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so * gtk/gtkiconfactory.c: (gtk_icon_size_register): Reorder code so
......
...@@ -1033,8 +1033,12 @@ gtk_real_button_leave (GtkButton *button) ...@@ -1033,8 +1033,12 @@ gtk_real_button_leave (GtkButton *button)
static gboolean static gboolean
button_activate_timeout (gpointer data) button_activate_timeout (gpointer data)
{ {
GDK_THREADS_ENTER ();
gtk_button_finish_activate (data, TRUE); gtk_button_finish_activate (data, TRUE);
GDK_THREADS_LEAVE ();
return FALSE; return FALSE;
} }
......
...@@ -754,7 +754,11 @@ gtk_clipboard_wait_for_contents (GtkClipboard *clipboard, ...@@ -754,7 +754,11 @@ gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
&results); &results);
if (g_main_is_running (results.loop)) if (g_main_is_running (results.loop))
{
GDK_THREADS_LEAVE ();
g_main_run (results.loop); g_main_run (results.loop);
GDK_THREADS_ENTER ();
}
g_main_destroy (results.loop); g_main_destroy (results.loop);
...@@ -805,7 +809,11 @@ gtk_clipboard_wait_for_text (GtkClipboard *clipboard) ...@@ -805,7 +809,11 @@ gtk_clipboard_wait_for_text (GtkClipboard *clipboard)
&results); &results);
if (g_main_is_running (results.loop)) if (g_main_is_running (results.loop))
{
GDK_THREADS_LEAVE ();
g_main_run (results.loop); g_main_run (results.loop);
GDK_THREADS_ENTER ();
}
g_main_destroy (results.loop); g_main_destroy (results.loop);
......
...@@ -878,7 +878,9 @@ gtk_dialog_run (GtkDialog *dialog) ...@@ -878,7 +878,9 @@ gtk_dialog_run (GtkDialog *dialog)
ri.loop = g_main_new (FALSE); ri.loop = g_main_new (FALSE);
GDK_THREADS_LEAVE ();
g_main_loop_run (ri.loop); g_main_loop_run (ri.loop);
GDK_THREADS_ENTER ();
g_main_loop_unref (ri.loop); g_main_loop_unref (ri.loop);
......
...@@ -2163,7 +2163,11 @@ update_im_cursor_location (GtkEntry *entry) ...@@ -2163,7 +2163,11 @@ update_im_cursor_location (GtkEntry *entry)
static gboolean static gboolean
recompute_idle_func (gpointer data) recompute_idle_func (gpointer data)
{ {
GtkEntry *entry = GTK_ENTRY (data); GtkEntry *entry;
GDK_THREADS_ENTER ();
entry = GTK_ENTRY (data);
gtk_entry_adjust_scroll (entry); gtk_entry_adjust_scroll (entry);
gtk_entry_queue_draw (entry); gtk_entry_queue_draw (entry);
...@@ -2172,6 +2176,8 @@ recompute_idle_func (gpointer data) ...@@ -2172,6 +2176,8 @@ recompute_idle_func (gpointer data)
update_im_cursor_location (entry); update_im_cursor_location (entry);
GDK_THREADS_LEAVE ();
return FALSE; return FALSE;
} }
...@@ -3807,7 +3813,11 @@ hide_cursor (GtkEntry *entry) ...@@ -3807,7 +3813,11 @@ hide_cursor (GtkEntry *entry)
static gint static gint
blink_cb (gpointer data) blink_cb (gpointer data)
{ {
GtkEntry *entry = GTK_ENTRY (data); GtkEntry *entry;
GDK_THREADS_ENTER ();
entry = GTK_ENTRY (data);
g_assert (GTK_WIDGET_HAS_FOCUS (entry)); g_assert (GTK_WIDGET_HAS_FOCUS (entry));
g_assert (entry->selection_bound == entry->current_pos); g_assert (entry->selection_bound == entry->current_pos);
...@@ -3827,6 +3837,8 @@ blink_cb (gpointer data) ...@@ -3827,6 +3837,8 @@ blink_cb (gpointer data)
entry); entry);
} }
GDK_THREADS_LEAVE ();
/* Remove ourselves */ /* Remove ourselves */
return FALSE; return FALSE;
} }
......
...@@ -844,6 +844,8 @@ animation_timeout (gpointer data) ...@@ -844,6 +844,8 @@ animation_timeout (gpointer data)
{ {
GtkImage *image; GtkImage *image;
GDK_THREADS_ENTER ();
image = GTK_IMAGE (data); image = GTK_IMAGE (data);
image->data.anim.frame_timeout = 0; image->data.anim.frame_timeout = 0;
...@@ -858,6 +860,8 @@ animation_timeout (gpointer data) ...@@ -858,6 +860,8 @@ animation_timeout (gpointer data)
gtk_widget_queue_draw (GTK_WIDGET (image)); gtk_widget_queue_draw (GTK_WIDGET (image));
GDK_THREADS_LEAVE ();
return FALSE; return FALSE;
} }
......
...@@ -1628,6 +1628,8 @@ gtk_menu_scroll_timeout (gpointer data) ...@@ -1628,6 +1628,8 @@ gtk_menu_scroll_timeout (gpointer data)
gint offset; gint offset;
gint view_width, view_height; gint view_width, view_height;
GDK_THREADS_ENTER ();
menu = GTK_MENU (data); menu = GTK_MENU (data);
widget = GTK_WIDGET (menu); widget = GTK_WIDGET (menu);
...@@ -1657,6 +1659,8 @@ gtk_menu_scroll_timeout (gpointer data) ...@@ -1657,6 +1659,8 @@ gtk_menu_scroll_timeout (gpointer data)
gtk_menu_scroll_to (menu, offset); gtk_menu_scroll_to (menu, offset);
GDK_THREADS_LEAVE ();
return TRUE; return TRUE;
} }
...@@ -1846,6 +1850,8 @@ gtk_menu_stop_navigating_submenu_cb (gpointer user_data) ...@@ -1846,6 +1850,8 @@ gtk_menu_stop_navigating_submenu_cb (gpointer user_data)
GtkMenu *menu = user_data; GtkMenu *menu = user_data;
GdkWindow *child_window; GdkWindow *child_window;
GDK_THREADS_ENTER ();
gtk_menu_stop_navigating_submenu (menu); gtk_menu_stop_navigating_submenu (menu);
if (GTK_WIDGET_REALIZED (menu)) if (GTK_WIDGET_REALIZED (menu))
...@@ -1866,6 +1872,8 @@ gtk_menu_stop_navigating_submenu_cb (gpointer user_data) ...@@ -1866,6 +1872,8 @@ gtk_menu_stop_navigating_submenu_cb (gpointer user_data)
} }
} }
GDK_THREADS_LEAVE ();
return FALSE; return FALSE;
} }
......
...@@ -2705,6 +2705,8 @@ first_validate_callback (gpointer data) ...@@ -2705,6 +2705,8 @@ first_validate_callback (gpointer data)
{ {
GtkTextView *text_view = data; GtkTextView *text_view = data;
GDK_THREADS_ENTER ();
/* Note that some of this code is duplicated at the end of size_allocate, /* Note that some of this code is duplicated at the end of size_allocate,
* keep in sync with that. * keep in sync with that.
*/ */
...@@ -2728,9 +2730,9 @@ first_validate_callback (gpointer data) ...@@ -2728,9 +2730,9 @@ first_validate_callback (gpointer data)
if (text_view->first_validate_idle != 0) if (text_view->first_validate_idle != 0)
{ {
DV(g_print(">Width change forced requeue ("G_STRLOC")\n")); DV(g_print(">Width change forced requeue ("G_STRLOC")\n"));
return FALSE;
} }
else
{
/* scroll to any marks, if that's pending. This can /* scroll to any marks, if that's pending. This can
* jump us to the validation codepath used for scrolling * jump us to the validation codepath used for scrolling
* onscreen, if so we bail out. * onscreen, if so we bail out.
...@@ -2742,6 +2744,10 @@ first_validate_callback (gpointer data) ...@@ -2742,6 +2744,10 @@ first_validate_callback (gpointer data)
g_assert (text_view->onscreen_validated); g_assert (text_view->onscreen_validated);
}
GDK_THREADS_LEAVE ();
return FALSE; return FALSE;
} }
...@@ -2749,6 +2755,9 @@ static gboolean ...@@ -2749,6 +2755,9 @@ static gboolean
incremental_validate_callback (gpointer data) incremental_validate_callback (gpointer data)
{ {
GtkTextView *text_view = data; GtkTextView *text_view = data;
gboolean result = TRUE;
GDK_THREADS_ENTER ();
DV(g_print(G_STRLOC"\n")); DV(g_print(G_STRLOC"\n"));
...@@ -2759,10 +2768,12 @@ incremental_validate_callback (gpointer data) ...@@ -2759,10 +2768,12 @@ incremental_validate_callback (gpointer data)
if (gtk_text_layout_is_valid (text_view->layout)) if (gtk_text_layout_is_valid (text_view->layout))
{ {
text_view->incremental_validate_idle = 0; text_view->incremental_validate_idle = 0;
return FALSE; result = FALSE;
} }
else
return TRUE; GDK_THREADS_LEAVE ();
return result;
} }
static void static void
...@@ -3688,9 +3699,13 @@ get_cursor_time (GtkTextView *text_view) ...@@ -3688,9 +3699,13 @@ get_cursor_time (GtkTextView *text_view)
static gint static gint
blink_cb (gpointer data) blink_cb (gpointer data)
{ {
GtkTextView *text_view = GTK_TEXT_VIEW (data); GtkTextView *text_view;
gboolean visible; gboolean visible;
GDK_THREADS_ENTER ();
text_view = GTK_TEXT_VIEW (data);
g_assert (text_view->layout); g_assert (text_view->layout);
g_assert (GTK_WIDGET_HAS_FOCUS (text_view)); g_assert (GTK_WIDGET_HAS_FOCUS (text_view));
g_assert (text_view->cursor_visible); g_assert (text_view->cursor_visible);
...@@ -3709,6 +3724,8 @@ blink_cb (gpointer data) ...@@ -3709,6 +3724,8 @@ blink_cb (gpointer data)
gtk_text_layout_set_cursor_visible (text_view->layout, gtk_text_layout_set_cursor_visible (text_view->layout,
!visible); !visible);
GDK_THREADS_LEAVE ();
/* Remove ourselves */ /* Remove ourselves */
return FALSE; return FALSE;
} }
...@@ -4224,10 +4241,14 @@ selection_scan_timeout (gpointer data) ...@@ -4224,10 +4241,14 @@ selection_scan_timeout (gpointer data)
{ {
GtkTextView *text_view; GtkTextView *text_view;
GDK_THREADS_ENTER ();
text_view = GTK_TEXT_VIEW (data); text_view = GTK_TEXT_VIEW (data);
move_mark_to_pointer_and_scroll (text_view, "insert"); move_mark_to_pointer_and_scroll (text_view, "insert");
GDK_THREADS_LEAVE ();
return TRUE; /* remain installed. */ return TRUE; /* remain installed. */
} }
...@@ -4241,6 +4262,8 @@ drag_scan_timeout (gpointer data) ...@@ -4241,6 +4262,8 @@ drag_scan_timeout (gpointer data)
GdkModifierType state; GdkModifierType state;
GtkTextIter newplace; GtkTextIter newplace;
GDK_THREADS_ENTER ();
text_view = GTK_TEXT_VIEW (data); text_view = GTK_TEXT_VIEW (data);
gdk_window_get_pointer (text_view->text_window->bin_window, gdk_window_get_pointer (text_view->text_window->bin_window,
...@@ -4259,6 +4282,8 @@ drag_scan_timeout (gpointer data) ...@@ -4259,6 +4282,8 @@ drag_scan_timeout (gpointer data)
text_view->dnd_mark, text_view->dnd_mark,
DND_SCROLL_MARGIN, FALSE, 0.0, 0.0); DND_SCROLL_MARGIN, FALSE, 0.0, 0.0);
GDK_THREADS_LEAVE ();
return TRUE; return TRUE;
} }
......
...@@ -3021,6 +3021,7 @@ remove_info (GtkTreeView *tree_view) ...@@ -3021,6 +3021,7 @@ remove_info (GtkTreeView *tree_view)
g_object_set_data (G_OBJECT (tree_view), "gtk-tree-view-drag-info", NULL); g_object_set_data (G_OBJECT (tree_view), "gtk-tree-view-drag-info", NULL);
} }
#if 0
static gint static gint
drag_scan_timeout (gpointer data) drag_scan_timeout (gpointer data)
{ {
...@@ -3031,6 +3032,8 @@ drag_scan_timeout (gpointer data) ...@@ -3031,6 +3032,8 @@ drag_scan_timeout (gpointer data)
GtkTreeViewColumn *column = NULL; GtkTreeViewColumn *column = NULL;
GdkRectangle visible_rect; GdkRectangle visible_rect;
GDK_THREADS_ENTER ();
tree_view = GTK_TREE_VIEW (data); tree_view = GTK_TREE_VIEW (data);
gdk_window_get_pointer (tree_view->priv->bin_window, gdk_window_get_pointer (tree_view->priv->bin_window,
...@@ -3063,9 +3066,11 @@ drag_scan_timeout (gpointer data) ...@@ -3063,9 +3066,11 @@ drag_scan_timeout (gpointer data)
} }
} }
GDK_THREADS_LEAVE ();
return TRUE; return TRUE;
} }
#endif /* 0 */
static void static void
remove_scroll_timeout (GtkTreeView *tree_view) remove_scroll_timeout (GtkTreeView *tree_view)
...@@ -3117,6 +3122,9 @@ open_row_timeout (gpointer data) ...@@ -3117,6 +3122,9 @@ open_row_timeout (gpointer data)
GtkTreeView *tree_view = data; GtkTreeView *tree_view = data;
GtkTreePath *dest_path = NULL; GtkTreePath *dest_path = NULL;
GtkTreeViewDropPosition pos; GtkTreeViewDropPosition pos;
gboolean result = FALSE;
GDK_THREADS_ENTER ();
gtk_tree_view_get_drag_dest_row (tree_view, gtk_tree_view_get_drag_dest_row (tree_view,
&dest_path, &dest_path,
...@@ -3130,15 +3138,18 @@ open_row_timeout (gpointer data) ...@@ -3130,15 +3138,18 @@ open_row_timeout (gpointer data)
tree_view->priv->open_dest_timeout = 0; tree_view->priv->open_dest_timeout = 0;
gtk_tree_path_free (dest_path); gtk_tree_path_free (dest_path);
return FALSE;
} }
else else
{ {
if (dest_path) if (dest_path)
gtk_tree_path_free (dest_path); gtk_tree_path_free (dest_path);
return TRUE;
result = TRUE;
} }
GDK_THREADS_LEAVE ();
return result;
} }
/* Returns TRUE if event should not be propagated to parent widgets */ /* Returns TRUE if event should not be propagated to parent widgets */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment