Commit Graph

5501 Commits

Author SHA1 Message Date
Andreas Kling
20bbeba6d5 CPUGraph: Launch the CPUGraph menu applet on startup 2019-12-05 19:44:22 +01:00
Andreas Kling
86d84f1654 WindowServer: Remove WSCPUMonitor
We'll still have a CPU graph, just not in the WindowServer process.
2019-12-05 19:43:56 +01:00
Andreas Kling
c3029a6a1f MenuApplets: Add CPUGraph, our first menu applet :^)
This implements the WSCPUMonitor functionality in a separate process.
2019-12-05 19:38:08 +01:00
Andreas Kling
44d5388e78 WindowServer: Add basic menu applet concept
It's now possible to create a little applet window that sits inside the
system's menubar. This is done using the new CreateMenuApplet IPC call.

So far, it's possible to assign a backing store ID, and to invalidate
rects for repaint. There is no way to get the events from inside the
applet just yet.

This will allow us to move the CPU graph and audio thingy to separate
applet processes. :^)
2019-12-05 19:36:01 +01:00
Andreas Kling
2d18fc8052 LibGUI: Move tooltip window rects if they don't end up on screen
This makes the quick launch button tooltips actually readable. :^)
2019-12-05 17:59:06 +01:00
Andreas Kling
e1862fe2f5 WindowServer: Move window minimize animation to a separate function
Move this from WSCompositor::compose() to a separate run_animations()
function to keep compose() readable. We might want to add some more
animations later.
2019-12-05 17:44:10 +01:00
William McPherson
aa8b40dce6 Shell: Cache PATH for faster tab completion
This patch reduces the O(n) tab completion to something like O(log(n)).
The cache is just a sorted vector of strings and we binary search it to
get a string matching our input, and then check the surrounding strings
to see if we need to remove any characters. Also we no longer stat each
file every time.

Also added an #include in BinarySearch since it was using size_t. Oops.

If `export` is called, we recache. Need to implement the `hash` builtin
for when an executable has been added to a directory in PATH.
2019-12-05 17:09:22 +01:00
Karol Baraniecki
431abc8846 Shell: Redirectiong from multiple-digit fds 2019-12-05 17:08:37 +01:00
Karol Baraniecki
7ed8a468ec Shell: Implement specifying fds in file redirection 2019-12-05 17:08:37 +01:00
Sergey Bugaev
cf7910fc1e AK: Implement %n printf specifier
This is a special specifier that does not output anything to the stream,
but saves the number of already output chars to the provided pointer.

This is apparently used by GNU Nano.
2019-12-05 12:29:11 +01:00
Dan MacDonald
f686b5b51b Meta: Check for Toolchain presence when running makeall.sh 2019-12-04 19:47:34 +01:00
Sergey Bugaev
f2546d15ce Taskbar: Add a quick launch bar
This is a tiny bar at the left of the taskbar where you can put
your most used apps to launch them with a single click. In a way,
it's another replacement for the Launcher, in addition to the app
menu. Unlike the launcher and the menu, it's not meant to be the
primary way to launch apps; it's only a faster way to launch a few
most often used utilities.
2019-12-04 14:32:15 +01:00
Andreas Kling
d111b6ead4 WindowServer+Taskbar: Animate window frames on minimize/unminimize
We now show a quick window outline animation when going in/out of
minimized state. It's a simple 10 frame animation at 60fps, just to
give a visual cue of what's happening with the window.

The Taskbar sends over the corresponding button rect for each window
to the WindowServer using a new WM_SetWindowTaskbarRect message.

Note that when unminimizing, we still *show* the window right away,
and don't hold off until the animation has finished. This avoids
making the desktop feel slow/sluggish. :^)
2019-12-03 21:34:34 +01:00
Sasan Hezarkhani
51262e7e2d GTextEditor: Clear current selection, if any, on set_document() 2019-12-03 12:51:27 +01:00
Sasan Hezarkhani
5c2ef01f7b LibGUI: Expose a function to clear GTextEditor selection 2019-12-03 12:51:27 +01:00
Tommy Nguyen
9a01e70ff9 FileManager: Refresh tree view when deleting directories
Fixes #825

The logic already existed. I just moved it to a separate lambda then added it
to the appropriate action. Note that when the tree view refreshes, it seems to
randomly open trees. I would like to fix this in a separate PR.
2019-12-03 12:50:47 +01:00
Sasan Hezarkhani
6db11e5bba IRCClient: Sort the member list ignoring the character cases.
I compared a few clients and they do the same sort of sorting.
2019-12-03 12:50:06 +01:00
Andreas Kling
8f80879676 AK: StringView::lines() should keep empty lines 2019-12-02 20:41:15 +01:00
Andreas Kling
d422c46ebb LibC: Also mark empty-but-kept-around BigAllocationBlocks as PROT_NONE
This extends the opportunistic protection of empty-but-kept-around to
also cover BigAllocationBlocks. Since we only cache 4KB BAB's at the
moment, this sees limited use, but it does work.
2019-12-02 20:02:23 +01:00
Andreas Kling
05c65fb4f1 Kernel: Don't CoW non-writable pages
A page fault in a page marked for CoW should not trigger a CoW if the
page is non-writable. I think this makes sense.
2019-12-02 19:20:09 +01:00
Andreas Kling
f41ae755ec Kernel: Crash on memory access in non-readable regions
This patch makes it possible to make memory regions non-readable.
This is enforced using the "present" bit in the page tables.
A process that hits an not-present page fault in a non-readable
region will be crashed.
2019-12-02 19:18:52 +01:00
Andreas Kling
ddd5411472 LibC: Protect empty-but-kept-around ChunkedBlocks with PROT_NONE
We now keep a separate queue of empty ChunkedBlocks in each allocator.
The underlying memory for each block is mprotect'ed with PROT_NONE to
provoke crashes on use-after-free.

This is not going to catch *all* use-after-frees, but if it catches
some, that's still pretty nice. :^)

The malloc memory region names are now updated to reflect their reuse
status: "malloc: ChunkedBlock(size) (free/reused)"
2019-12-02 18:54:12 +01:00
Andreas Kling
61f298faf3 AK: Add DoublyLinkedList::prepend()
Also make it possible to remove() with a value-type Iterator.
2019-12-02 18:36:10 +01:00
Andreas Kling
7dc9c90f83 Kernel: Fix bug where mprotect() would ignore setting PROT_WRITE
A typo in Region::set_writable() caused us to update the readable flag
rather than the writable flag.
2019-12-02 18:15:36 +01:00
Andreas Kling
64e77c262e Build: Add "sm" as an alias for SystemMonitor for now
This is one of the most common apps I bring up, yet there's no handy
alias for it? Silly :^)
2019-12-02 17:45:25 +01:00
Andreas Kling
b9f58a0e2e SystemMonitor: Enable sorting by column in the process memory map view 2019-12-02 17:43:52 +01:00
Andreas Kling
7970b594d5 SystemMonitor: Update the process memory map once every second 2019-12-02 17:36:10 +01:00
Andreas Kling
0e34b7d65e WindowServer: Remove debug spam about menu creation 2019-12-02 17:16:59 +01:00
Andreas Kling
790a27a444 Terminal: Ignore SIGCHLD with SA_NOCLDWAIT
Otherwise we'll accumulate a bunch of dead Terminal children if you
open and close more terminal windows.
2019-12-02 16:50:10 +01:00
Andreas Kling
340c5506b4 WindowServer: Remove silly debug logging on startup :^) 2019-12-02 16:47:11 +01:00
Andreas Kling
e91b2b8f1b WindowServer: Mark clients as misbehaving when they send invalid data
If a client sends an invalid window ID or similar to the WindowServer,
we'll now immediately mark them as misbehaving and disconnect them.

This might be too aggressive in some cases (window management, ...)
but it's just a place to start.
2019-12-02 15:55:14 +01:00
Andreas Kling
af9fd334f3 LibGUI: Don't show "Invalid" for menu items without a keyboard shortcut 2019-12-02 15:54:01 +01:00
William McPherson
d7177212fd AK: Add a BinarySearch template implementation
binary_search takes a haystack, a size, a needle and a compare function.
The compare function should return negative if a < b, positive if a > b
and 0 if a == b. The "sane default" compare function is integral_compare
which implements this with subtraction a - b.
binary_search returns a pointer to a matching element, NOT necessarily
the FIRST matching element. It returns a nullptr if the element was not
found.

This patch includes tests for binary_search.
2019-12-02 15:30:45 +01:00
Andrés Vieira
f8a0eb616c Userland: Add the cal command (#838)
This is a very simple implementation of the cal command to display
a calendar into the command line.

For now this only prints the current month highlighting the current
day.
2019-12-02 15:22:55 +01:00
Tommy Nguyen
2eb5793d55 LibMarkdown: Handle CRLF line endings
Previously, MDDocument only split on Unix-style line endings. This adds
a new function to StringView which handles LF, CR and CRLF.
2019-12-02 13:52:42 +01:00
Andreas Kling
035c4e15f4 Build: Build LibDraw before WindowServer 2019-12-02 13:17:32 +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
b780dcf353 LibDraw: Remove convenience functions for the old WindowServer IPC 2019-12-02 11:11:05 +01:00
Andreas Kling
86504f4461 LibIPC: Don't handle incoming messages right away when draining
When draining the socket in IServerConnection, we would previously
handle each incoming (local endpoint) message as it came in.

This would cause unexpected things to happen while blocked waiting
for a synchronous response. That's definitely not what we want,
so this patch puts all of the incoming messages in a queue and does
a separate pass over the queue to handle everything in order.
2019-12-02 11:11:05 +01:00
Andreas Kling
4a37bec27c LibIPC: Rename base classes to IClientConnection and IServerConnection
This matches what we're already calling the server-side subclasses
better, though we'll probably want to find some better names for the
client-side classes eventually.
2019-12-02 11:11:05 +01:00
Andreas Kling
5d4ee0f58a LibIPC: Move IPC client/server connection templates to LibIPC
Move over the CoreIPC::Server and CoreIPC::Client namespace stuff
into LibIPC where it will soon becomes LibIPC-style things.
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
Jonathan Archer
f4949fcf83 About: Show repository info
Fixes #832
2019-12-02 09:21:47 +01:00
Jonathan Archer
3f45ccffa6 Build System: Add common definitions for git info
Defs for commit, branch, and changes (status)
2019-12-02 09:21:47 +01:00
Andreas Kling
7aaea085de AK: Allow BufferStream to serialize/deserialize floats 2019-12-02 09:19:56 +01:00
Andreas Kling
b6ad94407e WindowServer: Remove unused GetWindowBackingStore IPC request 2019-12-01 19:29:48 +01:00
Andreas Kling
8bb98aa31b Kernel: Use a WaitQueue to implement finalizer wakeup
This gets rid of the special "Lurking" thread state and replaces it
with a generic WaitQueue :^)
2019-12-01 19:17:17 +01:00
Andreas Kling
5a45376180 Kernel+SystemMonitor: Log amounts of I/O per thread
This patch adds these I/O counters to each thread:

- (Inode) file read bytes
- (Inode) file write bytes
- Unix socket read bytes
- Unix socket write bytes
- IPv4 socket read bytes
- IPv4 socket write bytes

These are then exposed in /proc/all and seen in SystemMonitor.
2019-12-01 17:40:27 +01:00
Andreas Kling
a18aa8fd5f Kernel: Use a WaitQueue in NetworkTask 2019-12-01 16:47:49 +01:00