Commit graph

20541 commits

Author SHA1 Message Date
Valtteri Koskivuori
241b378e4b LibCore: Add offsets to binary signature matching
Some file signatures are at an offset into the file, so we need to be
able to specify an offset to start matching bytes at.
2021-05-18 19:57:53 +01:00
Valtteri Koskivuori
105bbc457d LibCore+Userland: Add 5 more detectable filetypes
This adds gzip, sqlite, 7-Zip, flac and midi.
2021-05-18 19:57:53 +01:00
Jesse Buhagiar
2f49241296 Solitaire: Prevent player dragging entire stack to foundation
Currently, it is possible for the player to drag an entire stack
of cards to the foundation stack, provided the top card of the stack
(i.e the "root" card) can be dropped onto the foundation stack.
This causes an invalid state where, e.g, red cards end up in a
black foundation stack, or vice versa.
2021-05-18 20:05:10 +02:00
Andreas Kling
a743075b9f Browser: Move actions from Tab to BrowserWindow
Navigation actions (back/forward/home/reload) now live in BrowserWindow
instead of being duplicated in every new Tab instance.
2021-05-18 20:02:00 +02:00
Andreas Kling
aed695d4b2 Browser: Move menu management from Tab to BrowserWindow
It was very confusing for every Tab to have their own GUI::Menubar that
got dynamically swapped in/out when switching tabs.

This change moves us to a single menubar per window, and BrowserWindow
is the owner of its own menubar.
2021-05-18 20:02:00 +02:00
Marcus Nilsson
e5367c13d8 CatDog: Remove global menu and add context menu
There was no way to close catdog since it relied on global menus, this
adds a context menu for opening the about dialog and quitting.

Fixes #7252
2021-05-18 18:59:18 +01:00
Dmitrii Ubskii
9c963fa17b Pong: Make the game winnable
- Make the ball chill out a bit by reducing its x velocity by 1.
- Make the AI dumber. It now relaxes until the ball is coming towards it
  and is in its half of the court.
2021-05-18 18:58:07 +01:00
Dmitrii Ubskii
9a7aac1c6a Pong: Fix paddle movement across resets if keys are held
The game waited for the next key down event before moving the player
paddle. Now the state of the arrow keys is carried over between resets.
2021-05-18 18:58:07 +01:00
Dmitrii Ubskii
58131082f4 Pong: Improve mouse controls
Just because you're the player, doesn't mean you can cheat ;)

- Limit paddle speed when following mouse cursor.
- Unhide pointer -- can't grab it, can't see when it's about to leave
  the window otherwise.
- Add last pointer y position indication for the player paddle.
- Prevent the paddle from following the mouse when Up or Down is being
  held (avoid controls fighting).
2021-05-18 18:58:07 +01:00
Dmitrii Ubskii
bb76bcde57 Pong: Improve AI paddle movement
Begin and end triggers for AI paddle to start moving prevent it from
continually jerking around the ball's position. It still moves in steps
of paddle.speed though, but overall experience is smoother.
2021-05-18 18:58:07 +01:00
Dmitrii Ubskii
7c67c9b45f Pong: Fix score display
Player 1's score used to be score's width offset to the right. Now it's
score_margin away from the divider line, same as player 2's.

Also factored out score margin and increased it from 2px to 5px just
to make it look a little nicer.
2021-05-18 18:58:07 +01:00
Ali Mohammad Pur
d897abf4c2 LibWeb: Implement test-web in terms of LibTest/JavaScriptTestRunner
This deduplicates the test-js copy-ism :^)
2021-05-18 18:48:15 +01:00
Ali Mohammad Pur
f137c1bfaa LibJS+LibTest: Move out the test-js test runner into LibTest 2021-05-18 18:48:15 +01:00
Ali Mohammad Pur
b6e5c76427 AK: Add deduction guides to Tuple 2021-05-18 18:48:15 +01:00
Ali Mohammad Pur
5bf37d758c AK: Let HashMap export its key and value types 2021-05-18 18:48:15 +01:00
Timothy Flynn
547c7ba57f Solitaire: Display high score in status bar 2021-05-18 17:57:23 +02:00
Timothy Flynn
3d3a75f1b9 Solitaire: Track and persist high score 2021-05-18 17:57:23 +02:00
Timothy Flynn
7d062d0033 Solitaire: Persist game mode to config file 2021-05-18 17:57:23 +02:00
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