I removed the unused argument and attached the patch. For future
reference, any easy way to get gmail to not mangle patches?
As for the data->cy temporary, the successive call
to window_copy_update_cursor clobbers the y coordinate in data. Unless the
y-coordinate is stored somewhere else (It doesn't appear to be), I have to
save a temp there.
Thanks,
Michael Graczyk
On Tue, Dec 9, 2014 at 1:37 AM, Nicholas Marriott <
nicholas.marri...@gmail.com> wrote:
> Your mailer has mangled this patch, can you send it as an attachment
> please?
>
> Also please just remove the old_x argument if you don't need it (or mark
> it "unused", but I'd just remove it). And there seems no need to use
> temporaries for data->c[xy].
>
>
> On Mon, Dec 08, 2014 at 05:25:29PM -0800, Michael Graczyk wrote:
> > On large displays, mouse selection performance was poor.** Tmux was
> > redrawing the entire screen for every mouse coordinate update when it
> only
> > needed to update those lines where the selection might have changed.
> > This patch makes mouse selection buttery-smooth by only updating those
> > lines that need updating.
> > From aedcc3e976ad3df4037b479ac5b789160ab94a51 Mon Sep 17 00:00:00 2001
> > From: Michael Graczyk <[1]mich...@mgraczyk.com>
> > Date: Mon, 8 Dec 2014 16:57:49 -0800
> > Subject: [PATCH] Fix poor performance during mouse mode selection.
> > ---
> > **window-copy.c | 29 ++++++++++++++++++++++++++++-
> > **1 file changed, 28 insertions(+), 1 deletion(-)
> > diff --git a/window-copy.c b/window-copy.c
> > index f597332..e7fbd32 100644
> > --- a/window-copy.c
> > +++ b/window-copy.c
> > @@ -868,12 +868,37 @@ window_copy_key_numeric_prefix(struct
> window_pane
> > *wp, int key)
> > ** return (0);
> > **}
> > **
> > +static void
> > +window_copy_for_selection(
> > + struct window_pane *wp,
> > + u_int old_x,
> > + u_int old_y
> > +) {
> > + struct window_copy_mode_data *data = wp->modedata;
> > + const u_int new_y = data->cy;
> > + u_int start, end, lines;
> > +
> > + (void)old_x;
> > + if (old_y <= new_y) {
> > + start = old_y;
> > + end = new_y;
> > + } else {
> > + start = new_y;
> > + end = old_y;
> > + }
> > +
> > + lines = end - start + 1;
> > + window_copy_redraw_lines(wp, start, lines);
> > +}
> > +
> > **void
> > **window_copy_mouse(struct window_pane *wp, struct session *sess,
> > ** ** **struct mouse_event *m)
> > **{
> > ** struct window_copy_mode_data *data = wp->modedata;
> > ** struct screen *s = &data->screen;
> > + u_int old_cx;
> > + u_int old_cy;
> > ** u_int i;
> > **
> > ** if (m->x >= screen_size_x(s))
> > @@ -907,9 +932,11 @@ window_copy_mouse(struct window_pane *wp, struct
> > session *sess,
> > ** */
> > ** if (s->mode & MODE_MOUSE_BUTTON) {
> > ** if (~m->event & MOUSE_EVENT_UP) {
> > + old_cx = data->cx;
> > + old_cy = data->cy;
> > ** window_copy_update_cursor(wp, m->x, m->y);
> > ** if (window_copy_update_selection(wp, 1))
> > - window_copy_redraw_screen(wp);
> > + window_copy_for_selection(wp, old_cx,
> > old_cy);
> > ** return;
> > ** }
> > ** goto reset_mode;
> > --**
> > 2.2.0.rc0.207.ga3a616c
> >
> > References
> >
> > Visible links
> > 1. mailto:mich...@mgraczyk.com
>
> >
> ------------------------------------------------------------------------------
> > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> > from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> > with Interactivity, Sharing, Native Excel Exports, App Integration & more
> > Get technology previously reserved for billion-dollar corporations, FREE
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
>
> > _______________________________________________
> > tmux-users mailing list
> > tmux-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/tmux-users
>
>
From 9896dd10c3f9922a0b0a48799ce5272616a772f3 Mon Sep 17 00:00:00 2001
From: Michael Graczyk <mich...@mgraczyk.com>
Date: Mon, 8 Dec 2014 16:57:49 -0800
Subject: [PATCH] Fix poor performance during mouse mode selection.
---
window-copy.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/window-copy.c b/window-copy.c
index f597332..54b65d5 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -868,12 +868,34 @@ window_copy_key_numeric_prefix(struct window_pane *wp, int key)
return (0);
}
+static void
+window_copy_for_selection(
+ struct window_pane *wp,
+ u_int old_y
+) {
+ struct window_copy_mode_data *data = wp->modedata;
+ const u_int new_y = data->cy;
+ u_int start, end, lines;
+
+ if (old_y <= new_y) {
+ start = old_y;
+ end = new_y;
+ } else {
+ start = new_y;
+ end = old_y;
+ }
+
+ lines = end - start + 1;
+ window_copy_redraw_lines(wp, start, lines);
+}
+
void
window_copy_mouse(struct window_pane *wp, struct session *sess,
struct mouse_event *m)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
+ u_int old_cy;
u_int i;
if (m->x >= screen_size_x(s))
@@ -907,9 +929,10 @@ window_copy_mouse(struct window_pane *wp, struct session *sess,
*/
if (s->mode & MODE_MOUSE_BUTTON) {
if (~m->event & MOUSE_EVENT_UP) {
+ old_cy = data->cy;
window_copy_update_cursor(wp, m->x, m->y);
if (window_copy_update_selection(wp, 1))
- window_copy_redraw_screen(wp);
+ window_copy_for_selection(wp, old_cy);
return;
}
goto reset_mode;
--
2.2.0.rc0.207.ga3a616c
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users