Commit graph

228 commits

Author SHA1 Message Date
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
Andreas Kling
46a57c7f59 IPCCompiler: Use const references for message constructor parameters 2019-12-14 16:17:00 +01:00
Andreas Kling
e4267020c4 ProfileViewer: Show kernel frames with a red icon :^) 2019-12-14 16:16:53 +01:00
Andreas Kling
5cd4fb4db2 ProfileViewer: Use the new multi-column tree model support in GTreeView
Put the sample count into a separate column. This is so neat :^)
2019-12-13 23:42:29 +01:00
Andreas Kling
9150be4716 ProfileViewer: Make sure ProfileNodes have the correct parent pointer
We were forgetting to call ProfileNode::add_child() which is how the
parent node pointer gets set. This fixes the weird looking GTreeView.
2019-12-12 22:51:08 +01:00
Andreas Kling
19d8c675f1 ProfileViewer: Begin work on a visualization tool for profiles :^)
We begin with a simple treeview that shows a recorded profile.
To record and view a profile of a process with <PID>, simply do this:

$ profile <PID> on
... wait while PID does something interesting ...
$ profile <PID> off
$ cat /proc/profile > my-profile.prof
$ ProfileViewer my-profile.prof
2019-12-12 22:01:06 +01:00
Andreas Kling
7f8e9a0f55 HackStudio: Use a table view in the "find in files" widget
Make the results of a "find in files" operation look a lot nicer by
presenting them in a table format, instead of in a single-column list.

Since we don't yet support rich text in table view cells, use the
marker glyphs in the system default fixed-width font to show where the
matched text begins and ends on the line we found it on. :^)
2019-12-10 22:07:52 +01:00
Andreas Kling
fd5eb79d19 LibGUI: Make GMenu inherit from CObject
This is primarily to make it possible to pass a GMenu* where a CObject*
is expected.
2019-12-09 21:05:44 +01:00
Andreas Kling
6f4c380d95 AK: Use size_t for the length of strings
Using int was a mistake. This patch changes String, StringImpl,
StringView and StringBuilder to use size_t instead of int for lengths.
Obviously a lot of code needs to change as a result of this.
2019-12-09 17:51:21 +01:00
Andreas Kling
8ae62c57ee LibIPC: Rename IMessage id/name to message_id/message_name
Hogging "id" and "name" makes it impossible to use these as message
parameter names, which seems silly. :^)
2019-12-02 11:11:05 +01:00
Andreas Kling
272d65e3e2 WindowServer: Port to the new IPC system
This patch introduces code generation for the WindowServer IPC with
its clients. The client/server endpoints are defined by the two .ipc
files in Servers/WindowServer/: WindowServer.ipc and WindowClient.ipc

It now becomes significantly easier to add features and capabilities
to WindowServer since you don't have to know nearly as much about all
the intricate paths that IPC messages take between LibGUI and WSWindow.

The new system also uses significantly less IPC bandwidth since we're
now doing packed serialization instead of passing fixed-sized structs
of ~600 bytes for each message.

Some repaint coalescing optimizations are lost in this conversion and
we'll need to look at how to implement those in the new world.

The old CoreIPC::Client::Connection and CoreIPC::Server::Connection
classes are removed by this patch and replaced by use of ConnectionNG,
which will be renamed eventually.

Goodbye, old WindowServer IPC. You served us well :^)
2019-12-02 11:11:05 +01:00
Sasan Hezarkhani
30db7813de HackStudio: Fixes CppLexer crashing on a comment block that does
not end.

CppLexer expected that `/*` always has `*/` at the end. This PR
fixes the issue and assumes the rest of file is a comment.
2019-12-02 09:23:47 +01:00
Andreas Kling
712ae73581 Kernel: Expose per-thread information in /proc/all
Previously it was not possible to see what each thread in a process was
up to, or how much CPU it was consuming. This patch fixes that.

SystemMonitor and "top" now show threads instead of just processes.
"ps" is gonna need some more fixing, but it at least builds for now.

Fixes #66.
2019-11-26 21:37:30 +01:00
Andreas Kling
0d2659c0a2 LibHTML: Use LibProtocol for HTTP requests :^)
This moves all of the browser networking to ProtocolServer.
2019-11-24 14:24:59 +01:00
Andreas Kling
dc9d44d7b1 IPCCompiler: Add support for String parameters in messages 2019-11-23 21:44:00 +01:00
Andreas Kling
8f9a522c37 HackStudio: Highlight matching pairs of [ and ] as well
Also refactor the token pair matching code a little bit to not repeat
ourselves so much. :^)
2019-11-23 17:49:14 +01:00
Andreas Kling
630d5b3ffd LibIPC+AudioServer: Allow unsolicited server-to-client IPC messages
Client-side connection objects must now provide both client and server
endpoint types. When a message is received from the server side, we try
to decode it using both endpoint types and then send it to the right
place for handling.

This now makes it possible for AudioServer to send unsolicited messages
to its clients. This opens up a ton of possibilities :^)
2019-11-23 16:50:21 +01:00
Andreas Kling
15fb341eb4 HackStudio: Always re-match curlies/parens after a re-highlight
While you are typing in HackStudio, we re-lex the C++ as you type,
so this means we also need to keep re-checking for matching curlies and
parentheses at the cursor.

Fixes #769 (although it's not optional, because it's too cool. :^)
2019-11-18 19:21:18 +01:00
Andreas Kling
d5afc58744 HackStudio: Highlight maching parentheses as well
This can just piggyback on the code I just wrote for curly braces.
2019-11-18 19:13:46 +01:00
Andreas Kling
c8e02e60a6 HackStudio+LibGUI: Implement matching curly brace highlighting
This works for C++ syntax highlighted text documents by caching the C++
token type in a new "arbitrary data" member of GTextDocumentSpan.

When the cursor is placed immediately before a '{' or immediately after
a '}', we highlight both of these brace buddies by changing their
corresponding spans to have a different background color.

..and spans can also now have a custom background color. :^)
2019-11-18 19:10:06 +01:00
Andreas Kling
6685be36a0 LibDraw: Add Rect::from_two_points(Point, Point)
This returns the rectangle between two given Points. Thanks Owlinator
for suggesting this much easier way of doing it :^)
2019-11-17 16:37:42 +01:00
Andreas Kling
197ed1bb2a HackStudio: Move the rubber-banding state into CursorTool
I originally put it in FormWidget because CursorTool was clueless about
painting. This patch adds Tool::on_second_paint() which allows all the
tools to hook into the second paint pass.
2019-11-16 22:26:46 +01:00
Andreas Kling
5fc62bcf68 HackStudio: Fill the selection rubber-band with some nice alpha color
Make use of the new alpha support in Painter::fill_rect() to fill the
rubber band with some see-through color. :^)
2019-11-16 19:31:57 +01:00
Andreas Kling
69dee20761 HackStudio: Allow rubber-band selection of widgets
This patch implements basic rubber-banding. Perhaps this mechanism can
be generalized somehow, but it's not clear to me how that would work
at the moment.
2019-11-16 19:17:27 +01:00
Andreas Kling
834eff7983 HackStudio: Mark whitespace tokens as skippable GTextDocumentSpans
This makes Ctrl+Left/Right jump over whitespace, which feels nice :^)
2019-11-15 21:03:22 +01:00
Sergey Bugaev
c6a8b95643 HackStudio: Add a Stop action to kill the current process
Also give the Run action a different icon that has the same style
as the stop icon that's now alongside it.

Closes https://github.com/SerenityOS/serenity/issues/771
2019-11-14 20:10:16 +01:00