From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 27 17:44:16 2019 Received: (at submit) by debbugs.gnu.org; 27 Apr 2019 21:44:16 +0000 Received: from localhost ([127.0.0.1]:36167 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKV7H-0005FI-IN for submit@debbugs.gnu.org; Sat, 27 Apr 2019 17:44:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46465) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKV7F-0005F0-2b for submit@debbugs.gnu.org; Sat, 27 Apr 2019 17:44:13 -0400 Received: from lists.gnu.org ([209.51.188.17]:46237) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hKV79-0002uD-PH for submit@debbugs.gnu.org; Sat, 27 Apr 2019 17:44:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hKV75-0001R8-MU for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2019 17:44:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hKV3u-0000Uo-Ig for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2019 17:40:48 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:41745) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hKV3u-0000Tw-7n for bug-gnu-emacs@gnu.org; Sat, 27 Apr 2019 17:40:46 -0400 Received: by mail-pf1-x444.google.com with SMTP id 188so3391813pfd.8 for ; Sat, 27 Apr 2019 14:40:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=bSfPs/a3UYLnwgPaxB5CnrIFpPT6M9mT6XvvWHdbh7o=; b=t1rmv/WBajp+PstmXhaQVnruIWRx3ZHbrKHCLLiGBTcFxbHpnGNG3TFiHSHQMgBKkM ZMc4tLscPTepWXpCaCNpAd6G8Ss3T7UmZcCcvOUU6hHjCEwcynuslFFjQfTz6KZZe0Ah mpEIRiaNPOGp7nHPaGgb1MuK7DuL4LlN0hzSm5Ra3HELUOONsWhZk5ML+9KrMKQBVhd9 BlsAgg29/QWVC5l0s42izmnUxngSwjQozYFG3KVcYPVmkaYyj4+eqefVbGWccIbJ9br5 pvbiwtBXEgXtN5BjoYkeO8uyClDjgPkiFXcsl2nTGIT7iIv/kxxLQepadYBEHCn4g9vn 6wvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=bSfPs/a3UYLnwgPaxB5CnrIFpPT6M9mT6XvvWHdbh7o=; b=lMlcI0GdEHkjyBFnTfTaaQDwQ62Kx52wbKtzvKpdZf7OpIDz390xfr+QYnbG8PRF3v O1Ax+BLq6ys8mt2teZORaGo3BUfizwWk3D/EsSvamRWMLJ/F9/QF3EY0AurLTWTd0fFi v58DtqFnplLgWKc8DyMeyR+TEdpqjbwvhgsBPmSyRMp5olDucByb0LucnS0Qxtdpytwu bj33/jBLcgWndfW9oGD2lRMysaKfbQnft2vr9UBU7WVDhTEcJIZoc0QjQGrFUif8KLtU xYTcIfZO9mhVgY6i0mDBMdwqe1IoMo86wO9UuVWbI4ldTnrMjZ26eksFcmdV9EcPwGLL ldDw== X-Gm-Message-State: APjAAAXRHC0K46lTBaj2dBx3ou/vJCEXkbDJaoPjdfaLHVOcBb+XetAv jg6D8nyhdFtSxQrPycexCE9s8asT X-Google-Smtp-Source: APXvYqyqUkjPiUZJYUJZwk/LoBtRAzCPRvZWEwjCSFTo90Ta9Nzpox1gDwGlJul3Lm0V1SPwdQRWiA== X-Received: by 2002:a65:4342:: with SMTP id k2mr14918359pgq.178.1556401245018; Sat, 27 Apr 2019 14:40:45 -0700 (PDT) Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id j12sm1604163pff.148.2019.04.27.14.40.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 27 Apr 2019 14:40:44 -0700 (PDT) From: Alex Gramiak To: bug-gnu-emacs@gnu.org Subject: Re: [PATCH] Refactor update_window_begin and update_window_end hooks References: <87k1ffnnn2.fsf@gmail.com> Date: Sat, 27 Apr 2019 15:40:47 -0600 In-Reply-To: <87k1ffnnn2.fsf@gmail.com> (Alex Gramiak's message of "Sat, 27 Apr 2019 15:28:49 -0600") Message-ID: <87ftq3nn34.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Ah, I forgot to update the patch to not use reset_mouse_highlight in the generic version: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Refactor-update_window_begin-and-update_window_end-h.patch Content-Description: v2 >From 380549267f0e83d284752ac90f2fdd1a8da99afb Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Sat, 27 Apr 2019 15:00:13 -0600 Subject: [PATCH] Refactor update_window_begin and update_window_end hooks * src/xdisp.c (gui_update_window_begin, gui_update_window_end): New procedures implementing common functionality. * src/nsterm.m: (ns_update_window_begin, ns_update_window_end): Remove in favor of the generic version. * src/w32term.c: (w32_update_window_begin, w32_update_window_end): Use gui_update_window_begin and gui_update_window_end. * src/xterm.c: (x_update_window_begin, x_update_window_end): Remove in favor of the generic version. --- src/dispextern.h | 3 ++ src/nsterm.m | 78 +++----------------------------------------- src/w32term.c | 40 ++--------------------- src/xdisp.c | 73 +++++++++++++++++++++++++++++++++++++++++ src/xterm.c | 84 +++--------------------------------------------- 5 files changed, 86 insertions(+), 192 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index 4d6d0371d3..827eed86f1 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3303,6 +3303,9 @@ extern void gui_update_cursor (struct frame *, bool); extern void gui_clear_cursor (struct window *); extern void gui_draw_vertical_border (struct window *w); extern void gui_draw_right_divider (struct window *w); +extern void gui_update_window_begin (struct window *w); +extern void gui_update_window_end (struct window *w, bool cursor_on_p, + bool mouse_face_overwritten_p); extern int get_glyph_string_clip_rects (struct glyph_string *, NativeRectangle *, int); diff --git a/src/nsterm.m b/src/nsterm.m index cdf1916e71..2a2b8cbaba 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1106,7 +1106,7 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) ns_update_begin (struct frame *f) /* -------------------------------------------------------------------------- Prepare for a grouped sequence of drawing calls - external (RIF) call; whole frame, called before update_window_begin + external (RIF) call; whole frame, called before gui_update_window_begin -------------------------------------------------------------------------- */ { #ifdef NS_IMPL_COCOA @@ -1128,81 +1128,11 @@ static NSRect constrain_frame_rect(NSRect frameRect, bool isFullscreen) } -static void -ns_update_window_begin (struct window *w) -/* -------------------------------------------------------------------------- - Prepare for a grouped sequence of drawing calls - external (RIF) call; for one window, called after update_begin - -------------------------------------------------------------------------- */ -{ - struct frame *f = XFRAME (WINDOW_FRAME (w)); - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - - NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_window_begin"); - w->output_cursor = w->cursor; - - block_input (); - - if (f == hlinfo->mouse_face_mouse_frame) - { - /* Don't do highlighting for mouse motion during the update. */ - hlinfo->mouse_face_defer = 1; - - /* If the frame needs to be redrawn, - simply forget about any prior mouse highlighting. */ - if (FRAME_GARBAGED_P (f)) - hlinfo->mouse_face_window = Qnil; - - /* (further code for mouse faces ifdef'd out in other terms elided) */ - } - - unblock_input (); -} - - -static void -ns_update_window_end (struct window *w, bool cursor_on_p, - bool mouse_face_overwritten_p) -/* -------------------------------------------------------------------------- - Finished a grouped sequence of drawing calls - external (RIF) call; for one window called before update_end - -------------------------------------------------------------------------- */ -{ - NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_window_end"); - - /* note: this fn is nearly identical in all terms */ - if (!w->pseudo_window_p) - { - block_input (); - - if (cursor_on_p) - display_and_set_cursor (w, 1, - w->output_cursor.hpos, w->output_cursor.vpos, - w->output_cursor.x, w->output_cursor.y); - - if (draw_window_fringes (w, 1)) - { - if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) - gui_draw_right_divider (w); - else - gui_draw_vertical_border (w); - } - - unblock_input (); - } - - /* If a row with mouse-face was overwritten, arrange for - frame_up_to_date to redisplay the mouse highlight. */ - if (mouse_face_overwritten_p) - reset_mouse_highlight (MOUSE_HL_INFO (XFRAME (w->frame))); -} - - static void ns_update_end (struct frame *f) /* -------------------------------------------------------------------------- Finished a grouped sequence of drawing calls - external (RIF) call; for whole frame, called after update_window_end + external (RIF) call; for whole frame, called after gui_update_window_end -------------------------------------------------------------------------- */ { NSTRACE_WHEN (NSTRACE_GROUP_UPDATES, "ns_update_end"); @@ -5166,8 +5096,8 @@ static Lisp_Object ns_string_to_lispmod (const char *s) gui_clear_end_of_line, ns_scroll_run, ns_after_update_window_line, - ns_update_window_begin, - ns_update_window_end, + gui_update_window_begin, + gui_update_window_end, 0, /* flush_display */ gui_clear_window_mouse_face, gui_get_glyph_overhangs, diff --git a/src/w32term.c b/src/w32term.c index 451dd54dd8..8d5f57836c 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -565,19 +565,12 @@ w32_update_window_begin (struct window *w) 0, 6000, NULL); } - w->output_cursor = w->cursor; + gui_update_window_begin (w); block_input (); if (f == hlinfo->mouse_face_mouse_frame) { - /* Don't do highlighting for mouse motion during the update. */ - hlinfo->mouse_face_defer = true; - - /* If F needs to be redrawn, simply forget about any prior mouse - highlighting. */ - if (FRAME_GARBAGED_P (f)) - hlinfo->mouse_face_window = Qnil; #if 0 /* Rows in a current matrix containing glyphs in mouse-face have their mouse_face_p flag set, which means that they are always @@ -696,36 +689,7 @@ static void w32_update_window_end (struct window *w, bool cursor_on_p, bool mouse_face_overwritten_p) { - if (!w->pseudo_window_p) - { - block_input (); - - if (cursor_on_p) - display_and_set_cursor (w, true, - w->output_cursor.hpos, w->output_cursor.vpos, - w->output_cursor.x, w->output_cursor.y); - - if (draw_window_fringes (w, true)) - { - if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) - gui_draw_right_divider (w); - else - gui_draw_vertical_border (w); - } - - unblock_input (); - } - - /* If a row with mouse-face was overwritten, arrange for - XTframe_up_to_date to redisplay the mouse highlight. */ - if (mouse_face_overwritten_p) - { - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); - - hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; - hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; - hlinfo->mouse_face_window = Qnil; - } + gui_update_window_end (w, cursor_on_p, mouse_face_overwritten_p); /* Unhide the caret. This won't actually show the cursor, unless it was visible before the corresponding call to HideCaret in diff --git a/src/xdisp.c b/src/xdisp.c index d52d1333a0..a3dddfa8a5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -32223,6 +32223,79 @@ gui_draw_bottom_divider (struct window *w) } } +/* EXPORT: + Start update of window W. */ + +void +gui_update_window_begin (struct window *w) +{ + struct frame *f = XFRAME (WINDOW_FRAME (w)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); + + w->output_cursor = w->cursor; + + block_input (); + + if (f == hlinfo->mouse_face_mouse_frame) + { + /* Don't do highlighting for mouse motion during the update. */ + hlinfo->mouse_face_defer = true; + + /* If the frame needs to be redrawn, simply forget about any + prior mouse highlighting. */ + if (FRAME_GARBAGED_P (f)) + hlinfo->mouse_face_window = Qnil; + } + + unblock_input (); +} + +/* EXPORT: + End update of window W. + + Draw vertical borders between horizontally adjacent windows, and + display W's cursor if CURSOR_ON_P is non-zero. + + MOUSE_FACE_OVERWRITTEN_P non-zero means that some row containing + glyphs in mouse-face were overwritten. In that case we have to + make sure that the mouse-highlight is properly redrawn. */ +void +gui_update_window_end (struct window *w, bool cursor_on_p, + bool mouse_face_overwritten_p) +{ + /* Pseudo windows don't have cursors, so don't display them here. */ + if (!w->pseudo_window_p) + { + block_input (); + + if (cursor_on_p) + display_and_set_cursor (w, true, + w->output_cursor.hpos, w->output_cursor.vpos, + w->output_cursor.x, w->output_cursor.y); + + if (draw_window_fringes (w, true)) + { + if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) + gui_draw_right_divider (w); + else + gui_draw_vertical_border (w); + } + + unblock_input (); + } + + /* If a row with mouse-face was overwritten, arrange for + frame_up_to_date_hook to redisplay the mouse highlight. */ + if (mouse_face_overwritten_p) + { + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); + + hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; + hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; + hlinfo->mouse_face_window = Qnil; + } +} + /* Redraw the part of window W intersection rectangle FR. Pixel coordinates in FR are frame-relative. Call this function with input blocked. Value is true if the exposure overwrites diff --git a/src/xterm.c b/src/xterm.c index dd19b8bde1..b08f5f6a62 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -989,7 +989,7 @@ x_set_frame_alpha (struct frame *f) /* Start an update of frame F. This function is installed as a hook for update_begin, i.e. it is called when update_begin is called. - This function is called prior to calls to x_update_window_begin for + This function is called prior to calls to gui_update_window_begin for each window being updated. Currently, there is nothing to do here because all interesting stuff is done on a window basis. */ @@ -1033,33 +1033,6 @@ x_update_begin (struct frame *f) #endif /* USE_CAIRO */ } -/* Start update of window W. */ - -static void -x_update_window_begin (struct window *w) -{ - struct frame *f = XFRAME (WINDOW_FRAME (w)); - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - - w->output_cursor = w->cursor; - - block_input (); - - if (f == hlinfo->mouse_face_mouse_frame) - { - /* Don't do highlighting for mouse motion during the update. */ - hlinfo->mouse_face_defer = true; - - /* If F needs to be redrawn, simply forget about any prior mouse - highlighting. */ - if (FRAME_GARBAGED_P (f)) - hlinfo->mouse_face_window = Qnil; - } - - unblock_input (); -} - - /* Draw a vertical window border from (x,y0) to (x,y1) */ static void @@ -1139,55 +1112,6 @@ x_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1) } } -/* End update of window W. - - Draw vertical borders between horizontally adjacent windows, and - display W's cursor if CURSOR_ON_P is non-zero. - - MOUSE_FACE_OVERWRITTEN_P non-zero means that some row containing - glyphs in mouse-face were overwritten. In that case we have to - make sure that the mouse-highlight is properly redrawn. - - W may be a menu bar pseudo-window in case we don't have X toolkit - support. Such windows don't have a cursor, so don't display it - here. */ - -static void -x_update_window_end (struct window *w, bool cursor_on_p, - bool mouse_face_overwritten_p) -{ - if (!w->pseudo_window_p) - { - block_input (); - - if (cursor_on_p) - display_and_set_cursor (w, true, - w->output_cursor.hpos, w->output_cursor.vpos, - w->output_cursor.x, w->output_cursor.y); - - if (draw_window_fringes (w, true)) - { - if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) - gui_draw_right_divider (w); - else - gui_draw_vertical_border (w); - } - - unblock_input (); - } - - /* If a row with mouse-face was overwritten, arrange for - XTframe_up_to_date to redisplay the mouse highlight. */ - if (mouse_face_overwritten_p) - { - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); - - hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; - hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; - hlinfo->mouse_face_window = Qnil; - } -} - /* Show the frame back buffer. If frame is double-buffered, atomically publish to the user's screen graphics updates made since the last call to show_back_buffer. */ @@ -4306,7 +4230,7 @@ x_scroll_run (struct window *w, struct run *run) block_input (); - /* Cursor off. Will be switched on again in x_update_window_end. */ + /* Cursor off. Will be switched on again in gui_update_window_end. */ gui_clear_cursor (w); #ifdef USE_CAIRO @@ -13145,8 +13069,8 @@ static struct redisplay_interface x_redisplay_interface = gui_clear_end_of_line, x_scroll_run, x_after_update_window_line, - x_update_window_begin, - x_update_window_end, + gui_update_window_begin, + gui_update_window_end, x_flip_and_flush, gui_clear_window_mouse_face, gui_get_glyph_overhangs, -- 2.21.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 27 18:13:05 2019 Received: (at control) by debbugs.gnu.org; 27 Apr 2019 22:13:05 +0000 Received: from localhost ([127.0.0.1]:36219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKVZA-0005ya-Rq for submit@debbugs.gnu.org; Sat, 27 Apr 2019 18:13:05 -0400 Received: from mail-pg1-f174.google.com ([209.85.215.174]:43044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKVZ9-0005y7-7U for control@debbugs.gnu.org; Sat, 27 Apr 2019 18:13:03 -0400 Received: by mail-pg1-f174.google.com with SMTP id t22so273782pgi.10 for ; Sat, 27 Apr 2019 15:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version; bh=o+bLQd/HP/7yiOy5x/wDmZk33h5zOb++bjrU/ifdy0o=; b=cfnc9SlfqRZ6lkOYwDqkbw+8RCZ71TKZwg9O4/wqr3AJNXkFjfWGUmU1TCyReIOTPV uwtAnP1v9YTPuxbhD85KYs2tE+3cS7MPbFxWDWbuSptROwxoisVJ4ZOM02kFElq7wuaX HY4AyGJ4WzQvcKW3uD+q8XNcSQdijN6XvNKoS1injcHL0Q6PnoUnL2GiXwMpkOOwqvVD RO18LTsPOnmawLyNV9w+QNIeuAgw1AWeVXZRJg47NmZowtAnXI32LO7J7+9wYS0mMzDt /tsDt4tURj6VLgP40Ak06EUjPL6kQdttLatSXVTBw40m/1+YtO/AtY+zw70QsLkd2AxX VU4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=o+bLQd/HP/7yiOy5x/wDmZk33h5zOb++bjrU/ifdy0o=; b=uD4cRdwlcmuU7G/JCdzFiYTzBnga0CNPg7+mR4mE4ipnujy1mkt7hugHMxkMZbOT/B nWiPHOloDuUHz0WsDhNGej0+k5MSEAP6xIKpxF3yBdzdOiFNffdhr2wZbgorIrnFFZjM J6MGYZ9tmnuBiPmoEBz0nvnhKULWTAtUcyQ+Mw/OlCSn7sr14GSaIvdGMXLvngYj/jCf TWAfCOiZSxaqws8IEztKEYhRka8gPRfoaBMXs0B9LqBhWql55Nz6LLuFHNR34Z+Xfkda 8VX3YESNvGSwoatWK92UwFaUxe9ExwQXhKdALd7LsP1kegro/VkBZ8F+eLKs/AKIF6H5 r+TA== X-Gm-Message-State: APjAAAUVE1d/wIwgN24DNFFek+65qDq9QkHU8H0Ki8RVSE9BG2ahryGE GAKbotc3mFIAvaFzgSnU9KiG+a53 X-Google-Smtp-Source: APXvYqwT5zxlzpf6e7suIiB/E9QfVOOjuX4xPXWKMGGYJWU+hg+VyBCcCQLd8URm8qB81iWeRVEBqA== X-Received: by 2002:a63:6b08:: with SMTP id g8mr51101179pgc.211.1556403176842; Sat, 27 Apr 2019 15:12:56 -0700 (PDT) Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id j19sm38158904pfh.41.2019.04.27.15.12.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 27 Apr 2019 15:12:56 -0700 (PDT) From: Alex Gramiak To: control@debbugs.gnu.org Subject: Merge repeated bugs Date: Sat, 27 Apr 2019 16:12:59 -0600 Message-ID: <87bm0rnllg.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) merge 35463 35464 quit From debbugs-submit-bounces@debbugs.gnu.org Fri May 03 01:10:50 2019 Received: (at control) by debbugs.gnu.org; 3 May 2019 05:10:50 +0000 Received: from localhost ([127.0.0.1]:47505 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hMQTB-00034P-EK for submit@debbugs.gnu.org; Fri, 03 May 2019 01:10:49 -0400 Received: from mail-pf1-f178.google.com ([209.85.210.178]:36805) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hMQT8-00033l-RN; Fri, 03 May 2019 01:10:47 -0400 Received: by mail-pf1-f178.google.com with SMTP id v80so2301480pfa.3; Thu, 02 May 2019 22:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=IAJgXcUDWb2l+eTQcm09iwY0lZWZ1k6PI1D+9B8Balw=; b=XcmGFBKZ1yJScEDYUxAUYmkC+11AsZedOgnlkOGqEOqNnu1OoT/BYGXSJhSn9RYHlH f8KH3Yq17G5VQLIPYxyUZ6sZG7rAD8lPWla+rg+DjbATfZvwIZAUwpkzO02Lgc4avzUa ld7Cb3ITXXUxitvEN5CTZApLDOiL2QDy+gv0rhXNCt4CbWB01lJ4ZNl2Glbb/URZV9/G VRJbXDD0O2SqBml15okuhMvojnpKackFUmU8KLj4dC2h/9eD+wIvVOrxIaLd3XXhwhoX nBKmfY9azCqN5MH8qsN91TstYpFA191zp9lDm/7U2LSvGMcpDhxcgFF38/b3T45x5+x9 wyUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=IAJgXcUDWb2l+eTQcm09iwY0lZWZ1k6PI1D+9B8Balw=; b=KO735RzMB0YxgB93fK5I6tVfkP6NW78qTmCvDc7zqVzvhfPt+InZtlLq/SNVnvQ3wW HcVQ7X5AIBVlkccIdhpDEVc/KUqJkIo+5YPbhXMEqhy+zSpVvmluMxWGQDVbHuj8RMur nCbVEjcKXP4Yfh5djMj8Znw7xHM+heRR8IwPMG1/eRvLafhQCVHI+AKg85rMh78wuOKO iYAtp2Y/jZTxGJBBi+dpYSQVCqhFPaDRfoNfDamaW1jZIRaWWarA7lFDil7tQ8TA6nGS VEgf2lqBCcXAOJnW/yf0qPQPs59LVQtpMIYgINvdkFXs5gvj4R2pTN43eQE79Z+WD+aB 6vsg== X-Gm-Message-State: APjAAAXNAvhjGLGMyh6cQRpI2dWdEX417M+ISaQpfQPNHfVlj4Ux5Wmf skX0kKYqSGvFfxTogHsaqAdIy2mx X-Google-Smtp-Source: APXvYqzeUYvYLMoT/+j9ee46Of87DdLGMy/t6VGcOg0eGkwWyS4C0JYhGVSLfgie9qYPqsPt70cMGg== X-Received: by 2002:aa7:90ca:: with SMTP id k10mr8227023pfk.144.1556860240610; Thu, 02 May 2019 22:10:40 -0700 (PDT) Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id r87sm1148811pfa.71.2019.05.02.22.10.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 May 2019 22:10:39 -0700 (PDT) From: Alex Gramiak To: Eli Zaretskii Subject: Re: bug#35464: [PATCH] Refactor update_window_begin and update_window_end hooks References: <87k1ffnnn2.fsf@gmail.com> <83v9yyt6xp.fsf@gnu.org> <87zhoanfh3.fsf@gmail.com> <83pnp6t1da.fsf@gnu.org> Date: Thu, 02 May 2019 23:10:41 -0600 In-Reply-To: <83pnp6t1da.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 28 Apr 2019 21:45:37 +0300") Message-ID: <87ftpwktri.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control Cc: 35464@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain close 35464 quit I pushed the change as 9ae94ebdf. I have another change that I don't think is worth a new bug report, which is refactoring scroll_run_hook in a similar way. Is it okay to apply it? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Refactor-scroll_run_hook.patch Content-Description: scroll_run_hook >From 18c2ba95e5f519b44ec49c398eee9572f2ded759 Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Thu, 2 May 2019 22:58:11 -0600 Subject: [PATCH] Refactor scroll_run_hook * src/dispnew.c (gui_scroll_run): New procedure implementing common functionality. All callers of scroll_run_hook changed. * src/dispextern.h (redisplay_interface): Change signature of scroll_run_hook to use common calculated boundaries. * src/nsterm.m (ns_scroll_run): * src/w32term.c (w32_scroll_run): * src/xterm.c (x_scroll_run): Rename to ns_scroll_run_hook, w32_scroll_run_hook, and w32_scroll_run_hook respectively, and remove now duplicated code. --- src/dispextern.h | 7 ++++--- src/dispnew.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++- src/nsterm.m | 47 +++++--------------------------------------- src/w32term.c | 33 +++---------------------------- src/xdisp.c | 11 +++++------ src/xterm.c | 42 ++++----------------------------------- 6 files changed, 71 insertions(+), 120 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index bb981f83fc..d45b6ba3cd 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2833,9 +2833,9 @@ struct redisplay_interface void (*clear_end_of_line) (struct window *w, struct glyph_row *row, enum glyph_row_area area, int x); - /* Function to call to scroll the display as described by RUN on - window W. */ - void (*scroll_run_hook) (struct window *w, struct run *run); + /* Function to call to scroll the display on window W. */ + void (*scroll_run_hook) (struct window *w, int x, int y, int bottom_y, + int from_y, int to_y, int width, int height); /* Function to call after a line in a display has been completely updated. Used to draw truncation marks and alike. DESIRED_ROW @@ -3524,6 +3524,7 @@ void update_single_window (struct window *); #ifdef HAVE_WINDOW_SYSTEM extern void gui_update_window_begin (struct window *); extern void gui_update_window_end (struct window *, bool, bool); +extern void gui_scroll_run (struct window *, struct run *); #endif void do_pending_window_change (bool); void change_frame_size (struct frame *, int, int, bool, bool, bool, bool); diff --git a/src/dispnew.c b/src/dispnew.c index 52a7b6d6ee..909c26787c 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -4452,7 +4452,9 @@ scrolling_window (struct window *w, bool header_line_p) if (r->current_y != r->desired_y) { rif->clear_window_mouse_face (w); - rif->scroll_run_hook (w, r); +#ifdef HAVE_WINDOW_SYSTEM + gui_scroll_run (w, r); +#endif } /* Truncate runs that copy to where we copied to, and @@ -4550,6 +4552,53 @@ scrolling_window (struct window *w, bool header_line_p) return nruns > 0; } +#ifdef HAVE_WINDOW_SYSTEM +/* Scroll part of the display as described by RUN. */ + +void +gui_scroll_run (struct window *w, struct run *run) +{ + int x, y, width, height, from_y, to_y, bottom_y; + + /* Get frame-relative bounding box of the text display area of W, + without mode lines. Include in this box the left and right + fringe of W. */ + window_box (w, ANY_AREA, &x, &y, &width, &height); + + from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); + to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); + bottom_y = y + height; + + if (to_y < from_y) + { + /* Scrolling up. Make sure we don't copy part of the mode + line at the bottom. */ + if (from_y + run->height > bottom_y) + height = bottom_y - from_y; + else + height = run->height; + } + else + { + /* Scrolling down. Make sure we don't copy over the mode line. + at the bottom. */ + if (to_y + run->height > bottom_y) + height = bottom_y - to_y; + else + height = run->height; + } + + block_input (); + + /* Cursor off. Will be switched on again in gui_update_window_end. */ + gui_clear_cursor (w); + + FRAME_RIF (XFRAME (w->frame))->scroll_run_hook + (w, x, y, bottom_y, from_y, to_y, width, height); + + unblock_input (); +} +#endif /************************************************************************ diff --git a/src/nsterm.m b/src/nsterm.m index ffb7b7692b..34a1838e46 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2823,61 +2823,24 @@ so some key presses (TAB) are swallowed by the system. */ } static void -ns_scroll_run (struct window *w, struct run *run) +ns_scroll_run_hook (struct window *w, int x, int _y, int _bottom_y, + int from_y, int to_y, int width, int height) /* -------------------------------------------------------------------------- External (RIF): Insert or delete n lines at line vpos. -------------------------------------------------------------------------- */ { - struct frame *f = XFRAME (w->frame); - int x, y, width, height, from_y, to_y, bottom_y; - - NSTRACE ("ns_scroll_run"); - - /* begin copy from other terms */ - /* Get frame-relative bounding box of the text display area of W, - without mode lines. Include in this box the left and right - fringe of W. */ - window_box (w, ANY_AREA, &x, &y, &width, &height); - - from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); - to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); - bottom_y = y + height; - - if (to_y < from_y) - { - /* Scrolling up. Make sure we don't copy part of the mode - line at the bottom. */ - if (from_y + run->height > bottom_y) - height = bottom_y - from_y; - else - height = run->height; - } - else - { - /* Scrolling down. Make sure we don't copy over the mode line. - at the bottom. */ - if (to_y + run->height > bottom_y) - height = bottom_y - to_y; - else - height = run->height; - } - /* end copy from other terms */ + NSTRACE ("ns_scroll_run_hook"); if (height == 0) return; - block_input (); - - gui_clear_cursor (w); - { + struct frame *f = XFRAME (w->frame); NSRect srcRect = NSMakeRect (x, from_y, width, height); NSRect dstRect = NSMakeRect (x, to_y, width, height); ns_copy_bits (f, srcRect , dstRect); } - - unblock_input (); } @@ -5094,7 +5057,7 @@ static Lisp_Object ns_string_to_lispmod (const char *s) gui_write_glyphs, gui_insert_glyphs, gui_clear_end_of_line, - ns_scroll_run, + ns_scroll_run_hook, ns_after_update_window_line, NULL, /* update_window_begin */ NULL, /* update_window_end */ diff --git a/src/w32term.c b/src/w32term.c index 0abec3d92a..634132c515 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2743,48 +2743,22 @@ w32_ins_del_lines (struct frame *f, int vpos, int n) /* Scroll part of the display as described by RUN. */ static void -w32_scroll_run (struct window *w, struct run *run) +w32_scroll_run_hook (struct window *w, int x, int y, int bottom_y, + int from_y, int to_y, int width, int height) { struct frame *f = XFRAME (w->frame); - int x, y, width, height, from_y, to_y, bottom_y; HWND hwnd = FRAME_W32_WINDOW (f); HRGN expect_dirty; - /* Get frame-relative bounding box of the text display area of W, - without mode lines. Include in this box the left and right - fringes of W. */ - window_box (w, ANY_AREA, &x, &y, &width, &height); - - from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); - to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); - bottom_y = y + height; - if (to_y < from_y) { - /* Scrolling up. Make sure we don't copy part of the mode - line at the bottom. */ - if (from_y + run->height > bottom_y) - height = bottom_y - from_y; - else - height = run->height; expect_dirty = CreateRectRgn (x, y + height, x + width, bottom_y); } else { - /* Scrolling down. Make sure we don't copy over the mode line. - at the bottom. */ - if (to_y + run->height > bottom_y) - height = bottom_y - to_y; - else - height = run->height; expect_dirty = CreateRectRgn (x, y, x + width, to_y); } - block_input (); - - /* Cursor off. Will be switched on again in gui_update_window_end. */ - gui_clear_cursor (w); - { RECT from; RECT to; @@ -2813,7 +2787,6 @@ w32_scroll_run (struct window *w, struct run *run) DeleteObject (combined); } - unblock_input (); DeleteObject (expect_dirty); } @@ -7043,7 +7016,7 @@ static struct redisplay_interface w32_redisplay_interface = gui_write_glyphs, gui_insert_glyphs, gui_clear_end_of_line, - w32_scroll_run, + w32_scroll_run_hook, w32_after_update_window_line, w32_update_window_begin, w32_update_window_end, diff --git a/src/xdisp.c b/src/xdisp.c index 3bdb8ea1b0..410247869d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -18021,9 +18021,8 @@ try_window_reusing_current_matrix (struct window *w) /* Scroll the display. Do it before the current matrix is changed. The problem here is that update has not yet run, i.e. part of the current matrix is not up to date. - scroll_run_hook will clear the cursor, and use the - current matrix to get the height of the row the cursor is - in. */ + gui_scroll_run will clear the cursor, and use the current + matrix to get the height of the row the cursor is in. */ run.current_y = start_row->y; run.desired_y = it.current_y; run.height = it.last_visible_y - it.current_y; @@ -18034,7 +18033,7 @@ try_window_reusing_current_matrix (struct window *w) update_begin (f); gui_update_window_begin (w); FRAME_RIF (f)->clear_window_mouse_face (w); - FRAME_RIF (f)->scroll_run_hook (w, &run); + gui_scroll_run (w, &run); gui_update_window_end (w, false, false); update_end (f); #endif @@ -18200,7 +18199,7 @@ try_window_reusing_current_matrix (struct window *w) update_begin (f); gui_update_window_begin (w); FRAME_RIF (f)->clear_window_mouse_face (w); - FRAME_RIF (f)->scroll_run_hook (w, &run); + gui_scroll_run (w, &run); gui_update_window_end (w, false, false); update_end (f); #endif @@ -19154,7 +19153,7 @@ try_window_id (struct window *w) #ifdef HAVE_WINDOW_SYSTEM gui_update_window_begin (w); FRAME_RIF (f)->clear_window_mouse_face (w); - FRAME_RIF (f)->scroll_run_hook (w, &run); + gui_scroll_run (w, &run); gui_update_window_end (w, false, false); #endif } diff --git a/src/xterm.c b/src/xterm.c index 26f74cde91..48bfb8fdbf 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -4192,46 +4192,13 @@ x_ins_del_lines (struct frame *f, int vpos, int n) } -/* Scroll part of the display as described by RUN. */ +/* Scroll part of the display. */ static void -x_scroll_run (struct window *w, struct run *run) +x_scroll_run_hook (struct window *w, int x, int _y, int _bottom_y, + int from_y, int to_y, int width, int height) { struct frame *f = XFRAME (w->frame); - int x, y, width, height, from_y, to_y, bottom_y; - - /* Get frame-relative bounding box of the text display area of W, - without mode lines. Include in this box the left and right - fringe of W. */ - window_box (w, ANY_AREA, &x, &y, &width, &height); - - from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); - to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); - bottom_y = y + height; - - if (to_y < from_y) - { - /* Scrolling up. Make sure we don't copy part of the mode - line at the bottom. */ - if (from_y + run->height > bottom_y) - height = bottom_y - from_y; - else - height = run->height; - } - else - { - /* Scrolling down. Make sure we don't copy over the mode line. - at the bottom. */ - if (to_y + run->height > bottom_y) - height = bottom_y - to_y; - else - height = run->height; - } - - block_input (); - - /* Cursor off. Will be switched on again in gui_update_window_end. */ - gui_clear_cursor (w); #ifdef USE_CAIRO if (FRAME_CR_CONTEXT (f)) @@ -4265,7 +4232,6 @@ x_scroll_run (struct window *w, struct run *run) x, to_y); #endif - unblock_input (); } @@ -13067,7 +13033,7 @@ static struct redisplay_interface x_redisplay_interface = gui_write_glyphs, gui_insert_glyphs, gui_clear_end_of_line, - x_scroll_run, + x_scroll_run_hook, x_after_update_window_line, NULL, /* update_window_begin */ NULL, /* update_window_end */ -- 2.21.0 --=-=-=-- From unknown Tue Jun 17 01:47:56 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 01 Jun 2019 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator