Commit graph

20523 commits

Author SHA1 Message Date
Hediadyoin1
5a8c220101 Kernel: Add a test for multi-region mprotect 2021-05-18 16:50:52 +02:00
Hendiadyoin1
ef425a02f7 Kernel: Implement mprotect for multiple Regions 2021-05-18 16:50:52 +02:00
Timothy Flynn
8afaa7f30e 2048: Display action status tips in status bar 2021-05-18 16:48:39 +02:00
Timothy Flynn
97cee35471 2048: Do not default to only temporarily applying settings changes
Also tweak its text in the settings window to be clearer on what this
check box is doing. Seemed a bit confusing that settings changes
required an extra action to persist.
2021-05-18 16:48:39 +02:00
Timothy Flynn
1a66f487a5 2048: Widen the settings window
It's currently too small to fit the text of some of the settings (in
particular, the "Target tile" text).
2021-05-18 16:48:39 +02:00
Timothy Flynn
f02a13c884 2048: Intialize settings window with current values
Currently, each time you open the settings window in 2048, it displays
the default values rather than the current values. This is confusing, so
display the current values instead.
2021-05-18 16:48:39 +02:00
Sahan Fernando
63a1be1406 Kernel: Don't update write_pos in DoubleBuffer if userspace copy fails 2021-05-18 16:47:26 +02:00
Sahan Fernando
c3b670c092 Kernel: Acknowledge partial writes from TTYs
Fixes a bug where TTY::write will attempt to write into the underlying
device but will not acknowledge the result of that write, instead
assuming that the write fully completed.
2021-05-18 16:47:26 +02:00
Matthew Olsson
fe2d4d85c4 PDFViewer: Add some padding to the outside of the page 2021-05-18 16:35:23 +02:00
Matthew Olsson
c3c2121b57 PDFViewer: Allow zooming in and out + scrolling
When holding ctrl and scrolling, the page will be zoomed in an out.
When zoomed in on a page, scrolling with move vertically up and down
the page (or horizontally if shift is being held).

In order to speed up zooming, zoomed bitmaps are cached per-page at
each distinct zoom level. This cache is cleared every 30 seconds to
prevent OOM problems.
2021-05-18 16:35:23 +02:00
Matthew Olsson
d5f94aaa7b LibPDF/PDFViewer: Support rotated pages 2021-05-18 16:35:23 +02:00
Matthew Olsson
fbe712e265 LibGfx: Rename RotationDirection members
Left => CounterClockwise
Right => Clockwise

Makes much more sense for a rotation
2021-05-18 16:35:23 +02:00
Matthew Olsson
f7ea1eb610 Applications: Add a very simple PDFViewer 2021-05-18 16:35:23 +02:00
Matthew Olsson
309105678b LibPDF: Fix bad resolve_to calls in Document
We can't call resolve_to with IndirectValue{,Ref}, since the values
will obviously be resolved, and will not give us the object of the
correct type.
2021-05-18 16:35:23 +02:00
Matthew Olsson
4479c1bff0 LibPDF: Add a bitmap renderer
This commit adds the Renderer class, which is responsible for rendering
a page into a Gfx::Bitmap. There are many improvements to make here,
but this is a great start!
2021-05-18 16:35:23 +02:00
Matthew Olsson
d6a9b41bac LibPDF: Parse page crop box and user units 2021-05-18 16:35:23 +02:00
Matthew Olsson
43724ac282 Base: Add LiberationSerif TTF font
This will be our primary PDF ttf font, since Times New Roman is not an
open font.
2021-05-18 16:35:23 +02:00
Matthew Olsson
101639e526 LibPDF: Parse graphics commands 2021-05-18 16:35:23 +02:00
Matthew Olsson
03649f85e2 LibPDF: Don't rely on a stream's /Length key existing
Some PDFs omit this key apparently, but Firefox opens them fine. Let's
emulate that behavior.
2021-05-18 16:35:23 +02:00
Matthew Olsson
2f0a2865f2 LibPDF: Give Parser a reference to the Document
The Parser will need to call resolve_to on certain values.
2021-05-18 16:35:23 +02:00
Gunnar Beutner
6808cd1915 Ports: Remove dns and getpw pledges for the OpenSSH client
These are not valid flags for SerenityOS.
2021-05-18 16:33:48 +02:00
Sahan Fernando
d0f314b23c Kernel: Fix subtle race condition in sys$write implementation
There is a slight race condition in our implementation of write().
We call File::can_write() before attempting to write to it (blocking if
it returns false). If it returns true, we assume that we can write to
the file, and our code assumes that File::write() cannot possibly fail
by being blocked. There is, however, the rare case where another process
writes to the file and prevents further writes in between the call to
Files::can_write() and File::write() in the first process. This would
result in the first process calling File::write() when it cannot be
written to.

We fix this by adding a mechanism for File::can_write() to signal that
it was blocked, making it the responsibilty of File::write() to check
whether it can write and then finally making sys$write() check if the
write failed due to it being blocked.
2021-05-18 16:33:15 +02:00
Idan Horowitz
208cfcb0a5 Kernel: Add support for multiple serial ports per device
This commit adds support for initializing multiple serial ports per
PCI board, as well as initializing multiple different pci serial boards

Currently we just choose the first PCI serial port seen as the debug
port, but this should probably be made configurable some how in the
future.
2021-05-18 16:31:39 +02:00
Gunnar Beutner
093818de62 Kernel: Avoid allocations when receiving network packets
This avoids two allocations when receiving network packets. One for
inserting a PacketWithTimestamp into m_packet_queue and another one
when inserting buffers into the list of unused packet buffers.

With this fixed the only allocations in NetworkTask happen when
initially allocating the PacketWithTimestamp structs and when switching
contexts.
2021-05-18 16:06:27 +02:00
Joel Hansen
b66f91e7d3
Base: Add "Plum" theme (#7076)
A theme with dark purples and reds. Inspired by the classic NT theme.
2021-05-18 16:02:43 +02:00
Gunnar Beutner
92879383fb Mandelbrot: Export images in a fixed resolution
This makes the exported image independent from the current window size
and just always exports it at 1920x1080.
2021-05-18 16:01:32 +02:00
Gunnar Beutner
f2f728d39a Mandelbrot: Keep the aspect ratio when (re-)sizing the window
Previously the initial aspect ratio was incorrect and there was
nothing to ensure that the aspect ratio is kept when resizing the
window.
2021-05-18 16:01:32 +02:00
Gunnar Beutner
77bd3f75ce Mandelbrot: Add support for exporting the current image
Unfortunately this means unveil() won't work - at least until we get
something like FilePickerServer.
2021-05-18 16:01:32 +02:00
Gunnar Beutner
b429ee88f8 Mandelbrot: Implement color smoothing with gradients
This removes the color banding that happens for some of the
"outer" areas which all have the same iteration count.
2021-05-18 16:01:32 +02:00
Gunnar Beutner
c961616e6d Mandelbrot: Maintain aspect ratio when selecting a region
This makes sure the aspect ratio of the widget and the selection
match. Otherwise you'd end up with distorted images when zooming
in.
2021-05-18 16:01:32 +02:00
Marcus Nilsson
198a4e2a3c Solitaire: Stop timer if new game animation is running
Starting a new game before the animation had finished caused a crash
since it never stopped the timer before starting a new one.

Fixes #7222
2021-05-18 16:00:44 +02:00
Andreas Kling
3ee092cd0c LibJS: Implement Object.hasOwn() :^)
This is currently a TC39 Stage 2 proposal, but let's go for it!

https://github.com/tc39/proposal-accessible-object-hasownproperty

I wrote the C++, @linusg found bugs and wrote the test.
2021-05-18 11:18:19 +02:00
Dmitrii Ubskii
94569e52f5 2048: Minimize player score when selecting worst tile
Maximizing the board population still takes priority, but if there are
tile generator "moves" that result in equivalent board population after
a player move, the one with the lowest score is selected.
2021-05-18 08:51:56 +01:00
Dmitrii Ubskii
a93d0fe8c2 2048: Evil AI logic: select new tile in the worst position
Not very smart: the worst position is defined such that after the
player's next move the fewest tiles remain empty.
2021-05-18 08:51:56 +01:00
Dmitrii Ubskii
4434e900af 2048: Evil AI settings entry 2021-05-18 08:51:56 +01:00
Dmitrii Ubskii
3e8220dec2 2048: Refactor tile sliding and score logic out of attempt_move() 2021-05-18 08:51:56 +01:00
stelar7
24c5b0e81c LibGfx: Add support for DDS images 2021-05-18 08:45:53 +01:00
DexesTTP
9f42ccd639 WebServer: Fix jailbreaking of server via .. relative paths
The recent patch to LexicalPath allowed relative paths like ../ to work
in requests to WebServer. This wasn't too dangerous because of unveil,
but let's still fix this :^)
2021-05-18 09:32:10 +02:00
Andreas Kling
7957f13e98 Revert "LibC: Simplify malloc size classes"
This reverts commit f91bcb8895.
2021-05-18 08:32:05 +02:00
Gunnar Beutner
f5c4d86592 Utilites: Make find respect lack of -L when iterating over directories
Previously find would follow symlinks when iterating over directories
even though the -L argument was not specified.
2021-05-18 08:11:42 +02:00
Gunnar Beutner
c99fd217e2 AK: Make LexicalPath handle relative paths correctly
Previously LexicalPath would consider "." and ".." as equivalent to
"/". This is not true though.
2021-05-18 08:11:21 +02:00
Lenny Maiorani
ebb1d9740e BitmapView: Disable mutations of the underlying Bitmap
Problem:
- `BitmapView` permits changing the underlying `Bitmap`. This violates
  the idea of a "view" since views are simply overlays which can
  themselves change but do not change the underlying data.

Solution:
- Migrate all non-`const` member functions to Bitmap.
2021-05-18 08:10:45 +02:00
Marcus Nilsson
63897c469b
SystemMonitor: Don't try and show process window with nothing selected (#7221)
When right-clicking with no selected row in the process list,
SystemMonitor would still show a context menu. This disables
the context menu if index is invalid and also disables Alt+Enter
so that build_process_window() is never called with a PID of -1.

Fixes #7167.
2021-05-18 08:10:27 +02:00
Idan Horowitz
325febf4e5 LibCompress: Discard GZip NAME & COMMENT optional strings
We now discard these strings instead of copying them into a String
which we immediately destruct. This should result in both a perf uplift
and lower memory usage.
2021-05-18 08:09:21 +02:00
Gunnar Beutner
3ef6e31ded
LibC: Use ptsname_r() instead of ptsname() in openpty() (#7231)
This improves thread-safety because ptsname() is using a global
buffer that is shared between threads.
2021-05-18 08:08:30 +02:00
DexesTTP
812875bc89 LibWebSocket: Fixed occasional infinite loop with TLS sockets
This was caused by a double notifier on the TLS socket, which caused
the TLS code to freak out about not being able to read properly. In
addition, the existing loop inside of drain_read() has been replaced by
code that actually works, and which includes new warnings when the
drain method is called before initialization is done or after the
websocket gets closed.
2021-05-18 08:07:56 +02:00
Gunnar Beutner
2754112a7a Utilities: Make the STATE column for top slightly larger
The STATE column was slightly too small to fit the states for
NetworkTask and FinalizerTask.
2021-05-18 08:07:29 +02:00
Lenny Maiorani
31d24d8292 LibC: Remove static from function local constexpr variable
Problem:
- Function local `constexpr` variables do not need to be
  `static`. This consumes memory which is unnecessary and can prevent
  some optimizations.

Solution:
- Remove `static` keyword.
2021-05-18 08:07:21 +02:00
Lenny Maiorani
44a9c7c23e AK/PrintfImplementation: Change static constexpr array to function local
Problem:
- Static variables take memory and can be subject to less optimization.
- This static variable is only used in 1 place.

Solution:
- Move the variable into the function and make it non-static.
2021-05-18 08:07:01 +02:00
Gunnar Beutner
3908a49661 AK: Revert removal of StringBuilder::will_append optimization
This was removed as part of the ByteBuffer changes but the allocation
optimization is still necessary at least for non-SerenityOS targets
where malloc_good_size() isn't supported or returns a small value and
causes a whole bunch of unnecessary reallocations.
2021-05-18 08:06:32 +02:00