unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jarek Czekalski <jarekczek@poczta.onet.pl>
To: 15801@debbugs.gnu.org
Subject: bug#15801: 24.3.50; bar scrolling freezes gtk emacs
Date: Mon, 09 Dec 2013 00:29:51 +0100	[thread overview]
Message-ID: <52A500EF.2090409@poczta.onet.pl> (raw)
In-Reply-To: <5277EA95.4070001@poczta.onet.pl>

[-- Attachment #1: Type: text/plain, Size: 72 bytes --]

Fixing compilation warning in the patch, missing include blockinput.h.


[-- Attachment #2: scroll_freeze_2_1.txt --]
[-- Type: text/plain, Size: 3607 bytes --]

=== modified file 'src/ChangeLog'
*** src/ChangeLog	2013-12-08 08:05:36 +0000
--- src/ChangeLog	2013-12-08 16:00:41 +0000
***************
*** 1,3 ****
--- 1,9 ----
+ 2013-12-08  Jarek Czekalski  <jarekczek@poczta.onet.pl>
+ 
+ 	Fix freezing with scroll bars of GTK3 Toolkit (Bug#15801).
+ 	* keyboard.c: A comment to unblock_input.
+ 	* xgselect.c: Prevent Glib main loop recursion.
+ 
  2013-12-08  Paul Eggert  <eggert@cs.ucla.edu>
  
  	Use libcrypto's checksum implementations if available, for speed.

=== modified file 'src/keyboard.c'
*** src/keyboard.c	2013-12-07 23:04:10 +0000
--- src/keyboard.c	2013-12-08 15:20:00 +0000
*************** unblock_input_to (int level)
*** 7118,7124 ****
  /* 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.  */
  
  void
  unblock_input (void)
--- 7118,7129 ----
  /* 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.
! 
!    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'
*** src/xgselect.c	2013-08-27 19:36:28 +0000
--- src/xgselect.c	2013-12-08 22:54:04 +0000
*************** along with GNU Emacs.  If not, see <http
*** 27,32 ****
--- 27,44 ----
  #include <errno.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,
*************** xg_select (int fds_lim, fd_set *rfds, fd
*** 45,56 ****
    int i, nfds, tmo_in_millisec;
    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;
--- 57,62 ----
*************** xg_select (int fds_lim, fd_set *rfds, fd
*** 132,139 ****
--- 138,150 ----
  #ifdef USE_GTK
        if (retval == 0)
  #endif
+         /* 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);
+         unblock_input();
  
        /* To not have to recalculate timeout, return like this.  */
        if (retval == 0)


  parent reply	other threads:[~2013-12-08 23:29 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04 18:42 bug#15801: 24.3.50; bar scrolling freezes gtk emacs Jarek Czekalski
2013-11-05 12:57 ` bug#15801: 15801: commit identified Jarek Czekalski
2013-11-06 19:48 ` bug#15801: it's a different revision, 112892 Jarek Czekalski
2013-11-21  6:00   ` Jan Djärv
2013-11-21  7:25     ` bug#15801: 24.3.50; bar scrolling freezes gtk emacs Jarek Czekalski
2013-11-30 11:41       ` Jan Djärv
2013-11-30 11:54         ` Eli Zaretskii
2013-11-30 12:51           ` Jan Djärv
2013-11-30 13:55             ` Eli Zaretskii
2013-11-30 14:05               ` Jan Djärv
2013-11-30 18:11               ` Jarek Czekalski
2013-11-30 18:38                 ` Eli Zaretskii
2013-11-30 17:04 ` Jarek Czekalski
2013-11-30 23:16   ` Jan Djärv
     [not found]     ` <529AF507.5080509@poczta.onet.pl>
     [not found]       ` <0440E2A5-37C6-4F29-9B5D-38A6AE88C3B5@swipnet.se>
     [not found]         ` <529B12DB.6020407@poczta.onet.pl>
2013-12-01 11:07           ` Jan Djärv
2013-12-01 11:38             ` Jarek Czekalski
2013-12-01 11:48               ` Jan Djärv
2013-11-30 17:10 ` bug#15801: 24.3.50; bar scrolling freezes gtk emacs - stdout warning Jarek Czekalski
2013-12-02  8:04 ` bug#15801: 24.3.50; bar scrolling freezes gtk emacs Jarek Czekalski
2013-12-02  8:18 ` Jarek Czekalski
2013-12-02 17:11 ` Jarek Czekalski
2013-12-03 22:27 ` Jarek Czekalski
2013-12-04 20:28 ` Jarek Czekalski
2013-12-05 17:08   ` Jarek Czekalski
2013-12-07 14:34     ` Jan Djärv
2013-12-08 16:14 ` Jarek Czekalski
2013-12-08 23:29 ` Jarek Czekalski [this message]
2013-12-11 19:52   ` Jan Djärv
2013-12-20  6:32   ` Jarek Czekalski
2013-12-20  8:58     ` Eli Zaretskii
2014-04-21 10:34 ` Jarek Czekalski
2014-04-21 15:56   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52A500EF.2090409@poczta.onet.pl \
    --to=jarekczek@poczta.onet.pl \
    --cc=15801@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).