Skip to content

Commit

Permalink
Fix recent changes to visible bell code
Browse files Browse the repository at this point in the history
* src/gtkutil.c (xg_create_scroll_bar):
(xg_create_horizontal_scroll_bar): Stop ensuring an X window
before the widget is realized.
(xg_update_scrollbar_pos):
(xg_update_horizontal_scrollbar_pos): Ensure such a window here
instead.
  • Loading branch information
Po Lu committed Jan 22, 2022
1 parent 882997e commit d878c45
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/gtkutil.c
Expand Up @@ -4431,10 +4431,6 @@ xg_create_scroll_bar (struct frame *f,

wscroll = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (vadj));

#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0)
eassert (gdk_window_ensure_native (gtk_widget_get_window (wscroll)));
#endif

xg_finish_scroll_bar_creation (f, wscroll, bar, scroll_callback,
end_callback, scroll_bar_name);
bar->horizontal = 0;
Expand Down Expand Up @@ -4467,10 +4463,6 @@ xg_create_horizontal_scroll_bar (struct frame *f,

wscroll = gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (hadj));

#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0)
eassert (gdk_window_ensure_native (gtk_widget_get_window (wscroll)));
#endif

xg_finish_scroll_bar_creation (f, wscroll, bar, scroll_callback,
end_callback, scroll_bar_name);
bar->horizontal = 1;
Expand Down Expand Up @@ -4542,6 +4534,12 @@ xg_update_scrollbar_pos (struct frame *f,
gtk_widget_show_all (wparent);
gtk_widget_set_size_request (wscroll, width, height);
}

#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0)
if (!gdk_window_ensure_native (gtk_widget_get_window (wscroll)))
emacs_abort ();
#endif

if (oldx != -1 && oldw > 0 && oldh > 0)
{
/* Clear under old scroll bar position. */
Expand Down Expand Up @@ -4595,7 +4593,6 @@ xg_update_horizontal_scrollbar_pos (struct frame *f,
int width,
int height)
{

GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id);

if (wscroll)
Expand Down Expand Up @@ -4642,6 +4639,11 @@ xg_update_horizontal_scrollbar_pos (struct frame *f,
pgtk_clear_area (f, oldx, oldy, oldw, oldh);
#endif

#if !defined HAVE_PGTK && GTK_CHECK_VERSION (2, 18, 0)
if (!gdk_window_ensure_native (gtk_widget_get_window (wscroll)))
emacs_abort ();
#endif

/* GTK does not redraw until the main loop is entered again, but
if there are no X events pending we will not enter it. So we sync
here to get some events. */
Expand Down

0 comments on commit d878c45

Please sign in to comment.