Commit graph

7608 commits

Author SHA1 Message Date
Stephan Unverwerth
fe36edf6ae LibSoftGPU: Put all constexpr config options into Config.h 2022-01-01 15:09:21 +01:00
circl
63760603f3 Kernel+LibC+LibCore: Add lchown and fchownat functions
This modifies sys$chown to allow specifying whether or not to follow
symlinks and in which directory.

This was then used to implement lchown and fchownat in LibC and LibCore.
2022-01-01 15:08:49 +01:00
Filiph Sandström
8a1d77f65c LibGfx: Add window border/title theming options
This commit adds support the following properties to theming:
Flags:
  - IsTitleCenter: true if the title should be centered.
Metrics:
  - BorderThickness: The border width.
  - BorderRadius: The border corner radius.
2022-01-01 14:54:16 +01:00
Daniel Bertalan
7fdf4004de LibCore: Fix OOB read in Stream::BufferedSeekable::read_until_any_of
If we do not decrement `m_buffered_size` whenever we read data from the
buffer, we end up saying that there are more lines available when we
reach the end of file. This bug caused callers to read garbage data.

This also fixes an incorrect condition in an if statement. The separator
candidate is searched for in `remaining_buffer`, so the separator's
length should be compared against that.
2022-01-01 14:44:02 +01:00
networkException
b46ea5158d WindowsServer+LibGUI: Avoid getting color under cursor outside screen
This patch fixes a crash in ColorPicker caused by the ColorSelectOverlay
trying to request the color for a pixel outside the screen rect.
2022-01-01 14:32:11 +01:00
Conor Byrne
8515d7d5ab LibC: Implement `flockfile and funlockfile`
To do this, we must set the type attribute when initializing a FILE to
``__PTHREAD_MUTEX_RECURSIVE``.
2022-01-01 09:50:32 +00:00
Linus Groh
d7f6635d55 LibJS: Add missing undefined fallback to IfStatement completions
Also add spec comments.
2021-12-31 15:39:25 +01:00
Conor Byrne
faad7a3ed1 LibDiff: Fix error when parsing a 'new' hunk location
If the location started at 0, and / or the length was 0, it would
originally turn out to be a location of { -1, -1 } when LibDiff was
finished parsing, which was incorrect.

To fix this, we only subtract 1 if `start` or `length` isn't 0.
2021-12-31 14:12:54 +01:00
davidot
c0a3b1467c LibJS: Fix the Now.plainDateTime in case they go over a year boundary
Since years don't have a constant amount of seconds because they can be
leap years no constant will work in all cases. We now test a timezone in
both the positive and negative direction and check that at least one
worked. Assuming years are at least 2 days long this will always pass
at least one test.
2021-12-31 12:26:26 +01:00
davidot
c296df6b58 LibJS: Convert to_reference() to ThrowCompletionOr 2021-12-31 00:03:20 +01:00
davidot
a24df37713 LibJS: Convert resolve_this_binding() to ThrowCompletionOr
Also add spec comments.
2021-12-31 00:03:20 +01:00
Emanuele Torre
dc03529ffd LibJS: Fix spec comment in Temporal::PlainDate::balance_iso_date()
This matches the text of the spec, and is more correct since the
variable is being updated, not defined it.

See: https://github.com/tc39/proposal-temporal/commit/5ab1822

---

I also changed `test_year += 1` to `test_year++` for consistency with
step 11.c that has the same description.
2021-12-30 23:59:40 +01:00
Ali Mohammad Pur
8de8a7766d LibCore: Add Core::System::setpgid() 2021-12-31 02:19:45 +03:30
Ali Mohammad Pur
ee46cee31f LibCore: Make Core::System::pipe2() available on Lagom
Note that this drops the flags on the floor if not on linux or serenity.
2021-12-31 02:19:45 +03:30
davidot
b303b8cf4e LibJS: Convert thrown exception to completion in binding initialization
This regressed in 676554d3 as it assumed to_reference() (already)
returned a completion type instead of putting the error in
vm.exception().
2021-12-30 20:14:13 +01:00
davidot
9d3623f0e8 LibJS: Add and fix some spec comments in AbstractOperations 2021-12-30 15:29:33 +01:00
davidot
d72022ba04 LibJS: Convert get_identifier_reference() to ThrowCompletionOr
And while we're here add spec comments.
2021-12-30 15:29:33 +01:00
davidot
676554d3f8 LibJS: Convert resolve_binding() to ThrowCompletionOr
The spec has a note stating that resolve binding will always return a
reference whose [[ReferencedName]] field is name. However this is not
correct as the underlying method GetIdentifierReference may throw on
env.HasBinding(name) thus it can throw. However, there are some
scenarios where it cannot throw because the reference is known to exist
in that case we use MUST with a comment.
2021-12-30 15:29:33 +01:00
Young-Jin Park
9d74659f3b LibGUI: Fix leading whitespaces when text is wrapped
This commit should fix a bug where using leading whitespaces when a line
is wrapped results in a crash. Now it should correctly highlight the
leading whitespaces even when the leading whitespaces are longer than a
line.
2021-12-30 14:34:01 +01:00
Elyse
173a84a2ef LibGUI+SoundPlayer: Use 'decrease_slider_by_page_steps()' method
This method allow us to avoid repeating the pattern
'set_value(value() - page_step() * page_number)'.
2021-12-30 14:31:50 +01:00
Elyse
0d660b27ae LibGUI+SoundPlayer: Use 'increase_slider_by_page_steps()'
This method allow us to avoid repeating the pattern
'set_value(value() + page_step() * page_number)'.
2021-12-30 14:31:50 +01:00
Elyse
8d1fb299b1 LibGUI+LibWeb: Use 'decrease_slider_by_steps()' method
This method allow us to avoid repeating the pattern
'set_value(value() - step() * step_number)'.
2021-12-30 14:31:50 +01:00
Elyse
cee4e02134 LibGUI+LibWeb: Use 'increase_slider_by_steps()' method
This method allow us to avoid repeating the pattern
'set_value(value() + step() * step_number)'.
2021-12-30 14:31:50 +01:00
Elyse
086615535f Everywhere: Use 'decrease_slider_by()' method from AbstractSlider
The same idea as 'increase_slider_by()', it helps us to avoid repeating
the pattern 'set_value(value() - delta)'.
2021-12-30 14:31:50 +01:00
Elyse
d53e1fa1fa Everywhere: Use 'increase_slider_by()' method from AbstractSlider
This method help us to avoid repeating the pattern
'set_value(value() + delta)'.
2021-12-30 14:31:50 +01:00
Elyse
8b8f404146 LibGUI: Add movement methods to AbstractSlider
These methods give us a simple way to move up and down the slider,
without needing to repeat the 'set_value(value() + some_value)'
pattern that multiple applications and libraries use.
2021-12-30 14:31:50 +01:00
Luke Wilde
4427386d5f LibWeb: Implement Element.getAttributeNames 2021-12-30 14:30:35 +01:00
Jelle Raaijmakers
c19632128c LibGL+LibSoftGPU: Implement texture coordinate generation
Texture coordinate generation is the concept of automatically
generating vertex texture coordinates instead of using the provided
coordinates (i.e. `glTexCoord`).

This commit implements support for:

* The `GL_TEXTURE_GEN_Q/R/S/T` capabilities
* The `GL_OBJECT_LINEAR`, `GL_EYE_LINEAR`, `GL_SPHERE_MAP`,
  `GL_REFLECTION_MAP` and `GL_NORMAL_MAP` modes
* Object and eye plane coefficients (write-only at the moment)

This changeset allows Tux Racer to render its terrain :^)
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
69da279073 LibSoftGPU: Use eye coordinates for fog calculation
Now that we calculate and store eye coordinates for each vertex, we
should use their `z` values for the fragment depth used in further fog
calculations.

This fixes the fog in Tux Racer :^)
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
fef7f7159c LibGL+LibSoftGPU: Implement eye, clip, NDC and window coordinates
This follows the OpenGL 1.5 spec much more closely. We need to store
the eye coordinates especially, since they are used in texture
coordinate generation and fog fragment depth calculation.
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
fd4d6b0031 LibSoftGPU: Set obvious FP values for depth_min/max 2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
e4080aed00 LibGL: Use standard debug message for gl_materialv 2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
92ecd66490 LibGL: Reduce nesting levels in gl_tex_env 2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
8cf91a5ae5 LibGL: Change gl_tex_gen param to GLint
The singular form of `glTexGeni/f/d` only supports constants, not
floating point values as its parameter.
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
ab6a869f55 LibSoftGPU: Drop unnecessary FP divisions in to_vec4 2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
079c14931f LibSoftGPU: Be less lenient towards unknown enum values 2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
9d90bab91b LibSoftGPU: Prevent fog from overwriting the alpha channel
Fog only affects the RGB channels according to the spec.
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
f2d8fcb830 LibGL: Remove glPush/PopMatrix debug spam
Even behind the `GL_DEBUG` macro this was too noisy.
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
3a5f69b6f3 LibGL+LibSoftGPU: Implement normalization of normals
* LibGL now supports the `GL_NORMALIZE` capability
* LibSoftGPU transforms and normalizes the vertices' normals

Normals are heavily used in texture coordinate generation, to be
implemented in a future commit.
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
e056cf7e3f LibGfx: Mark some Matrix functions as [[nodiscard]] 2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
57e1dc7765 LibGfx: Add Matrix3x3
This defines `Matrix3x3`, `FloatMatrix3x3` and `DoubleMatrix3x3`
mirroring `Matrix4x4`. Since we will need matrix multiplication with a
`Vector3` for LibGL's normalization, we also add that `*` operator.
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
9bc8587c0d LibGL: Implement fog in GL_LINEAR mode
The `GL_LINEAR` param was erroneously not picked up on. Also implement
support for `GL_FOG_START` and `GL_FOG_END`, and make sure that the
`gl_fog*` family of functions are optionally registered with the active
list.
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
5e01ca29c5 LibGL: Optimize float divisions in unpack_color
For Tux Racer on my machine, this function would account for 15% of
samples. After this change, that drops down to 9%.
2021-12-30 14:24:29 +01:00
Jelle Raaijmakers
1a3af23a10 LibGL: Defer depth writing until after alpha testing
In the OpenGL fixed function pipeline, alpha testing should happen
before depth testing and writing. Since the tests are basically boolean
ANDs, we can reorder them however we like to improve performance and as
such, we perform early depth testing and delay the more expensive alpha
testing until we know which pixels to test.

However, we were already writing to the depth buffer during the depth
test, even if the alpha test fails later on. Depth writing should only
happen if depth testing _and_ writing is enabled.

This change introduces depth staging, deferring the depth write until
we are absolutely sure we should do so.
2021-12-30 14:24:29 +01:00
Maciej
cd92b73845 LibGUI: Convert INISyntaxHighlighter to east-const 2021-12-30 14:12:39 +01:00
Maciej
1f7e363b74 LibGUI: Use consistent naming scheme in INILexer 2021-12-30 14:12:39 +01:00
Maciej
18d489faec LibGUI: Handle '#' comments in INILexer
They are supported by LibCore's ConfigFile but were not higlighted.
2021-12-30 14:12:39 +01:00
Linus Groh
87068896d0 LibJS: Evaluate NewExpression arguments before checking constructor type
Exactly like in 99f9609, which fixed the same issue in CallExpression,
the spec tells us to *first* evaluate the arguments, if any, and *then*
check if the provided value is a constructor function.
2021-12-30 01:02:30 +01:00
Brian Gianforcaro
bad6d50b86 Kernel: Use Process::require_promise() instead of REQUIRE_PROMISE()
This change lays the foundation for making the require_promise return
an error hand handling the process abort outside of the syscall
implementations, to avoid cases where we would leak resources.

It also has the advantage that it makes removes a gs pointer read
to look up the current thread, then process for every syscall. We
can instead go through the Process this pointer in most cases.
2021-12-29 18:08:15 +01:00
davidot
e179cf2540 LibJS: Don't VERIFY that the token after 'import' is one of '.' and '('
Although those are the only valid options parse_primary_expression is
sometimes called when only an expression is valid which means it did not
check match_expression and might fail the now removed VERIFY.
2021-12-29 16:57:23 +01:00