[00/61] More TUI refactorings

Message ID 20190704170311.15982-1-tom@tromey.com
Headers show
Series
  • More TUI refactorings
Related show

Message

Tom Tromey July 4, 2019, 5:02 p.m.
Here is another series of TUI cleanups.  It covers several things.

I made an attempt to remove most of the uses of the TUI_*_WIN globals,
and to remove explicit checks of window types.  I think this is
important if we want to be able to easily add new types of windows:
the core code should be able to manipulate windows without regard to
their exact contents.

This transformation isn't complete, but this series takes it pretty
far, with many of the remaining uses being in the layout code (mainly
tui-layout.c, but also other files) -- which, if we're going to add
new windows types, is going to need to be rewritten anyhow.  (Also,
even once this is all done, I suspect the command window will always
be a singleton with special code here and there in the TUI anyhow.)

This series also simplifies window creation and management.  By the
end of the series, init_and_make_win is completely gone, replaced with
ordinary uses of "new" at the appropriate spots.  These transforms
make this code much simpler to understand, IMO.

The TUI source code is also rearranged somewhat.  In particular, by
the end of the series, the declaration for a window class is in the
appropriate .h file (that is, most are moved out of tui-data.h), and
all the methods for a given class are grouped into a single .c file.

A couple of small bugs have been fixed in this series.  See the patch
"Fix flushing bug in tui_puts_internal" and also "Remove deleted
breakpoint from TUI display".

Finally, the series contains a fair amount of trivia, just random
little things I noticed while working on the code.

In some cases this series introduces functions, only to remove them
some patches later.  This is a side effect of how I wrote the patches,
but TBH I think it makes each individual patch more clear -- bundling
the two patches together would make the result less obviously correct.

I've tested this as well as I could.  You may want to give it a try,
though.  It is on the "t/tui-rewrite" branch in my github.

Tom

Comments

Pedro Alves July 17, 2019, 12:41 p.m. | #1
On 7/4/19 6:02 PM, Tom Tromey wrote:
> Here is another series of TUI cleanups.  It covers several things.

> 

> I made an attempt to remove most of the uses of the TUI_*_WIN globals,

> and to remove explicit checks of window types.  I think this is

> important if we want to be able to easily add new types of windows:

> the core code should be able to manipulate windows without regard to

> their exact contents.

> 

> This transformation isn't complete, but this series takes it pretty

> far, with many of the remaining uses being in the layout code (mainly

> tui-layout.c, but also other files) -- which, if we're going to add

> new windows types, is going to need to be rewritten anyhow.  (Also,

> even once this is all done, I suspect the command window will always

> be a singleton with special code here and there in the TUI anyhow.)

> 

> This series also simplifies window creation and management.  By the

> end of the series, init_and_make_win is completely gone, replaced with

> ordinary uses of "new" at the appropriate spots.  These transforms

> make this code much simpler to understand, IMO.

> 

> The TUI source code is also rearranged somewhat.  In particular, by

> the end of the series, the declaration for a window class is in the

> appropriate .h file (that is, most are moved out of tui-data.h), and

> all the methods for a given class are grouped into a single .c file.

> 

> A couple of small bugs have been fixed in this series.  See the patch

> "Fix flushing bug in tui_puts_internal" and also "Remove deleted

> breakpoint from TUI display".

> 

> Finally, the series contains a fair amount of trivia, just random

> little things I noticed while working on the code.

> 

> In some cases this series introduces functions, only to remove them

> some patches later.  This is a side effect of how I wrote the patches,

> but TBH I think it makes each individual patch more clear -- bundling

> the two patches together would make the result less obviously correct.

> 

> I've tested this as well as I could.  You may want to give it a try,

> though.  It is on the "t/tui-rewrite" branch in my github.


I've tested it a bit, and didn't spot anything different.

I read through the series, and it all looked great to me.

I sent a few comments to individual patches pointing out 
some tiny things.

Thanks for doing all of this.  Impressive.

Pedro Alves
Tom Tromey July 17, 2019, 6:35 p.m. | #2
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:


Pedro> I've tested it a bit, and didn't spot anything different.

Pedro> I read through the series, and it all looked great to me.

Thanks for looking at it.

I've addressed all the comments you made, and since the changes were
generally small, I am going to check it in.

I've got another cleanup series like this nearly ready.  After that one
I will probably stop doing TUI cleanups and try to fix a few bugs or add
features.

Tom