[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-24 r116996: Fix freezing with scroll bars of GTK3 To
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] emacs-24 r116996: Fix freezing with scroll bars of GTK3 Toolkit. |
Date: |
Mon, 21 Apr 2014 15:55:35 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116996
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15801
author: Jarek Czekalski <address@hidden>
committer: Stefan Monnier <address@hidden>
branch nick: emacs-24
timestamp: Mon 2014-04-21 11:55:28 -0400
message:
Fix freezing with scroll bars of GTK3 Toolkit.
* src/keyboard.c (unblock_input): Add comment.
* src/xgselect.c (xg_select): Prevent Glib main loop recursion.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/keyboard.c keyboard.c-20091113204419-o5vbwnq5f7feedwu-449
src/xgselect.c xgselect.c-20091121171556-bypaf8oo9ygoo13w-2
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-04-19 18:13:26 +0000
+++ b/src/ChangeLog 2014-04-21 15:55:28 +0000
@@ -1,3 +1,9 @@
+2014-04-21 Jarek Czekalski <address@hidden>
+
+ Fix freezing with scroll bars of GTK3 Toolkit (bug#15801).
+ * keyboard.c (unblock_input): Add comment.
+ * xgselect.c (xg_select): Prevent Glib main loop recursion.
+
2014-04-19 Stefan Monnier <address@hidden>
* intervals.c (rotate_right, rotate_left): Fix up length computation.
=== modified file 'src/keyboard.c'
--- a/src/keyboard.c 2014-04-13 10:45:46 +0000
+++ b/src/keyboard.c 2014-04-21 15:55:28 +0000
@@ -7121,7 +7121,12 @@
/* End critical section.
If doing signal-driven input, and a signal came in when input was
- blocked, reinvoke the signal handler now to deal with it. */
+ blocked, reinvoke the signal handler now to deal with it.
+
+ It will also process queued input, if it was not read before.
+ When a longer code sequence does not use block/unblock input
+ at all, the whole input gathered up to the next call to
+ unblock_input will be processed inside that call. */
void
unblock_input (void)
=== modified file 'src/xgselect.c'
--- a/src/xgselect.c 2014-04-15 20:05:02 +0000
+++ b/src/xgselect.c 2014-04-21 15:55:28 +0000
@@ -28,6 +28,18 @@
#include <stdbool.h>
#include <timespec.h>
#include "frame.h"
+#include "blockinput.h"
+
+/* `xg_select' is a `pselect' replacement. Why do we need a separate function?
+ 1. Timeouts. Glib and Gtk rely on timer events. If we did pselect
+ with a greater timeout then the one scheduled by Glib, we would
+ not allow Glib to process its timer events. We want Glib to
+ work smoothly, so we need to reduce our timeout to match Glib.
+ 2. Descriptors. Glib may listen to more file descriptors than we do.
+ So we add Glib descriptors to our pselect pool, but we don't change
+ the value returned by the function. The return value matches only
+ the descriptors passed as arguments, making it compatible with
+ plain pselect. */
int
xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds,
@@ -47,12 +59,6 @@
bool need_to_dispatch;
USE_SAFE_ALLOCA;
- /* Do not try to optimize with an initial check with g_main_context_pending
- and a call to pselect if it returns false. If Gdk has a timeout for 0.01
- second, and Emacs has a timeout for 1 second, g_main_context_pending will
- return false, but the timeout will be 1 second, thus missing the gdk
- timeout with a lot. */
-
context = g_main_context_default ();
if (rfds) all_rfds = *rfds;
@@ -136,8 +142,13 @@
if (need_to_dispatch)
{
int pselect_errno = errno;
+ /* Prevent g_main_dispatch recursion, that would occur without
+ block_input wrapper, because event handlers call
+ unblock_input. Event loop recursion was causing Bug#15801. */
+ block_input ();
while (g_main_context_pending (context))
- g_main_context_dispatch (context);
+ g_main_context_dispatch (context);
+ unblock_input ();
errno = pselect_errno;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-24 r116996: Fix freezing with scroll bars of GTK3 Toolkit.,
Stefan Monnier <=