From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.bugs Subject: bug#23925: 25.0.95; display broken when maximizing frame Date: Tue, 26 Mar 2019 11:12:25 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <26943.50736.587398.22400@gargle.gargle.HOWL> <83wpkvgua6.fsf@gnu.org> <5780C7C0.5000607@gmail.com> <8d8bb416-c246-285c-6ae2-62c3b544aea3@yandex.ru> <2095b034-95e0-f185-c157-b92de9aff1cd@yandex.ru> <0f5b640c-593c-aeb1-921c-f1d7b5bd9fa8@gmail.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="33510"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: 23925@debbugs.gnu.org, =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel , Dmitry Gutov To: Roland Winkler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 26 03:14:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8bbP-0008Ti-9z for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Mar 2019 03:14:11 +0100 Original-Received: from localhost ([127.0.0.1]:51393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8bbO-0005MR-AK for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Mar 2019 22:14:10 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8baO-0004ti-3K for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2019 22:13:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8baM-0007ue-OG for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2019 22:13:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45317) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h8baI-0007ss-NK for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2019 22:13:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h8baI-00039a-8u for bug-gnu-emacs@gnu.org; Mon, 25 Mar 2019 22:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: YAMAMOTO Mitsuharu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Mar 2019 02:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23925 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: help Original-Received: via spool by 23925-submit@debbugs.gnu.org id=B23925.155356635112076 (code B ref 23925); Tue, 26 Mar 2019 02:13:02 +0000 Original-Received: (at 23925) by debbugs.gnu.org; 26 Mar 2019 02:12:31 +0000 Original-Received: from localhost ([127.0.0.1]:58861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8bZn-00038h-8b for submit@debbugs.gnu.org; Mon, 25 Mar 2019 22:12:31 -0400 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:52277) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h8bZk-00038S-1A for 23925@debbugs.gnu.org; Mon, 25 Mar 2019 22:12:29 -0400 Original-Received: from mathent.math.s.chiba-u.ac.jp (mathent [192.168.32.5]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 69C35F08FC; Tue, 26 Mar 2019 11:12:25 +0900 (JST) (envelope-from mituharu@math.s.chiba-u.ac.jp) In-Reply-To: <0f5b640c-593c-aeb1-921c-f1d7b5bd9fa8@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156798 Archived-At: On Tue, 18 Dec 2018 04:28:17 +0900, Cl=E9ment Pit-Claudel wrote: >=20 > >> I have just tried a --with-cairo build of the latest master, and can't= repro any of the symptoms described here, as long as Emacs is launched wit= h GDK_SCALE=3D1 (I have a HiDPI screen, and redisplay with scale=3D2 looks = very broken). > >=20 > > And with the current emacs-26 branch, even that is not a problem. > >=20 > > So to sum up, I'm failing to reproduce any of the problems described in= this bug report. Could any of the previous commenters try? >=20 > I just tried it again, on master. I can't reproduce the problem any more. With cairo, I can still see the problem that enlarging the frame by mouse does not update the newly added area on master, with XQuartz on macOS. The following patch works for me. Does the OP still have the similar problem on master? If so, could you try the patch below? YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp diff --git a/src/xterm.c b/src/xterm.c index 1b0c2f5ec5..ec89091d2a 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -299,6 +299,10 @@ record_event (char *locus, int type) =20 #define FRAME_CR_CONTEXT(f) ((f)->output_data.x->cr_context) #define FRAME_CR_SURFACE(f) ((f)->output_data.x->cr_surface) +#define FRAME_CR_SURFACE_DESIRED_WIDTH(f) \ + ((f)->output_data.x->cr_surface_desired_width) +#define FRAME_CR_SURFACE_DESIRED_HEIGHT(f) \ + ((f)->output_data.x->cr_surface_desired_height) =20 static struct x_gc_ext_data * x_gc_get_ext_data (struct frame *f, GC gc, int create_if_not_found_p) @@ -333,6 +337,22 @@ x_extension_initialize (struct x_display_info *dpyinfo) dpyinfo->ext_codes =3D ext_codes; } =20 +static void +x_cr_set_surface_desired_size (struct frame *f, int width, int height) +{ + cairo_surface_t *surface =3D FRAME_CR_SURFACE (f); + + if (surface + && cairo_image_surface_get_width (surface) =3D=3D width + && cairo_image_surface_get_height (surface) =3D=3D height) + FRAME_CR_SURFACE_DESIRED_WIDTH (f) =3D 0; + else + { + FRAME_CR_SURFACE_DESIRED_WIDTH (f) =3D width; + FRAME_CR_SURFACE_DESIRED_HEIGHT (f) =3D height; + } +} + static void x_cr_destroy_surface (struct frame *f) { @@ -350,22 +370,24 @@ cairo_t * x_begin_cr_clip (struct frame *f, GC gc) { cairo_t *cr =3D FRAME_CR_CONTEXT (f); + cairo_surface_t *surface =3D FRAME_CR_SURFACE (f); =20 - if (!cr) + if (! surface || FRAME_CR_SURFACE_DESIRED_WIDTH (f)) { + if (surface) + cairo_surface_destroy (surface); =20 - if (! FRAME_CR_SURFACE (f)) - { - int scale =3D 1; -#ifdef USE_GTK - scale =3D xg_get_scale (f); -#endif + FRAME_CR_SURFACE (f) =3D + cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + FRAME_CR_SURFACE_DESIRED_WIDTH (f), + FRAME_CR_SURFACE_DESIRED_HEIGHT (f)); + FRAME_CR_SURFACE_DESIRED_WIDTH (f) =3D 0; =20 - FRAME_CR_SURFACE (f) =3D - cairo_image_surface_create (CAIRO_FORMAT_ARGB32, - scale * FRAME_PIXEL_WIDTH (f), - scale * FRAME_PIXEL_HEIGHT (f)); - } + if (cr) cairo_destroy (cr); + cr =3D NULL; + } + if (!cr) + { cr =3D cairo_create (FRAME_CR_SURFACE (f)); FRAME_CR_CONTEXT (f) =3D cr; } @@ -989,41 +1011,7 @@ x_set_frame_alpha (struct frame *f) static void x_update_begin (struct frame *f) { -#ifdef USE_CAIRO - if (FRAME_TOOLTIP_P (f) && !FRAME_VISIBLE_P (f)) - return; - - if (! FRAME_CR_SURFACE (f)) - { - int width, height; -#ifdef USE_GTK - if (FRAME_GTK_WIDGET (f)) - { - GdkWindow *w =3D gtk_widget_get_window (FRAME_GTK_WIDGET (f)); - int scale =3D xg_get_scale (f); - width =3D scale * gdk_window_get_width (w); - height =3D scale * gdk_window_get_height (w); - } - else -#endif - { - width =3D FRAME_PIXEL_WIDTH (f); - height =3D FRAME_PIXEL_HEIGHT (f); - if (! FRAME_EXTERNAL_TOOL_BAR (f)) - height +=3D FRAME_TOOL_BAR_HEIGHT (f); - if (! FRAME_EXTERNAL_MENU_BAR (f)) - height +=3D FRAME_MENU_BAR_HEIGHT (f); - } - - if (width > 0 && height > 0) - { - block_input(); - FRAME_CR_SURFACE (f) =3D cairo_image_surface_create - (CAIRO_FORMAT_ARGB32, width, height); - unblock_input(); - } - } -#endif /* USE_CAIRO */ + /* Nothing to do. */ } =20 /* Start update of window W. */ @@ -8772,7 +8760,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, font_drop_xrender_surfaces (f); unblock_input (); #ifdef USE_CAIRO - if (f) x_cr_destroy_surface (f); + if (f) + x_cr_set_surface_desired_size (f, configureEvent.xconfigure.width, + configureEvent.xconfigure.height); #endif #ifdef USE_GTK if (!f @@ -8786,7 +8776,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, xg_frame_resized (f, configureEvent.xconfigure.width, configureEvent.xconfigure.height); #ifdef USE_CAIRO - x_cr_destroy_surface (f); + x_cr_set_surface_desired_size (f, configureEvent.xconfigure.width, + configureEvent.xconfigure.height); #endif f =3D 0; } @@ -11834,7 +11825,7 @@ x_free_frame_resources (struct frame *f) free_frame_xic (f); #endif =20 - x_free_cr_resources (f); + x_cr_destroy_surface (f); #ifdef USE_X_TOOLKIT if (f->output_data.x->widget) { diff --git a/src/xterm.h b/src/xterm.h index 972a10f4d4..3456e12d84 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -744,6 +744,10 @@ struct x_output cairo_t *cr_context; /* Cairo surface for double buffering */ cairo_surface_t *cr_surface; + /* Size reported by the last ConfigureNotify event. The value of + cr_surface_desired_width is 0 when the size matches with that of + cr_surface above. */ + int cr_surface_desired_width, cr_surface_desired_height; #endif }; =20