Commit Graph

5414 Commits

Author SHA1 Message Date
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
Andreas Kling
2ece61fa1f LibCore: Improve logging of errors in safe_syscall() somewhat 2019-12-01 16:47:28 +01:00
Andreas Kling
cde0a1eeb5 Kernel: Put some debug spam behind PAGE_FAULT_DEBUG 2019-12-01 16:03:24 +01:00
Andreas Kling
5859e16e53 Kernel: Use a dedicated thread state for wait-queued threads
Instead of using the generic block mechanism, wait-queued threads now
go into the special Queued state.

This fixes an issue where signal dispatch would unblock a wait-queued
thread (because signal dispatch unblocks blocked threads) and cause
confusion since the thread only expected to be awoken by the queue.
2019-12-01 16:02:58 +01:00
Andreas Kling
7126a42d4d Kernel: Use a WaitQueue in the SoundBlaster 16 driver
Instead of waking up to check for IRQ's regularly, use a WaitQueue and
wake it up in the IRQ handler.
2019-12-01 12:57:35 +01:00
Andreas Kling
8b129476b1 Kernel: Use a WaitQueue in PATAChannel
Instead of waking up repeatedly to check if a disk operation has
finished, use a WaitQueue and wake it up in the IRQ handler.

This simplifies the device driver a bit, and makes it more responsive
as well :^)
2019-12-01 12:54:38 +01:00
Andreas Kling
9ed272ce98 Kernel: Disable interrupts while setting up a thread blocker
There was a race window between instantiating a WaitQueueBlocker and
setting the thread state to Blocked. If a thread was preempted between
those steps, someone else might try to wake the wait queue and find an
unblocked thread in a wait queue, which is not sane.
2019-12-01 12:47:33 +01:00
Andreas Kling
f067730f6b Kernel: Add a WaitQueue for Thread queueing/waking and use it for Lock
The kernel's Lock class now uses a proper wait queue internally instead
of just having everyone wake up regularly to try to acquire the lock.

We also keep the donation mechanism, so that whenever someone tries to
take the lock and fails, that thread donates the remainder of its
timeslice to the current lock holder.

After unlocking a Lock, the unlocking thread calls WaitQueue::wake_one,
which unblocks the next thread in queue.
2019-12-01 12:07:43 +01:00
Andreas Kling
cada332e95 LibPthread: Remove some duplicate declarations in pthread.h 2019-12-01 11:52:52 +01:00
Brandon Scott
c7f2fc8a29 Ports: vttest
Test application designed to test various VT's.
2019-12-01 11:52:17 +01:00
Brandon Scott
fd15c7e8db LibC: Added _PC_VDISABLE option to fpathconf()
This was needed for vttest
2019-12-01 11:52:17 +01:00
Brandon Scott
194f85431f LibVT: Fixed some debugging code that didn't compile 2019-12-01 11:52:17 +01:00
Andreas Kling
d27e5a77e7 GTextEditor: Don't assert is_readonly() in did_change()
This callback will be invoked when calling set_text() to set the
initial contents of a GTextEditor, and that's okay.
2019-11-30 19:11:31 +01:00
Andreas Kling
6f70238a32 GTextEditor: Fire the on_change hook on GTextDocument change 2019-11-30 18:55:07 +01:00
Andreas Kling
a349e7dbda LibVT: Always use Painter::clear_rect() instead of Painter::fill_rect()
We never want to alpha blend when rendering the terminal buffer, so we
can just use clear_rect() and avoid trouble.

This fixes an issue with inconsistent translucency in the terminal app
when setting a custom background opacity.
2019-11-30 18:28:38 +01:00
Andreas Kling
32be9941f4 GTextEditor: Implement Shift+Delete using RemoveTextCommand 2019-11-30 17:19:35 +01:00
Andreas Kling
990042c8ec GTextEditor: Implement the Delete key using RemoveTextCommand 2019-11-30 16:58:07 +01:00
Andreas Kling
00a91bb02c LibGUI: Consolidate and simplify commands used for insertion/removal
This patch adds InsertTextCommand and RemoveTextCommand.
These two commands are used to ... insert and remove text :^)

The bulk of the logic is moved into GTextDocument, and we now use the
command's redo() virtual to perform the action. Or in other words, when
you type into the text editor, we create an InsertTextCommand, push it
onto the undo stack, and call redo() on it immediately. That's how the
text gets inserted.

This makes it quite easy to implement more commands, as there is no
distinction between a redo() and the initial application.
2019-11-30 16:54:05 +01:00
Andreas Kling
f430da1d45 LibGUI: Add GUndoStack and GCommand classes
This patch converts the undo stack from GTextDocument into GUndoStack,
and GTextDocumentUndoCommand now inherits from GCommand.

Let's turn this into a generic mechanism that can be used to implement
undo/redo in any application. :^)
2019-11-30 15:36:17 +01:00
Andreas Kling
f8703d44cc TextEditor: Focus the editor widget on startup 2019-11-30 15:35:19 +01:00
Andreas Kling
ee8773c586 LibGUI: Move the undo stack from GTextEditor to GTextDocument
Since the same document can be edited by multiple editors, we need to
keep the undo stack with the document for coherency.
2019-11-30 13:05:17 +01:00
Andreas Kling
d6426e4af9 LibHTML: Allow resource loads to fail
It's perfectly normal for resource loads to fail sometimes. When they
do, we now simply pass a null buffer to the callback.
2019-11-30 11:58:47 +01:00
Andreas Kling
039fc0f2d1 LibHTML: Don't bother updating layout in frameless documents
Before/after the document is attached to a frame, there's no point in
doing any kind of layout, since we can't display the results anywhere.
2019-11-30 11:57:41 +01:00
Andreas Kling
4104f53a94 ProtocolServer: Don't crash on failed request
The CNetworkJob::on_finish hook will be invoked both for success and
failure, but there will only be a m_job->response() in the success case
so we have to null-check it before using it.

This should have been obvious from the "->"
2019-11-30 11:02:14 +01:00
Andreas Kling
b09ac26311 PaintBrush: Allow canceling a line by pressing the Escape key
Sometimes you change your mind mid-line, and just want to get out of
the situation. You can now do that :^)
2019-11-29 22:41:36 +01:00
Andreas Kling
4e6cd541c9 PaintBrush: Add a "line" tool for drawing straight lines
This implements "preview" of the line by allowing tool subclasses to
hook the second_paint_event on the PaintableWidget.

Work towards #375.
2019-11-29 22:41:19 +01:00
Andreas Kling
f04394b9f3 LibDraw: Painter::draw_pixel() with thickness>1 was doubly translating
Callers of draw_pixel() are not expecting it to apply translation since
they will have already done that themselves.

This was causing draw_line() with thickness>1 to have an offset applied
in case the painter was already translated.
2019-11-29 22:31:45 +01:00
Andreas Kling
e2b88f66d3 modunload: Take the module-to-unload as a command-line argument 2019-11-29 21:35:10 +01:00
Andreas Kling
f60c40ab2e jp: Print double-quotes around string values in output 2019-11-29 21:35:01 +01:00
Andreas Kling
ef32c71683 Kernel: Have modules export their name in a "module_name" string
This will show up in /proc/modules, and is also the name you can pass
to the module_unload() syscall for unloading the module.
2019-11-29 21:31:17 +01:00
Andreas Kling
86c61218a7 modload: Take the module-to-load as a command-line argument
Instead of hard-coding /mod/TestModule.o :^)
2019-11-29 21:19:23 +01:00
Andreas Kling
3ad0e6e198 Kernel: Show module memory size in /proc/modules
Note that this only shows the size of the loaded module sections,
and does not include any memory allocated *by* the module.
2019-11-29 21:18:37 +01:00
Andreas Kling
5ca88bf9b4 DisplayProperties: Add 1280x720 to the list of resolutions 2019-11-29 21:07:24 +01:00
Andreas Kling
f99e554c5e Calculator: Add a 16x16 app icon 2019-11-29 21:04:19 +01:00
Andreas Kling
e56daf547c Kernel: Disallow syscalls from writeable memory
Processes will now crash with SIGSEGV if they attempt making a syscall
from PROT_WRITE memory.

This neat idea comes from OpenBSD. :^)
2019-11-29 16:30:05 +01:00
Andreas Kling
ea52fe528a LibGUI: Keep the (1, 1) text offset on GButton after it becomes checked
This makes the text offset "stick" after you click to select a window
in the taskbar, for example.
2019-11-29 15:46:38 +01:00
Andreas Kling
dd72608aed LibGUI: Align GButton text according to the specified text_alignment()
This makes the taskbar button labels align properly relative to their
icons instead of sometimes being too far right.
2019-11-29 15:41:53 +01:00
Andreas Kling
f75a6b9daa Kernel: Demangle kernel C++ symbols correctly again
I broke this while implementing module linking. Also move the actual
demangling work to AK, in AK::demangle(const char*)
2019-11-29 14:59:15 +01:00