Commit Graph

14712 Commits

Author SHA1 Message Date
Tom
4bbee00650 Kernel: disown should unblock any potential waiters
This is necessary because if a process changes the state to Stopped
or resumes from that state, a wait entry is created in the parent
process. So, if a child process does this before disown is called,
we need to clear those entries to avoid leaking references/zombies
that won't be cleaned up until the former parent exits.

This also should solve an even more unlikely corner case where another
thread is waiting on a pid that is being disowned by another thread.
2020-12-12 21:28:12 +01:00
Tom
bcb9363a97 LibPthread: Return errors as positive return values
pthread implementations generally return errors as a positive non-zero
value. Our kernel generally returns errors as negative values. If we
receive a negative value from a system call, turn it into a positive
return value to relay the error appropriately.

Also, fix the tt test utility to not rely on errno, as the pthread
library does not use errno.
2020-12-12 21:28:12 +01:00
Tom
da5cc34ebb Kernel: Fix some issues related to fixes and block conditions
Fix some problems with join blocks where the joining thread block
condition was added twice, which lead to a crash when trying to
unblock that condition a second time.

Deferred block condition evaluation by File objects were also not
properly keeping the File object alive, which lead to some random
crashes and corruption problems.

Other problems were caused by the fact that the Queued state didn't
handle signals/interruptions consistently. To solve these issues we
remove this state entirely, along with Thread::wait_on and change
the WaitQueue into a BlockCondition instead.

Also, deliver signals even if there isn't going to be a context switch
to another thread.

Fixes #4336 and #4330
2020-12-12 21:28:12 +01:00
AnotherTest
0918d8b1f8 LibGfx: Make fill_path() less bad at filling paths
This patchset fixes:
- Some parts of the path being skipped and not drawn (often horizontal)
- The filled shape moving around on an int grid depending on the winding
  number
- Winding number mess-up with four-way intersections
2020-12-12 20:10:04 +01:00
Linus Groh
af80d71abc Spreadsheet: Reduce top bar default height
50px is a bit extreme, it's down to 26px high now. Still a bit larger
than a regular GUI::TextBox but enough to look decent, even with the
help button in there.

Closes #3905.
2020-12-12 20:09:55 +01:00
xspager
dd198e1a29 AK::URL: Fix setting the port number in the case it was the last element of the URL 2020-12-12 20:09:42 +01:00
Andreas Kling
2b8c7faee4 LibWeb: Use the margin box of floating elements for flowing around
Inline content flows around the entire margin box of floating elements,
not just the content box.
2020-12-12 19:59:24 +01:00
Andreas Kling
66e9dde86f LibWeb: Don't place floating boxes before everything else
Instead, just handle them as we go about laying out block-level boxes.
2020-12-12 19:31:46 +01:00
Andreas Kling
ec89302fbe LibWeb: Make the ad-hoc CSS parser a little more tolerant
Just bail when encountering some unexpected character. This makes it
much more tolerable to type a stylesheet into TextEditor with live
HTML preview enabled.
2020-12-12 11:47:11 +01:00
Andreas Kling
b60801a9ba LibWeb: Apply 'min-width' and 'max-width' constraints to replaced boxes
This is definitely not 100% correct but I tried implementing the basic
algorithms described in CSS 2.2. It's good enough to render the penguin
on @linusg's homepage at the right size. :^)
2020-12-12 00:29:49 +01:00
Andreas Kling
63067ada68 Meta: Add Luke Wilde to the contributors list :^) 2020-12-11 23:29:30 +01:00
Andreas Kling
97d789c75b Kernel: Fix null dereference when execve'ing ELF without PT_TLS header
Fixes #4387.
2020-12-11 22:59:46 +01:00
Andreas Kling
552ba1b0a3 LibWeb: Remove some unnecessary is_replaced() checks in BFC
BFC::compute_width() has a short-circuit path for replaced elements.
2020-12-11 22:59:46 +01:00
Andreas Kling
67732df034 LibWeb: Move replaced element layout out of Layout::ReplacedBox
Replaced elements are now laid out by the current formatting context.
Since the logic is almost identical in BFC and IFC, it's implemented
by static helpers in FormattingContext.
2020-12-11 22:59:46 +01:00
Andreas Kling
e8d6691470 LibWeb: Fix inline-block width computation with no specified width
Undefined width should be treated the same as width:auto;
2020-12-11 22:59:46 +01:00
Andreas Kling
aec54af04f LibDebug: Clean up DebugSession construction a little bit
No need to wrap MappedFile in a NonnullOwnPtr. Also make the session
constructor private and use adopt_own().
2020-12-11 22:59:46 +01:00
Tom
03fcd02dfd Kernel: Fix leaking Timer instances
When a Timer is queued we add a reference, so whenever we remove
a timer or fire it we should drop that reference.

Fixes #4382
2020-12-11 19:33:15 +01:00
Sahan Fernando
66f9a2d9ec LibDebug: Fix crash when debugging short lived programs 2020-12-11 09:55:31 +01:00
Zac
1851da9c93 FileManager: Added context menu for right-clicks on desktop icons.
Moved the same copy/paste/properties/delete functionality used in the
run_in_windowed_mode() method to the run_in_desktop_mode() method.
2020-12-11 09:36:44 +01:00
Zac
dea399ff08 FileManager: focus_dependent_delete_action is correctly enabled/disabled
The focus_dependent_delete_action that sits in the file manager's
toolbar would always remain enabled, even if nothing was selected,
activating it if nothing was selected would then crash the application.

The action is now correctly enabled/disabled, but due to the way
selection works in TreeViews, something is always selected, what really
matters is if the TreeView has something selected, and it has focus.
As it currently stands, there is no way to know when the TreeView's
is_focused status changes. In order for this to work I added a callback
to the Widget class which fires when a widget receives or looses focus.
In that callback, the focus_dependent_delete_action's enabled value is
recalculated.
2020-12-11 09:36:44 +01:00
Zac
df44ab8599 FileManager: TreeView accepts drags from the DirectoryView. 2020-12-11 09:36:44 +01:00
Dan MacDonald
0e8702c310 Meta: Update bare metal installation guide 2020-12-11 09:35:24 +01:00
Andreas Kling
c139b7fe78 Base: Remove *.hsp files
HackStudio no longer has dedicated project files, so let's get rid of
the *.hsp file concept. It'll eventually produce some files again,
but they won't be the same kind of "project" files.
2020-12-10 20:43:19 +01:00
Andreas Kling
dd3e6451ac HackStudio: Rethink the "project" concept to be about a directory
Instead of having .hsp files that determine which files are members
of a project, a project is now an entire directory tree instead.

This feels a lot less cumbersome to work with, and removes a fair
amount of busywork that would otherwise be expected from the user.

This patch refactors large parts of HackStudio to implement the new
way of thinking. I've probably missed some details here and there,
but generally I think it's pretty OK.
2020-12-10 20:42:11 +01:00
Andreas Kling
5d0fda3d39 AK: Add String::substring(start)
This is a convenience API when you just want the rest of the string
starting at some index. We already had substring_view() in the same
flavor, so this is a complement to that.
2020-12-10 20:42:11 +01:00
Andreas Kling
e9280cba13 HackStudio: Don't vend invalid indices from SearchResultsModel
This fixes an assertion when clicking in the "find in files" search
results table when there were no matches.
2020-12-10 20:42:11 +01:00
Ben Wiederhake
ebbae015ef UserspaceEmulator: Fix page determination
Note that this *only* affects the last few bytes of the ELF headers, since all
other allocations are PAGE_SIZE aligned.
2020-12-10 20:41:12 +01:00
AnicJov
e119d7d6b9 Chess: Added ability to put markings on the board
With this patch you can use right-click to mark a square on the board.
You can add modifier keys to the click to change to alternate color
(with CTRL) or secondary color (with Shift). If you right-click and
drag from one square to another you will create an arrow. The
markings go away as soon as you left-click on the board or the board
state changes.

Note: The arrows sometimes look weird, and horizontal ones get cut
      off. They also don't account for alpha. This is not a bug in
      Chess code, rather, likely in the fill_path() function that's
      used to draw the arrows. If anyone might know what's up with
      that I urge you to take a look. :)
2020-12-10 20:40:51 +01:00
AnicJov
f631e73519 Chess: Added abilty to import PGN files
This patch allows the user to load games using PGN files. The parsing
is not complete and has a bunch of work left to be done, but it's
okay for our use case here. It can load all of the games our PGN
exporter can save. As the Chess program impoves so can the PGN parser.
2020-12-10 20:40:51 +01:00
AnicJov
4d9837d792 Chess: Add ability to replay moves
This patch allows the user to go back and forward in move history
to replay moves from the game. This is view-only however, and as soon
as a move is made the board returns to it's current state. This will
work well for replaying games loaded in with PGN files, once that's
implemented.
2020-12-10 20:40:51 +01:00
AnicJov
cf8fce368a Chess: Added ability to copy board state as FEN
You can now copy the board state as Forsyth-Edwards Notation. You can
then paste this into other chess programs/games, or into ours when
it gets implemented.
2020-12-10 20:40:51 +01:00
AnicJov
b000a884c8 Chess: Change keyboard shortcuts
Use some better keyboard shortcuts that make more sense and are more
common, instead of random function keys.
2020-12-10 20:40:51 +01:00
AnotherTest
a2879f53c8 Shell: Restore the terminal PGID before printing out job status on exit
This fixes the assert tripping when interrupting a foreground job.
Also make `bg` mark the job as 'should announce exit'.
2020-12-10 16:20:39 +01:00
Andreas Kling
350b2c6d9e LibWeb: Use the surrounding text color as the caret color
This way you can always see the cursor as long (as you can see the text
you are editing.)
2020-12-10 11:39:47 +01:00
Linus Groh
5d77a19af5 LibWeb: Replace IDL 'void' return type with 'undefined'
From the Web IDL spec: https://heycam.github.io/webidl/#idl-undefined

[...]
undefined constant values in IDL are represented with the `undefined`
token.
[...]
Note: This value was previously spelled `void`, and more limited in how
it was allowed to be used.
2020-12-10 11:02:46 +01:00
Linus Groh
c1dfb2d883 LibWeb: Expect IDL namespace to end with semicolon
From the Web IDL spec: https://heycam.github.io/webidl/#prod-Namespace

Namespace ::
    namespace identifier { NamespaceMembers } ;
2020-12-10 11:02:46 +01:00
AnotherTest
ec4980e875 AK: Ensure dual_pivot_quick_sort does not copy the pivots
Also add a test that would fail to compile if quick_sort tries to copy
anything :P
2020-12-10 11:02:02 +01:00
asynts
5b104eedaf AK: Fix offset calculation error in DuplexMemoryStream::write. 2020-12-09 21:17:24 +01:00
asynts
ce15c9a04c AK: Fix unsigned integer underflow in DuplexMemoryStream::write. 2020-12-09 21:17:24 +01:00
Andreas Kling
a34e023a33 LibC: Make getdelim() fail with EINVAL on null input pointers
This matches some other libc's.
2020-12-09 21:12:40 +01:00
asynts
2981f10a5e LibWeb: Apply suggested fixes. 2020-12-09 21:05:06 +01:00
asynts
1c7a834278 LibWeb: Expose DOM::Range to JavaScript. 2020-12-09 21:05:06 +01:00
asynts
10f9c85090 LibWeb: Make DOM::Range more suitable for JS. 2020-12-09 21:05:06 +01:00
asynts
4df0eeaa3d LibWeb: Join start and end after deleting selection. 2020-12-09 21:05:06 +01:00
asynts
a94a1d9f9e LibWeb: Implement deletion of more complex selections. 2020-12-09 21:05:06 +01:00
asynts
b3d7c5bfbc LibWeb: Fix many bugs with the editing. 2020-12-09 21:05:06 +01:00
asynts
78558c9f30 LibWeb: Add support for cursor movement and delete. 2020-12-09 21:05:06 +01:00
asynts
e96faea1a2 LibWeb: Support range delection accross nodes with shared parent. 2020-12-09 21:05:06 +01:00
asynts
43dc47a494 LibWeb: Add support for range deletion. 2020-12-09 21:05:06 +01:00
asynts
bbcc5a9332 LibWeb: Move editing stuff into EditEventHandler. 2020-12-09 21:05:06 +01:00