Commit graph

37964 commits

Author SHA1 Message Date
Sam Atkins
e74e320750 MouseSettings: Update the cursor theme preview when restoring defaults
Previously, if you opened MouseSettings, set the cursor theme to Dark,
and then click "Defaults", the cursors list would not update.
ComboBox::set_text() does not call the on_change callback, so we have
to run the steps manually.

I've also made `m_theme_name` into a local variable, since it can be.
2022-05-12 13:10:49 +02:00
Sam Atkins
6ba03dec35 WindowServer: Save config file when mouse cursor theme is changed
When user code requests the current cursor theme name with
`GUI::ConnectionToWindowServer::the().get_cursor_theme()`, that reads
the name from the config file. If we don't write that out when it's
changed, then users get given an outdated cursor theme instead of the
current one.

In particular, changing the theme in MouseSettings, saving and closing
it, then reopening MouseSettings, would show the wrong theme selected.
So, that's fixed now. :^)
2022-05-12 13:10:49 +02:00
Sam Atkins
c7d038cc26 MailSettings: Set window modified state 2022-05-12 13:10:49 +02:00
Sam Atkins
ab2bbaabc7 KeyboardSettings: Set window modified state 2022-05-12 13:10:49 +02:00
Sam Atkins
57bac17b9f ClockSettings: Set window modified state 2022-05-12 13:10:49 +02:00
Sam Atkins
f27985a021 BrowserSettings: Set window modified state 2022-05-12 13:10:49 +02:00
Sam Atkins
4f9f948b6d LibGUI: Support "modified" window state in SettingsWindow
SettingsWindow now notices if the window is marked as modified, and
shows a confirmation pop-up to check if the user wants to apply or
discard their changes. It automatically marks the window as unmodified
after restoring defaults or applying the changes, but each Tab subclass
needs to call `set_modified(true)` when the user modifies things.

The "Apply" button is automatically disabled when there are no unsaved
changes to be applied.
2022-05-12 13:10:49 +02:00
Sam Atkins
ebbbca98fa LibGUI: Run TextEditor::on_change callback immediately
This is the only Widget that ran its callback in deferred_invoke(). It
seems to be a holdover from when syntax-highlighting ran whenever the
text changed, but that has not been true since
bec2b3086c. Running the callback
immediately has no obvious downsides, but does make it a lot easier to
reason about. (I might have spent an hour confused as to why things
were happening in the wrong order...)
2022-05-12 13:10:49 +02:00
RKBethke
0836912a6d LibGL+LibGPU+LibSoftGPU: Implement and expose glClipPlane
This commit implements glClipPlane and its supporting calls, backed
by new support for user-defined clip planes in the software GPU clipper.

This fixes some visual bugs seen in the Quake III port, in which mirrors
would only reflect correctly from close distances.
2022-05-11 23:09:47 +02:00
kleines Filmröllchen
bc2f738a84 WindowServer: Make window frame flashing use the highlight color
Now, when windows flash, the "active" color of the window title frame's
flash is the highlight color instead of the standard window color. The
"inactive" color of the flash is still the disabled color as before.

Reasoning behind this change in aesthetics: There are four [1] window
title frame colors with specific UI purposes:
1. "Active" for the normal active window, obvious purpose.
2. "Moving" for the window that is being dragged or resized by the user.
   Responsible for acting as a visual click feedback as a kind of
   subdued button.
3. "Inactive" for any inactive windows, obvious purpose.
4. "Highlight".

The purpose of "Highlight" is in the name, though it's non-obvious what
that exactly entails. Before, only alt-tab selecting windows would use
the highlight color for showing the current target window. In my opinion
this points to the purpose of "highlight" being to move the user's focus
to another window when the simple active state is not enough. Then it
makes sense to have the window flashing use the highlight color. The
entire purpose of window flashing is to shift the user's focus to a
dialog window that might not be close to the window they just clicked.
Using the highlight color enables an even stronger emphasis than before.
It enables a cleaner separation between the purpose of the two frame
colors, as well as making the "Highlight" frame more common.

[1] Technically there are eight, as the title frame has a gradient by
default. We can count the gradient as one color for this purpose.
2022-05-11 21:00:39 +02:00
Jelle Raaijmakers
5861f1821e LibSoftGPU: Clamp polygon depth values to 0.f - 1.f
According to the OpenGL spec, we're expected to clamp the fragment
depth values to the range `0.f - 1.f` for all polygons.

This fixes Z-fighting issues with the sky in Quake 3.
2022-05-11 20:25:17 +02:00
Karol Kosek
f505f1ab5e LibGUI: Try use layout's preferred size for the content size
Previously this was only done if the widget had shrink_to_fit property
enabled.
2022-05-11 20:24:57 +02:00
Karol Kosek
9156614de3 LibGUI: Always use widget's minimum size in ScrollableContainerWidget
I don't know if it makes much sense to use min_size and shrink_to_fit
at the same time, but it will make the code a bit cleaner later.
2022-05-11 20:24:57 +02:00
Karol Kosek
3e4f912479 LibGUI: Reuse common parts in ScrollableContainerWidget
No functional changes.
2022-05-11 20:24:57 +02:00
Karol Kosek
ea99589d04 LibGUI: Take only valid sizes when calculating BoxLayout preferred size
We ran a min() function to clamp child widgets to their maximum size,
but if it wasn't set, it got -1 and made the widget able to shrink
completely.
2022-05-11 20:24:38 +02:00
Sam Atkins
84b98da259 Userland: Set tab-widget properties in GML instead of code 2022-05-11 20:16:43 +02:00
Sam Atkins
24a8a260c0 Base: Document new TabWidget properties, and extend the example a bit 2022-05-11 20:16:43 +02:00
Sam Atkins
0e1c8e702c LibGUI: Expose more TabWidget properties to GML
- close_button_enabled
- show_tab_bar
- reorder_allowed
2022-05-11 20:16:43 +02:00
Sam Atkins
f64a164392 Documentation: Correct and update IDL documentation
- Delete the part about removing `[Exposed=Window]` since that's not
  necessary and we may want that information there to generate the
  Window object.
- Mention adding `#import`s.
- Outline the requirements for the implementation class.
- Mention the non-Event wrapper factories that need to know about
  certain types.

I tend to refer to this document every time I add an IDL type so it's
helpful if it's comprehensive.
2022-05-11 20:16:10 +02:00
Sam Atkins
c718ba5947 LibWeb: Implement CSSRule.parentRule and .parentStyleSheet
Both of these are supposed to be set when the CSSRule is created. The
spec is silent on setting it when a CSSRule is added to a parent. So,
this is a bit ad-hoc.

The parent rule gets set whenever a rule is added to a new parent. The
parent stylesheet gets set whenever the rule or one of its ancestors is
added to a different stylesheet. There may be some nuance there that
I'm missing, but I'm sure we'll find out quickly once we have WPT
running!
2022-05-11 20:16:10 +02:00
Sam Atkins
6e6607a92f LibWeb: Allow passing StringView to CSSRuleList::insert_a_css_rule()
The spec is a little bizarre here. One caller of this
(`CSSStyleSheet::insert_rule()`) wants to give it a parsed CSSRule, but
the spec itself wants it to take a string. (As will be used by
`CSSGroupingRule::insert_rule()`) Using a Variant isn't pretty but it's
the best solution I've come to - having two overloads was worse, whether
one called the other or they just duplicated the logic. This seems the
least bad.
2022-05-11 20:16:10 +02:00
Sam Atkins
dfba0cb2d9 LibWeb: Implement @supports serialization 2022-05-11 20:16:10 +02:00
Sam Atkins
1cec8e473f LibWeb: Add CSSSupportsRule wrapper 2022-05-11 20:16:10 +02:00
Sam Atkins
fda71a6d48 LibWeb: Add CSSMediaRule wrapper 2022-05-11 20:16:10 +02:00
Sam Atkins
0cf8986a1e LibWeb: Add CSSImportRule wrapper 2022-05-11 20:16:10 +02:00
Sam Atkins
1951873a5d LibWeb: Add CSSConditionRule wrapper 2022-05-11 20:16:10 +02:00
Sam Atkins
cfe5d63a1e LibWeb: Add CSSGroupingRule wrapper 2022-05-11 20:16:10 +02:00
Sam Atkins
bc4c185aef LibWeb: Add MediaList wrapper
Most of the pieces were already there, I'd just forgotten to actually
wire them up.
2022-05-11 20:16:10 +02:00
Jelle Raaijmakers
b8c0ebccfd LibSoftGPU: Implement depth offset factor
This implements the depth offset factor that you can set through e.g.
OpenGL's `glPolygonOffset`. Without it, triangles might start to Z-
fight amongst each other.

This fixes the floor decals in Quake 3.
2022-05-10 19:36:41 +02:00
offtkp
62d41d58d6 LibGUI: Consider TextEditor icon size when scrolling text horizontally
If an icon exists and the horizontal scroll value is larger than 0,
translate the TextEditor painter by the icon size and padding.

The text would scroll over the icon when the text was long enough to
trigger a horizontal scroll.

Fixes #13669.
2022-05-09 22:52:05 +02:00
Jelle Raaijmakers
a20bf80b05 LibGL+LibGPU+LibSoftGPU: Implement point and line drawing
Implement (anti)aliased point drawing and anti-aliased line drawing.
Supported through LibGL's `GL_POINTS`, `GL_LINES`, `GL_LINE_LOOP` and
`GL_LINE_STRIP`.

In order to support this, `LibSoftGPU`s rasterization logic was
reworked. Now, any primitive can be drawn by invoking `rasterize()`
which takes care of the quad loop and fragment testing logic. Three
callbacks need to be passed:

* `set_coverage_mask`: the primitive needs to provide initial coverage
   mask information so fragments can be discarded early.
* `set_quad_depth`: fragments survived stencil testing, so depth values
  need to be set so depth testing can take place.
* `set_quad_attributes`: fragments survived depth testing, so fragment
  shading is going to take place. All attributes like color, tex coords
  and fog depth need to be set so alpha testing and eventually,
  fragment rasterization can take place.

As of this commit, there are four instantiations of this function:

* Triangle rasterization
* Points - aliased
* Points - anti-aliased
* Lines - anti-aliased

In order to standardize vertex processing for all primitive types,
things like vertex transformation, lighting and tex coord generation
are now taking place before clipping.
2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
950ded7ab9 LibSoftGPU: Mention correct i686 target in Device comment 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
2c381ea45c AK: Add clamp(f32x4, float, float)
We are allowed to directly compare `f32x4` with a `float`, so make use
of it.
2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
7906ada015 LibSoftGPU: Update coverage mask bits during rasterization
We were not updating `coverage_bits` causing us to perform just a
little bit more work than strictly necessary.
2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
54a24fe45a LibGfx: Use AK::round_to for VectorN::to_rounded<U> 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
878111abf6 LibGfx: Add VectorN::to_type<T>() 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
dfe002cfd4 LibGfx: Use VectorN dot product of self for length()
No functional changes.
2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
582fb3f263 LibGL+LibGPU: Copy line width to rasterizer in glLineWidth 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
0abb7df09b LibGL+LibGPU: Implement GL_LINE_SMOOTH context parameter 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
f13d4cd3a0 LibGL+LibGPU: Implement GL_POINT_SMOOTH context parameter 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
0dcb23ee96 LibGL+LibGPU: Implement glPointSize 2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
ac3e46b97d LibGL: Remove break from GL_SCISSOR_BOX context parameter
We already `return` immediately before; no functional changes.
2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
0730bd620c LibGL: Alphabetize GL_LIGHT* cases in gl_enable()
No functional changes.
2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
e34e46ebb3 LibSoftGPU: Reference correct class in Typed2DBuffer comment
No functional changes.
2022-05-09 21:49:48 +02:00
Jelle Raaijmakers
b5a39f5edb Ports: Play GLTron audio at 1x speed
Because of sample rate issues, the audio used to be played at 2x speed.
2022-05-09 21:18:21 +02:00
Jelle Raaijmakers
fa77e6b289 Ports: Convert GLTron patches to new format 2022-05-09 21:18:21 +02:00
Jelle Raaijmakers
37bbfc1b38 Ports: Improve newline support for ./package.sh dev
Previously `git am` could fail on patches with Windows line endings
(CRLF). By supplying `--keep-cr`, we prevent git from stripping the CR
from our patches.
2022-05-09 21:18:21 +02:00
Timon Kruiper
b8854549f2 Kernel: Sort aarch64 CMake sources alphabetically 2022-05-09 21:12:56 +02:00
Timon Kruiper
c515e1341a Kernel: Add initial implementation of Processor in aarch64
Instead of storing the current Processor into a core local register, we
currently just store it into a global, since we don't support SMP for
aarch64 anyway. This simplifies the initial implementation.
2022-05-09 21:12:56 +02:00
Timon Kruiper
ed4bfaed12 Kernel: Call the constructors in the aarch64 init function
Now that we have separated the kmalloc.cpp constructors into a separate
library, we can actually call the constructors in the init function.
2022-05-09 21:12:56 +02:00