This is an archive of the discontinued LLVM Phabricator instance.

[LLDB][GUI] Refactor form drawing using subsurfaces
ClosedPublic

Authored by OmarEmaraDev on Jul 30 2021, 10:23 AM.

Details

Summary

This patch adds a new method SubSurface to the Surface class. The method
returns another surface that is a subset of this surface. This is
important to further abstract away drawing from the ncurses objects. For
instance, fields could previously be drawn on subpads only but can now
be drawn on any surface. This is needed to create the file search
dialogs and similar functionalities.

There is an opportunity to refactor window drawing in general using
surfaces, but we shall consider this separately later.

Diff Detail

Event Timeline

OmarEmaraDev created this revision.Jul 30 2021, 10:23 AM
OmarEmaraDev requested review of this revision.Jul 30 2021, 10:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2021, 10:23 AM
clayborg accepted this revision.Aug 2 2021, 12:56 PM
This revision is now accepted and ready to land.Aug 2 2021, 12:56 PM
This revision was landed with ongoing or failed builds.Aug 5 2021, 4:51 PM
This revision was automatically updated to reflect the committed changes.

Am I the only one seeing a compiler error with this patch?

if (is_pad(m_window))

is_pad isn't defined anywhere?

I reverted this commit in 4d3d182c1dcb99ddcce7d077060d87111cb8dbfa to fix the build for now; I'm not sure where is_pad() is intended to come from.

@jasonmolenda is_pad is defined by ncurses. According to the man page, it is an extension that is not supported on Version 7, BSD or System V implementations., but that shouldn't be a problem as far as I know. Can you maybe check the ncurses header and see if it is there?

is_pad was added in 2009 in ncurses 5.7 - patch 20090906. So it is sufficiently old to be used, is it not?

is_pad was added in 2009 in ncurses 5.7 - patch 20090906. So it is sufficiently old to be used, is it not?

Thanks Omar, I didn't know that. I was building on macOS 11.5.1 (current newest release version). Looking at our curses.h, it looks like we have a slightly-too-old version of 5.7:

#define NCURSES_VERSION_MAJOR 5
#define NCURSES_VERSION_MINOR 7
#define NCURSES_VERSION_PATCH 20081102

is_pad isn't in the header or in the libcurses solib. And our next major version, macOS 12, is using the same version. :(

@jasonmolenda Okay, I will just reimplement the patch without is_pad somehow.

@jasonmolenda Okay, I will just reimplement the patch without is_pad somehow.

Thanks! Sorry it's so very old. :(