Commit Graph

3786 Commits

Author SHA1 Message Date
Andreas Kling
d64e698bf1 AK: Add a simple TriState type
enum class TriState : u8 { False, True, Unknown };
2019-08-15 20:53:12 +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
Sergey Bugaev
b4c607a8da Kernel: Add TmpFS
This is an FS that stores all of its contents directly in memory.
It's mounted on /tmp by default.
2019-08-15 19:20:51 +02:00
Andreas Kling
d92ba85689 Terminal: Mark window as alpha-less when starting up with 100% opacity
WindowServer was led to believe that the Terminal window had an alpha
channel that had to be respected by the compositor. This caused us to
always consider it as non-opaque when culling dirty rects in compose.
2019-08-15 15:30:11 +02:00
Andreas Kling
14888bd992 WindowServer: Add a mode for running without buffer flipping
We can't rely on all hardware to give us a way to flip between the back
and front buffer.

This mode should actually perform slightly better but may show some tearing
as we don't have a way to know when we're in vertical retrace.
2019-08-15 15:11:31 +02:00
Andreas Kling
2349dc1a21 StringView: Add StringView::operator==(StringView)
Previously we'd implicitly convert the second StringView to a String
when comparing two StringViews, which is obviously not what we wanted.
2019-08-15 14:09:27 +02:00
Andreas Kling
77737be7b3 Kernel: Stop eagerly loading entire executables
We were forced to do this because the page fault code would fall apart
when trying to generate a backtrace for a non-current thread.

This issue has been fixed for a while now, so let's go back to lazily
loading executable pages which should make everything a little better.
2019-08-15 10:29:44 +02:00
Andreas Kling
eaa9cf58f5 AK: Use int_hash() to generate less idiotic hashes for {Nonnull,}OwnPtr 2019-08-14 21:21:15 +02:00
Andreas Kling
e0395d5ebe SystemMonitor: Paint the "used" disk space column as a progress bar
This needs to be applied consistently in the rest of this UI, but here
is a start. I can't figure out what the right look should be right now
so I'm just gonna commit it this way and we'll work it out later. :^)
2019-08-14 20:38:18 +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
Andreas Kling
1ac963b5c8 JsonParser: "" is an empty string, not a null value 2019-08-14 15:01:42 +02:00
Sergey Bugaev
f6fe56d011 SystemMonitor: Add a PCI devices tab
This is essentially a graphical version of the lspci command.
2019-08-14 14:28:45 +02:00
Sergey Bugaev
cbdda91065 ProcessManager: Rename it to SystemMonitor
This is a more appropriate name now that it does a lot
more than just manage processes ^)
2019-08-14 14:28:45 +02:00
Conrad Pankoff
c7040cee62 Userland: Use LibPCIDB in lspci to print device names 2019-08-14 13:12:54 +02:00
Conrad Pankoff
37a2c03655 Misc: Import pci.ids file version 2019.08.08 2019-08-14 13:12:54 +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
fdcff7d15e AK: Make it possible to use HashMap<K, NonnullOwnPtr>::get()
Add the concept of a PeekType to Traits<T>. This is the type we'll
return (wrapped in an Optional) from HashMap::get().

The PeekType for OwnPtr<T> and NonnullOwnPtr<T> is const T*,
which means that HashMap::get() will return an Optional<const T*> for
maps-of-those.
2019-08-14 11:47:38 +02:00
Andreas Kling
f75b1127b2 OwnPtr: Add a way to turn an OwnPtr into a NonnullOwnPtr
Okay, so, OwnPtr<T>::release_nonnull() returns a NonnullOwnPtr<T>.
It assumes that the OwnPtr is non-null to begin with.

Note that this removes the value from the OwnPtr, as there can only be
a single owner.
2019-08-14 11:04:19 +02:00
Conrad Pankoff
99ed4ce30c Userland: Implement simple lspci command 2019-08-14 06:28:53 +02:00
Conrad Pankoff
6fe18a0417 Kernel: Hide PCI logs behind a debug flag like other logs 2019-08-14 06:28:53 +02:00
Conrad Pankoff
833f0beeed Kernel: Reimplement /proc/pci as JSON, add some more fields 2019-08-14 06:28:53 +02:00
Conrad Pankoff
dce003c7eb Kernel: Add more PCI configuration reading functions 2019-08-14 06:28:53 +02:00
Conrad Pankoff
06743932b8 AK: Support width/alt/caps/padding modifiers for %x in printf 2019-08-13 18:15:58 +02:00
Andreas Kling
7cc9a18c39 Terminal: Only repaint the lines that actually changed
This optimization was broken since who-knows-when. Now we once again do
our best to only repaint the lines that had the "dirty" flag set.

This dramatically reduces the amount of work done by an idle Terminal
since the cursor blinking won't redraw the whole window anymore. :^)
2019-08-13 13:57:04 +02:00
Andreas Kling
ce6463ba76 Terminal: Clip to the paint event rect
We should try to avoid painting any more than what we're asked to.
2019-08-13 13:45:58 +02:00
Andreas Kling
178788f19a Terminal: Rename Terminal => TerminalWidget
This makes it a bit less confusing which is what between TerminalWidget
and VT::Terminal.
2019-08-13 13:45:48 +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
e8eadd19a5 Kernel: Show region access bits (R/W/X) in crash dump region lists
It's pretty helpful to be able to see the various access bits for each
region in a crash dump. :^)
2019-08-12 19:37:28 +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
4917445e2e Minesweeper: Make the SquareButtons non-checkable
We manage the checked state of these buttons manually in the code, and
we don't want the user to interfere with it, which would be possible if
we put them in checkable state.
2019-08-12 18:51:23 +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
af6483cabb WindowServer: Fix incorrect "window left" event after button drag
This fixes an issue where we'd send a "cursor has left the window"
message incorrectly to the client after a button was clicked and the
user moved the cursor a little without releasing the button.

The issue was that we didn't update the 'hovered_window' out param
in mouse event processing in the case where we had an active input
window set.
2019-08-12 18:36:33 +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
Conrad Pankoff
4b44962e03 Kernel: Use a CircularQueue for input rather than a DoubleBuffer
TTY::emit is called from an IRQ handler, and is used to push input data
into a buffer for later retrieval. Previously this was using DoubleBuffer,
but that class wants to take a lock. Our lock code wants to make sure
interrupts are enabled, but they're disabled while an IRQ handler is
running. This made the kernel sad, but this CircularQueue cheers it up by
avoiding the lock requirement completely.
2019-08-12 14:15:24 +02:00
Conrad Pankoff
ce8387d1ed VirtualConsole: Only consume data from key-down events 2019-08-12 14:15:24 +02:00
Conrad Pankoff
dffdd5545a Kernel: Restore alt+n hijacking for virtual console switching 2019-08-12 14:15:24 +02:00
Conrad Pankoff
e4826276d1 Kernel: Don't forward hijacked keypresses in keyboard driver 2019-08-12 14:15:24 +02:00
Conrad Pankoff
67a4256a98 Server: Add TTYServer, a rudimentary text console manager
This should probably call out to a login program at some point. Right now
it just puts a root terminal on tty{1,2,3}.

Remember not to leave your Serenity workstation unattended!
2019-08-12 13:52:20 +02:00
Conrad Pankoff
072bf8cbb9 Kernel: Fix non-DMA writes to IDE drives
Our logic for using the ATA_CMD_CACHE_FLUSH functionality was a bit wrong,
and now it's better.

The ATA spec says these two things:

> The device shall enter the interrupt pending state when:
> 1) any command except a PIO data-in command reaches command completion
>    successfully;
> ...
> The device shall exit the interrupt pending state when:
> 1) the device is selected, BSY is cleared to zero, and the Status
>		 register is read;

This means that our sequence of actions was probably never going to work.
We were waiting in a loop checking the status register until it left the
busy state, _then_ waiting for an interrupt. Unfortunately by checking the
status register, we were _clearing_ the interrupt we were about to wait
for.

Now we just wait for the interrupt - we don't poll the status register at
all. This also means that once we get our `wait_for_irq` method sorted out
we'll spend a bunch less CPU time waiting for things to complete.
2019-08-12 13:25:59 +02:00
Conrad Pankoff
53ddbce0b3 Kernel: Use established device name and number for framebuffer
This is to prepare for other framebuffer implementations, for which it
would be inappropriate to use the /dev/bxvga device name.
2019-08-12 12:56:55 +02:00
Conrad Pankoff
e60577aab6 Kernel: Allow boot without mouse attached by checking for presence 2019-08-12 12:51:52 +02:00
Andreas Kling
8faeead753 ProcessManager: Hook the sort order for the file systems JSON model
..and install a GSortingProxyModel on the view. This allows you to sort
the filesystems by used space etc *numerically*. :^)
2019-08-12 11:56:30 +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
Andreas Kling
2c7b0b8893 Vector: Use memcpy to implement remove() for trivial types
This is a lot faster than the generic code path.
Also added some unit testing for this.
2019-08-12 11:07:31 +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