Commit Graph

18182 Commits

Author SHA1 Message Date
Andreas Kling
f6c61940f6 LibWeb: Add PlatformObject class
This represents the "platform object" concept from the IDL spec, which
refers to an object that implements an IDL interface.
2022-09-06 00:27:09 +02:00
Timothy Flynn
9e860d973e LibLocale: Move locale source files to the LibLocale library
Everything is now setup to create the LibLocale library and link it
where needed.
2022-09-05 14:37:16 -04:00
Timothy Flynn
f082b6ae48 LibUnicode: Generate a separate Locale enumeration for special casing
The UCD only cares about a few locales for special casing rules (az, lt,
and tr). Unfortunately, LibUnicode cannot use LibLocale once the
libraries are separate because LibLocale will need to use LibUnicode for
many more things; thus there would be a circular dependency. Instead,
just generate the small enum needed for this one use case.
2022-09-05 14:37:16 -04:00
Timothy Flynn
43a3471298 LibLocale: Move locale source files to the LibLocale folder
These are still included in LibUnicode, but this updates their location
and the include paths of other files which include them.
2022-09-05 14:37:16 -04:00
Timothy Flynn
ff48220dca Userland: Move files destined for LibLocale to the Locale namespace 2022-09-05 14:37:16 -04:00
Timothy Flynn
6c7b05a0ff LibUnicode+LibJS: Move Unicode::get_available_currencies() to Locale.h
This is generated by GenerateLocaleData, which will soon be in the
Locale namespace. Move it out of CurrencyCode.h, as that will continue
to live in the Unicode namespace.
2022-09-05 14:37:16 -04:00
Timothy Flynn
1e0276f541 LibLocale+LibUnicode: Move generated CLDR data files to LibLocale folder
They are still included into LibUnicode, but this moves their generated
location to be under LibLocale.
2022-09-05 14:37:16 -04:00
Timothy Flynn
fc8bf7ac3e LibUnicode+Userland: Migrate generated CLDR data to LibLocaleData
Currently, LibUnicodeData contains the generated UCD and CLDR data. Move
the UCD data to the main LibUnicode library, and rename LibUnicodeData
to LibLocaleData. This is another prepatory change to migrate to
LibLocale.
2022-09-05 14:37:16 -04:00
Timothy Flynn
89d1813b5d LibUnicode: Move CLDR data generators to a LibLocale subfolder
To prepare for placing all CLDR generated data in a new library,
LibLocale, this moves the code generators for the CLDR data to the
LibLocale subfolder.
2022-09-05 14:37:16 -04:00
Timothy Flynn
e3e0602833 LibUnicode: Fully qualify use of AK::Variant in Locale.h
The generated locale data contains an enum also named Variant, as
variants are part of locale strings. This hasn't been an issue, but as
includes are reordered, the order in which the enum and AK::Variant are
included may cause an ambiguity error.
2022-09-05 14:37:16 -04:00
Timothy Flynn
85994d6115 LibJS: Remove unused include from JS::Temporal::Calendar 2022-09-05 14:37:16 -04:00
Tim Schumacher
e2c55ee0a8 LibC: Move dlfcn_integration.h to the bits directory 2022-09-05 10:12:02 +01:00
Tim Schumacher
be941c13e3 LibC: Reduce reliance on the dlfcn internals for regex functions 2022-09-05 10:12:02 +01:00
Tim Schumacher
da0e28dccc LibC: Remove the LibDl interface target 2022-09-05 10:12:02 +01:00
Tim Schumacher
8778bb3473 Everywhere: Fully remove the separate LibDl directory 2022-09-05 10:12:02 +01:00
Tim Schumacher
226608a48f LibDl: Move the dlfcn implementation to LibC 2022-09-05 10:12:02 +01:00
Tim Schumacher
27bfb81702 Everywhere: Refer to dlfcn*.h by its non-prefixed name 2022-09-05 10:12:02 +01:00
networkException
9b6fab264f LibGUI: Implement basic rubber band selections in ColumnsView
This patch adds the ability to select multiple entries in a column using
a rubber band selection. Currently the implementation is lacking support
for expanding a selection using the ctrl modifier.
2022-09-05 09:23:36 +01:00
networkException
f0a20fc902 LibGUI: Add granular ColumnView helpers for column and index at events
This patch extracts logic for getting colum at an event position and for
getting an index in a column at an event position from
index_at_event_position into separate functions.
2022-09-05 09:23:36 +01:00
networkException
707b4f83eb WebServer: Make bound socket a clickable hyperlink :^)
This patch adds a hyperlink that can be hovered over and clicked on to
open the WebServer's index page in Browser.
2022-09-05 09:23:20 +01:00
networkException
b29fbe96dd LibVT: Handle non file urls in on hover tooltips
Previously we would simply compute the basename of the hovered url's
path and display it as the resource that will be opened. This patch adds
a fallback for non file urls to simply show the full url, making http
urls show up properly.
2022-09-05 09:23:20 +01:00
FrHun
00acf56e94 LibGUI: Add Widgets before the ResizeCorner by default in Statusbar
Before this, any Widgets added through e.g. GML appeared after the
ResizeCorner, which didn't make sense. (see FileManager)
2022-09-04 20:01:43 +01:00
Jesse Buhagiar
8df09f6e13 Utilities/lsusb: Fix uninitialized variable error
The variable `print_verbose` (which prints verbose information about the
USB devices connected to the system) was uninitialized in `lsusb`. This
was causing the verbose information to be printed if `-v` was NOT seen
on the command line.
2022-09-04 13:26:05 -04:00
kleines Filmröllchen
c1c2e6f7d7 PixelPaint: Introduce a vectorscope
Vectorscopes are a standard tool in professional video/film color
grading. *Very* simply, the Vectorscope shows image colors with hue as
the angle and saturation as the radius; brightness for each point in the
scope is determined by the number of "color vectors" at that point. More
specifically, the Vectorscope shows a 2D UV histogram of the image,
where U and V are the chroma ("color") channels of the image.

Co-authored-by: MacDue <macdue@dueutil.tech>
2022-09-03 16:57:37 +01:00
MacDue
f9b08272db LibGfx: Add AntiAliasingPainter::fill_rect
This function is able to draw rectangles of floating-point pixel
precision.
2022-09-03 16:57:37 +01:00
kleines Filmröllchen
049c1a536c LibGfx: Add saturation modification functions to Color
This operates via the HSV color space; I'm not 100% sure whether the
conversions are lossless.
2022-09-03 16:57:37 +01:00
kleines Filmröllchen
5bb277d9ec LibGfx: Add YUV conversion functions to Color 2022-09-03 16:57:37 +01:00
kleines Filmröllchen
ac23b806a2 LibGfx: Make Color::set_alpha constexpr 2022-09-03 16:57:37 +01:00
kleines Filmröllchen
e6f20f27d8 PixelPaint: Invoke the modified_change callback when layers change
This propagates layer edits as well as undo stack operations to whoever
needs to perform updates when the image changes.
2022-09-03 16:57:37 +01:00
kleines Filmröllchen
fe88fd22fa PixelPaint: Extract common scope code into a generic ScopeWidget
When we add more scopes, this will facilitate code sharing.
2022-09-03 16:57:37 +01:00
kleines Filmröllchen
8b60305698 PixelPaint: Specify histogram height in GML
The histogram is perfectly fine with being drawn at any size, but the
code currently fixes its height to 65. Once the histogram is in a
subclass and several GML things around it change, the fixed height
breaks, so we move the height specification to GML. Additionally, the
container is specified to shrink as much as possible, alleviating a
hard-coded UI size. The user can now change histogram height in GML,
which is a lot more obvious.
2022-09-03 16:57:37 +01:00
Andreas Kling
7fce5f102f LibJS: Don't use a Handle<Realm> in FinalizationRegistry
Instead just treat it like a normal GC cell edge.
2022-09-03 00:36:26 +02:00
Andreas Kling
63cc2650e3 LibJS: Make Handle<T> more user-friendly
Allow *handle, !handle, handle.ptr(), assignment from compatible
pointer types, etc. This is in preparation for using Handles in
more generated code.
2022-09-03 00:36:26 +02:00
Andreas Kling
01828edd37 LibJS: Add Cell::Visitor::visit(Cell&) 2022-09-03 00:36:26 +02:00
Andreas Kling
e34e21367e LibJS: Add GCPtr and NonnullGCPtr
These are two new smart pointers that are really just raw pointers under
the hood. The initial benefit is all in the names, they allow us to
declare that we're pointing at something in the GC heap.

Later we may also find ways to add debugging logic or static analysis to
these types.
2022-09-03 00:36:26 +02:00
demostanis
c56cbf8027 CMake: Quote all CMAKE_COMMAND occurences
Building might fail if the cmake command path contains
whitespace. See https://stackoverflow.com/a/35853080.
2022-09-02 23:34:47 +01:00
Karol Kosek
652870c178 LibGfx: Ignore incorrect .font files when building the Font Database
Previously every GUI application would crash if we had an incorrect (or
empty) .font file in /res/fonts.
2022-09-03 00:07:53 +02:00
Jelle Raaijmakers
8ab410a536 LibGL: Implement glGetTexImage
The plumbing was already there in LibGPU, so all that was left was to
implement the API :^)
2022-09-03 00:07:24 +02:00
Jelle Raaijmakers
4f69022c32 LibGL: Correct GL_BLEND_*_ALPHA constant values
They were plain wrong; while we're here, also add the `*_EXT` variants.
2022-09-03 00:07:24 +02:00
Jelle Raaijmakers
f08411ba3f LibGL: Improve constants and types compatibility
When compiling with SDL_opengl, all kinds of differences between LibGL
and OpenGL constants and types popped up as redefinition warnings and
errors.

This fixes all LibGL-related warnings when compiling PrBoom+ :^)
2022-09-03 00:07:24 +02:00
thankyouverycool
4d090487ac LibGUI: Stop auto repeat timer for Buttons on EnabledChange events
Since 5064b58 SpinBox buttons are disabled if value reaches the
min or max allowed. Consequently this swallows the final MouseUp
event, leaving the repeat timer running. Fixes SpinBoxes
{dec,inc}rementing their value in perpetuity after min/max value
is reached through button clicking.
2022-09-03 00:07:06 +02:00
Linus Groh
486775f9fe LibJS: Fix incorrect check in ValidateAndApplyPropertyDescriptor
This is an editorial change in the ECMA-262 spec.

See: https://github.com/tc39/ecma262/commit/f0e4ae8
2022-09-02 22:47:28 +01:00
Linus Groh
455537d31d LibJS: Assert Proxy target is a function in [[Call]] and [[Construct]]
As the TODOs suggested for a long time. :^)
2022-09-02 22:44:44 +01:00
davidot
9f661d20f7 LibJS: Allow anonymous functions as default exports
This requires a special case with names as the default function is
supposed to have a unique name ("*default*" in our case) but when
checked should have name "default".
2022-09-02 02:07:37 +01:00
davidot
0fc67ffd62 LibJS: Make indirect bindings of module behave like normal bindings
Before this we attempted to hack around this by only overriding
has_binding. However this did not cover all cases, for example when
assigning to variables before their declaration it didn't throw.
By using the new find_binding_and_index virtual method we can just
pretend the indirect bindings are real.

Since indirect binding do come from a normal environment we need to
ensure you cannot modify the binding and that properties like mutable
are false as expected by the spec for such an indirect binding.
2022-09-02 02:07:37 +01:00
davidot
2484bbc4e0 LibJS: Make DeclarativeEnvironment based on bindings instead of indices
This will allow other environments which extend DeclarativeEnvironment
to provide their own custom bindings.
2022-09-02 02:07:37 +01:00
davidot
faf1430ce4 LibJS: Allow exporting any imported bindings 2022-09-02 02:07:37 +01:00
davidot
462c6df24b LibJS: Only check for duplicate exports if they have a name
Together with removing an incorrect VERIFY this allows multiple star
imports in a single module.
2022-09-02 02:07:37 +01:00
davidot
3b56043612 LibJS: Put exports before symbols in keys of module namespace object 2022-09-02 02:07:37 +01:00
davidot
fb61e9274a LibJS: Call resolve instead of reject in AsyncFromSyncIteratorPrototype 2022-09-02 02:07:37 +01:00
davidot
3b1c3e574f LibJS: Handle empty named export
This is an export which looks like `export {} from "module"`, and
although it doesn't have any real export entries it should still add
"module" to the required modules to load.
2022-09-02 02:07:37 +01:00
davidot
f75c51b097 LibJS: Allow full ModuleExportName in namespace
This means we should accept a string after 'export * as '.
2022-09-02 02:07:37 +01:00
demostanis
68c6161f25 LibMarkdown: Add newline and remove ANSI escape after code blocks
Also make clang-tidy happy by making line a const&
2022-09-01 23:36:23 +00:00
Timothy Slater
5064b581ee LibGUI: Disable increment/decrement buttons on SpinBox based on value
When the value for a SpinBox equals the max, disable the increment
button. Functionally, clicking the button doesn't do anything because
the set_value() clamps the value to min/max and updates the textbox.
However it is still nice to indicate to the user that they've reached
the max. Same goes for minimum value and the decrement button.
2022-09-01 17:47:49 +01:00
Timothy Slater
e43e412fc8 LibGUI: Improve SpinBox usability
Previously the value of the SpinBox is re-evaluated after every change
to the TextBox control. This leads to very unintuitive behavior such as
the user deleting the contents of the box and it having no
visible effect. This happens because the TextBox no longer has a valid
number and so gets reset to the current m_value of the SpinBox.

By defering the update of to the SpinBox value until focus leaves the
control we provide a much more intuitive experience with the text box.
We do still validate when a user types something that it parses to an
int. If it does not we delete the most recent character. This in effect
prevents non-numeric numbers from being entered.

Upon losing focus the value will be checked. If empty we set the SpinBox
value to the minimum allowed value.
2022-09-01 17:47:49 +01:00
Karol Kosek
5478409025 LibGfx: Fallback to a default scaled bitmap if the upscaled one failed
This makes cursors in a 2x Display Scale without a special upscaled
version (such as a Hand cursor) display the 1x version instead.
2022-09-01 14:27:07 +01:00
Timothy Slater
f2da577e77 PixelPaint: Change repeated code into a loop for Wand Select Tool 2022-08-31 18:19:46 +01:00
Karol Kosek
a0ef00cab2 LibGUI: Don't accept drag events in AbstractView if it's not editable
With a new DragCopy cursor icon being used on accepted events, this
caused a 'false assumption' that everything can be dropped into
AbstractView.

This will now only happen if the View is editable, which still isn't
perfect, but at least the Settings app will no longer change cursors.
Also note that we won't get "drag move" events as the comment below
says, which disables automatic scrolling when dragging an element.
2022-08-31 17:29:44 +01:00
Karol Kosek
1d9ec8bd56 LibVT: Accept supported drag enter events 2022-08-31 17:29:44 +01:00
Karol Kosek
f1aa03b779 WindowServer: Place drag and drop overlay at the cursor position
... instead of in the center of the cursor bitmap.

It doesn't make much of a difference, as the default cursor hotspot is
center. But since now we switch between a normal Drag cursor and
DragCopy one that has set hotspot, this caused the overlay to shake.
2022-08-31 17:29:44 +01:00
Karol Kosek
d4aff36875 WindowServer: Include window frames when sending drag events
Previously, the cursor would use a default cursor on window frames such
as the title bar and menu bar, which was not quite correct as drop
events were still handled there.
2022-08-31 17:29:44 +01:00
Karol Kosek
2e244fc85b WindowServer+LibGUI: Change cursor icon if DragEnter event was accepted 2022-08-31 17:29:44 +01:00
Karol Kosek
e5674d9666 Base+WindowServer+LibGfx: Add new DragCopy Cursor
The purpose of this cursor is to indicate if a current dragged object
(file, Spreadsheet cell) can be dropped onto a widget.
2022-08-31 17:29:44 +01:00
Timothy Slater
25ac38cac1 PixelPaint: Make erase_selection work for non-rectangular selections
Layer::erase_selection used to erase the entire bounding box of the
selection. With the add/subtract merge modes for the selection tool it
is possible to create selections which are not rectangular. This leads
to deleting pixels that were not selected.

This change adjusts the erase behavior to walk the selection rect and
check if a pixel is selected or not before deleting.
2022-08-31 16:59:22 +01:00
Jelle Raaijmakers
a373542f4c Profiler: Display correctly rounded percentages as '#.##%' 2022-08-31 16:57:40 +01:00
Timothy Slater
fcf86b07a5 PixelPaint: Add Wand Select Tool
Wand Selection tool uses similar logic to the Bucket Tool. Flood filling
and threshold calculations to determine the affected area just in this
case we do not set the pixels of the selected area, instead we use
those pixels to alter the selection mask.

In the future we can probably abstract out the shared flood logic so
both tools can share the code.
2022-08-31 16:30:23 +02:00
Timothy Slater
066c5acee1 PixelPaint: Change BucketTool flood fill algorithm
This resolves some cases where the existing filling algorithm could get
stuck in a recursion loop and evenutally overflow the stack.
2022-08-31 16:26:09 +02:00
Timothy Slater
0506f4eef8 PixelPaint: Account for alpha in color distance calculation
This fixes an issue where BucketTool would consider "black"
and "transparent" the same color.
2022-08-31 16:26:09 +02:00
Hendiadyoin1
21ae882cfd LibJS: Implement SuperCall for the Bytecode-VM 2022-08-31 15:22:36 +01:00
Hendiadyoin1
25be67299e LibJS: Use builder.join in to_string_impl()s where applicable 2022-08-31 15:22:36 +01:00
Skye Sprung
4370e8f80a HackStudio: Warn of unsaved changes before making a new project
Before, the warning dialog would be opened after the NewProjectDialog,
leading to focus-fighting by the two windows. This fixes that and makes
the action more consistent with the standard serenity way of handling
unsaved changes by asking before the NewProjectDialog is brought up.
The way this is achieved avoids having to rewrite open_project as well.
2022-08-31 15:21:03 +01:00
Skye Sprung
a7b7003376 HackStudio: Fix crash when opening or creating with open empty file
This commit fixes a crash that would occur due to an unnamed file being
automatically saved via EditorWrapper::save(). Now, we throw up a
FilePicker::get_save_filepath.
2022-08-31 15:21:03 +01:00
Crax97
7d544344ca PixelPaint: Add point_position_to_preferred_cell to RectangleSelectTool
Specializing point_position_to_preferred_cell for the
RectangleSelectTool as it selects a new cells with a rounding
behavior instead of a flooring behavior
2022-08-31 12:20:55 +02:00
Crax97
3d756e89c8 PixelPaint: Ask the current tool for the preferred pixel location
When handling mouse events, different tools may want to interact
with a different pixel in the image for the same input position.
2022-08-31 12:20:55 +02:00
Crax97
c9fb380490 PixelPaint: Execute mousemove_event early return check before
This is done to allow querying the current active tool inside the
event_with_pan_and_scale_applied and event_adjusted_for_layer
functions without risking a null pointer dereference
2022-08-31 12:20:55 +02:00
Crax97
3037f5b183 PixelPaint: Add point_position_to_preferred_cell method to Tool
This method is used to point a position at the preferred pixel of
the image. Certain tools may want to specify a different preferred
pixel for the same input position.
2022-08-31 12:20:55 +02:00
Crax97
059a9c71a0 LibGfx: Add Point::to_ceiled method for getting a ceiled Point 2022-08-31 12:20:55 +02:00
Adam Jakubek
aa466723eb FileManager: Navigate to parent dir when current location is removed
When the location currently displayed in FileManager is removed, find
the nearest existing parent path and open it in the window.
Without the fix, the FileManager window remained in the deleted
directory.

Changing the path in 'DirectoryView' object will automatically update
other components in the FileManager (breadcrumb bar, directory tree
view).
2022-08-31 10:32:41 +01:00
Adam Jakubek
f7e6593910 LibGUI: Fix assertion when handling removal of FileSystemModel's root
This commit fixes FileSystemModel behaviour when the root path of the
model has been deleted.
In this case, the model index resolved for the root path is invalid and
passing it to 'begin_delete_rows' would trigger assertion failure.

Instead of deleting all children rows one by one, we simply invalidate
the whole model.
2022-08-31 10:32:41 +01:00
Timothy Flynn
c477425b9b LibJS: Create DurationFormat's ListFormat object with type and style
This is a normative change in the Intl.DurationFormat spec. See:
https://github.com/tc39/proposal-intl-duration-format/commit/1304e4b
2022-08-30 14:26:11 -04:00
Timothy Flynn
127b28c940 LibJS: Use numeric style if the previous style was numeric or 2-digit
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/3a46ee3
2022-08-30 14:26:11 -04:00
Timothy Flynn
cab1cce522 LibJS: Update DurationFormat AO text to align with ECMA-402 and Temporal
These are editorial changes in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/71b291b
https://github.com/tc39/proposal-intl-duration-format/commit/d0cc6fa
https://github.com/tc39/proposal-intl-duration-format/commit/d4b35bb
2022-08-30 14:26:11 -04:00
Timothy Flynn
a86b840c64 LibJS: Rename DurationFormat's DurationSign to DurationRecordSign
This is an editorial change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/f947239
2022-08-30 14:26:11 -04:00
Timothy Flynn
f8c51fec1d LibJS: Align ToDurationRecord with ToTemporalDurationRecord
This is an editorial change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/527ea58
2022-08-30 14:26:11 -04:00
Timothy Flynn
a28ff92106 LibJS: Mark PartitionDurationFormatPattern as infallible
This is an editorial change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/cea3b68
2022-08-30 14:26:11 -04:00
Timothy Flynn
aabd06722f LibJS: Change GetDurationUnitOptions to require a string for prevStyle
This is an editoral change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/62ee645
2022-08-30 14:26:11 -04:00
Timothy Flynn
1778462d97 LibJS: Resolve FIXMEs in DurationFormat's PartitionDurationFormatPattern
These are normative changes in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/e2e18d1
https://github.com/tc39/proposal-intl-duration-format/commit/f1e8ed3
https://github.com/tc39/proposal-intl-duration-format/commit/2ed31b8
https://github.com/tc39/proposal-intl-duration-format/commit/2d51d64
https://github.com/tc39/proposal-intl-duration-format/commit/64cc5db
https://github.com/tc39/proposal-intl-duration-format/commit/a1d7876
https://github.com/tc39/proposal-intl-duration-format/commit/47a3a69
https://github.com/tc39/proposal-intl-duration-format/commit/3e9358e
https://github.com/tc39/proposal-intl-duration-format/commit/f4ecb46
https://github.com/tc39/proposal-intl-duration-format/commit/b454c8c
2022-08-30 14:26:11 -04:00
Timothy Flynn
d57b92da09 LibJS: Default to "short" for DurationFormat's style option
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/b289494
2022-08-30 14:26:11 -04:00
Timothy Flynn
765d016670 LibJS: Default to 0 for DurationFormat's fractionalDigits option
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/ac7e184
2022-08-30 14:26:11 -04:00
Timothy Flynn
2fb332da7b LibJS: Update spec steps to validate DurationFormat's numberingSystem
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/63a9202
2022-08-30 14:26:11 -04:00
thankyouverycool
cce9172cd4 Applications+DevTools: Remove fixed sizes from Splitters
And adjust some GML properties. Since a808cfa, splitters grow
opportunistically. Setting them to fixed sizes now quite literally
fixes them in place. Fixes immovable splitters missed in the
aforementioned commit.
2022-08-30 16:28:44 +01:00
Linus Groh
6cedb1b9d9 LibJS: Implement $262.evalScript() according to the given algorithm
test262's INTERPRETING.md specifies the exact steps for this function,
so let's shuffle some things around and add "spec" comments.

Most importantly this now returns the result of the evaluated script,
which at least one test relies on:
https://github.com/tc39/test262/blob/main/test/built-ins/Proxy/revocable/tco-fn-realm.js
2022-08-30 12:00:04 +01:00
Linus Groh
69415f0608 LibJS: Make string_to_bigint() a standalone function
This now matches the newly added string_to_number().
2022-08-30 10:30:54 +01:00
Linus Groh
15e3a99250 LibJS: Trim non-ASCII whitespace as well in StringToBigInt
This was never caught since the original implementation AFAICT, and
isn't being covered by test262 either:
https://github.com/tc39/test262/issues/1354
2022-08-30 10:30:43 +01:00
Linus Groh
c88c33dc22 LibJS: Trim non-ASCII whitespace as well in StringToNumber
This regressed in f4b3bb5.
2022-08-30 10:20:45 +01:00
Slappy826
f4b3bb519f LibJS: Handle non-decimal integer literals in Value::to_number
Implements support for parsing binary and octal literals, and fixes
instances where a hex literal is parsed in ways the spec doesn't
allow.
2022-08-30 01:00:48 +01:00
davidot
123cdfa1f1 LibJS: Properly initialize the global object for $262.createRealm 2022-08-29 22:44:35 +01:00
Timothy Flynn
48cb15283a LibRegex: Explicitly check if a character falls into a table-based range
Previously, for a regex such as /[a-sy-z]/i, we would incorrectly think
the character "u" fell into the range "a-s" because neither of the
conditions "u > s && U > s" or "u < a && U < a" would be true, resulting
in the lookup falling back to assuming the character is in the range.

Instead, first explicitly check if the character falls into the range,
rather than checking if it falls outside the range. If the explicit
checks fail, then we know the character is outside the range.
2022-08-29 16:34:47 -04:00
djwisdom
27f5a18ce6 HexEditor: Add Help->Manual entry in Menu 2022-08-29 09:25:29 +01:00
Andreas Kling
35c9aa7c05 LibJS: Hide all the constructors!
Now that the GC allocator is able to invoke Cell subclass constructors
directly via friendship, we no longer need to keep them public. :^)
2022-08-29 03:24:54 +02:00
Andreas Kling
d54ba587f3 LibJS: Make Heap a friend of everyone who uses JS_CELL
This will allow Heap to invoke non-public constructors when allocating
new cells.
2022-08-29 03:24:54 +02:00
Andreas Kling
49fd92d92a LibJS: Make JS_OBJECT and JS_ENVIRONMENT forward to JS_CELL 2022-08-29 03:24:54 +02:00
Andreas Kling
6e973ce69b LibJS: Add JS_CELL macro and use it in all JS::Cell subclasses
This is similar to what we already had with JS_OBJECT (and also
JS_ENVIRONMENT) but sits at the top of the Cell inheritance hierarchy.
2022-08-29 03:24:54 +02:00
Jelle Raaijmakers
94f016b363 LibGL+LibGPU+LibSoftGPU: Report texture env add extension
The Quake 3 port makes use of this extension to determine a more
efficient multitexturing strategy. Since LibSoftGPU supports it, let's
report the extension in LibGL. :^)
2022-08-28 23:45:43 +01:00
Linus Groh
d53a369e7f LibJS: Implement ShadowRealmConstructor::construct() closer to spec
Defer creation of the global object to Realm::set_global_object(), and
use the newly added set_default_global_bindings() AO as intended.
2022-08-28 19:34:10 +01:00
Linus Groh
040e3abb1d LibJS: Implement SetDefaultGlobalBindings as a standalone function
Instead of hardcoding all the property definitions in GlobalObject's
initialize() function, make it the standalone AO it is supposed to be
that can then be used by other global objects that don't inherit from
JS::GlobalObject.
2022-08-28 19:34:10 +01:00
Linus Groh
e3804e6426 LibJS: Move construction of GlobalObject native functions to Intrinsics
This will later allow global objects not inheriting from the regular
JS::GlobalObject to pull in these functions without having to implement
them from scratch. The primary use case here is, again, a wrapper-less
HTML::Window in LibWeb :^)

Allocating these upfront now allows us to get rid of two hacks:

- The GlobalObject assigning Intrinsics private members after finishing
  its initialization
- The GlobalObject defining the parseInt and parseFloat properties of
  the NumberConstructor object, as they are supposed to be identical
  with the global functions of the same name
2022-08-28 19:34:10 +01:00
Linus Groh
52543fc771 LibJS+LibWeb: Let Realm store a plain Object for [[GlobalObject]]
This removes the requirement of having a global object that actually
inherits from JS::GlobalObject, which is now a perfectly valid scenario.

With the upcoming removal of wrapper objects in LibWeb, the HTML::Window
object will inherit from DOM::EventTarget, which means it cannot also
inherit from JS::GlobalObject.
2022-08-28 16:36:56 +01:00
Linus Groh
72730422bb LibJS: Remove Shape::global_object() and Object::global_object()
Same reason as in commit 275dea9.
2022-08-28 16:36:56 +01:00
Linus Groh
4f436bd323 LibJS: Let NewGlobalEnvironment take a plain Object
The object is passed directly to NewObjectEnvironment, which has no
requirement for this being a JS::GlobalObject. This is needed for the
next change, which will make Realm store a plain Object as for the
global object as well.
2022-08-28 16:36:56 +01:00
Linus Groh
cfa5885855 LibJS: Turn initialize_global_object() into a regular initialize()
There's nothing special about global object initialization anymore, this
can just work the same way as for any other object now.
2022-08-28 16:36:56 +01:00
Linus Groh
867ad03995 LibJS: Move Console ownership from GlobalObject to ConsoleObject
GlobalObject is now a regular object with no special properties :^)
2022-08-28 16:36:56 +01:00
Linus Groh
78eca3ae64 LibJS: Move ConsoleObject construction from GlobalObject to Intrinsics
This will allow us to move the underlying console from GlobalObject to
ConsoleObject without still having to do a 'console' property lookup on
the GlobalObject.
2022-08-28 16:36:56 +01:00
Linus Groh
d35f53c344 LibJS: Remove Console's reliance on GlobalObject
This was not being used for anything meaningful, just store a reference
to the VM directly.
2022-08-28 16:36:56 +01:00
thankyouverycool
1dd9086e1a WindowServer: Remove misbehavior conditions for modals
This was too restrictive and there are already UI elements that rely
on this behavior. Now Blocking modals will preempt interaction with
all windows in their modal chain except those descending from them.
Fixes crashing in FilePicker when permission is denied.
2022-08-28 16:04:35 +01:00
thankyouverycool
b2b68a7551 WindowServer: Continue processing ongoing resizes after tiling
Just like tiling behavior during ongoing moves, now resizing
does not finish until a MouseUp event, letting you drag out of
undesired tile states. Resize tiling only works with vertical
and horizontal cursors now to cut down on unintentional tiling
from the corners.
2022-08-28 16:04:35 +01:00
thankyouverycool
38e13772e0 LibGUI: Make CommandPalette and EmojiInputDialog passive modals
Now they can be dismissed by clicking anywhere outside themselves,
including on their parent windows. This is a better default for
them since they don't have title bars to flash, and it's more
consistent with other frameless windows in the system.
2022-08-28 16:04:35 +01:00
Kenneth Myhra
54435dea59 LibC: Add stubs for 'removexattr()' and friends
This add stubs for 'removexattr()', 'lremovexattr()', and
'fremovexattr()'.

These are needed by GLib version 2.73.3.
2022-08-28 15:42:14 +01:00
Andreas Krohn
8aca5ab3b3 PixelPaint: Cropping to content with moved layers was broken
When cropping to content with a layer not positioned at 0,0 the moved
layers content disappeared and the layers position was not updated
according to the crop offset.

There's probably an easier/more efficient way, but for my testcase this
improves the behavior.
2022-08-28 11:22:42 +01:00
Kevin Meyer
6e006be9e6 PixelPaint: Fix const correctness of Selection::in_interactive_selection 2022-08-28 10:14:18 +01:00
davidot
ba5bcb67a5 LibWeb: Implement the HostEnsureCanAddPrivateElement JS hook
Also added a local test for ensuring this behavior since it is unique to
browsers. Since we don't actually use WindowProxy anywhere yet we just
test on location for now.
2022-08-27 20:33:27 +01:00
davidot
cd763de280 LibJS+LibUnicode: Move some constant arrays to a separate header
Since LibUnicode depends on this data it used to include
Intl/AbstractOperations which in turn includes a number of other LibJS
headers. By moving this to its own header with minimal includes we can
save on rebuilding LibUnicode for unrelated LibJS header changes.
2022-08-27 10:55:44 -04:00
Linus Groh
dfb7588d30 LibJS: Remove GlobalObject::{set_,}associated_realm() 2022-08-27 11:29:10 +01:00
Linus Groh
61bd9fef7d LibJS+LibWeb: Remove last uses of GlobalObject::associated_realm() 2022-08-27 11:29:10 +01:00
Linus Groh
50428ea8d2 LibJS: Move intrinsics to the realm
Intrinsics, i.e. mostly constructor and prototype objects, but also
things like empty and new object shape now live on a new heap-allocated
JS::Intrinsics object, thus completing the long journey of taking all
the magic away from the global object.
This represents the Realm's [[Intrinsics]] slot in the spec and matches
its existing [[GlobalObject]] / [[GlobalEnv]] slots in terms of
architecture.

In the majority of cases it should now be possibly to fully allocate a
regular object without the global object existing, and in fact that's
what we do now - the realm is allocated before the global object, and
the intrinsics between both :^)
2022-08-27 11:29:10 +01:00
Jelle Raaijmakers
84c4b66721 LibGL+LibGPU+LibSoftGPU: Implement texture pixel format support
In OpenGL this is called the (base) internal format which is an
expectation expressed by the client for the minimum supported texel
storage format in the GPU for textures.

Since we store everything as RGBA in a `FloatVector4`, the only thing
we do in this patch is remember the expected internal format, and when
we write new texels we fixate the value for the alpha channel to 1 for
two formats that require it.

`PixelConverter` has learned how to transform pixels during transfer to
support this.
2022-08-27 12:28:05 +02:00
Jelle Raaijmakers
6c80d12111 LibGPU+LibSoftGPU: Add PixelFormat::Intensity 2022-08-27 12:28:05 +02:00
Jelle Raaijmakers
e615af886e LibGL: Report color buffer bits instead of texture bits
For `GL_RED_BITS`, `GL_GREEN_BITS`, `GL_BLUE_BITS` and `GL_ALPHA_BITS`
we were reporting the values we use in LibSoftGPU for textures. This
fixes these context parameters to actually report the color buffer
bits.
2022-08-27 12:28:05 +02:00
Jelle Raaijmakers
eb7c3d16fb LibGL+LibGPU+LibSoftGPU: Implement flexible pixel format conversion
A GPU (driver) is now responsible for reading and writing pixels from
and to user data. The client (LibGL) is responsible for specifying how
the user data must be interpreted or written to.

This allows us to centralize all pixel format conversion in one class,
`LibSoftGPU::PixelConverter`. For both the input and output image, it
takes a specification containing the image dimensions, the pixel type
and the selection (basically a clipping rect), and converts the pixels
from the input image to the output image.

Effectively this means we now support almost all OpenGL 1.5 formats,
and all custom logic has disappeared from:
  - `glDrawPixels`
  - `glReadPixels`
  - `glTexImage2D`
  - `glTexSubImage2D`

The new logic is still unoptimized, but on my machine I experienced no
noticeable slowdown. :^)
2022-08-27 12:28:05 +02:00
Jelle Raaijmakers
d7cfdfe633 LibGL: Implement GL_NORMAL_ARRAY_TYPE context parameter
This is used by the Grim/Monkey4 engine in ScummVM.
2022-08-27 12:28:05 +02:00
Jelle Raaijmakers
73f7f4656c LibSoftGPU: Make ownership_token type in Image consistent
This is now the same as defined in `GPU::Image`.
2022-08-27 12:28:05 +02:00
Jelle Raaijmakers
3279c25553 LibGfx: Allow non-const indexing into VectorN 2022-08-27 12:28:05 +02:00
Jelle Raaijmakers
07ae5514ae LibGL: Rename units to all singular 2022-08-27 12:28:05 +02:00
Andreas Kling
e65990f7a3 LibWeb: Treat cyclic percentage max-size as "auto" on the flex container
This allows things like `max-width: 100%` to work on flex containers
whose containing blocks themselves have automatic width.
2022-08-27 12:19:37 +02:00
Linus Groh
92295b9584 LibWeb: Remove one remaining use of JS::InvalidCharacterError 2022-08-26 23:19:15 +01:00
Linus Groh
adc5ac35b7 LibJS: Remove InvalidCharacterError
This a Web API and not part of ECMA-262. Never has been.
2022-08-26 22:26:03 +01:00
davidot
6989f304bc LibJS: Remove now unnecessary i32 casts when constructing BigIntegers 2022-08-26 19:18:26 +01:00
davidot
791855deab LibCrypto+LibJS: Remove the create_from methods from BigInteger
Instead we just use a specific constructor. With this set of
constructors using curly braces for constructing is highly recommended.
As then it will not do too many implicit conversions which could lead to
unexpected loss of data or calling the much slower double constructor.

Also to ensure we don't feed (Un)SignedBigInteger infinities we throw
RangeError earlier for Durations.
2022-08-26 19:18:26 +01:00
davidot
528891bf69 LibCrypto: Add a constructor to (Un)SignedBigInteger taking a double
For now this will assume that the double given is exactly representable
as an integer, so no NaN, infinity or rounding.
2022-08-26 19:18:26 +01:00
davidot
c87d10365b LibCrypto: Make the constructors of (Un)SignedBigInteger templated
This means it can take any (un)signed word of size at most Word.
This means the constructor can be disambiguated if we were to add a
double constructor :^).

This requires a change in just one test.
2022-08-26 19:18:26 +01:00
davidot
48ac6ba372 LibJS: Use the proper to_double method in NumberConstructor 2022-08-26 19:18:26 +01:00
davidot
77d71a5ffd LibCrypto: Add a rounding mode to UnsignedBigInteger::to_double
This allows using different options for rounding, like IEEE
roundTiesToEven, which is the mode that JS requires.

Also fix that the last word read from the bigint for the mantissa could
be shifted incorrectly leading to incorrect results.
2022-08-26 19:18:26 +01:00
Robbie Vanbrabant
26a3b42a15 LibGUI: Add visual line mode to VimEditingEngine
Applications using the Vim emulation engine now support line-wise text
selection.

We already have support for character-wise text selection, by pressing
`v` from normal mode.

However now can also trigger line-wise text selection by pressing
`shift+v` from normal mode, and then using vertical motion commands
(e.g. `j` or `k`) to expand the selection. This is a standard vim
feature.

In visual line mode the following operations are supported:

  * `escape`: back to normal mode
  * `u`: convert to lowercase
  * `U`: convert to uppercase
  * `~`: toggle case
  * `ctrl+d`: move down by 50% of page height
  * `ctrl+u`: move up by 50% of page height
  * `d` or `x`: delete selection
  * `c`: change selection
  * `y`: copy selection
  * `page up`: move up by 100% of page height
  * `page down`: move down by 100% of page height

Notably I didn't implement pressing `v` to go to regular
(character-wise) visual mode straight from visual line mode. This is
tricky to implement in the current code base, and there's an
alternative, which is to take a detour via normal mode.
2022-08-26 12:50:30 +02:00
martinfalisse
f8e82da4b4 LibWeb: Handle unknown values in grid-template-*
This commit fixes a bug found when passing exotic values in the
grid-template-columns (or grid-template-rows) which are not yet
supported.

The bug seems to have been something like:
grid-template-columns: 0 minmax(0, calc(10px - var(--some-color)));
2022-08-26 12:48:57 +02:00
thankyouverycool
3dd522a109 SpreadSheet: Pass parent window when constructing About action
Fixes About dialog not blocking the app's main window.
2022-08-26 12:48:05 +02:00
thankyouverycool
7b2becad52 FileSystemAccessServer: Set dummy child to WindowMode::Passive
so Dialogs can join the modal chain of the window parenting them.
Fixes apps that use FileSystemAccess to sandbox FilePicker not
respecting its blocking effect.
2022-08-26 12:48:05 +02:00
thankyouverycool
aa045a9fdf WindowServer: Always restore modal chain when clicking a window
Refactors restore helper into move_to_front_and_make_active().
Fixes not bringing all modal children to the front when any modal
child or its modeless parent is clicked.
2022-08-26 12:48:05 +02:00
thankyouverycool
d815f659cc LibGUI+Taskbar+WindowServer: Prevent minimization when blocked
This was intentionally enabled with WindowModes as a new Taskbar
convenience, but on second thought, it doesn't add up visually.

Taskbar buttons show blockers' context menus when available,
which is a bit confusing when the window isn't visible. The
modeless window's disabled context menu options and inactive title
bar also contradict the button. So, this patch reenables the
restriction for now. Blocking modals you don't want to answer to
immediately can still be tucked away on another workspace.
2022-08-26 12:48:05 +02:00
thankyouverycool
18b111b802 WindowServer: Ignore modal blocking if capturing input
This exception is necessary for ComboBoxes used in some blocking
Dialogs. CaptureInput is now the only mode which can spawn from
a blocking modal and it won't accept any children of its own.
2022-08-26 12:48:05 +02:00
Jean Lourenço
bab8bd143f Chess: Highlight piece origin square when dragging piece 2022-08-26 09:53:13 +01:00
Andreas Kling
49deb936be PixelPaint: Make selection changes undoable
Using the Rectangle Select Tool will now generate undo/redo commands
like any other tool. :^)
2022-08-26 01:04:52 +02:00
Andreas Kling
d571159aeb PixelPaint: Move selection from ImageEditor to Image
This is preparation for making selection state undoable.
2022-08-26 01:04:52 +02:00
Andreas Kling
67596d9546 PixelPaint: Move "marching ants" painting logic to ImageEditor
Since this code needs to look at a bunch of ImageEditor state anyway,
it makes more sense for it to live in ImageEditor.
2022-08-26 01:04:52 +02:00
Andreas Kling
e6d860f2fe PixelPaint: Round mouse event coordinates instead of truncating
This makes the rectangle select tool feel a lot better when zoomed in.
2022-08-26 01:04:52 +02:00
Andreas Kling
d32f7112dc LibWeb: Intentionally leak the main thread JS VM
This way we avoid doing an expensive full GC on exit.
2022-08-26 01:04:51 +02:00
Linus Groh
36225c0ae7 LibJS: Allow undefined for calendar in MaybeFormatCalendarAnnotation
This is an editorial change in the Temporal spec.

Now that this is spec'd as either an Object or undefined, we can change
the parameter type from arbitrary JS::Value to JS::Object*.

See: https://github.com/tc39/proposal-temporal/commit/cdfcffd
2022-08-25 23:41:09 +01:00
Linus Groh
741cc08221 LibJS: Use fully spec'd algorithm for ToISOWeekOfYear
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/33b62a3
2022-08-25 23:41:09 +01:00
Linus Groh
b438839fcc LibJS: Reject ambiguous time string even with a calendar
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/5e2afb9
2022-08-25 23:41:09 +01:00
Linus Groh
2cf5f5c278 LibJS: Remove unused nonterminals from the ISO8601 parser
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/fe9ef00
2022-08-25 23:41:09 +01:00
Linus Groh
42452a81a2 LibJS: Simplify TimeSpecWithOptionalTimeZoneNotAmbiguous
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/77b0163
2022-08-25 23:41:09 +01:00
Linus Groh
f29c7cab16 LibJS: Remove exception rule from TimeZoneIANAName production
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6a758d6
2022-08-25 23:41:09 +01:00
MacDue
965237efb8 LibWeb: Don't return an opaque origin for file:// URLs
The protocol of the origin is used for checking if the a file://
iframe is allowed to be loaded (a document with a file:// origin
can load other files in iframes).

This used to be the case, but was changed in
6e71e400e6, which broke file:// iframes.
2022-08-26 00:21:10 +02:00
MacDue
8d2c2f7c52 LibWeb: Determine the origin when navigating across documents 2022-08-26 00:21:10 +02:00
Luke Wilde
9643a5c63f LibJS: Accept and ignore calendar annotation in Instant strings
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/3cd9669
2022-08-25 23:07:08 +01:00
Luke Wilde
54bb6bf2c0 LibJS: Avoid calling ToString on calendar when calendarName is "never"
This is a normative change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/6122f4e
- https://github.com/tc39/proposal-temporal/commit/cf586bc
2022-08-25 21:11:23 +01:00
Timothy Flynn
6309b8773d LibJS: Guard IntegerIndexedElementSet with receiver check
This is a normative change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/3620f11
2022-08-25 19:50:04 +01:00
Timothy Flynn
a803d9226f LibJS: Always access RegExp flags by its "flags" property
This is a normative change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/35b7eb2

Note there is a bit of weirdness between the mainline spec and the set
notation proposal as the latter has not been updated with this change.
For now, this implements what the spec PR and other prototypes indicate
how the proposal will behave.
2022-08-25 16:39:45 +01:00
Timothy Flynn
9a1f55afe5 LibJS: Fix spec steps and links for RegExp set notation proposal 2022-08-25 16:39:45 +01:00
Timothy Flynn
6af9bf1a1e LibUnicode: Fix compilation when ENABLE_UNICODE_DATABASE_DOWNLOAD is OFF 2022-08-25 16:20:22 +01:00
martinfalisse
79a630adef LibWeb: Begin formatting the grid
This is a really starter attempt at formatting the grid. It doesn't yet
take into account the computed_values of grid-template-rows, nor the
values in grid-column-start and like CSS properties.

But these changes are a start and make it so the examples in
display-grid.html work.

To be fleshed out further..
2022-08-25 13:47:48 +02:00
martinfalisse
7bb3a8d646 LibWeb: Parse grid-column and grid-row CSS values 2022-08-25 13:47:48 +02:00
martinfalisse
44d08b81b7 LibWeb: Parse grid-column-start and related CSS properties
Parse grid-column-start, end, and the equivalent for rows.
2022-08-25 13:47:48 +02:00
martinfalisse
92a00648b1 LibWeb: Parse grid-template-columns and grid-template-rows
Add functionality to begin parsing grid-template-columns and
grid-template-rows. There are still things to be added, like parsing
functions, but I would say a couple of the major points are already
adressed like length, percentage, and flexible-length.
2022-08-25 13:47:48 +02:00
martinfalisse
c40dd9ee78 LibWeb: Add GridTrackPlacementShorthandStyleValue
Add GridTrackPlacementShorthandStyleValue for the use of grid-column and
grid-row.
2022-08-25 13:47:48 +02:00
martinfalisse
08b832eb69 LibWeb: Add GridTrackPlacementStyleValue
Add GridTrackPlacementStyleValue for the use of CSS properties
grid-column-start, grid-column-end, grid-row-start, grid-row-end.
2022-08-25 13:47:48 +02:00
martinfalisse
0148260b5f LibWeb: Add GridTrackSizeStyleValue
Add GridTrackSizeStyleValue for the use of CSS properties
grid-template-columns, grid-template-rows.
2022-08-25 13:47:48 +02:00
martinfalisse
ca286fc220 LibWeb: Add GridTrackPlacement for grid-[column/row]-[start/end]
Add GridTrackPlacement to use with grid-column-start and related CSS
properties.
2022-08-25 13:47:48 +02:00
martinfalisse
fc36970973 LibWeb: Add GridTrackSize class for grid-template-*
Add GridTrackSize to be used with grid-template-column and
grid-template-row.
2022-08-25 13:47:48 +02:00
martinfalisse
e4c5799026 LibWeb: Add GridFormattingContext 2022-08-25 13:47:48 +02:00
martinfalisse
e4541d83d3 LibWeb: Parse grid display value 2022-08-25 13:47:48 +02:00
MacDue
b609dd7348 Eyes: Add an option to show/hide the window frame
This works the same as in the Cube demo, and now allows enjoying
the eyes without any obstructions :^)

The window frame can now be disabled with the -h/--hide-window
command-line option, or via toggle in the GUI.
2022-08-25 13:42:17 +02:00
faxe1008
21358d8a5f PixelPaint: Reduce verbosity of crop to content feature
This patch reduces the repetitiveness of the crop to content feature
implementation.
2022-08-25 13:38:31 +02:00
thankyouverycool
d5de9bcc51 Applications: Use modeless windows in some apps
Browser, Spreadsheet and Charactermap now open child windows
modelessly.
2022-08-25 13:28:50 +02:00
thankyouverycool
35a230f974 LibGUI+Taskbar+WindowServer: Remove mode and parent methods from Taskbar
Taskbar only needs a modeless parent and the activity state of the
modal chain to update buttons.
2022-08-25 13:28:50 +02:00
thankyouverycool
d54dc22362 WindowServer: Default to Desktop when picking a new active window 2022-08-25 13:28:50 +02:00
thankyouverycool
af706d081c WindowServer: Invalidate new and previous active input window frames
Fixes shared active title bar theming not updating for capturing
modals.
2022-08-25 13:28:50 +02:00
thankyouverycool
6f316d59f4 WindowServer: Restore modal chains from the Taskbar and Switcher
And only show modeless windows in WindowSwitcher.
2022-08-25 13:28:50 +02:00
thankyouverycool
5a0472d8d2 WindowServer: Use nearest modeless window for modal Taskbar rects
Modeless windows are guaranteed Taskbar buttons which lets us
simplify getting the proper taskbar rect for modals.
2022-08-25 13:28:50 +02:00
thankyouverycool
df2f479810 WindowServer: Don't move child windows in unison with their parents
This was a cludge for ComboBox ListView windows when they were first
implemented. The behavior is no longer needed and not very ergonomic
when moving Normal windows around.
2022-08-25 13:28:50 +02:00
thankyouverycool
2b2c317c2d WindowServer: Don't let modals minimize themselves
But do allow them to remain minimizable by a parent. This is a nice
ergonomics fix to allow a parent window to quickly minimize and
restore all its modal children.
2022-08-25 13:28:50 +02:00
thankyouverycool
788b16cbf8 WindowServer: Replace modal stacks with modal chains
And apply modal effects on move_to_front_and_make_active()

Instead of building a vector of windows every time we want to
loop over a group of related modals, simply recurse through
their ancestory. This lineage is now called a modal chain. Modal
chains begin at the first modeless parent, and a new chain
starts at every modeless child. This lets apps spawn child windows
independent of the main window's modal effects, restore state,
and workspace, yet still remain descendants.

Looping through a modal chain is recursive and includes the
modeless window which begins it.
2022-08-25 13:28:50 +02:00
thankyouverycool
4c7f95e2f8 LibGUI+WindowServer+Apps: Replace Accessory Windows
with the CaptureInput WindowMode. This mode will serve the same
function as accessories: redirecting input while allowing parent
windows to remain active.
2022-08-25 13:28:50 +02:00
thankyouverycool
0d4fd4e2a6 LibGfx+LibGUI+WindowServer+Apps+Demos: Replace ToolWindows
with the RenderAbove WindowMode. This mode will ensure child
windows always draw above their parents, even when focus is lost.
RenderAbove modals are automatically themed the same as the old
ToolWindows. Fixes ToolWindows rendering above ALL normal windows,
regardless of parent. We can't rely on WindowType to create these
sort of effects because of WindowManager's strict display hierarchy.
2022-08-25 13:28:50 +02:00
thankyouverycool
589572cfa4 LibGUI+WindowServer: Introduce WindowModes
Previously, Windows only understood blocking modality: Windows were
either modal, i.e., in a blocking state, or not. Windows could also
be set as Accessories or ToolWindows, attributes which technically
applied modes to their parents but were implemented ad hoc. This patch
redefines these modal effects as WindowModes and sets up some helpers.
This will let us simplify a lot of modal logic in the upcoming patches
and make it easier to build new modal effects in the future.

Windows can now set 1 of 5 modes before reification:
-Modeless:	No modal effect; begins a new modal chain
-Passive:	Window joins its modal chain but has no effect
-RenderAbove:	Window renders above its parent
-CaptureInput:	Window captures the active input role from its parent
-Blocking:	Window blocks all interaction with its modal chain

States like fullscreen and tiling are dynamic and don't alter behavior
in modal chains, so they aren't included.
2022-08-25 13:28:50 +02:00
thankyouverycool
609391b46e WindowServer: Add modeless_ancestor() helper 2022-08-25 13:28:50 +02:00
thankyouverycool
ab517aa21d WindowServer: Remove m_unmaximized_rect from Window
Superceded by m_floating_rect
2022-08-25 13:28:50 +02:00
thankyouverycool
68570e897d LibGfx+WindowServer: Remove set_size_around() from Rect and Window
Superceded by to_floating_cursor_position() as a more accurate way
to reposition windows on untile. Effectively made set_size_around()
dead code, so the remnants can be removed.
2022-08-25 13:28:50 +02:00
thankyouverycool
a1dceb5b97 WindowServer: Remove nudge_into_desktop() from Window
Positioning windows outside visible coordinates is valid if sometimes
curious behavior, but it shouldn't be considered misbehavior by default.
There are multiple ways to recover windows with obscured title bars,
and this function papers over actual resize bugs and is no longer
needed to normalize window size, so let's remove it for now.
2022-08-25 13:28:50 +02:00
thankyouverycool
b180132c87 WindowServer: Fix typo 'reminder' -> 'remainder' in WindowManager 2022-08-25 13:28:50 +02:00
thankyouverycool
24b8301a0e WindowServer: Get taskbar height from TaskbarWindow directly
Fixes incorrect hardcoded heights and a failure to get taskbar
height when tiling on new workspaces.
2022-08-25 13:28:50 +02:00