unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: emacs-devel@gnu.org, Martin Rudalics <rudalics@gmx.at>
Subject: Re: emacs-27 c49d379: Fix some problems with moving and resizing child frames
Date: Wed, 8 Apr 2020 06:33:52 +0300	[thread overview]
Message-ID: <ca4881c5-e675-bc1b-159a-fb3ab2f127c2@yandex.ru> (raw)
In-Reply-To: <20200406072406.9C05720A26@vcs0.savannah.gnu.org>

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

Hi Martin,

On 06.04.2020 10:24, Martin Rudalics wrote:
> +
> +      if (totalwidth != gwidth || totalheight != gheight)
> +	{

Speaking of this optimization, can we make it apply to 'resize-mode' 
child frames too?

I've been doing some testing, and in certain situations, the value 
'hide' actually seems more performant when the size doesn't need to be 
changed. This largely makes a difference when, at random times, the 
child frame takes ~100ms to resize (which corresponds to the value of 
x-wait-for-event-timeout).

The attached patch seems to help.

[-- Attachment #2: speedup_childframe_resizing.diff --]
[-- Type: text/x-patch, Size: 1787 bytes --]

diff --git a/src/gtkutil.c b/src/gtkutil.c
index e374bdbe03..9fcaeed097 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -954,6 +954,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
     = pixelheight + FRAME_TOOLBAR_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f);
   int totalwidth = pixelwidth + FRAME_TOOLBAR_WIDTH (f);
   bool was_visible = false;
+  bool hide_child_frame = false;
 
   if (FRAME_PIXEL_HEIGHT (f) == 0)
     return;
@@ -996,26 +997,33 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
       gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
 			 totalwidth, gheight);
     }
-  else if (FRAME_PARENT_FRAME (f) && FRAME_VISIBLE_P (f)
-	   && EQ (x_gtk_resize_child_frames, Qhide))
+  else if (FRAME_PARENT_FRAME (f) && FRAME_VISIBLE_P (f))
     {
       was_visible = true;
+      hide_child_frame = EQ (x_gtk_resize_child_frames, Qhide);
 
       if (totalwidth != gwidth || totalheight != gheight)
 	{
 	  frame_size_history_add
 	    (f, Qxg_frame_set_char_size_4, width, height,
 	     list2i (totalwidth, totalheight));
-	  block_input ();
-	  gtk_widget_hide (FRAME_GTK_OUTER_WIDGET (f));
-	  unblock_input ();
+
+          if (hide_child_frame)
+            {
+              block_input ();
+              gtk_widget_hide (FRAME_GTK_OUTER_WIDGET (f));
+              unblock_input ();
+            }
 
 	  gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
 			     totalwidth, totalheight);
 
-	  block_input ();
-	  gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f));
-	  unblock_input ();
+          if (hide_child_frame)
+            {
+              block_input ();
+              gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f));
+              unblock_input ();
+            }
 
 	  fullscreen = Qnil;
 	}

       reply	other threads:[~2020-04-08  3:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200406072405.19842.29678@vcs0.savannah.gnu.org>
     [not found] ` <20200406072406.9C05720A26@vcs0.savannah.gnu.org>
2020-04-08  3:33   ` Dmitry Gutov [this message]
2020-04-08  9:21     ` emacs-27 c49d379: Fix some problems with moving and resizing child frames martin rudalics
2020-04-08  9:48       ` Eli Zaretskii
2020-04-08 11:08         ` Dmitry Gutov

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=ca4881c5-e675-bc1b-159a-fb3ab2f127c2@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.at \
    /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).