Commit graph

3438 commits

Author SHA1 Message Date
Andreas Kling
841b2e5d13 WindowServer+LibGUI: Pass window icons as shared buffers rather than paths.
Now that we support more than 2 clients per shared buffer, we can use them
for window icons. I didn't do that previously since it would have made the
Taskbar process unable to access the icons.

This opens up some nice possibilities for programmatically generated icons.
2019-07-28 10:18:49 +02:00
Andreas Kling
63619b9f7c Kernel: Disallow access to shared buffers we're not allowed to access.
Unless we're on the share list, make all shared buffer related syscalls
return EPERM.
2019-07-28 07:13:38 +02:00
Andreas Kling
de3d1f2275 LibAudio: Remove an unnecessary copy of sample buffers before sending them.
I missed this earlier, but *now* we're actually using the same SharedBuffer
all the way from client-side WAV reading to server-side mixing. :^)
2019-07-27 21:28:45 +02:00
Andreas Kling
b98c77229d TextEditor: Let's have line numbers starting at 1.
Thanks to Dan for pointing this out on IRC:

<danboid> I see TextEditor still numbers its lines from 0. You're too much of a programmer sometimes kling! :)
<  kling> that might be the most extreme form of "programmer design" I've seen in serenity
2019-07-27 21:20:38 +02:00
Andreas Kling
6a0319697c AudioServer: Let ASMixer notify ASClientConnection about finished buffers.
Instead of posting a message directly from ASMixer, notify the client via
ASClientConnection::did_finish_playing_buffer().
2019-07-27 21:17:14 +02:00
Andreas Kling
dbebf10131 LibAudio: Allow WAV files up to 1GB.
We were limiting ourselves to only play WAV files smaller than 42 MB
for no particular reason. This patch increases the limit to 1 GB.
Perhaps there should not be any limit at all, but 1GB seems like a
reasonable sanity check at the moment. :^)
2019-07-27 20:49:15 +02:00
Andreas Kling
eda272eec8 TextEditor: Add back lost "Save as..." action. 2019-07-27 20:32:19 +02:00
Andreas Kling
68c20e50da LibAudio: WAV reading should stop when we run out of file. :^) 2019-07-27 18:54:03 +02:00
Andreas Kling
e6eba24405 WindowServer+AudioServer: Add some missing C_OBJECT macros. 2019-07-27 18:43:59 +02:00
Andreas Kling
60a9a232be AudioServer: Remove some outdated comments. 2019-07-27 18:41:24 +02:00
Andreas Kling
5e01dde7b1 Audio: Make ABuffer sit on top of a SharedBuffer.
This allows us to carry the same buffer all the way from the WAV loader
to the AudioServer mixer.

This alleviates some of the stutter, but there's still a noticeable
skip when switching buffers. We're gonna need to do better. :^)
2019-07-27 18:17:17 +02:00
Andreas Kling
b805f112c2 AudioServer: Avoid two heap allocations per mixing iteration. 2019-07-27 17:43:00 +02:00
Andreas Kling
426248098c Audio: Make basic streaming WAV playback work.
I had to solve a bunch of things simultaneously to make this work.
Refactor AWavLoader to be a streaming loader rather than a one-shot one.
The constructor parses the header, and if everything looks good, you can
repeatedly ask the AWavLoader for sample buffers until it runs out.

Also send a message from AudioServer when a buffer has finished playing.
That allows us to implement a blocking variant of play().

Use all of this in aplay to play WAV files chunk-at-a-time.
This is definitely not perfect and it's a little glitchy and skippy,
but I think it's a step in the right direction.
2019-07-27 17:27:05 +02:00
Andreas Kling
a292d8cd5a LibCore: Add CFileStreamReader, a simple streaming CFile reader.
This is extremely barebones right now, but can be used to easily read binary
data from a CFile piece by piece.
2019-07-27 16:38:44 +02:00
Andreas Kling
be1025c03f LibAudio: Use ByteBuffer::slice_view() to avoid double memory usage.
We only need a temporary copy for passing to ABuffer::from_pcm_data().
2019-07-27 15:29:12 +02:00
Andreas Kling
6f397e23f1 ByteBuffer: Add slice_view(). Works like slice() but makes a wrapper only.
So we already have ByteBuffer::wrap() which is like a StringView for random
data. This might not be the best abstraction actually, but this will be
immediately useful so let's add it.
2019-07-27 15:26:51 +02:00
Andreas Kling
c7a4c8f93b LibAudio: Run clang-format on all of it to make editing easier. 2019-07-27 14:36:32 +02:00
Andreas Kling
9ed7f4576b CIODevice: Try to preallocate the exact needed buffer size in read_all().
If we can get the exact file size from fstat(), it's a very good idea to use
it since it means we avoid eleventy thousand reallocations.
2019-07-27 14:24:19 +02:00
Andreas Kling
a79d8d8ae5 Kernel: Add (expensive) but valuable userspace symbols to stacks.
This is expensive because we have to page in the entire executable for every
process up front for this to work. This is due to the page fault code not
being strong enough to run while another process is active.

Note that we already had userspace symbols in *crash* stacks. This patch
adds them generally, so they show up in /proc, Process Manager, etc.

There's room for improvement here, but the debugging benefits way overshadow
the performance penalty right now. :^)
2019-07-27 12:02:56 +02:00
Andreas Kling
7cd2e739f2 LibDraw: Tweak the hover highlight color.
It was a tad too bright. Also make sure we're using the same color in
all the different places. At some point it would be nice to improve global
color settings, etc.
2019-07-27 11:16:10 +02:00
Andreas Kling
34ccc7b4a7 ProcessManager: Oops, the process-specific view should not be global.
It should only be visible when we have the process table open.
2019-07-27 11:11:49 +02:00
Andreas Kling
fd4ae0d25b Piano: Add an (empty) menubar so the app looks a little more complete. 2019-07-27 11:06:00 +02:00
Andreas Kling
e7957db173 LibCore: Remove CSocket's bind() and listen().
We're going to be using dedicated server socket classes instead.
This was only implemented for CLocalSocket, and clients have been switched
over to using CLocalServer.
2019-07-27 10:58:21 +02:00
Andreas Kling
fe45f5a6d2 LibCore: Port CoreIPCServer to using CLocalServer.
Use CLocalServer to listen for connections in WindowServer and AudioServer.
This allows us to accept incoming CLocalSocket objects from the CLocalServer
and construct client connections based on those.

Removed COpenedSocket since it's replaced by CLocalSocket.
2019-07-27 10:53:50 +02:00
Andreas Kling
c289e49ee5 LibCore: Use clang-format on CoreIPC{Client,Server}. 2019-07-27 10:50:26 +02:00
Andreas Kling
82446ea701 CSocket: Add an on_ready_to_read callback.
This callback uses a CNotifier internally and will fire whenever there's
something to be read from the socket.
2019-07-27 10:48:43 +02:00
Andreas Kling
8f4fba95c0 CIODevice: Add a virtual did_update_fd() no notify subclasses of fd change.
This will allow subclasses to react when the file descriptor changes.
2019-07-27 10:47:46 +02:00
Andreas Kling
8ed078e5b2 WindowServer: Add missing WSAPITypes.h include in WSClientConnection.h 2019-07-27 10:33:06 +02:00
Andreas Kling
b3fe9cde52 LibCore: Add CLocalServer, a server-only local socket class.
Instead of trying to support both client and server in CLocalSocket, let's
have a specialized server class.

The basic usage is:

    CLocalServer server;
    server.listen("/tmp/name-of-portal");
    server.on_ready_to_accept = [&] {
        CLocalSocket* client = server.accept();
        ...
    };

This will make things a lot simpler, since an accepting socket doesn't need
half of the stuff that a regular CIODevice provides. :^)
2019-07-27 10:32:40 +02:00
Andreas Kling
9b7e1eb287 ProcessManager: Add a process-specific tab view below the process table.
To start out, add a "Stacks" view where we see what the selected process is
currently doing (via /proc/PID/stack) :^)
2019-07-27 09:39:43 +02:00
Andreas Kling
c452528952 ProcessManager: Add ProcessTableView::on_process_selected() callback.
This will be useful for doing something in response to the user selecting
a different process.
2019-07-27 09:37:26 +02:00
Andreas Kling
f1af5f26eb GSplitter: Explicitly set the size policies when resizing.
If we don't have the fixed size policy for the first resizee, the layout
system will just ignore the preferred sizes that we're giving it.
2019-07-27 09:36:21 +02:00
Andreas Kling
2b02deef28 GWidget: Remove unused is_widget() virtual.
This is implemented as a bool member in CObject, not a virtual.
2019-07-27 09:35:07 +02:00
Andreas Kling
7dc7f11ed8 GWidget: Add set_size_policy(Orientation, Policy).
This allows you to set the policy for a single orientation rather than
both at the same time.
2019-07-27 09:34:28 +02:00
Andreas Kling
10c35d345a LibCore: Add comment about child events for partially-constructed children.
Since ChildAdded events originate from the CObject constructor, they are not
fully constructed when their parent learns that they were added.
Added a little comment about this to the child_event() declaration.
2019-07-27 09:31:46 +02:00
Andreas Kling
185ba4dc3f ProcessManager: Move the memory stats widget under "Graphs" instead.
Making space for some new thingy under the process table view.
2019-07-27 08:43:32 +02:00
Andreas Kling
cd3463d2e3 ProcessManager: Rename "widget" to "process_table_container". 2019-07-27 08:42:15 +02:00
Andreas Kling
5d83a049c2 FormCompiler: Add some more LibCore object files to host build. 2019-07-26 22:42:10 +02:00
Andreas Kling
be2b585ca6 LibCore: Add CSocket::bind() (virtual) and CSocket::listen().
These will be useful for implementing server sockets.
2019-07-26 22:39:16 +02:00
Andreas Kling
2f373a27a2 AK: Add RELEASE_ASSERT in non-Serenity builds. 2019-07-26 22:15:54 +02:00
Andreas Kling
d7ff2c5b86 LibGUI: GDialog should close its nested event loop on window close.
Make GWindow::close() so we can override it in GDialog and quit from the
internal event loop when the window manager tells us to close ourselves.

The dialog will return GDialog::ExecCancel in these situations.
2019-07-26 16:13:59 +02:00
Andreas Kling
7da5a04131 CEventLoop: Convert dbgprintf() to dbg(). 2019-07-26 16:00:56 +02:00
Andreas Kling
1d3889e24f Meta: Minor tweak to Contributing.md 2019-07-26 15:45:47 +02:00
Andreas Kling
9b17016c17 Meta: Add some basic contribution guidelines. 2019-07-26 15:31:36 +02:00
Andreas Kling
bacbb52f2e Lagom: Let's not hard-code the compiler. Add compiler-relevant flags though.
I'm still getting the hang of this CMake thing.
2019-07-26 11:03:19 +02:00
Andreas Kling
e423bb4901 LibHTML: A tiny bit of work towards block layout. 2019-07-26 08:05:14 +02:00
Andreas Kling
fc9a1a1328 AK: Fix NonnullRefPtr<T>::operator=(NonnullRefPtr<U>). 2019-07-26 08:04:33 +02:00
Rhin
d6cd98cfa1 TextEditor: Fix nullptr refrence to save action & m_path (#364)
We forgot to persist our actions in the constructor for later reference, whoops.
Also use the correct path in the "open" action.
2019-07-26 06:48:39 +02:00
Andreas Kling
4316fa8123 Kernel: Dump backtrace to debugger for DefaultSignalAction::DumpCore.
This makes assertion failures generate backtraces again. Sorry to everyone
who suffered from the lack of backtraces lately. :^)

We share code with the /proc/PID/stack implementation. You can now get the
current backtrace for a Thread via Thread::backtrace(), and all the traces
for a Process via Process::backtrace().
2019-07-25 21:02:19 +02:00
Andreas Kling
a599317624 LibCore: Introduce a C_OBJECT macro.
This macro goes at the top of every CObject-derived class like so:

class SomeClass : public CObject {
    C_OBJECT(SomeClass)
public:
    ...

At the moment, all it does is create an override for the class_name() getter
but in the future this will be used to automatically insert member functions
into these classes.
2019-07-25 19:49:28 +02:00