Commit graph

453 commits

Author SHA1 Message Date
Andreas Kling 0af5e0b9f8 Applications: Tweak main layout spacing and background 2020-04-23 18:30:59 +02:00
Andreas Kling ab336e895f LibGUI: Add a ToolBarContainer widget and put most ToolBars in one
This mimics the Explorer toolbar container from Windows 2000 and looks
pretty neat! :^)
2020-04-23 17:44:49 +02:00
Andreas Kling 705cee528a LibGUI: Make it easier to create checkable GUI::Actions
This patch adds GUI::Action::create_checkable() helpers that work just
like the existing create() helpers, but the actions become checkable(!)

Clients are no longer required to manage the checked state of their
actions manually, but instead they will be checked/unchecked as needed
by GUI::Action itself before the activation hook is fired.
2020-04-21 17:21:28 +02:00
Andreas Kling 52a250cb61 LibGUI: Make MenuBar a Core::Object
This makes it show up in Inspector with all the menus inside it. :^)
2020-04-21 16:19:18 +02:00
Itamar edaa9c06d9 LibELF: Make ELF::Loader RefCounted 2020-04-20 17:25:50 +02:00
Emanuel Sprung bf00e33a04 ProfileViewer: Make the invert menu item visible again :^) 2020-04-18 18:01:00 +02:00
Andreas Kling 264726b2d6 ProfileViewer: Switching to percent mode should take effect immediately 2020-04-12 15:23:24 +02:00
Andreas Kling 477bacddad ProfileViewer: Symbolicate the disassembled instructions
Instead of "call 0x0811d6ac", we now say "call 0x0811d6ac <malloc>" :^)
2020-04-12 14:20:04 +02:00
Andreas Kling 8e4751a963 LibGUI: Add a way for models to update without invalidating indexes
This is really just a workaround to keep SystemMonitor's process table
working right wrt selection retention during resorts (while also doing
full index invalidation on things like ProfileViewer inversion.)

It's starting to feel like the model abstraction is not super great
and we'll need a better approach if we want to actually build some more
dynamic functionality into our views.
2020-04-12 12:03:33 +02:00
Andreas Kling c596ef3c0e ProfileViewer: Put the tree and disasembly views in a vertical splitter 2020-04-12 10:57:44 +02:00
Andreas Kling 8aab8faf30 ProfileViewer: Open /boot/kernel for disassembly if possible
If you have access to /boot/kernel, you can see the disassembly of
kernel code in ProfileViewer. This is really useful! :^)
2020-04-11 23:37:11 +02:00
Andreas Kling dccfff8c19 ProfileViewer: Don't crash when we can't disassemble something 2020-04-11 23:15:33 +02:00
Andrew Kaster 21b5909dc6 LibELF: Move ELF classes into namespace ELF
This is for consistency with other namespace changes that were made
a while back to the other libraries :)
2020-04-11 22:41:05 +02:00
Andreas Kling 8dd96ad143 ProfileViewer: Color code the instruction rows by sample percentage
We now "heat color" the instruction-level samples so you can get a nice
visual picture of where time is spent in functions. :^)
2020-04-11 21:04:45 +02:00
Andreas Kling a4006e19d7 ProfileViewer: Don't skip the innermost frame when loading profiles
We were skipping the innermost frame as a workaround for the kernel
putting garbage data there. Now that the kernel puts the instruction
poiner there, we can load the frame normally! :^)
2020-04-11 21:04:45 +02:00
Andreas Kling 2b7220b093 ProfileViewer: Remove debug spam during disassembly 2020-04-11 18:58:17 +02:00
Andreas Kling 68ddbc0084 ProfileViewer: Highlight instructions with >0 samples in yellow 2020-04-11 18:56:50 +02:00
Andreas Kling 69583f07e0 ProfileViewer: Add an instruction-level sample viewer
When you select a function in the profile tree, we will now display
a per-instruction breakdown of aggregated samples in that function.

This allows us to look much closer at what our code is doing! :^)
2020-04-11 18:46:11 +02:00
Andreas Kling f813041f67 ProfileViewer: Remove nonsense no-op 2020-04-07 21:29:30 +02:00
Andreas Kling 992d8e450c ProfileViewer: Remove an unnecessary call to String::format() 2020-04-07 16:41:00 +02:00
Brian Gianforcaro e54cc055ac HackStudio: pledge "thread" to fix opening files
It looks like HackStudio got broken when clicking on
a folder in the open file dialog. The thumbnail icons
appear to be loaded on a new thread.
2020-04-07 12:14:35 +02:00
Andreas Kling 0d48fb9a87 AK: Add out() and warn() streams that forward to stdout and stderr
Our C++ code generator tools have been relying on host-side dbg() being
forwarded to stdout until now. Now they use out() instead.

Hopefully this will make it easier and more enticing to use streams in
userspace programs as well. :^)
2020-04-06 10:49:27 +02:00
Oriko 795067e08c HackStudio: Add new Terminals 2020-04-06 09:01:42 +02:00
Andreas Kling 26eeaef0a8 LibGUI: Add MenuBar::add_menu(name)
This allows us to construct menus in a more natural way:

    auto& file_menu = menubar->add_menu("File");
    file_menu.add_action(...);

Instead of the old way:

    auto file_menu = GUI::Menu::construct();
    file_menu->add_action(...);
    menubar->add_menu(file_menu);
2020-04-04 12:58:05 +02:00
Andreas Kling 2463a285ee LibGUI: Make GUI::TabWidget::add_tab<T>() return a T&
Since the newly constructed sub-widget is owned by the TabWidget,
we can simply return a T& here. :^)
2020-04-04 11:10:07 +02:00
Tibor Nagy 9e855376dd HackStudio: Move the "Find in files" button in line with the search box 2020-04-01 11:35:21 +02:00
Tibor Nagy f221771717 HackStudio: Add icon for the Find action 2020-03-30 13:03:53 +02:00
Tibor Nagy c7f3d72a6a HackStudio: Add an upscaled 32x32 icon to the About dialog 2020-03-30 13:03:53 +02:00
Tibor Nagy f15e9ee0fc HackStudio: Fix the labels of project opening menu and dialog 2020-03-30 13:03:53 +02:00
Andreas Kling 7cfe712f4d LibGfx+LibIPC: Add Gfx::ShareableBitmap, a bitmap for easy IPC usage
With this patch, it's now possible to pass a Gfx::ShareableBitmap in an
IPC message. As long as the message itself is synchronous, the bitmap
will be adopted by the receiving end, and disowned by the sender nicely
without any accounting effort like we've had to do in the past.

Use this in NotificationServer to allow sending arbitrary bitmaps as
icons instead of paths-to-icons.
2020-03-29 19:37:23 +02:00
Andreas Kling 4f72f6b886 AK: Add FlyString, a simple flyweight string class
FlyString is a flyweight string class that wraps a RefPtr<StringImpl>
known to be unique among the set of FlyStrings. The class is very
unoptimized at the moment.

When to use FlyString:

- When you want O(1) string comparison
- When you want to deduplicate a lot of identical strings

When not to use FlyString:

- For strings that don't need either of the above features
- For strings that are likely to be unique
2020-03-22 13:03:43 +01:00
Oriko a115702746 HackStudio: Expand project tree view by default 2020-03-18 16:33:54 +01:00
Tibor Nagy f347dd5c5e Applications: Use "Document - AppName" window title format
Fixes #1444
2020-03-13 23:30:12 +01:00
Oriko b6e1c1b516 HackStudio: Use Javascript syntax highlighter 2020-03-13 22:53:13 +01:00
Oriko 8285102b6d HackStudio: Add Javascript projects 2020-03-13 20:19:01 +01:00
Oriko 792a709765 HackStudio: Fix the wrong cursor being drawn 2020-03-13 20:19:01 +01:00
Oriko 137d68a2ae HackStudio: Abstract over syntax highlighter 2020-03-12 19:04:59 +01:00
Oriko bacd3dd57a HackStudio: Underline header links 2020-03-12 19:04:59 +01:00
Oriko 879bf3e97b HackStudio: Add header navigation 2020-03-12 12:37:13 +01:00
Andreas Kling 37fc6c117c Userspace: Add missing #includes now that AK/StdLibExtras.h is smaller 2020-03-08 13:06:51 +01:00
Andreas Kling b1058b33fb AK: Add global FlatPtr typedef. It's u32 or u64, based on sizeof(void*)
Use this instead of uintptr_t throughout the codebase. This makes it
possible to pass a FlatPtr to something that has u32 and u64 overloads.
2020-03-08 13:06:51 +01:00
Andreas Kling 830a57c6b2 LibWeb: Rename directory LibHTML => LibWeb
Let's rename this to LibWeb since it aims to provide more parts of the
web platform than just HTML. :^)
2020-03-07 10:32:51 +01:00
Andreas Kling 7a6c4a72d5 LibWeb: Move everything into the Web namespace 2020-03-07 10:27:02 +01:00
Shannon Booth 6a3b12664a LibGUI: Move Icon and FontDatabase into the GUI namespace
We also clean up some old references to the old G prefixed GUI classes

This also fixes a potential bug with using: C_OBJECT_ABSTRACT(GAbstractButton)
instead of C_OBJECT_ABSTRACT(AbstractButton)
2020-03-07 01:33:53 +01:00
Andreas Kling af29dff224 Inspector: Use pledge() and unveil() 2020-03-06 09:23:07 +01:00
Andreas Kling 6d66462254 Inspector: Store remote object addresses as uintptr_t instead of String 2020-03-05 16:31:03 +01:00
Andreas Kling fbf345e03e Inspector: Handle multi-packet RPC responses
This makes it possible to connect to Minesweeper, which has a rather
huge widget tree. :^)
2020-03-05 16:02:20 +01:00
Andreas Kling b2be8466fb Inspector: Make properties editable :^)
This patch makes it possible to live-edit remote object properties by
simply double clicking on them in the property table view.

This is pretty neat! :^)
2020-03-05 15:50:22 +01:00
Andreas Kling e23c5b7e83 LibGUI+Inspector: Highlight the currently remotely inspected widget
This patch adds a magenta rectangle around the currently inspected
widget. This allows you to browse an app's widget tree somewhat
visually using the Inspector. :^)
2020-03-05 14:42:05 +01:00
Andreas Kling 37c71bad8a Inspector: Add special icon for timer objects 2020-03-05 11:27:03 +01:00
Andreas Kling f8daa9ef02 Inspector: Don't show child count in remote object tree
You can just open a node if you want to see its children.
2020-03-05 11:14:34 +01:00
Andreas Kling 6bcda1875e Inspector: Add a special icon for layout classes 2020-03-05 11:13:44 +01:00
Andreas Kling 41c4e661e5 Inspector: Make the window icon show up for Window objects again
This broke in the GWindow => GUI::Window rename.
2020-03-05 09:24:29 +01:00
Andreas Kling ecc39678f5 Inspector: Stringify remote property values
This prevents us from asserting if the remote sends us a property made
up of an array or object.
2020-03-05 09:19:59 +01:00
Andreas Kling b29ff7b821 LibGUI: Don't use Core::Object::add() to instantiate dialogs
Now that add() returns a WidgetType&, we can't rely on the parent of a
GUI::Dialog to still keep it alive after exec() returns. This happens
because exec() will call remove_from_parent() on itself before
returning.

And so we go back to the old idiom for creating a GUI::Dialog centered
above a specific window. Just call GUI::Dialog::construct(), passing
the "parent" window as the last parameter.
2020-03-04 21:04:06 +01:00
Andreas Kling 028c011760 LibCore: Make Core::Object::add<ChildType> return a ChildType&
Since the returned object is now owned by the callee object, we can
simply vend a ChildType&. This allows us to use "." instead of "->"
at the call site, which is quite nice. :^)
2020-03-04 21:04:06 +01:00
Andreas Kling 0f3e57a6fb LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients 2020-03-04 14:26:16 +01:00
Andreas Kling 4697195645 LibGUI: Use set_layout<LayoutType>() in lots of client code 2020-03-04 13:49:48 +01:00
Andreas Kling a26b63a958 LibGUI: Remove Button& parameter from Button::on_click hook
There was but a single user of this parameter and it's a bit tedious
to write it out every time, so let's get rid of it.
2020-03-03 17:02:38 +01:00
Andreas Kling 686ade6b5a AK: Make quick_sort() a little more ergonomic
Now it actually defaults to "a < b" comparison, instead of forcing you
to provide a trivial less-than comparator. Also you can pass in any
collection type that has .begin() and .end() and we'll sort it for you.
2020-03-03 16:02:58 +01:00
Andreas Kling 058cd1241e ProfileViewer: Add mode that shows percentages instead of sample counts
Sometimes it's much nicer to work with percentages than raw sample
counts when browsing through a profile. :^)
2020-03-02 23:05:04 +01:00
Andreas Kling 8effe0b632 ProfileView: Show "self" sample counts in profiles
The "self" sample count is the number of samples that had this specific
frame as its innermost stack frame (leaf nodes in the profile tree.)
2020-03-02 23:05:04 +01:00
Andreas Kling e7f8c8a342 ProfileViewer: Parse the JSON input directly to Profile::Event
We were going from "new JSON format" => "old JSON format" => Event.
This made loading longer profiles unnecessarily slow. It's still pretty
slow, and we should... profile it! :^)
2020-03-02 23:05:04 +01:00
Andreas Kling 8eaac171d7 ProfileViewer: Rename Profile::Sample => Profile::Event 2020-03-02 23:05:04 +01:00
howar6hill 055344f346 AK: Move the wildcard-matching implementation to StringUtils
Provide wrappers in the String and StringView classes, and add some tests.
2020-03-02 10:38:08 +01:00
Andreas Kling 79e06e8308 ProfileViewer: Unbreak after Vector size_t changes
Another backwards iteration accident.
2020-02-29 22:06:52 +01:00
joshua stein 0d2bfe5c65 Build: Only look at SUBDIRS with Makefiles
If a directory is renamed or deleted before 'make clean', git will
delete the Makefile but leave all of the object and dependency files
around.  When make would try to recurse into that directory from the
wildcard, it would error out since there is no Makefile.
2020-02-25 19:56:48 +01:00
Andreas Kling ceec1a7d38 AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
Andreas Kling 6c5100b644 LibGUI: Add helper for constructing new TabWidget tabs
This patch adds the following convenience helper:

    auto tab_widget = GUI::TabWidget::construct();
    auto my_widget = tab_widget->add_tab<GUI::Widget>("My tab", ...);

The above is equivalent to:

    auto tab_widget = GUI::TabWidget::construct();
    auto my_widget = GUI::Widget::construct(...);
    tab_widget->add_widget("My tab", my_widget);
2020-02-23 12:27:53 +01:00
Andreas Kling c5d913970a LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
Andreas Kling 4ce28c32d1 Inspector: Use Core::Object::add() 2020-02-23 12:27:53 +01:00
Andreas Kling bfd86c4631 LibGUI: Make GUI::Frame have the 2px sunken container look by default
The overwhelming majority of GUI::Frame users set the same appearance,
so let's just make it the default.
2020-02-23 11:10:52 +01:00
Andreas Kling 3d20da9ee4 Userspace: Use Core::Object::add() when building interfaces 2020-02-23 11:10:52 +01:00
Andreas Kling af02d0ee97 ProfileViewer: Fix treeview selection looking unselected on Left key
When pressing the Left arrow key, we now travel to the parent_index()
of the currently selected index. Our implementation of parent_index()
was always returning an index with column 0, instead of using the
same column as the current index.

This prevented the selected item from looking selected.
2020-02-22 11:27:09 +01:00
Andreas Kling bb7d6fb310 ProfileViewer: Remove loading code for the old file format
We're still jumping through all kinds of silly hoops to load the new
format, and this commit only gets rid of the API for loading old files.
2020-02-22 11:26:40 +01:00
Andreas Kling e81bde4a3d ProfileViewer: Symbolicate unknown addresses as "??" for now
This makes unknown addresses accumulate their children together in the
treeview, which turns out to be a bit more useful than having hundreds
of unique garbage addresses each with their own subtree.
2020-02-22 11:11:07 +01:00
Andreas Kling 647d0b9e0f ProfileViewer: Symbolicate kernel addresses when possible
ProfileViewer will now attempt to open /boot/kernel and use that to
symbolicate kernel addresses (anything above the 3GB mark.)

In other words, if you run ProfileViewer as root, on a profile that
was generated by root, you can now see kernel functions properly
as well. This is not available to non-privileged users.
2020-02-22 10:09:54 +01:00
Andreas Kling 983b4bd9f2 Kernel+ProfileViewer: Move symbolication to userspace for time profiles
This makes the time profiles look like the memory profiles so we can
use the userspace symbolication code in ProfileViewer.
2020-02-22 10:09:54 +01:00
Andreas Kling 88b9fcb976 AK: Use size_t for ByteBuffer sizes
This matches what we already do for string types.
2020-02-20 13:20:34 +01:00
Andreas Kling 0bb4111735 HackStudio: Unbreak the form editor's widget icons
This is breakage from the GFoo => GUI::Foo rename.
2020-02-17 21:49:17 +01:00
Andreas Kling 2143da6434 LibGUI: Add forwarding header
This patch adds <LibGUI/Forward.h> and uses it a bunch.
It also dragged various header dependency reduction changes into it.
2020-02-16 09:41:56 +01:00
Andreas Kling a4d857e3c5 LibIPC+IPCCompiler: Add IPC::Decoder, let classes decode themselves
This shaves ~5 seconds off of a full build, not too bad. Also it just
seems nicer to push this logic out to classes. It could be better but
it's a start. :^)
2020-02-15 12:11:19 +01:00
Andreas Kling 2ae9a56c3f LibIPC: Move IPC::Encoder functions out of line
Compiling anything that includes generated IPC messages is painfully
slow at the moment. This moves the encoding helpers out of line, which
helps a bit. Doing the same for decoding will help more.
2020-02-15 12:10:48 +01:00
Andreas Kling ef01af1cb2 LibIPC+IPCCompiler: Remove some unused members from generated messages 2020-02-15 12:10:48 +01:00
Andreas Kling b011ea9962 LibGUI: Reduce menu-related header dependencies 2020-02-15 01:56:30 +01:00
Andreas Kling e1ff4fa034 LibGUI: Remove more header dependencies from Widget.h 2020-02-15 00:24:14 +01:00
Andreas Kling 69400c2ca1 LibCore: Replace manual forward declarations with <LibCore/Forward.h> 2020-02-15 00:13:44 +01:00
Andreas Kling 6a3cd11a80 AK: Remove manual forward declarations with <AK/Forward.h> 2020-02-15 00:12:31 +01:00
Andreas Kling 34c7322d77 LibGUI: Remove some header dependencies from Widget.h 2020-02-14 23:53:11 +01:00
Andreas Kling 8f7333f080 LibCore: Add a forward declaration header
This patch adds <LibCore/Forward.h> and uses it in various places to
shrink the header dependency graph.
2020-02-14 23:31:18 +01:00
Andreas Kling d217d3ff6f HackStudio: Disallow invalid indices when typing into the locator
The locator was a bit crashy since it would allow you to navigate
to invalid indices.
2020-02-07 20:58:44 +01:00
Andreas Kling bb8e65be41 LibGUI+HackStudio: Move syntax highlighting from HackStudio to LibGUI
This patch introduces the GUI::SyntaxHighlighter class, which can be
attached to a GUI::TextEditor to provide syntax highlighting.

The C++ syntax highlighting from HackStudio becomes a new class called
GUI::CppSyntaxHighlighter. This will make it possible to get C++ syntax
highlighting in any app that uses a GUI::TextEditor. :^)

Sidenote: It does feel a bit weird having a C++ lexer in a GUI toolkit
library, and we'll probably end up moving this out to a separate place
as this functionality grows larger.
2020-02-07 20:07:15 +01:00
Andreas Kling 6a9cc66b97 LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
Andreas Kling 2e219255a2 IPCCompiler: Put message classes in the Messages namespace 2020-02-06 20:21:49 +01:00
Andreas Kling d17e23bd27 LibCore: Remove leading C from filenames 2020-02-06 15:04:03 +01:00
Andreas Kling 7415e6ef9f LibIPC: Remove leading I from filenames 2020-02-06 14:54:09 +01:00
Andreas Kling 799b0a4fa8 LibGUI: Rename {H,V}BoxLayout => {Horizontal,Vertical}BoxLayout 2020-02-06 14:44:13 +01:00
Andreas Kling dccf335d5b LibGUI: Add HorizontalSlider and VerticalSlider convenience classes 2020-02-06 14:43:16 +01:00
Andreas Kling 6a71ba1deb LibGUI: Add HorizontalSplitter and VerticalSplitter convenience classes 2020-02-06 14:40:59 +01:00
Andreas Kling 5c06c32df4 LibGfx: Prefer using Gfx::Bitmap::load_from_file instead of load_png()
Code that just wants to open a Gfx::Bitmap from a file should not be
calling the PNG codec directly.
2020-02-06 13:39:17 +01:00
Andreas Kling f8b00aa290 LibGfx: Unpublish Gfx::Size from the global namespace 2020-02-06 13:32:14 +01:00
Andreas Kling 9b87843af1 LibGfx: Unpublish Gfx::Point from global namespace 2020-02-06 13:08:32 +01:00
Andreas Kling 20cfd2a6bf LibGfx: Unpublish Gfx::Rect from global namespace 2020-02-06 13:02:38 +01:00
Andreas Kling 9ac94d393e LibGfx: Rename from LibDraw :^) 2020-02-06 12:04:00 +01:00
Andreas Kling 11580babbf LibDraw: Put all classes in the Gfx namespace
I started adding things to a Draw namespace, but it somehow felt really
wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename
the library to LibGfx. :^)
2020-02-06 11:56:38 +01:00
Andreas Kling f2a087126c LibC: Add posix_openpt(), grantpt() and unlockpt()
This makes getting a pseudoterminal pair a little bit more portable.
Note that grantpt() and unlockpt() are currently no-ops, since we've
already granted the pseudoterminal slave to the calling user.

We also accept O_CLOEXEC to posix_openpt(), unlike some systems. :^)
2020-02-05 21:17:41 +01:00
Andreas Kling d264e8fcc5 LibIPC: Put all classes in the IPC namespace and remove the leading I 2020-02-05 19:57:18 +01:00
Andreas Kling a894a799c3 IPCCompiler: Remove outdated FIXME
We actually do support longer messages now since the message encoder
grows dynamically.
2020-02-05 19:40:16 +01:00
Andreas Kling 4352558bf7 IPCCompiler: Encode String length as i32, with <0 meaning null String() 2020-02-05 19:33:03 +01:00
Andreas Kling 0cff25ac78 AK+IPCCompiler: Get rid of BufferStream overloads for size_t
Since BufferStream is about creating specific binary stream formats,
let's not have a flaky type like size_t in there. Instead, clients of
BufferStream can cast their size_t to the binary size they want to use.

Account for this in IPCCompiler by making String lengths always 32-bit.
2020-02-05 19:13:44 +01:00
joshua stein 519bc758f1 IPCCompiler: Encode/decode string lengths as native size_t, not int 2020-02-05 18:39:45 +01:00
Andreas Kling 9dc78338ad ProfileViewer: Only show live allocations by default
For memory profiles, we now keep track of which allocations are still
live at the end of the selected timeline range and only show those.

This is really cool, I have to admit. :^)
2020-02-02 20:59:26 +01:00
Andreas Kling 266d7ca268 ProfileViewer: Add basic support for loading "perfcore" files
"perfcore" is the file that the kernel generates after a process that
was recording performance events has exited.

This patch teaches ProfileViewer how to load (and symbolicate!) those
files so that we can look at them. This will need a bunch more work
to make it truly useful.
2020-02-02 20:29:55 +01:00
Andreas Kling c5bd9d4ed1 LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
2020-02-02 15:15:33 +01:00
Andreas Kling 2d39da5405 LibCore: Put all classes in the Core namespace and remove the leading C
I've been wanting to do this for a long time. It's time we start being
consistent about how this stuff works.

The new convention is:

- "LibFoo" is a userspace library that provides the "Foo" namespace.

That's it :^) This was pretty tedious to convert and I didn't even
start on LibGUI yet. But it's coming up next.
2020-02-02 15:15:30 +01:00
Andreas Kling d67da8c101 LibGUI: Add GHBoxLayout and GVBoxLayout convenience classes 2020-02-02 15:09:48 +01:00
Andreas Kling 6906edee9a LibGUI: Add 64-bit signed integer support to GVariant
What was previously the "Int" type is now "Int32" and "Int64".
2020-01-27 10:55:10 +01:00
Andreas Kling a33259483a GTextEditor: Move "Go to line" feature from HackStudio into GTextEditor
This is a handy feature for any multi-line GTextEditor, so let's just
have it in the base widget. :^)

Fixes #1122.
2020-01-23 21:33:15 +01:00
Andreas Kling 2cd212e5df Kernel: Let's say that everything < 3GB is user virtual memory
Technically the bottom 2MB is still identity-mapped for the kernel and
not made available to userspace at all, but for simplicity's sake we
can just ignore that and make "address < 0xc0000000" the canonical
check for user/kernel.
2020-01-19 08:58:33 +01:00
Andreas Kling 94ca55cefd Meta: Add license header to source files
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.

For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.

Going forward, all new source files should include a license header.
2020-01-18 09:45:54 +01:00
Andreas Kling 26a31c7efb Kernel: Add "accept" pledge promise for accepting incoming connections
This patch adds a new "accept" promise that allows you to call accept()
on an already listening socket. This lets programs set up a socket for
for listening and then dropping "inet" and/or "unix" so that only
incoming (and existing) connections are allowed from that point on.
No new outgoing connections or listening server sockets can be created.

In addition to accept() it also allows getsockopt() with SOL_SOCKET
and SO_PEERCRED, which is used to find the PID/UID/GID of the socket
peer. This is used by our IPC library when creating shared buffers that
should only be accessible to a specific peer process.

This allows us to drop "unix" in WindowServer and LookupServer. :^)

It also makes the debugging/introspection RPC sockets in CEventLoop
based programs work again.
2020-01-17 11:19:06 +01:00
joshua stein 376fece51e HackStudio: add exec pledge 2020-01-16 12:42:25 +01:00
joshua stein d063a4ccf3 HackStudio: set sane $PATH early to include /usr/local/bin
Launching from the terminal inherits $PATH which includes
/usr/local/bin, but launching from the system menubar doesn't, so
HackStudio wasn't finding make installed from ports.
2020-01-16 12:42:25 +01:00
Andreas Kling f813bb52a2 Applications+DevTools+MenuApplets: Drop "unix" pledge when possible
Now that the "unix" pledge is no longer required for socket I/O, we can
drop it after making the connections we need in a program.

In most GUI program cases, once we've connected to the WindowServer by
instantiating a GApplication, we no longer need "unix" :^)
2020-01-12 12:03:57 +01:00
Andreas Kling 457c7d9efd HackStudio: Use pledge() 2020-01-11 21:33:12 +01:00
0xtechnobabble 123dcada05 Themes: Support rubberband selection theming 2020-01-07 11:02:43 +01:00
joshua stein d61131945d Build: HOST_CXX -> USE_HOST_CXX
Allow HOST_CXX to be passed to make which will be the actual host
C++ compiler used, such as 'make HOST_CXX=clang++'.
2020-01-02 21:03:53 +01:00
Andreas Kling efbdaaaa65 ProfileViewer: Interpret addresses >= 0xc0000000 as kernel frames 2020-01-02 20:51:31 +01:00
Andreas Kling ef658594e4 LibIPC: Let's start building custom message codecs for LibIPC
Instead of using ByteBuffer (which always malloc() their storage) for
IPC message encoding, we now use a Vector<u8, 1024>, which means that
messages smaller than 1 KB avoid heap allocation entirely.
2019-12-30 02:41:45 +01:00
Conrad Pankoff f5412f10cf HackStudio: Check for make command on startup 2019-12-28 23:53:09 +01:00
Conrad Pankoff fe1037bcb6 HackStudio: Add file list context menu and file removal action 2019-12-28 21:04:29 +01:00
Andreas Kling 22776589f0 HackStudio: Fix failure to open files
Use FileSystemPath to figure out that "./foo.cpp" == "foo.cpp"
2019-12-26 10:19:44 +01:00
joshua stein c127d16326 Build: support library and generator dependencies
Instead of directly manipulating LDFLAGS, set LIB_DEPS in each
subdirectory Makefile listing the libraries needed for
building/linking such as "LIB_DEPS = Core GUI Draw IPC Core".

This adds each library as an -L and -l argument in LDFLAGS, but
also adds the library.a file as a link dependency on the current
$(PROGRAM).  This causes the given library to be (re)built before
linking the current $(PROGRAM), but will also re-link any binaries
depending on that library when it is modified, when running make
from the root directory.

Also turn generator tools like IPCCompiler into dependencies on the
files they generate, so they are built on-demand when a particular
directory needs them.

This all allows the root Makefile to just list directories and not
care about the order, as all of the dependency tracking will figure
it out.
2019-12-25 10:11:09 +01:00
Andreas Kling a79bac428b LibGUI+LibDraw: Add "Palette" concept for scoped color theming
GApplication now has a palette. This palette contains all the system
theme colors by default, and is inherited by a new top-level GWidget.
New child widgets inherit their parents palette.

It is possible to override the GApplication palette, and the palette
of any GWidget.

The Palette object contains a bunch of colors, each corresponding to
a ColorRole. Each role has a convenience getter as well.

Each GWidget now has a background_role() and foreground_role(), which
are then looked up in their current palette when painting. This means
that you no longer alter the background color of a widget by setting
it directly, rather you alter either its background role, or the
widget's palette.
2019-12-24 21:27:16 +01:00
Andreas Kling b6eba388e3 LibDraw: Add Selection and SelectionText system theme colors 2019-12-24 12:13:49 +01:00
Andreas Kling 411058b2a3 WindowServer+LibGUI: Implement basic color theming
Color themes are loaded from .ini files in /res/themes/
The theme can be switched from the "Themes" section in the system menu.

The basic mechanism is that WindowServer broadcasts a SharedBuffer with
all of the color values of the current theme. Clients receive this with
the response to their initial WindowServer::Greet handshake.

When the theme is changed, WindowServer tells everyone by sending out
an UpdateSystemTheme message with a new SharedBuffer to use.

This does feel somewhat bloated somehow, but I'm sure we can iterate on
it over time and improve things.

To get one of the theme colors, use the Color(SystemColor) constructor:

    painter.fill_rect(rect, SystemColor::HoverHighlight);

Some things don't work 100% right without a reboot. Specifically, when
constructing a GWidget, it will set its own background and foreground
colors based on the current SystemColor::Window and SystemColor::Text.
The widget is then stuck with these values, and they don't update on
system theme change, only on app restart.

All in all though, this is pretty cool. Merry Christmas! :^)
2019-12-23 20:33:01 +01:00
Andreas Kling 5ff9ac1276 HackStudio: Show the project name as the root in the project tree 2019-12-23 10:55:34 +01:00
Andreas Kling 6e27b14a4a HackStudio: Sort the project tree alphabetically
I had to turn the tree nodes into RefCounted objects since it's not
possible to quick_sort() a Vector<OwnPtr<T>> at the moment.
2019-12-23 10:55:34 +01:00
Andreas Kling d9706ee882 HackStudio: Show the project file list in a tree view
Replace the boring list view with an awesome tree view :^)
2019-12-23 10:55:34 +01:00
joshua stein ac25438d54 Build: clean up build system, use one shared Makefile
Allow everything to be built from the top level directory with just
'make', cleaned with 'make clean', and installed with 'make
install'.  Also support these in any particular subdirectory.

Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as
it runs.

Kernel and early host tools (IPCCompiler, etc.) are built as
object.host.o so that they don't conflict with other things built
with the cross-compiler.
2019-12-20 20:20:54 +01:00
Ohad Rau 3809da4abb ProfileViewer: Make initial invert checkbox match initial tree view
The "Invert tree" checkbox was accidentally defaulted to display true when the actual tree wasn't being inverted, causing the checkbox to say the opposite of the tree state initially. This change just brings the visual indicator in line with what the code is actually doing.
2019-12-17 07:25:50 +01:00
Andreas Kling 3b76f2502a ProfileViewer: Ignore empty samples
Sometimes we get empty samples in a profile. I'm not sure why that
happens, but let's just ignore them for now.
2019-12-16 20:38:30 +01:00
Andreas Kling fe421bd7b4 ProfileViewer: Add the ability to invert the profile tree
Inverting the tree turns all of the innermost stack frames into roots,
allowing them to accumulate their total sample counts with other
instances of the same frame being innermost. This is an essential
feature of any cool profiler, and now we have it. :^)
2019-12-16 18:26:24 +01:00
Andreas Kling 648ed76085 ProfileViewer: Add a basic menu bar to make it look proper 2019-12-15 22:55:11 +01:00
Andreas Kling be0b527cfc ProfileViewer: Scale the sample columns by stack depth
From a nice suggestion by Nagy Tibor. :^)
2019-12-15 18:11:10 +01:00
Andreas Kling 063fef312e ProfileViewer: Convert the JSON samples into a more efficient format
Only do the conversion from JSON once. This makes it much faster to do
time range filtering with the timeline widget. :^)
2019-12-15 17:26:54 +01:00
gla3dr 12cc518d1e ProfileViewer: Fix copy-paste error :^)
Saw this copy-paste mistake in the ProfileViewer Timeline video
2019-12-15 10:11:48 +01:00
Andreas Kling 4d6968f95d ProfileViewer: Precompute the timestamp and "in kernel?" per sample
Instead of fetching these from JSON in every paint event, we now have a
separate "SampleData" vector that can be iterated.

This optimization was made possible by profiling ProfileViewer and then
analyzing the profile with ProfileViewer! :^)
2019-12-14 19:25:33 +01:00
Andreas Kling 3fd2304dad ProfileViewer: Allow filtering samples in a specific time range
You can now select the time range you want on the profile timeline.
The tree view will update automatically as you alter the range.

Unfortunately this causes the treeview to collapse all of its nodes.
It would be nice to solve this somehow in the future so that nodes
can stay open.
2019-12-14 19:10:12 +01:00
Andreas Kling a3e7c99ffe ProfileViewer: Add a timeline widget for a visual view of the profile
Userspace stack frames are in blue, kernel stack frames in red :^)
2019-12-14 18:44:29 +01:00