Commit graph

5234 commits

Author SHA1 Message Date
Conrad Pankoff
1868523e00 LibC: Move duplicated winsize struct definition into ioctl_numbers.h 2019-08-18 07:40:02 +02:00
Andreas Kling
266b9cb654 LibC: Fix strtol() not populating `endptr' for valid strings
We were not writing anything out to the `endptr` pointer if a number
was successfully parsed from the input string.

Fixes #460.
2019-08-17 22:07:48 +02:00
Andreas Kling
8a91b90258 GTableView: Fix column resize cursor not showing up in scrolled tables
If the table was scrolled somewhat, we'd stop showing the resize cursor
when hovering the mouse cursor between two table column headers.
2019-08-17 15:01:45 +02:00
Andreas Kling
8031960541 GTableView: Fix row selection when clicking between two cells
We should still select the entire row when you click between two cells.
2019-08-17 14:56:53 +02:00
Sergey Bugaev
e0e1be8c33 LibCore: Fix a crash in CArgsParser 2019-08-17 12:07:55 +02:00
Sergey Bugaev
bec646c0bb LibC: Implement wait()
This is a simple convenience wrapper over waitpid().
2019-08-17 12:07:55 +02:00
Sergey Bugaev
425c356288 Kernel+LibC+Userland: Support mounting other kinds of filesystems 2019-08-17 12:07:55 +02:00
Andreas Kling
1febd59f83 LibCore+rpcdump: Publish CObject graph to on-demand RPC socket
All programs that have a CEventLoop now allow local socket connections
via /tmp/rpc.PID and will dump a serialized JSON array of all the live
CObjects in the program onto connecting sockets.

Also added a small /bin/rpcdump tool that connects to an RPC socket and
produces a raw dump of the JSON that comes out.
2019-08-17 11:39:26 +02:00
Andreas Kling
2fa2d72761 CObject: Put all CObjects on a global IntrusiveList for introspection
This will allow us to easily traverse the entire CObject graph.
2019-08-17 11:26:19 +02:00
Andreas Kling
7127c4fdbb LibCore: CIODevice::set_error() is meant to be called with the 'errno'
The point of this function is to stash away the innermost error code
so that we don't lose it by the time we get back to the client code.
2019-08-17 11:07:15 +02:00
Jesse Buhagiar
bc22456f89 Kernel: Added unmount ability to VFS
It is now possible to unmount file systems from the VFS via `umount`.
It works via looking up the `fsid` of the filesystem from the `Inode`'s
metatdata so I'm not sure how fragile it is. It seems to work for now
though as something to get us going.
2019-08-17 09:29:54 +02:00
Andreas Kling
6ad3efe067 Kernel+LibC: Add get_process_name() syscall
It does exactly what it sounds like:

    int get_process_name(char* buffer, int buffer_size);
2019-08-15 20:55:10 +02:00
Andreas Kling
e62a2b7cf8 LibC: Fix clang-tidy warning about else-after-return in errno handling 2019-08-15 20:25:50 +02:00
Andreas Kling
9789ee9b58 GTableView: Add a way to customize cell painting per-column
You can now set a GTableCellPaintingDelegate per column in GTableView.
For columns with a painting delegate set, the view will defer to the
delegate for painting each cell in that column.
2019-08-14 20:34:46 +02:00
Andreas Kling
b777f740a4 StylePainter: Move progress bar painting from GProgressBar to here
We need to be able to paint progress bars without having a widget. :^)
2019-08-14 20:31:46 +02:00
Andreas Kling
f9b8a18fae GJsonArrayModel: Add hook for customizing the GModel::Role::Custom data 2019-08-14 20:30:18 +02:00
Conrad Pankoff
ecde025375 Libraries: Add LibPCIDB for reading PCI device information from pci.ids 2019-08-14 13:12:54 +02:00
Andreas Kling
ca9592d56f LibVT: Shave down VT::Attribute from 8 bytes to 3 bytes
We have one of these per character in the terminal buffers, so it's a
decent haircut. :^)
2019-08-13 12:59:58 +02:00
Andreas Kling
4fb02c78a9 LibVT: Rename VT::BufferPosition to VT::Position and move to own file 2019-08-13 12:56:10 +02:00
Andreas Kling
7d6689055f Kernel+LibC+crash: Add mprotect() syscall
This patch adds the mprotect() syscall to allow changing the protection
flags for memory regions. We don't do any region splitting/merging yet,
so this only works on whole mmap() regions.

Added a "crash -r" flag to verify that we crash when you attempt to
write to read-only memory. :^)
2019-08-12 19:33:24 +02:00
Andreas Kling
7e93418927 GButton: Allow non-checkable buttons to render as checked
This changes the behavior of the "is_checkable" flag on GAbstractButton
to only be about user interaction checkability. In other words, it now
only prevents the user from checking/unchecking the button, the code.
2019-08-12 18:50:19 +02:00
Andreas Kling
b24b111298 LibVT: Factor out terminal emulation from Terminal to make it reusable
Now that we're bringing back the in-kernel virtual console, we should
move towards having a single implementation of terminal emulation.

This patch rips out the emulation code from the Terminal application
and turns it into the beginnings of LibVT.

The basic design idea is that users of VT::Terminal will implement and
provide a VT::TerminalClient subclass to handle presentation-specific
things. We'll need to iterate on this, but it's a start. :^)
2019-08-12 17:34:48 +02:00
Andreas Kling
69ec08774b GJsonArrayModel: Add hook to customize what comes out of GModel::Sort
Now you can provide a massage_for_sort hook in your FieldSpec.
This allows you to implement arbitrary sorting rules for the data.
2019-08-12 11:54:18 +02:00
Ignas S
6228e18a09 GTableView and friends: API improvements for 'Sortable' flag. 2019-08-12 11:01:47 +02:00
Ignas S
405d7ddec8 GDirectoryModel: prevent sorting by icons. 2019-08-12 11:01:47 +02:00
Ignas S
823d5d097b GTableView: add 'sortable' column header flag.
This prevents sorting unsortable by unsortable things, like icons.
2019-08-12 11:01:47 +02:00
ignas-sa
0faaa1e53a GSortingProxyModel: Sort case insensitively by default (#441) 2019-08-11 18:11:25 +02:00
Ignas S
feabe6ed31 GScrollBar: highlight the scrubber while it's in use.
Originally, it would stop being highlighted if the mouse was moved away from
it, even while in use. Now it will stay highlighted for the duration of
usage.
2019-08-11 12:00:10 +02:00
Andreas Kling
ee83b1bcf4 LibCore: Use URL in CHttpRequest
Now there's just CHttpRequest::set_url(URL), no need to specify the
host, port and path manually anymore.

Updated ChanViewer and Downloader for the API change.
2019-08-10 19:32:03 +02:00
Andreas Kling
ed43770b2f AK: Add a basic URL class to help us handle URL's
We're gonna need these as we start to write more networking programs.
2019-08-10 17:30:35 +02:00
Andreas Kling
afd25679bc GJsonArrayModel: Support fields that aren't tied to a single JSON value
Change the custom data massaging callback to take a const JsonObject&.
This will allow binding together data from multiple fields into one
output in the model. :^)
2019-08-10 15:06:29 +02:00
Andreas Kling
078ce97c41 GJsonArrayModel: Add an optional "massage_for_display" fieldspec hook
This allows to you install a custom callback that can do anything with
Role::Display data before it's returned by GJsonArrayModel::data().
2019-08-10 11:06:29 +02:00
Andreas Kling
6e50631e35 LibGUI: Add GJsonArrayModel, a simple JSON-data-file-as-GModel helper
This makes it very easy to expose JSON files as GModels. :^)
2019-08-10 10:29:46 +02:00
Sergey Bugaev
cfe8fdd5aa LibM: Implement sqrt()
Use the x87 fsqrt instruction for that.

We cannot use __builtin_sqrt(), since GCC expands it into
a sqrt() call, so we just loop endlessly.
2019-08-10 08:46:22 +02:00
Andreas Kling
0a061d4314 GLabel: Repaint immediately on icon change 2019-08-09 23:48:44 +02:00
Andreas Kling
db6ed8eebd GFilePicker: Make double-clicking actually choose/pick the file
..unless it's a directory, in which case we navigate into the directory
instead, as you would expect.
2019-08-09 23:45:04 +02:00
Andreas Kling
d31ddf9aaa Painter: Fix off-by-one in bounding rects for right-aligned text
Another instance of "Rect::right() is the last pixel *inside* the rect,
not the first pixel outside the rect" messing me up.
2019-08-09 19:51:14 +02:00
Andreas Kling
b5525d4ec3 GTableView: Add a mode for automatically sizing column to fit content
You can now call GTableView::set_size_columns_to_fit_content(true) and
the table columns will grow to fit the content. They will never shrink,
only grow.

This means I can spend a lot less time fidgeting with column widths :^)
2019-08-09 19:30:24 +02:00
Andreas Kling
899366da9d GTableView: Debug-log the current column width while resizing
This makes it easier to decide on a good initial width for a column.
2019-08-08 20:41:24 +02:00
Conrad Pankoff
da615e46cd LibCore: Initialise m_port as zero in CSocketAddress 2019-08-06 15:06:20 +02:00
Andreas Kling
fdcaf2d2b5 GComboBox: Make set_only_allow_values_from_model() actually take effect 2019-08-05 18:52:29 +02:00
Andreas Kling
6311a617be GComboBox: Include the selected index with the on_change notification
This will be useful for clients that need to fetch additional data from
the model on selection change.
2019-08-05 18:42:51 +02:00
Andreas Kling
ffff150435 LibGUI: Allow specifying the model column for GListView and GComboBox
These widgets can only display a single column from the underlying data
model, and it was previously hard-coded to use column 0. Now you can
use any column you like.
2019-08-05 18:32:04 +02:00
Andreas Kling
7c0f9ea2b9 GComboBox: Constrain the list popup window height to the desktop rect
This looks much better than allowing it to extend past the bottom of
the screen. :^)
2019-08-05 18:31:13 +02:00
Sergey Bugaev
211b51dab7 CEventLoop: Create the wake pipe with O_CLOEXEC
This ensures the pipe fds don't leak into child processes.
This manifested as the Shell (and all processes started
from the shell) having two mysterious FIFOs open. This
was happening because of the Terminal, which the shell
was spawned form, leaking its CEventLoop wake pipe fds.
2019-08-05 16:04:31 +02:00
Sergey Bugaev
9c3b1ca0c6 Kernel+LibC: Support passing O_CLOEXEC to pipe()
In the userspace, this mimics the Linux pipe2() syscall;
in the kernel, the Process::sys$pipe() now always accepts
a flags argument, the no-argument pipe() syscall is now a
userspace wrapper over pipe2().
2019-08-05 16:04:31 +02:00
Conrad Pankoff
ed66f1d6d4 LibCore: Add CTCPServer
This is pretty much a find/replace copy of CLocalServer, and some
modifications to CTCPSocket and CSocketAddress to support it.
2019-08-05 12:53:07 +02:00
Andreas Kling
54ed6a888d LibCore: Move CHttpJob and CNetworkJob output to the right places
Errors go to stderr, debug output goes to the debug console. :^)
2019-08-04 22:10:54 +02:00
Andreas Kling
948c2657d6 CSocket: Close the underlying socket on destruction
Otherwise we leak the file descriptor.
2019-08-04 22:02:25 +02:00
Andreas Kling
b5aac9c44b CHttpJob: Drive response download via on_ready_read instead of blocking
This allows the event loop to service events while an HTTP download is
happening. Pretty cool :^)
2019-08-04 18:59:06 +02:00
Conrad Pankoff
c0ba6f69f0 LibC: Define SIZE_MAX
According to the internet, this is a safe way to define SIZE_MAX. There
may be a better way to do it, but this worked for me.
2019-08-04 18:46:58 +02:00
Andreas Kling
a8740f82eb CHttpJob: Collect the payload as a list of buffers during download
Instead of growing the payload buffer as-we-go. This avoids wasting a
ton of time on buffer reallocation for non-trivial payloads.
2019-08-04 14:54:25 +02:00
Andreas Kling
273d9d6cf5 CHttpJob: If no "Content-Length" header was received, read until EOF
Instead of aborting after receiving the first chunk, we have to keep
reading until EOF.
2019-08-04 09:26:08 +02:00
Andreas Kling
7d08116a6d LibDraw: Add Font::default_bold_fixed_width_font()
We need a way to get a bold version of the default fixed-width font.
2019-08-04 08:14:53 +02:00
Andreas Kling
8e684f0959 AudioServer: Port to the new generated IPC mechanism
Fork the IPC Connection classes into Server:: and Client::ConnectionNG.
The new IPC messages are serialized very snugly instead of using the
same generic data structure for all messages.

Remove ASAPI.h since we now generate all of it from AudioServer.ipc :^)
2019-08-03 19:49:19 +02:00
Andreas Kling
3519b6c201 IPCCompiler: More work towards AudioServer bringup
- Add IEndpoint::handle(IMessage), a big switch table on message type.
  handle() will return a response message for synchronous messages,
  and return nullptr otherwise.
- Use i32 instead of int for everything
- Make IMessage::encode() const
- Make IEndpoint::decode_message() static, this allows template code to
  decode messages without an endpoint instance on hand.
2019-08-03 19:24:08 +02:00
Andreas Kling
05e08afcd8 IPCCompiler: Generate getters for message ID's and message names
Each endpoint namespace will have an enum class MessageID where you can
find all of its messages.
2019-08-03 16:19:14 +02:00
Andreas Kling
a40e763b2a LibIPC: Start fleshing out a separate IPC library
This will be a place to put object serialization/deserialization logic,
message parsing, endpoint management, etc.
2019-08-03 15:29:40 +02:00
Andreas Kling
47511b5930 GWidget: Implement set_backcolor() and set_forecolor()
These are set-color-from-string variants used by the VisualBuilder's
code generator.
2019-08-03 11:35:10 +02:00
Andreas Kling
54c77cb714 GVariant: Try to do color string parsing in GVariant::to_color()
If the underlying variant type is a String, try to parse out a color
when to_color() is called.

This makes VisualBuilder apply the saved colors when loading forms.
2019-08-03 11:34:02 +02:00
Andreas Kling
e43b27a3fa LibDraw: Add Color::from_string(StringView)
This parses hex colors in either #RRGGBBAA or #RRGGBB format.
No other formats are supported at the moment.
2019-08-03 11:33:34 +02:00
Andreas Kling
7f25959fa2 LibCore: Make get_current_user_home_path() return String & close passwd
This API was returning a "const char*" and it was unclear who took care
of the underlying memory. Returning a String makes that obvious.

Also make sure we close the /etc/passwd file when we're done with it.
2019-08-03 08:32:07 +02:00
rhin123
c02868f000 LibGUI: Allow setting window icon before show(). 2019-08-02 21:18:21 +02:00
Andreas Kling
33b0c4cfaf LibAudio: Explicitly ignore IPC postprocessing requests
We don't need to do any IPC postprocessing in LibAudio (yet.)
This is the mechanism used by LibGUI to do repaint coalescing etc.
2019-08-02 19:57:30 +02:00
Jesse
401c87a0cc Kernel: mount system call (#396)
It is now possible to mount ext2 `DiskDevice` devices under Serenity on
any folder in the root filesystem. Currently any user can do this with
any permissions. There's a fair amount of assumptions made here too,
that might not be too good, but can be worked on in the future. This is
a good start to allow more dynamic operation under the OS itself.

It is also currently impossible to unmount and such, and devices will
fail to mount in Linux as the FS 'needs to be cleaned'. I'll work on
getting `umount` done ASAP to rectify this (as well as working on less
assumption-making in the mount syscall. We don't want to just be able
to mount DiskDevices!). This could probably be fixed with some `-t`
flag or something similar.
2019-08-02 15:18:47 +02:00
Andreas Kling
3f91d2d0cc CEventLoop: Devirtualize take_pending_events_from(CEventLoop) 2019-08-02 13:58:55 +02:00
Andreas Kling
38c80d5e6d LibHTML: Make some use of Vector::empend(). 2019-08-01 16:50:15 +02:00
Andreas Kling
673a98258b GDirectoryModel: Fix redundant identical comparison.
Found by PVS-Studio.
2019-08-01 14:01:37 +02:00
Andreas Kling
ab8891c064 LibCore: Initialize pid/id variables in CoreIPC{Client,Server}
Also rename CoreIPCServer::m_pid to m_client_pid for clarification.

Found by PVS-Studio.
2019-08-01 11:42:30 +02:00
Andreas Kling
b2aea6b4ff Painter: Scaling RGBA32 bitmaps treated the source as alpha-less RGB32
Found by PVS-Studio.
2019-08-01 11:05:52 +02:00
Andreas Kling
be4d33fb2c Kernel+LibC: A lot of the signal handling code was off-by-one.
There is no signal 0. The valid ones are 1 (SIGHUP) through 31 (SIGSYS)
Found by PVS-Studio.
2019-08-01 11:03:48 +02:00
Andreas Kling
bd08664f05 LibC: In fgetc(), fread() will never return < 0.
Furthermore, fread() has already handled EOF, so there's no need to do
it again. If we read a character, return it, otherwise return EOF.
Note that EOF means "EOF or error" here.
2019-08-01 10:50:51 +02:00
Andreas Kling
caeb4b7a7e CEventLoop: Add a missing initializer to EventLoopTimer. 2019-08-01 10:49:31 +02:00
Andreas Kling
385e9268f4 CIODevice: printf() thought it was calling ::write() but it was write()
There's some confusion between the write syscall and CIODevice::write()
here. The internal write() returns a boolean, and has already whined
in case the syscall failed, so we don't need to do that again.
2019-08-01 10:41:04 +02:00
Andreas Kling
db5a4c3409 GDirectoryModel: Tweak default width of permission bits column
Now that GTableView elides text content by default, this column was a
little too wide and ended up getting elided sometimes.
2019-07-31 21:21:20 +02:00
Andreas Kling
df51014834 GTableView: Elide cell content so it doesn't overflow the cell rect
I originally thought I'd have to implement text clipping in Painter for
this, but it seems like I can get away without doing that today. :^)

Fixes #390.
2019-07-31 21:18:01 +02:00
Conrad Pankoff
6b5fbad250 LibGUI: Simplify GTreeView ancestor traversal 2019-07-31 16:38:10 +02:00
Conrad Pankoff
9b6e99f17e LibGUI: Reify intermediate nodes during index traversal
In the event where you want to find the index of a deeply-nested path
with a GFileSystemModel that hasn't yet traversed most of that path, it
is possible for a false negative failure to occur. This failure is
caused by the GFileSystemModel incorrectly bailing out of the search
when it hits the first unseen path segment that is not at the very end
of the path.

This patch fixes this problem by reifying the intermediate nodes during
that search and traversal process.
2019-07-31 16:33:21 +02:00
Andreas Kling
993ab84a0d GDirectoryModel: Add "modification time" column.
Fixes #373.
2019-07-31 07:09:35 +02:00
Andreas Kling
10b4c92e21 GVariant: Add Type::UnsignedInt. 2019-07-31 07:07:59 +02:00
Andreas Kling
34db7067fa GDirectoryModel: Shrink the Permissions and Inode columns a little bit. 2019-07-31 06:50:01 +02:00
Andreas Kling
0f3d191a70 LibCore: Rename CFileStreamReader => CIODeviceStreamReader. 2019-07-30 15:16:39 +02:00
rhin123
c869d62e16 GFilePicker: Edit file name on opening window
Overlooked that you can't have two GWidgets
selected at the same time, whoops!
2019-07-30 09:19:14 +02:00
Andreas Kling
e6db1b81b8 AudioServer: Begin work on a new IPC API style.
The goal here is to generate most of this code from IPC protocol
descriptions, but for now I've spelled them all out to get started.

Each message gets a wrapper class in the ASAPI_Client or ASAPI_Server
namespace. They are convertible to and from the old message structs.

The real hotness happens when you want to make a synchronous request
to the other side:

    auto response = send_sync<ASAPI_Client::GetMainMixVolume>();

Each request class knows his corresponding response class, so in the
above example, "response" will be an ASAPI_Server::DidGetMainMixVolume
object, and we can get the volume like so:

    int volume = response.volume();

For posting messages that don't expect a response, you can still use
post_message() since the message classes are convertible:

    post_message(ASAPI_Server::DidGetMainMixVolume(volume));

It's not perfect yet, but I already really like it. :^)
2019-07-29 22:39:20 +02:00
rhin123
a175e76948 TextEditor: Include extension during SaveAs
When we save-as in the text editor we now auto-populate GFilePicker /w
the current name & extension.
2019-07-29 20:46:31 +02:00
Andreas Kling
15afc88ffe AudioServer: Add a "main mix volume" and a simple program to get/set it
Give the mixer a main volume value (percent) that we scale all the
outgoing samples by (before clipping.)

Also add a simple "avol" program for querying and setting the volume:

- "avol" prints the current volume.
- "avol 200" sets the main mix volume to 200%
2019-07-29 19:06:58 +02:00
Andreas Kling
57c29491a3 Kernel+AK: Remove AK/StdLibExtras.cpp, moving kernel stuff to Kernel/.
We had some kernel-specific gizmos in AK that should really just be in the
Kernel subdirectory instead. The only thing remaining after moving those
was mmx_memcpy() which I moved to the ARCH(i386)-specific section of
LibC/string.cpp.
2019-07-29 11:58:44 +02:00
Andreas Kling
5ded77df39 Kernel+ProcessManager: Let processes have an icon and show it in the table.
Processes can now have an icon assigned, which is essentially a 16x16 RGBA32
bitmap exposed as a shared buffer ID.

You set the icon ID by calling set_process_icon(int) and the icon ID will be
exposed through /proc/all.

To make this work, I added a mechanism for making shared buffers globally
accessible. For safety reasons, each app seals the icon buffer before making
it global.

Right now the first call to GWindow::set_icon() is what determines the
process icon. We'll probably change this in the future. :^)
2019-07-29 07:26:01 +02:00
Andreas Kling
66f8ea92cb LibAudio: Silence some debug spam in the WAV loader. 2019-07-28 21:54:34 +02:00
Andreas Kling
ae4a9e017a LibAudio+aplay: Make the aplay output look a little funner.
Show some information about the file we're playing, and display how many
samples we've played out of how many total.

This might be a bit buggy as I haven't tested it with many different files,
but it's a start. :^)
2019-07-28 21:52:30 +02:00
Andreas Kling
b44d3faa1c LibAudio: WAV: Don't emit the very last sample in each decoded batch.
This is a total hack, because I haven't really looked into why these are
happening. Somehow we're producing one extra sample and it's glitching
up the sound stream ever so slightly.
2019-07-28 21:34:47 +02:00
Andreas Kling
be31e2232c AudioServer+LibAudio: Make mixing queue-based instead of buffer-based.
Each client connection now sets up an ASBufferQueue, which is basically a
queue of ABuffers. This allows us to immediately start streaming the next
pending buffer whenever our current buffer runs out of samples.

This makes the majority of the skippiness go away for me. :^)

Also get rid of the old PlayBuffer API, since we don't need it anymore.
2019-07-28 21:34:47 +02:00
Rhin
731f91f1ab GFilePicker: Quality of life improvements (#370)
Added:
- Default to home directory on open.
- Save button focus.
- Correct title for the mode were in.
- Home directory shortcut.
2019-07-28 20:04:57 +02:00
Andreas Kling
7cabe6433e AudioServer: Add a buffer queue so we can buffer some sound.
The idea here is to keep a small number of sample buffers queued in the
AudioServer so we don't get caught without something to play.
2019-07-28 18:27:32 +02:00
Andreas Kling
7f82e86fb8 GTabWidget: Allow putting the tabs on the bottom of the widget.
They're still painted as if they are top tabs, but the subwidget placement
logic is all there.
2019-07-28 17:43:51 +02:00
Andreas Kling
d4892b3fdc WindowServer+LibGUI: Remove old "icon path" way of doing things.
Now that we can set icons directly "by bitmap", there's no need for passing
around the icon paths anymore, so get rid of all the IPC and API related
to that. :^)
2019-07-28 10:24:58 +02:00
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
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
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
68c20e50da LibAudio: WAV reading should stop when we run out of file. :^) 2019-07-27 18:54:03 +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
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
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
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
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
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
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
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
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
e423bb4901 LibHTML: A tiny bit of work towards block layout. 2019-07-26 08:05:14 +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
Andreas Kling
d21a4f7518 CEventLoop: Don't re-process already processed events when un-nesting.
If we had already processed a couple of queued events by the time we were
told to un-nest the event loop, we'd put the entire current batch at the
head of the outer queue. This meant that we might end up trying to process
the same events multiple times.

Let's not do that. :^)
2019-07-25 16:12:51 +02:00
Andreas Kling
a6b5bb439c LibC: Don't clobber errno in free().
This one is a bit mysterious. I can't find any authoritative answer on what
the correct behavior is, but it seems reasonable to me that free() doesn't
step on errno, since it returns "void" and thus the caller won't know to
inspect errno anyway.
2019-07-25 15:23:29 +02:00
Andreas Kling
3048e4b9f5 LibC: Make sure we always return the intended errno from execvpe(). 2019-07-25 15:21:50 +02:00
Andreas Kling
9fb2a65716 AK: Rename ValueRestorer => ScopedValueRollback.
Qt had a pretty good name for this concept, so let's steal it. :^)
2019-07-25 15:15:46 +02:00
Andreas Kling
f46a1377ac CSocket: Add missing <sys/un.h> include to fix host build. 2019-07-25 11:49:08 +02:00
Andreas Kling
16bcaf08a3 CSocket: Fix Clang warning about unused private member m_type. 2019-07-25 11:48:21 +02:00
Andreas Kling
e940d4b07b LibCore: Only build CThread on Serenity platforms. 2019-07-25 11:47:53 +02:00
Andreas Kling
f186c018f1 LibC: Fix execvpe() exiting with bad errno when giving up.
This is still not perfect, but at least it fixes one such issue.
2019-07-25 07:05:05 +02:00
Andreas Kling
1d0b464618 AK: Make HashMap::get(Key) return an Optional<Value>.
This allows HashMap::get() to be used for value types that cannot be default
constructed (e.g NonnullOwnPtr.)
2019-07-24 10:25:43 +02:00
Andreas Kling
2196f17c10 LibGUI: Convert Vector<OwnPtr> to NonnullOwnPtrVector.
This is turning out really nice so far. :^)
2019-07-24 09:13:06 +02:00
Andreas Kling
93489fbc4c Convert HashMap<Key, OwnPtr<T>> to HashMap<Key, NonnullOwnPtr<T>>.
In every case I found, we never wanted to support null entry values.
With NonnullOwnPtr, we can encode that at the type level. :^)
2019-07-24 08:42:55 +02:00
Andreas Kling
3c5befde36 CEventLoop: Use NonnullOwnPtr for QueuedEvent::event.
We don't allow null events in the event queue. :^)
2019-07-24 08:38:28 +02:00
Andreas Kling
f88c5860df LibHTML: Fetch the box edge values needed for block width computation. 2019-07-24 07:34:07 +02:00
Andreas Kling
af23b38418 LibHTML: Fix host build. 2019-07-24 07:27:07 +02:00
Andreas Kling
356babaf96 LibGUI: Destroy tooltip windows when they are not used.
Cached tooltip windows were preventing the automatic event loop shutdown.
It's not like we were gaining much by caching these anyway, since we only
cached the GWindow, not anything on the WindowServer side.
2019-07-23 20:51:08 +02:00
Andreas Kling
72a3f69df7 LibGUI: Get rid of GWindow::should_exit_event_loop_on_close().
This behavior and API was extremely counter-intuitive since our default
behavior was for applications to never exit after you close all of their
windows.

Now that we exit the event loop by default when the very last GWindow is
deleted, we don't have to worry about this.
2019-07-23 18:20:00 +02:00
Andreas Kling
fbae03b737 LibGUI: Exit the main event loop when the last window is deleted.
This behavior is the new opt-out default. If you don't want your app to exit
when the last GWindow is destroyed, call this:

    - void GApplication::set_quit_set_quit_when_last_window_deleted(bool)

Also renamed "windows()" to "reified_windows" in GWindow.cpp to reflect that
it only contains GWindows that have a server-side representation. :^)
2019-07-23 18:16:25 +02:00
Andreas Kling
528d8d49dc LibDraw: Add LogStream operator<< overload for Color. 2019-07-23 14:56:42 +02:00
Andreas Kling
66646081b7 CEventLoop: Avoid undefined evaluation order in register_timer(). 2019-07-23 14:55:12 +02:00
Andreas Kling
b312215d33 GDirectoryModel: Don't forget to drain the watch descriptor. 2019-07-22 20:12:35 +02:00
Andreas Kling
1511cac715 GDirectoryModel: Automagically update on filesystem changes.
Use the new watch_file() mechanism to monitor the currently open directory
for changes and refresh the model when notified. This makes FileManager
automagically show newly added files. :^)
2019-07-22 20:08:25 +02:00
Andreas Kling
c8e2bb5605 Kernel: Add a mechanism for listening for changes to an inode.
The syscall is quite simple:

    int watch_file(const char* path, int path_length);

It returns a file descriptor referring to a "InodeWatcher" object in the
kernel. It becomes readable whenever something changes about the inode.

Currently this is implemented by hooking the "metadata dirty bit" in
Inode which isn't perfect, but it's a start. :^)
2019-07-22 20:01:11 +02:00
Andreas Kling
af81645a2a Kernel+LibC: Add a dbgputstr() syscall for sending strings to debug output.
This is very handy for the DebugLogStream implementation, among others. :^)
2019-07-21 21:43:37 +02:00
Andreas Kling
0ef13e60b0 Libraries: Fix wrong paths to "Root" in the various install.sh scripts.
We were installing libraries into /Libraries/Root, rather than in /Root.
This made the ports system behave rather unpredictable, since I had old
versions of things in /Root and new versions of things in /Libraries/Root.
2019-07-21 21:38:30 +02:00
Andreas Kling
c7ea94697e Libraries: Remove unused "install" targets.
We've been using a per-directory "install.sh" for some time, so let's get
rid of the old way of doing things.
2019-07-21 21:28:48 +02:00
Andreas Kling
3fce2fb205 Kernel+LibC: Add a dbgputch() syscall and use it for userspace dbgprintf().
The "stddbg" stream was a cute idea but we never ended up using it in
practice, so let's simplify this and implement userspace dbgprintf() on top
of a simple dbgputch() syscall instead.

This makes debugging LibC startup a little bit easier. :^)
2019-07-21 19:45:31 +02:00
Robin Burchell
f2c0e55070 Userspace: Deal with select() returning EINTR on a signal interruption
Add a trivial CSafeSyscall template that calls a callback until it stops
returning EINTR, and use it everywhere we use select() now.

Thanks to Andreas for the suggestion of using a template parameter for
the syscall function to invoke.
2019-07-21 14:27:14 +02:00
Andreas Kling
98b569a702 CEventLoop: Skip over null events in the queue.
Added some FIXME's about correctness issues in nested event loop exiting.
2019-07-21 10:18:00 +02:00
Andreas Kling
d2b521f0ab Kernel+LibC: Add a dump_backtrace() syscall.
This is very simple but already very useful. Now you're able to call to
dump_backtrace() from anywhere userspace to get a nice symbolicated
backtrace in the debugger output. :^)
2019-07-21 09:59:17 +02:00
Andreas Kling
aa2224a2f0 GWidget: Add set_preferred_size(width, height) overload.
It was annoying to always write set_preferred_size({ width, height }). :^)
2019-07-20 22:39:24 +02:00
Andreas Kling
5b440a72f9 GSplitter: Implement using the orientation-based geometry helpers. 2019-07-20 22:17:46 +02:00
Andreas Kling
2a14ba99a7 LibDraw: Add orientation-based size helpers to Size as well.
Now you can ask for e.g Size::primary_size_for_orientation(Orientation).
2019-07-20 22:16:40 +02:00
Andreas Kling
c59b053ad6 GSlider: Add support for vertical sliders.
You now have to pass an Orientation to the GSlider constructor. It's not
possible to change the orientation after construction.

Added some vertical GSliders to the WidgetGallery demo for testing. :^)
2019-07-20 19:32:12 +02:00
Andreas Kling
8ab1923abe LibDraw: Add orientation-based offset/size manipulation helpers.
These are useful when doing widgets that can be switched between vertical
and horizontal mode, such as GSlider. The idea is that instead of using
"x" and "y" directly, you use the "primary" and "secondary" offset/size
for the Orientation you're configured in.
2019-07-20 19:32:12 +02:00
Andreas Kling
26e252b0f8 LibDraw: Move the Orientation enum to its own LibDraw header file. 2019-07-20 19:32:12 +02:00
Andreas Kling
046f00f77e CEventLoop: Use Vector::prepend(Vector&&) to shuffle events to outer loop.
When exiting a nested event loop, we prepend any unprocessed events to the
outer loop's event queue.
2019-07-20 16:11:45 +02:00
Andreas Kling
26c29e59ec CEventLoop: Remove some no-longer-used virtuals. 2019-07-20 15:50:03 +02:00
Jesse
a5d80f7e3b Kernel: Only allow superuser to halt() the system (#342)
Following the discussion in #334, shutdown must also have root-only
run permissions.
2019-07-19 13:08:26 +02:00
Jesse
a27c9e3e01 Kernel+Userland: Addd reboot syscall (#334)
Rolling with the theme of adding a dialog to shutdown the machine, it is
probably nice to have a way to reboot the machine without performing a full
system powerdown.

A reboot program has been added to `/bin/` as well as a corresponding
`syscall` (SC_reboot). This syscall works by attempting to pulse the 8042
keyboard controller. Note that this is NOT supported on  new machines, and
should only be a fallback until we have proper ACPI support.

The implementation causes a triple fault in QEMU, which then restarts the
system. The filesystems are locked and synchronized before this occurs,
so there shouldn't be any corruption etctera.
2019-07-19 09:58:12 +02:00
Andreas Kling
23d45532fc StylePainter: Tweak surface highlight color to match the system warm gray. 2019-07-18 21:30:18 +02:00
rhin123
598715d4cc GFilePicker: OKCancel MsgBox for overwriting files
Allow the user to Overwrite/Cancel when writing to an existing file.
2019-07-18 21:04:02 +02:00
Robin Burchell
d19136ce07 AWavLoader: Share code between 24/16/8 bit reading
The only part of this that actually differs between all of them is the
stream -> sample reading, so turn that into a function that the channel
reader can call as it wants.
2019-07-18 13:45:10 +02:00
Robin Burchell
a2fbfb6cef AWavLoader: Support 24 bit wav files (mono & stereo) 2019-07-18 13:45:10 +02:00
Andreas Kling
1c0669f010 LibDraw: Introduce (formerly known as SharedGraphics.)
Instead of LibGUI and WindowServer building their own copies of the drawing
and graphics code, let's it in a separate LibDraw library.

This avoids building the code twice, and will encourage better separation
of concerns. :^)
2019-07-18 10:18:16 +02:00
Robin Burchell
b907608e46 SharedBuffer: Split the creation and share steps
This allows us to seal a buffer *before* anyone else has access to it
(well, ok, the creating process still does, but you can't win them all).

It also means that a SharedBuffer can be shared with multiple clients:
all you need is to have access to it to share it on again.
2019-07-18 10:06:20 +02:00
Robin Burchell
57da716be0 ps: Port to using CProcessStatisticsReader and /proc/all
Drop /proc/summary in the process.
We only needed one new field here, thankfully, so this was quite straightforward.
2019-07-18 07:23:26 +02:00
Robin Burchell
a9d1a86e6e CProcessStatisticsReader: Be consistent about terminology from the kernel down 2019-07-18 07:23:26 +02:00
Robin Burchell
7a53096e8d LibGUI: Revert GWindowServerConnection to being a singleton
This was a mistake, of course. Nested event loops don't need (or want)
independent server connections.

We initialize the connection early in GEventLoop for e.g. users that
want to get the size of a GDesktop before the connection has been
established.

Bug noticed by Andreas, introduced by me ;-)
2019-07-17 21:03:01 +02:00
Robin Burchell
9c8dd836fc Rename new IPC headers & classes
Sticking these in a namespace allows us to use a more generic
("Connection") term without clashing, which is way easier to understand
than to try to come up with unique names for both.
2019-07-17 20:16:44 +02:00
Robin Burchell
2177594c96 Port LibGUI to use CIPCClientSideConnection
As a consequence, move to use an explicit handshake() method rather than
calling virtuals from the constructor. This seemed to not bother
AClientConnection, but LibGUI crashes (rightfully) because of it.
2019-07-17 20:16:44 +02:00
Robin Burchell
41bece0682 Make AClientConnection generic 2019-07-17 20:16:44 +02:00
Robin Burchell
6eaa6826fa Port WSClientConnection to CIPCServerSideClient 2019-07-17 20:16:44 +02:00
Robin Burchell
edcbba9e98 Introduce CIPCServerSideClient
As a new base class of IPC connections server-side.
Port ASClientConnection to CIPCServerSideClient.
2019-07-17 20:16:44 +02:00
Robin Burchell
adeead24a3 LibC: Fix MALLOC_DEBUG to work 2019-07-17 12:55:47 +02:00
Robin Burchell
ac4f8fe350 AClientConnection: Fix double exit 2019-07-17 09:47:52 +02:00
Robin Burchell
fd6cafaa84 ABuffer: clamp -> clip
More natural term when talking about audio :)
2019-07-17 09:47:52 +02:00
Robin Burchell
ed25d524f2 ABuffer: move it and groove it 2019-07-17 09:47:52 +02:00
Robin Burchell
2df6f0e87f Work on AudioServer
The center of this is now an ABuffer class in LibAudio.
ABuffer contains ASample, which has two channels (left/right) in
floating point for mixing purposes, in 44100hz.

This means that the loaders (AWavLoader in this case) needs to do some
manipulation to get things in the right format, but that we don't need
to care after format loading is done.

While we're at it, do some correctness fixes. PCM data is unsigned if
it's 8 bit, but 16 bit is signed. And /dev/audio also wants signed 16
bit audio, so give it what it wants.

On top of this, AudioServer now accepts requests to play a buffer.
The IPC mechanism here is pretty much a 1:1 copy-paste from
LibGUI/WindowServer. It can be generalized more in the future, but for
now I want to get AudioServer working decently first :)

Additionally, add a little "aplay" tool to load and play a WAV file. It
will break with large WAVs (run out of memory, heh...) but it's a start.

Future work needs to make AudioServer block buffer submission from
clients until it has played the buffer they are requesting to play.
2019-07-17 09:39:31 +02:00
Andreas Kling
a17fbd98e7 LibGUI: Add input types to GMessageBox.
Currently the two available input types are:

- GMessageBox::InputType::OK (default)
- GMessageBox::InputType::OKCancel

Based on your choice, GMessageBox::exec() will return ExecOK or ExecCancel.
2019-07-16 21:41:13 +02:00
Robin Burchell
d8387f1506 CNotifier: Turn into a CObject and Use the event queue to deliver events
This way, CNotifier can mutate state to its little heart's content
without destroying the world when the global CNotifier hash changes
during delivery.
2019-07-16 20:47:32 +02:00
Robin Burchell
a714fc661d LibCore: Add a way to mark a socket as blocking (or not)
If custom I/O is being done outside CIODevice, we need a way to force blocking sometimes.
This also fixes the default of CLocalSocket to be non-blocking, the same
as CTCPSocket.
2019-07-16 20:22:54 +02:00
Robin Burchell
7bf420d83d CNotifier: Provide a way to unregister a notifier temporarily 2019-07-16 15:23:57 +02:00
Robin Burchell
e922db68d8 CSocket: Also call on_connected for local socket connections 2019-07-16 13:18:37 +02:00
Robin Burchell
14b2f90920 LibCore: Always call on_connected whether the connection was synchronous or not
It's unreasonable to expect the client to have to call it themselves if
the connection was immediate (local).
2019-07-16 13:18:37 +02:00
rhin123
fdb365856d GFilePicker: Changed file_exists MessageBox to warning
Forgot to remove Error in the title. Going to be replaced by YesNo
GMessagebox in the future.
2019-07-16 08:34:51 +02:00
rhin123
82d9410226 TextEditorWidget: Added improved save feature.
Instead of saving to a temp file, the TextEditorWidget now saves
to a path returned by the improved GFilePicker.
2019-07-15 18:33:33 +02:00
Andreas Kling
954a0b8efe AK: Add a canonicalized_path() convenience function.
This is the same as calling FileSystemPath(foo).string(). The majority of
clients only care about canonicalizing a path, so let's have an easy way
to express that.
2019-07-15 06:50:32 +02:00
Robin Burchell
cd497accbe CLocalSocket: Add missing pragma once 2019-07-14 15:29:59 +02:00
Robin Burchell
7b75632e5c AK/LibAudio: Add stream read operators to AK::BufferStream, and use it in AWavLoader
At the same time, we allow chaining of streaming operators, and add a
way to check for partial reads (also used in WAV parsing).
2019-07-14 15:29:59 +02:00
Andreas Kling
e8d61bb8c0 CEventLoop: Oops, I had the pipe reader/writer fd's mixed up. 2019-07-14 14:28:24 +02:00
Andreas Kling
4c0c93ce09 LibCore: Oops, fix infinite recursion in LogStream << CSocketAddress. 2019-07-14 14:24:37 +02:00
Andreas Kling
de03b72979 LibC: Add WIFSTOPPED() macro in <sys/wait.h>. 2019-07-14 11:31:53 +02:00
Andreas Kling
c9ee481cdf LibCore: Port CSocket over to using dbg().
Also added a LogStream operator<< for CSocketAddress.
2019-07-14 11:02:40 +02:00
Andreas Kling
b4329a8eec CObject: Add LogStream operator<< for CObject. 2019-07-14 10:59:26 +02:00
Andreas Kling
a634fab3c4 CObject: Add custom_event() virtual.
This way you can just override custom_event() to catch CCustomEvent instead
of having to filter the entire event stream with event(). :^)
2019-07-14 10:27:27 +02:00
Andreas Kling
17ee548bcd CEventLoop: Add wake(), a mechanism for waking up when blocked in select().
This patch generalizes the concept used in Piano to wake up the event loop
so it can react to something happening on a secondary thread.
Basically, there's a pipe who is always part of the file descriptor set we
pass to select(), and calling wake() simply writes a little to that pipe.
2019-07-14 10:20:57 +02:00
Andreas Kling
f1d6a37d5d LibCore: Add CThread, a simple thread abstraction object.
Currently this is only a simple wrapper around create_thread() that
remembers the thread ID of the spawned thread.
2019-07-14 10:19:51 +02:00
Robin Burchell
0a1bd03f1d WindowServer: Add a custom window type for Launcher
This keeps it out of the taskbar window list.
The stacking order is a little gnarly, but it seems to work OK still.
2019-07-14 00:06:47 +02:00
Robin Burchell
ffa8cb668f AudioServer: Assorted infrastructure work
* Add a LibAudio, and move WAV file parsing there (via AWavFile and AWavLoader)
* Add CLocalSocket, and CSocket::connect() variant for local address types.
  We make some small use of this in WindowServer (as that's where we
  modelled it from), but don't get too invasive as this PR is already
  quite large, and the WS I/O is a bit carefully done
* Add an AClientConnection which will eventually be used to talk to
  AudioServer (and make use of it in Piano, though right now it really
  doesn't do anything except connect, using our new CLocalSocket...)
2019-07-13 22:57:24 +02:00
Andreas Kling
302cae5c2f CEventLoop: When asked to exit the event loop, exit right away.
Don't process any more events. We already prepend the remaining events in
this loop to the outer loop if needed.

If there were any more events queued after the exit request, the iteration
code would make an invalid access into 'queued_events'.

Fixes #300.
2019-07-13 19:54:57 +02:00
Andreas Kling
cf1afcafbc LibC: Protect the malloc heap with a basic lock. 2019-07-13 18:36:19 +02:00
Andreas Kling
debc587ce2 LibCore: Add CCustomEvent, a custom CEvent for arbitrary use.
For convenience it includes an int, and a void*. Interpretation of the
contents is up to the client.
2019-07-13 18:35:13 +02:00
Andreas Kling
b425de18cc LibGUI: Add an auto-repeat interval to GAbstractButton.
Use this in GSpinBox to implement auto-increment / auto-decrement while you
are pressing down the respective buttons. :^)
2019-07-13 10:27:19 +02:00
Andreas Kling
c53f6a52e0 LibC: Fix make target dependency that was breaking parallel make sometimes. 2019-07-13 08:09:53 +02:00
Andreas Kling
974c0f97b8 GGroupBox: Allow constructing these without an initial text. 2019-07-11 20:16:34 +02:00
Lawrence Manning
01998a10e3 GSlider: Make the knob width proportional to the range, if in that mode (#288)
Regardless of mode, made the knob container clickable so the knob position
can be moved without dragging the knob itself.

Added a 3rd GSlider to the WidgetGallery showing the proportional mode in
action.
2019-07-11 16:31:43 +02:00
Andreas Kling
b522e3cc05 GWidget: Make set_font() take either Font* or Font&. 2019-07-11 16:02:39 +02:00
Andreas Kling
7faf878e0a GToolBar: Make add_action() take a GAction& instead of NonnullRefPtr&&.
There's very little reason to take NonnullRefPtr&& in arguments really.
You can avoid ref-count churn in the cases where ownership is transferred
from the caller to the callee, but that's a pretty unusual situation and
not worth optimizing for at this stage.
2019-07-11 15:57:29 +02:00
Andreas Kling
22528d8db3 GLabel: Make set_icon() take a GraphicsBitmap*.
Taking a RefPtr<GraphicsBitmap>&& was just making things unnecessarily
complicated for clients, and didn't actually improve anything.
2019-07-11 15:52:15 +02:00
Andreas Kling
992272761c LibGUI: Remove use of copy_ref(). 2019-07-11 15:49:47 +02:00
Andreas Kling
b3d431e390 GWidget: Add "set_autofill" as an alias for set_fill_with_background_color. 2019-07-10 21:12:09 +02:00
Andreas Kling
f465de8f76 GWidget: Add placeholder setters for the backcolor/forecolor properties. 2019-07-10 21:00:34 +02:00
Andreas Kling
b06d2c04dc CObject: Add a "name" property.
This will be useful for things like the VisualBuilder code generator.
2019-07-10 20:33:53 +02:00
Andreas Kling
c33766f039 LibCore: Tweak slightly-off error message in CProcessStatisticsReader. 2019-07-10 15:32:30 +02:00
Andreas Kling
01216f3c3f Userland+LibCore: Use CProcessStatisticsReader to implement top.
Also tweaked CProcessStatisticsReader a bit to simplify the API.
2019-07-10 13:56:28 +02:00
Andreas Kling
7083a0104a LibGUI: Add GActionGroup, a way to group a bunch of GActions.
This can be used to make a bunch of actions mutually exclusive.
This patch only implements the exclusivity behavior for buttons.
2019-07-09 22:10:03 +02:00
Andreas Kling
2ae0333f5d GAction: Remove "custom_data" and the related convenience constructors.
This mechanism was never actually used, just something I imagined would be
useful while I was first creating the class.
2019-07-09 21:28:52 +02:00
Andreas Kling
b149dd7584 LibC: Provide generic versions of memcpy() and memset() for non-i386 builds.
We don't actually do any non-i386 builds at the moment, this is just gently
steering in a nice direction for the future. :^)
2019-07-09 15:48:55 +02:00
Andreas Kling
c110cf193d Kernel: Have the open() syscall take an explicit path length parameter.
Instead of computing the path length inside the syscall handler, let the
caller do that work. This allows us to implement to new variants of open()
and creat(), called open_with_path_length() and creat_with_path_length().
These are suitable for use with e.g StringView.
2019-07-08 20:01:49 +02:00
Andreas Kling
fc127eb769 LibHTML: Create anonymous blocks around inline children of blocks. 2019-07-08 17:42:23 +02:00
Andreas Kling
0e75aba7c3 StringView: Rename characters() to characters_without_null_termination().
This should make you think twice before trying to use the const char* from
a StringView as if it's a null-terminated string.
2019-07-08 15:38:44 +02:00
Andreas Kling
56563cb305 CDirIterator: Fix another instance of StringView::characters() misuse. 2019-07-08 14:03:19 +02:00
Andreas Kling
b6dcb5e7ae LibC: Use IPv4Address::from_string() in gethostbyname(). 2019-07-08 11:40:12 +02:00
Andreas Kling
3c71dc4320 LibHTML: Oops, fix build.
It's another "hacking on the train and forgetting to try a full build"
episode, this time starring LibHTML.
2019-07-08 08:18:53 +02:00
Andreas Kling
8812b35c5e LibHTML: Reorganize layout tree build so that parents add their children.
This will allow us to insert anonymous blocks with ease.
2019-07-08 07:33:58 +02:00
Andreas Kling
0ccad4208f LibHTML: Move layout tree building to a separate function. 2019-07-08 07:24:15 +02:00
Andreas Kling
9526b0e13a LibHTML: Add InheritStyleValue and InitialStyleValue.
These correspond to the 'inherit' and 'initial' CSS values respectively.
2019-07-08 07:15:56 +02:00
Andreas Kling
105a97685e LibHTML: Fix host build after Libraries/ shuffle. 2019-07-08 07:14:18 +02:00
Andreas Kling
d47432487d GStackWidget: Add a notification hook for when the active widget changes. 2019-07-07 21:50:38 +02:00
Andreas Kling
8b0953a795 Libraries: Unbreak "make install" with new directory locations. 2019-07-04 16:41:42 +02:00
Andreas Kling
04b9dc2d30 Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
2019-07-04 16:16:50 +02:00