Commit graph

2978 commits

Author SHA1 Message Date
kleines Filmröllchen
dd66f5e838 Help: Link to LibLocale
This managed to fly under my radar for the LibManual PR, and somehow it
only happens for the Clang build but doesn't always trigger on CI.
2022-12-11 13:59:41 -07:00
kleines Filmröllchen
b65258c093 Help+man+LibManual: Move argument handling to LibManual
This deduplicates argument handling logic from Help and man and makes it
more modular for future use cases. The argument handling works as
before: two arguments specify section and page (in this order), one
argument specifies either a page (the first section that it's found in
is used) or a path to a manpage markdown file.
2022-12-11 16:05:23 +00:00
kleines Filmröllchen
146bce53dd Help: Fix search query parsing
This was failing probably because AK::URL was being too strict; and the
query emptyness check was flipped.
2022-12-11 16:05:23 +00:00
kleines Filmröllchen
a438c4d568 Help+LibManual: Move all manpage path handling to LibManual
This way, we'll have an easier time changing these paths.
2022-12-11 16:05:23 +00:00
kleines Filmröllchen
4625f7aab5 LibManual: Refactor SectionNode in preparation for subsections
- Calculate the full name on demand
- Make section and name protected
- Reorder some members logically
- Change the name getter to be fallible, as some implementors need to
  allocate
2022-12-11 16:05:23 +00:00
kleines Filmröllchen
ad6a55e1f0 Help+LibManual: Move non-UI-specific manual handling to LibManual
This is a first step in deduplicating code within and across Help and
man.

Because LibManual also doesn't contain any DeprecatedString, some
adjustments to Help's string handling is included, just to interoperate
with LibManual better. Further work in this area mostly requires String
APIs in LibGUI.
2022-12-11 16:05:23 +00:00
Andreas Kling
a3a5d2b27d SpaceAnalyzer: Consolidate the node context menus
Instead of having two separate context menus and popping up either the
"file" or "directory" one depending on the selected node, we now have a
single context menu and update it (before popping it up) to show the
context-appropriate actions.

This is achieved by simply updating the visibility of the actions.

This takes care of one TODO! :^)
2022-12-10 14:28:38 +01:00
thankyouverycool
31f4ec66c5 Magnifier: Add a manual to Help menu and propagate construction errors 2022-12-10 13:15:35 +01:00
thankyouverycool
5e96ad0345 Magnifier: Standardize File menu
File->Quit should appear as the final item in its menu
2022-12-10 13:15:35 +01:00
thankyouverycool
f8e0bcbedf Magnifier: Remove always_on_top_action
This action was originally added so that Magnifier's window would
always be on top by default, but it's a redundant menu item and wasn't
actually setting itself at start-up. Instead, rely on the same menu
item provided to all Modeless windows by default for a more consistent
UX, and set the option after show() so it takes effect.
2022-12-10 13:15:35 +01:00
Arda Cinar
6361584d4a KeyboardSettings: Disable "activate keymap" button if keymap is active 2022-12-10 12:00:30 +00:00
Tim Schumacher
8940f2da7f LibCore: Use Core::Stream for ProcessStatisticsReader 2022-12-10 11:49:24 +00:00
Rodrigo Tobar
67b50d7994 PDFViewer: Let users change image rendering
A new checkbox in the toolbar now allows users toggle image rendering. A
corresponding Config option makes this setting non-volatile. To void
clashing with the previous "show_clipping_paths" option when caching a
Page, we now use the RenderingPreferences.hash() and the pair_int_hash
funcitons to compute a unique key into the page cache map for a given
RenderingPreferences and zoom level.
2022-12-10 10:49:03 +01:00
Sam Atkins
64cfe2b163 SpaceAnalyzer: Display the current location in the window title :^) 2022-12-09 23:23:00 +00:00
Sam Atkins
d8ceaf7870 SpaceAnalyzer: Add a tooltip for the hovered tree node
Many of the nodes are visually too small to show their full name and
file size, so this makes that information visible.
2022-12-09 23:23:00 +00:00
Sam Atkins
6d64e650f1 SpaceAnalyzer: Remove declaration for unimplemented method 2022-12-09 23:23:00 +00:00
Arda Cinar
d46315bcc0 SpaceAnalyzer: Propagate possible errors up
These include a JSON parse error, file open errors, and vector appends.
These fix a bunch of calls to functions with `fixme` in them.
2022-12-09 16:14:32 +00:00
Arda Cinar
f0b61e1443 SpaceAnalyzer: Use raw_delta_y in TreeMapWidget::mousewheel_event
There was a FIXME about using raw delta y value of the mousewheel event
in TreeMapWidget::mousewheel_event. Some time after that code was
written, a raw delta x/y API was added to GUI::MouseEvent. This patch
simply uses that API and removes the FIXME message there.
2022-12-09 16:14:32 +00:00
Moustafa Raafat
ae2abcebbb Everywhere: Use C++ concepts instead of requires clauses 2022-12-09 11:25:30 +00:00
FrHun
59028515c0 LibGUI: Split OpacitySlider into vertical and horizontal helper classes 2022-12-09 00:25:30 +01:00
Lucas CHOLLET
f14006637d CrashReporter: Factorize exiting behavior to window->close() 2022-12-08 17:20:51 +01:00
Timothy Flynn
fef255ee22 Browser: Store cookies in a LibSQL database :^)
Currently, cookies are ephemeral and only survive for the lifetime of
Browser instance. This will make Browser instead store cookies in a SQL
database for persisted access.
2022-12-08 17:14:48 +01:00
Timothy Flynn
bf060adcf9 Browser+LibWebView+WebContent: Do not domain match on cookie updates
Updating cookies through these hooks happens in one of two manners:
1. Through the Browser's storage inspector.
2. Through WebDriver's delete-cookies operation.

In (1), we should not restrict ourselves to being able to delete cookies
for the current page. For example, it's handy to open the inspector from
the welcome page and be able to delete cookies for any domain.

In (2), we already are only interacting with cookies that have been
matched against the document URL.
2022-12-08 17:14:48 +01:00
Andreas Kling
d88c7fee32 LibGfx+Userland: Make PNGWriter::encode() return ErrorOr<ByteBuffer>
This is a first step towards handling PNG encoding failures instead of
just falling over and crashing the program.

This initial step will cause encode() to return an error if the final
ByteBuffer copy fails to allocate. There are more potential failures
that will be surfaced by subsequent commits.

Two FIXMEs were killed in the making of this patch. :^)
2022-12-08 13:01:11 +00:00
Tim Schumacher
2fc2025f49 LibCore: Move Core::Stream::File::exists() to Core::File
`Core::Stream::File` shouldn't hold any utility methods that are
unrelated to constructing a `Core::Stream`, so let's just replace the
existing `Core::File::exists` with the nicer looking implementation.
2022-12-08 12:52:14 +00:00
Lucas CHOLLET
1ac0aaa555 CrashReporter: Disable save button until it is ready to use 2022-12-08 07:12:01 -05:00
Filiph Sandström
01cdd3f181 WindowServer+MouseSettings: Improve buttons_switched naming
Before this commit it was a bit ambiguous which buttons the function
name were referring to; this instead now makes it clear that it's
related to mouse input. Additionally, this also fixes incorrect getter
naming leftover from yesteryear.
2022-12-08 07:04:09 -05:00
Sam Atkins
81fe2ef178 FileManager: Silence the "not found" error when setting no wallpaper
If we're setting the path to "" then we can just set the wallpaper to
nullptr and carry on with our day. :^)
2022-12-07 17:12:45 +00:00
Linus Groh
525f22d018 LibJS: Replace standalone js_string() with PrimitiveString::create()
Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
2022-12-07 16:43:06 +00:00
MacDue
27fae78335 Meta+Userland: Pass Gfx::IntSize by value
Just two ints like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue
e011eafd37 Meta+Userland: Pass Gfx::FloatPoint by value
Just a small 8-byte value like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue
7be0b27dd3 Meta+Userland: Pass Gfx::IntPoint by value
This is just two ints or 8 bytes or the size of the reference on
x86_64 or AArch64.
2022-12-07 11:48:27 +01:00
MacDue
bbc149ebb9 Meta+Userland: Pass Gfx::Color by value
Gfx::Color is always 4 bytes (it's just a wrapper over u32) it's less
work just to pass the color directly.

This also updates IPCCompiler to prevent from generating
Gfx::Color const &, which makes replacement easier.
2022-12-07 11:48:27 +01:00
Linus Groh
112b3f7342 LibJS: Convert MarkupGenerator to the new String 2022-12-07 09:58:38 +00:00
Maciej
6e4f886999 3DFileViewer: Properly propagate errors from WavefrontOBJLoader
Fixes 3 FIXMEs.
2022-12-06 17:24:45 +00:00
Linus Groh
57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Filiph Sandström
2e3efd34c3 MouseSettings: Add "Natural scrolling" toggle 2022-12-04 19:32:43 +00:00
Osamu-kj
ac556e2623 DisplaySettings: Remove unnecessary check for an overridden theme
Issue discussed in #16290
2022-12-04 12:12:55 +00:00
Linus Groh
d26aabff04 Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Andreas Oppebøen
8cca9e94a2 PixelPaint: Record action for all select operations to allow undo
Since selections with the select tools support undo, it makes
sense for the edit operations 'select all', 'none', 'invert' and
'clear selection' to also support undo.
2022-11-30 12:18:06 +00:00
Andreas Oppebøen
427d488d7e PixelPaint: Record action when erasing a selection to allow undo 2022-11-30 12:18:06 +00:00
thankyouverycool
a97768001b TextEditor: Change Find/Replace shortcut to Ctrl+Shift+F 2022-11-29 15:39:13 +00:00
MacDue
458ca83d8c PixelPaint: Fix lasso tool preview when zoomed in
Previously only part of the preview would be visible when zoomed in,
with less visible the more you zoomed. This also now doesn't scale
the preview line thickness, similar to other image editing programs.
2022-11-27 20:35:22 +01:00
MacDue
fccda26ef9 PixelPaint: Don't scale preview thickness for polygonal select tool
This is consistent with other editors and makes it a little easier
to precisely select things when zoomed in.
2022-11-27 20:35:22 +01:00
MacDue
0482190bc8 PixelPaint: Make antialiasing the default for tools
Our AA painting works with opacity and generally has a nicer look
so lets make it the default.
2022-11-27 20:35:22 +01:00
Baitinq
f3763a5275 Browser: Remove previous history entry in History::replace_current()
The lack of this action caused a bug in my original patch
(https://github.com/SerenityOS/serenity/pull/16004) that appeared when
accessing a site that redirected the client and it was the first site
the client loaded.
2022-11-26 20:54:55 +01:00
thankyouverycool
bc0d56fa74 Assistant: Add a context menu for search results
Right-clicking now reveals menu options for copying text and
showing results in the File Manager
2022-11-26 18:11:51 +01:00
thankyouverycool
65c5901e7c Assistant: Automatically compute Assistant's window dimensions
Disregarding minimum widget size was originally set as a quick fix
when converting Assistant to a Popup window, but it's really much
easier to let layout manage dynamic resizing instead of trying to
add up pixels piecemeal.
2022-11-26 18:11:51 +01:00
thankyouverycool
518964e7c7 Assistant: Convert ResultRows to Coolbar Buttons
This gives search results a more tactile look and feel, consistent
with other iconified widgets across the system. Custom provider
subtitles now appear as tooltips.
2022-11-26 18:11:51 +01:00
Baitinq
f1205b608f Browser: Replace history entry if loading URL because of a redirect
We now replace the current history entry if the page-load has been
caused because of a redirect. This makes it able to traverse the
history if one of the entries redirects you, which previously
caused an infinite history traversion loop.
2022-11-26 11:03:24 +01:00
Baitinq
b447e486b5 Browser: Add History::replace_current() function
This function replaces the current history entry with a new history
entry.
2022-11-26 11:03:24 +01:00
Timothy Flynn
34fd5cb206 SoundPlayer+VideoPlayer: Set the play/pause action text on state change 2022-11-26 09:02:25 +01:00
kleines Filmröllchen
9b819a0dc9 LibAudio: Set asynchronous audio enqueuer thread to maximum priority
Anything that handles audio in this way should run at maximum priority.
2022-11-25 17:01:44 -07:00
Lucas CHOLLET
4219d50a21 LibGfx: Use the Midpoint Ellipse Algorithm
It is only used to draw non-antialiased and non-filled ellipses.
2022-11-26 00:49:05 +01:00
Zaggy1024
ceb7632862 VideoPlayer: Add an option to enable fast seeking
The fast seeking toggle is in the new Playback menu, and when enabled
it makes the PlaybackManager immediately start playing after finding a
keyframe to decode.
2022-11-25 23:28:39 +01:00
Zaggy1024
9a9fe08449 LibVideo: Rewrite the video frame present function to be more readable
The PlaybackManager::update_presented_frame function was getting out of
hand and adding seeking was making it illegible. This rewrites it to be
(hopefully) quite a bit more readable, and adds a few comments to help
future readers of the code.

In addition, some helpful debugging prints were added that should help
debug any future issues with the player.
2022-11-25 23:28:39 +01:00
Zaggy1024
f31621b3f2 VideoPlayer/LibVideo: Implement the UI functionality for seeking
With these changes, the seek bar can be used, but only to seek to the
start of the file. Seeking to anywhere else in the file will cause an
error in the demuxer.

The timestamp label that was previously invisible now has its text set
according to either the playback or seek slider's position.
2022-11-25 23:28:39 +01:00
Zaggy1024
9cf7e8c5aa LibVideo: Reorganize demuxer file hierarchy and rename Matroska files
As new demuxers are added, this will get quite full of files, so it'll
be good to have a separate folder for these.

To avoid too many chained namespaces, the Containers subdirectory is
not also a namespace, but the Matroska folder is for the sake of
separating the multiple classes for parsed information entering the
Video namespace.
2022-11-25 23:28:39 +01:00
Baitinq
75e20a5fd7 PixelPaint: Add the Pen tool as the default tool
We now preselect the pen tool when PixelPaint is launched.
2022-11-25 23:17:44 +01:00
Rodrigo Tobar
44c518e767 PDFViewer: Show single/multi page actions on toolbar
These actions were being constructed, and they work, but were not shown
in the toolbar. Adding them will allow users to actually use them, as
well as pick up any bugs they might have.
2022-11-25 23:03:24 +01:00
Rodrigo Tobar
cbb373e135 PDFViewer: Toggle prev/next page actions when page changes
These actions were not updated accordingly when one scrolled through the
document, and thus one could accidentally, for example, move to the next
page when standing on the last, which caused a crash.

This commit fixes that behavior, toggling the actions' enabled status
depending on the new page being displayed.
2022-11-25 23:03:24 +01:00
Rodrigo Tobar
a740423e23 PDFViewer: Prevent infinity recursion
When removing all contents from the NumericInput box in PDFViewer the
callback set the (empty) text again back in the box, triggering another
callback in a recursive, non-stopping fashion. Not setting the text back
in the box avoids the problem.
2022-11-25 23:03:24 +01:00
Rodrigo Tobar
bc7da24fe6 PDFViewer: Let users change clipping paths visibility
Now that the Renderer accepts preferences, PDFViewer can offer ways for
changing these preferences. The first step in this direction is to add a
checkbox that allows toggling whether clipping paths are visible or not.
A Config item has also been added to remember this setting.
2022-11-25 23:03:24 +01:00
Timothy Slater
3d542b0c38 PixelPaint: Add lasso selection tool
Lasso selection works by allowing the user to draw an arbitrary shape
much like the pen tool and ensuring the shape is closed by connecting
the start/end points when the user is done drawing. Everything inside
the shape becomes the selection.

Selection is determined via an outer flood fill. We begin a flood fill
from a point that is guaranteed to be outside of the drawn shape, and
anything the fill doesn't touch is determined to be the selection
region.
2022-11-25 22:52:45 +01:00
Timothy Slater
dc5402f61e PixelPaint: Clear selection with escape key regardless of active tool
This makes ImageEditor responsible for clearing the active selection
when the escape key is pressed. If the active tool didn't act on the
Escape key (like some selection tools use this to indicate cancelling of
making a new selection), then ImageEditor will check for an active
selection and clear it.
2022-11-25 22:52:45 +01:00
kleines Filmröllchen
de44d6c0a6 Applications: Add Presenter
This version can already:
- load all of the defined file format except for the image type and the
  frame-specific stuff
- navigate frames and slides (though frames are mostly stubbed out)
- display text with various common settings
- displays text with various fitting and scaling methods
- scale and position objects correctly no matter the window size
2022-11-25 14:28:33 -07:00
Andreas Kling
b0b022507b LibJS: Reduce AST memory usage by shrink-wrapping source range info
Before this change, each AST node had a 64-byte SourceRange member.
This SourceRange had the following layout:

    filename:       StringView (16 bytes)
    start:          Position (24 bytes)
    end:            Position (24 bytes)

The Position structs have { line, column, offset }, all members size_t.

To reduce memory consumption, AST nodes now only store the following:

    source_code:    NonnullRefPtr<SourceCode> (8 bytes)
    start_offset:   u32 (4 bytes)
    end_offset:     u32 (4 bytes)

SourceCode is a new ref-counted data structure that keeps the filename
and original parsed source code in a single location, and all AST nodes
have a pointer to it.

The start_offset and end_offset can be turned into (line, column) when
necessary by calling SourceCode::range_from_offsets(). This will walk
the source code string and compute line/column numbers on the fly, so
it's not necessarily fast, but it should be rare since this information
is primarily used for diagnostics and exception stack traces.

With this, ASTNode shrinks from 80 bytes to 32 bytes. This gives us a
~23% reduction in memory usage when loading twitter.com/awesomekling
(330 MiB before, 253 MiB after!) :^)
2022-11-22 21:13:35 +01:00
Names4Noobs
610f1a5aab 3DFileViewer: Propagate key events to the window
Before this, shortcuts would not work due to key events not
being propagated to the window.
2022-11-22 11:23:44 +00:00
thankyouverycool
f7eb72a8be Terminal+LibVT: Toggle TerminalWidget's focus on input preemption
This prevents Terminal's cursor from blinking when a Popup is open.
2022-11-19 16:04:42 +01:00
thankyouverycool
4aa608aa71 LibGUI+Taskbar+Applets+Applications: Set various windows as Popups
Makes the Audio applet, Taskbar clock, CommandPalette, EmojiPicker,
and Assistant work as Popup windows. Popups are frameless, unmovable,
and unresizable by default, in addition to their preemptive function.
Also sets Assistant not to obey widget min size so its search result
area resizes correctly
2022-11-19 16:04:42 +01:00
Julian Offenhäuser
0308300b78 PDFViewer: Take the mousewheel delta into account for scrolling
We now respect the system-wide setting for scroll speed, where we would
previously use a fixed step.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
9b1331a984 PDFViewer: Simplify user-facing error messages
We now show a simple, if less helpful, message to the user and print
the verbose error message to serial instead.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
e782d03f96 PDFViewer: Invalidate document when a page fails to load
This fixes an issue where we would show an error message on every
subsequent paint event, making it impossible to close or use the
application further.

Some more architectural work is needed if we want to invalidate the
sidebar entries as well.
2022-11-19 15:42:08 +01:00
thankyouverycool
92a75ccaed FontEditor: Include file basename in error messages when available
And write messages in the [action] failed: [error] format to match
common error message formatting elsewhere in Userland.
2022-11-19 15:41:09 +01:00
thankyouverycool
9725fd162f LibGUI+Applications: Allow GlyphMapWidget's set_font() to fail
And TRY early during initialization in FontEditor to leave the app
in a valid state on error. Fixes OOM crashes when cloning the original
font for highlight modifications.
2022-11-19 15:41:09 +01:00
thankyouverycool
d9fb838cf6 LibGUI+FontEditor: Allow system emoji to be toggled in GlyphMapWidget
And remove their red backgrounds when visible to not be confused with
deletion highlights.
2022-11-19 15:41:09 +01:00
thankyouverycool
c974e644ec FontEditor: Add Layout options to View menu
Like other apps, FontEditor now organizes widget visibility toggles
under a View->Layout submenu. The main toolbar and the status bar
can now be turned on and off.
2022-11-19 15:41:09 +01:00
thankyouverycool
61d93092cf FontEditor: Remove redundant set_scale() helper 2022-11-19 15:41:09 +01:00
thankyouverycool
8f7dbf363e FontEditor: Remove overzealous find-and-replace ""sv operator 2022-11-19 15:41:09 +01:00
thankyouverycool
894b41ef4d FontEditor: Consolidate GlyphEditor's flip_{horizontally,vertically} 2022-11-19 15:41:09 +01:00
thankyouverycool
d867871bda FontEditor: Standardize Gfx::RotationDirections for rotate_90() 2022-11-19 15:41:09 +01:00
MacDue
8a5d2be617 Everywhere: Remove unnecessary mutable attributes from lambdas
These lambdas were marked mutable as they captured a Ptr wrapper
class by value, which then only returned const-qualified references
to the value they point from the previous const pointer operators.

Nothing is actually mutating in the lambdas state here, and now
that the Ptr operators don't add extra const qualifiers these
can be removed.
2022-11-19 14:37:31 +00:00
thankyouverycool
d444724d24 ThemeEditor: Update GML and polish interface
Registers the PreviewWidget for addition directly into GML. Fixes
its previous double Frame borders. Also standardizes the Apply and
Reset buttons as DialogButtons and spaces them consistently with
other apps. Gives the TabWidget some tasteful container margins.
2022-11-19 11:04:11 +01:00
thankyouverycool
e99277611b Magnifier+ThemeEditor: Use CommonMenus::make_accessibility_menu() 2022-11-19 11:04:11 +01:00
Idan Horowitz
798d7c6fae LibWeb: Add 'should block pop ups' user config to Page
This will also be used by the window.open algorithm steps.
2022-11-15 21:48:19 +00:00
Timothy Flynn
4fd9e3ab08 Userland: Remove workarounds for LibIPC include order sensitivity 2022-11-15 13:25:51 -05:00
Zaggy1024
66b15e6cd6 KeyboardMapper: Call event.ignore() on keydown in the main widget 2022-11-14 16:08:11 +00:00
Zaggy1024
76627ec0a2 HexEditor: Allow keydown events to propagate if they are not handled 2022-11-14 16:08:11 +00:00
Zaggy1024
7ce346e50e PixelPaint: Allow keydown events to bubble from ImageEditor
Previously, all keydown KeyEvents were accepted, causing parent widgets
not to receive them. With the addition of shortcut handling to keydown,
shortcuts were not called when the ImageEditor was focused.
2022-11-14 16:08:11 +00:00
Zaggy1024
87aed17a46 VideoPlayer: Make PlaybackManager use OwnPtr
VideoPlayerWidget was keeping a reference to PlaybackManager when
changing files, so the old and new managers would both send frames to
be presented at the same time, causing it to flicker back and forth
between the two videos. However, PlaybackManager no longer relies on
event bubbling to pass events to its parent. By changing it to send
events directly to an Object, it can avoid being ref counted, so that
it will get destroyed with its containing object and stop sending
events.
2022-11-14 10:05:56 +00:00
Andrew Kaster
5925d3b26b Browser: Remove unused WebDriverSessionServer.ipc
This was missed in 7972916be7
2022-11-14 10:01:44 +00:00
Lucas CHOLLET
7649feb26f SoundPlayer: Load cover image from music files
When the visualization is set to "Album Cover", the player will now try
to load the embedded image. On failure, it defaults to a "Cover" image
file in the directory.

In Player::play_file_path, file_name_changed now needs to be executed
after that the loader have been set, to get the correct image.
2022-11-13 18:51:18 -07:00
Karol Kosek
0b7f5bbdfb Userland: Accept drag_enter events for widgets supporting file drops
This patch will switch cursor to DragCopy when a user enters a widget
while dragging file(s), giving them a visual clue that it *might* be
dropped into this widget.

This is a rather naive approach, as the cursor icon will change for any
kind of file, as currently programs don't know the drag contents before
dropping it. But after all I think it's better than nothing. :^)
2022-11-13 16:13:03 -07:00
Timothy Slater
461ee18d64 PixelPaint: Correct active tool ImageEditor sync issue
This fixes a scenario in which the active tool can get out of sync in
regards to what it believes it the current ImageEditor. In the case
where multiple images are open, switching between the editor tabs with a
tool selected can lead to this unsynchronized state due to a check that
the ImageEditor's active tool matches the current tool. If this is the
case the method returns early before we properly set the new editor
pointer on the active tool.
2022-11-13 16:08:48 -07:00
kleines Filmröllchen
276be7f8cc Piano: Guard against all allocations at top level of the audio pipeline
Therefore, we don't rely on LibDSP Processors to use allocation guards
themselves. It also demonstrates that nested allocation guards work
correctly :^)
2022-11-13 19:17:21 +00:00
kleines Filmröllchen
59a9f8a958 Piano: Alphabetize sources
:greenlinus:
2022-11-13 19:13:28 +00:00
Tobias Christiansen
1aa16b4dd4 WebDriver: Implement POST /session/{id}/window/fullscreen endpoint 2022-11-12 12:12:05 +00:00
Timothy Flynn
7972916be7 Browser+WebDriver: Remove the connection between Browser and WebDriver
WebDriver now only has an IPC connection to WebContent. WebDriver still
launches the browser, but now when the session ends, we simply send a
SIGTERM signal to the browser.
2022-11-11 22:03:23 +00:00
Timothy Flynn
c64da0d00c Browser+WebDriver: Add missing header includes
These are currently being included transitively, and will cause an error
when those intermediate includes are removed.
2022-11-11 22:03:23 +00:00
Timothy Flynn
2c9549cb76 Browser+WebContent+WebDriver: Move Get Title to WebContent 2022-11-11 22:03:23 +00:00
Timothy Flynn
7f142745e2 Browser+WebContent+WebDriver: Move Back, Forward, Refresh to WebContent 2022-11-11 22:03:23 +00:00
Timothy Flynn
ff6055e0a3 Browser+WebContent+WebDriver: Move Delete All Cookies to WebContent 2022-11-11 18:02:04 +00:00
Timothy Flynn
b7f21bb92e Browser+WebContent+WebDriver: Move Delete Cookie to WebContent 2022-11-11 18:02:04 +00:00
Timothy Flynn
18abc6c85d Browser+WebContent+WebDriver: Move Add Cookie to WebContent
The new implementation is made a bit simpler by way of TRY. It also
implements setting the SameSite attribute.
2022-11-11 18:02:04 +00:00
Timothy Flynn
a3d6c2f6af Browser+WebContent+WebDriver: Move Get Named Cookie to WebContent
Instead of sending *all* cookies over IPC and filtering by name, we now
filter by name from the cookie jar and send just the first matching
cookie.
2022-11-11 18:02:04 +00:00
Timothy Flynn
c77260c480 Browser+WebContent+WebDriver: Move Get All Cookies to WebContent
There are a couple changes here from the existing Get All Cookies
implementation.

1. Previously, WebDriver actually returned *all* cookies in the cookie
   jar. The spec dictates that we only return cookies that match the
   document's URL. Specifically, it calls out that we must run just the
   first step of RFC 6265 section 5.4 to perform domain matching.

   This change adds a special mode to our implementation of that section
   to skip the remaining steps.

2. We now fill in the SameSite cookie attribute when serializing the
   cookie to JSON (this was a trival FIXME that didn't get picked up
   when SameSite was implemented).
2022-11-11 18:02:04 +00:00
Timothy Flynn
31469ee45a Browser+WebContent+WebDriver: Move Execute Async Script to WebContent
With this, WebDriverEndpoints is unused and removed :^)
2022-11-11 11:36:07 +00:00
Timothy Flynn
88dcdf681f Browser+WebContent+WebDriver: Move Get Page Source to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
ea0561a0b3 Browser+WebContent+WebDriver: Move Take Element Screenshot to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
de1e882601 Browser+WebContent+WebDriver: Move Take Screenshot to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
93e14799c5 Browser+WebContent+WebDriver: Move Is Element Enabled to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
30d6a73d0e Browser+WebContent+WebDriver: Move Get Element Rect to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
9dd62228c8 Browser+WebContent+WebDriver: Move Get Element Tag Name to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
5d32fd7026 Browser+WebContent+WebDriver: Move Get Element Text to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
06f1b8825c Browser+WebContent+WebDriver: Move Get Element CSS Value to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
3c00d0e92b Browser+WebContent+WebDriver: Move Get Element Property to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
1bc94e135f Browser+WebContent+WebDriver: Move Get Element Attribute to WebContent
In doing so, this also implements a FIXME to handle boolean attributes.
2022-11-10 17:02:11 +00:00
Timothy Flynn
04ea3992e9 Browser+WebContent+WebDriver: Move Is Element Selected to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
560da56a1d Browser+WebContent+WebDriver: Move Find Elements From Element to WC
This also lets us remove the element location strategy and some
WebContent IPC from Browser/LibWebView now that they are unused.
2022-11-10 13:10:16 +00:00
Zaggy1024
18a6a1dd10 LibVideo: Handle corrupted video errors without spamming dialogs
No longer will the video player explode with error dialogs that then
lock the user out of closing them.

To avoid issues where the playback state becomes invalid when an error
occurs, I've made all decoder errors pass through the frame queue.
This way, when a video is corrupted, there should be no chance that the
playback state becomes invalid due to setting the state to Corrupted
in the event handler while a presentation event is still pending.
Or at least I think that was what caused some issues I was seeing :^)

This system should be a lot more robust if any future errors need to be
handled.
2022-11-10 12:32:55 +03:30
Timothy Flynn
03d0c7a5b6 Browser+WebContent+WebDriver: Move [Max,Min]imize Window to WebContent
This also lets us more fully implement the "iconify the window" method,
which requires we block until the document reaches the "hidden" state.
2022-11-09 19:59:26 +00:00
Timothy Flynn
1c398b32ce Browser+LibWebView+WebContent: Add IPC to minimize and maximize window
Requests to maximize and minimize Browser windows will be coming from
the WebContent process rather than the WebDriver process. Add hooks to
propagate these requests back up to the Browser.
2022-11-09 19:59:26 +00:00
Timothy Flynn
b57d7e4332 Browser+WebContent+WebDriver: Move Get/Set Window Rect to WebContent
This also lets us more fully implement the "restore the window" method,
which requires we block until the document reaches the "visible" state.
2022-11-09 19:59:26 +00:00
Timothy Flynn
9505928fdb Browser+LibWebView+WebContent: Add IPC to re[store,size,position] window
Requests to restore, resize, and reposition Browser windows will be
coming from the WebContent process rather than the WebDriver process.
Add hooks to propagate these requests back up to the Browser.

The spec notes "The specification does not guarantee that the resulting
window size will exactly match that which was requested", so these new
methods return the actual new size/position.
2022-11-09 19:59:26 +00:00
Timothy Flynn
71aba39562 Browser: Remove unused WebDriver IPC endpoints
I had originally thought to just leave these and remove them all at once
at the end of the WebContent migration. But it is kind of confusing to
have them around, so this removes the endpoints that have already been
ported.
2022-11-09 19:59:26 +00:00
Timothy Slater
75c359ef31 PixelPaint: Make filters apply to a selection if one is present
This changes ImageProcessor to use the scratch bitmap of the layer which
will cause the changes to only be applied inside the active selection
(if there is one). This also updates the FilterPreviewWidget to show the
filter preview with active selection taken into account.
2022-11-09 22:13:26 +03:30
Timothy Flynn
31bb79295d WebContent+WebDriver: Move the Navigate To command to WebContent 2022-11-08 19:58:34 -05:00
Timothy Flynn
50ae1ad18a Browser+LibWebView+WebDriver: Connect WebDriver to WebContent
First, this moves the WebDriver socket to the /tmp/websocket/ directory,
as WebDriver now creates multiple sockets per session. Those sockets are
now created with Core::LocalServer rather than manually setting up the
listening sockets (this was an existing FIXME which resolved some issues
I was hitting with creating a second listening socket).

WebDriver passes both socket paths to Browser via command line. Browser
continues to connect itself via one socket path, then forwards the other
socket path to the WebContent process created by the OOPWV. WebContent
then connects to WebDriver over this path.

WebContent will temporarily set the navigator.webdriver flag to true
after connecting to WebDriver. This will soon be moved to its own IPC to
be sent by WebDriver.
2022-11-08 19:58:34 -05:00
Torstennator
a66dbef1ed PixelPaint: Improve brushtool gradient for low hardness
This patch mitigates a rough gradient for the brush tool with a low
hardness. Previously the gradient alpha value was truncated by the type
conversion to int. Now the desired alpha value is scaled up to mitigate
the information loss due to type conversion which results in a much
smoother gradient.
2022-11-07 20:58:02 +00:00
Torstennator
e520b9c3a3 PixelPaint: Relate cursor to brush tool size
This patch changes the cursor for the brush tool to a circle of dynamic
size to indicate the region where the tool will apply color changes.
2022-11-07 20:58:02 +00:00
Karol Kosek
9805cdeaf5 ThemeEditor: Warn about unsaved changes on file open 2022-11-07 12:55:46 +00:00
Karol Kosek
6b8d351b40 TextEditor+HexEditor: Warn about unsaved changes after dropping files 2022-11-07 12:55:46 +00:00
Torstennator
65919bcbb5 PixelPaint: Remember visibility for histogram and vectorscope
This patch allows pixelpaint to remember if the histogram or vectorscope
was visible last time the application was used.
2022-11-07 12:39:44 +00:00
Slimey
e00b16460c Base+VideoPlayer: Add an icon for video player
Co-authored-by: TreuKS <ks2225@protonmail.com>
2022-11-06 22:27:22 -08:00
Daniel Bertalan
4296425bd8 Everywhere: Remove redundant inequality comparison operators
C++20 can automatically synthesize `operator!=` from `operator==`, so
there is no point in writing such functions by hand if all they do is
call through to `operator==`.

This fixes a compile error with compilers that implement P2468 (Clang
16 currently). This paper restores the C++17 behavior that if both
`T::operator==(U)` and `T::operator!=(U)` exist, `U == T` won't be
rewritten in reverse to call `T::operator==(U)`. Removing `!=` operators
makes the rewriting possible again.
See https://reviews.llvm.org/D134529#3853062
2022-11-06 10:25:08 -07:00
Slimey
bb95374b49 VideoPlayer: Add quit action and help menu
I also moved the menubar initialization code to VideoPlayerWidget in
order to keep all of the bulk out of main.cpp :)
2022-11-06 16:27:18 +01:00
Slimey
8006bdf6b4 VideoPlayer: Show current open file in the title 2022-11-06 14:49:09 +01:00
Timothy Flynn
ea7ce76d20 Browser: Add a context menu item to take a full document screenshot 2022-11-05 09:29:28 +01:00
Timothy Flynn
59b1dfa4e5 Browser: Rename "take screenshot" action to "take visible screenshot"
This is to differentiate between this and an upcoming action to take a
screenshot of the entire document.
2022-11-05 09:29:28 +01:00
Linus Groh
b667cd69ca Browser: Add a banner to tabs controlled by WebDriver
From https://www.w3.org/TR/webdriver/#security:

It is also suggested that user agents make an effort to visually
distinguish a user agent session that is under control of WebDriver from
those used for normal browsing sessions. This can be done through a
browser chrome element such as a “door hanger”, colorful decoration of
the OS window, or some widget element that is prevalent in the window so
that it easy to identify automation windows.
2022-11-04 23:38:38 -04:00
Linus Groh
3ed1a14371 Browser: Refactor WebDriver flag activation into a single function 2022-11-04 23:38:38 -04:00
Timothy Flynn
b0eb45f7c7 WebDriver+Browser: Implement GET /session/{id}/element/{id}/screenshot 2022-11-05 01:10:03 +00:00
Gunnar Beutner
0eb7d1e05c FileManager: Improve error handling when posix_spawn() fails
Previously we'd try to disown() the newly created process even if
posix_spawn() had failed.
2022-11-04 09:47:30 +01:00
Timothy Flynn
2d75229192 WebDriver+Browser: Implement GET /session/{id}/element/{id}/selected 2022-11-03 19:40:43 -04:00
Timothy Flynn
0f2b4d0aac WebDriver+Browser: Implement GET /session/{id}/element/{id}/enabled 2022-11-03 19:15:43 +00:00
Timothy Flynn
08c687ef20 WebDriver+Browser: Implement GET /session/{id}/element/{id}/rect 2022-11-03 19:15:43 +00:00
Nico Weber
daeaefad17 Everywhere: Clean up "the the" comment typos 2022-11-03 17:38:32 +00:00
Timothy Flynn
61d0b66bfb WebDriver+Browser: Implement GET /session/{id}/source 2022-11-03 14:48:04 +00:00
Linus Groh
747ba2a88f Browser+LibWebView: Add WebDriver IPC plumbing for executing scripts 2022-11-02 23:46:30 +00:00
Timothy Flynn
ce8c34a8c9 Browser: Add a context menu item to take a screenshot of the current tab 2022-11-02 23:44:18 +00:00
Timothy Flynn
1ffaad29e1 WebDriver+Browser: Implement GET /session/{id}/screenshot
This doesn't follow the spec to a tee. Our OutOfProcessWebView already
has a bitmap that can be used as the window screenshot. Therefore, we
can bypass the steps that assume we need to access the window's frame
buffer in-flight.

We also don't create an HTMLCanvasElement. We would need a Document in
the WebDriver process to do so. Instead, we can still run the encoding
steps exactly as-is using the screenshot bitmap.
2022-11-02 17:55:37 +00:00
Timothy Flynn
d603585802 Browser+LibWebView: Add a Tab hook to take a screenshot 2022-11-02 17:55:37 +00:00
Timothy Flynn
11d0489fa3 WebDriver+Browser: Implement POST /session/{id}/window/minimize 2022-11-02 15:41:19 +00:00
Timothy Flynn
89b2ff72f7 WebDriver+Browser: Implement POST /session/{id}/window/maximize 2022-11-02 15:41:19 +00:00
Timothy Flynn
174248678e WebDriver+Browser: Implement POST /session/{id}/window/rect 2022-11-02 15:41:19 +00:00
Timothy Flynn
dac91c5790 WebDriver+Browser: Implement GET /session/{id}/window/rect 2022-11-02 15:41:19 +00:00
Moustafa Raafat
0ce854cf73 TextEditor: Save the selected font 2022-11-02 14:21:30 +00:00
Maciej
c90024fbab SystemMonitor: Add context menu for opening adapter in NetworkSettings 2022-11-02 12:00:26 +00:00
Maciej
38fb3257c8 NetworkSettings: Add command line option for opening a specific adapter 2022-11-02 12:00:26 +00:00
Maciej
f4a5cd63bb SystemMonitor: Add Command column to ProcessModel
This column shows full command line of a process, or empty line if an
error occures when reading it. The command is not escaped for now.
2022-11-02 12:00:26 +00:00
jack gleeson
4bf587811f PixelPaint+LibGfx: Allow resizing images and layers
This PR adds resize ability to PixelPaint as per issue 11862.
The previous behaviour was to always rescale the canvas when
resizing an image. This adds a checkbox to toggle between
rescaling, and resizing which blits the existing canvas to
the top left of the new, resized canvas.

As part of this, a new ScalingMode is added to
LibGfx - None.
2022-11-02 10:59:18 +00:00
Timothy Flynn
325e3c7bc6 Browser: Inform WebView processes of the browser window's position/size 2022-11-01 21:16:50 +00:00
Tim Schumacher
ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
2022-11-01 14:49:09 +00:00
Timothy Flynn
d515929134 Browser: Update Storage Inspector's cookie model when deleting cookies
We currently get a list of cookies when the Storage Inspector is opened
and never update that list when deleting cookies. This updates the
inspector to actually take cookies out of the model when deleting them,
rather than deleting a copy of them.
2022-11-01 14:32:26 +00:00
kamp
8b0a464f5c HexEditor: Implement undo and redo actions 2022-11-01 12:07:28 +00:00
kamp
24f729d0ef HexEditor: Only mark window as modified when document is actually dirty 2022-11-01 12:07:28 +00:00
martinfalisse
76da0c6c54 WebDriver: Implement GET /session/{id}/element/{id}/text endpoint 2022-11-01 10:55:34 +00:00
martinfalisse
5ffff09e05 WebContent+Friends: Add get_element_text IPC and plumbing 2022-11-01 10:55:34 +00:00
premek
ec34d60e5c HexEditor: Specify page skip size in multiples of the line height 2022-10-31 15:37:08 +00:00
Zaggy1024
f99d356a17 VideoPlayer: Start fleshing out the user interface
This adds player widget with working play/pause controls, a seek bar
which currently only displays the current playback position, and a
button to cycle between the scaling modes.

The player uses the new PlaybackManager class to handle demuxing,
decoding, and frame presentation timing.

Currently, the volume control is non-functional.
2022-10-31 14:47:13 +01:00
Zaggy1024
0a4def1208 LibVideo: Abstract media container format demuxing
This creates an abstract Demuxer class to allow multiple container
container formats to be easily used by video playback systems.
2022-10-31 14:47:13 +01:00
Zaggy1024
2b4b6c5613 LibVideo: Make VP9::Decoder a subclass of a new abstract VideoDecoder
This will allow other decoders to be used in place of VP9::Decoder when
new video decoders are implemented, such as AV1.
2022-10-31 14:47:13 +01:00
Zaggy1024
3720f66bb1 LibVideo: Set CodingIndependentCodePoints in its member functions
This moves the setting of code points in CICP structs to member
functions completely so that the code having to set these code points
can be much cleaner.
2022-10-31 14:47:13 +01:00
Zaggy1024
074f771b59 LibVideo: Add VideoFrame class for decoded video frames
The class is virtual and has one subclass, SubsampledYUVFrame, which
is used by the VP9 decoder to return a single frame. The
output_to_bitmap(Bitmap&) function can be used to set pixels on an
existing bitmap of the correct size to the RGB values that
should be displayed. The to_bitmap() function will allocate a new bitmap
and fill it using output_to_bitmap.

This new class also implements bilinear scaling of the subsampled U and
V planes so that subsampled videos' colors will appear smoother.
2022-10-31 14:47:13 +01:00
Oleg Kosenkov
0c27d95e76 Userland: Use Threading::MutexLocker to lock/unlock mutexes 2022-10-31 00:00:52 +01:00
Sam Atkins
ff0a2b1a60 LibGfx+Everywhere: Make DisjointRectSet work for non-int Rects
For convenience, `DisjointIntRectSet` is an alias for
`DisjointRectSet<int>`, and is used everywhere for now.
2022-10-27 13:06:33 +02:00
Timothy Slater
e73aeb4cea PixelPaint: Make scopes hideable
Vectorscope and Histogram are now hidden by default. New menu "Scopes"
allows for them to be toggled on/off.
2022-10-27 12:59:20 +02:00
Liav A
5dfb2b18f3 Applications: Use new global variables at /sys/kernel/ directory 2022-10-25 15:33:34 -06:00
demostanis
34acae90c7 Userland: Let applications make use of make_command_palette_action() 2022-10-25 10:21:18 +01:00
Zaggy1024
b87398341b LibVideo: Add CICP parsing to MatroskaReader
This will allow correct independent code points to be selected from VP9
in WebM, since the VP9 bitstream does not specify them independently.
2022-10-25 11:06:11 +02:00
Zaggy1024
cd127b65c3 LibVideo: Implement CICP color space conversion
This adds a struct called CodingIndependentCodePoints and related enums
that are used by video codecs to define its color space that frames
must be converted from when displaying a video.

Pre-multiplied matrices and lookup tables are stored to avoid most of
the floating point division and exponentiation in the conversion.
2022-10-25 11:06:11 +02:00
Timothy Slater
0d7d759095 PixelPaint: Limit editing tools to selection
This effectively creates a double-buffer for tools to use when modifying
the layer's bitmap (content or mask). Once the changes have been made
the tool reports to the layer that it has made changes along with a Rect
of the changed region. The layer will then merge the changes from the
scratch image to the real bitmap. This merge is done as follows: If a
given pixel is inside the selected region, the pixel from the scratch
bitmap is copied to the real bitmap. If the pixel is not inside the
selected region, the pixel from the real bitmap is copied to the scratch
bitmap.

As an optimization, when there is no selection active, the new method
for getting the scratch bitmap will return the real bitmap and no
merging will need to take place.
2022-10-24 23:46:22 +01:00
demostanis
3e8b5ac920 AK+Everywhere: Turn bool keep_empty to an enum in split* functions 2022-10-24 23:29:18 +01:00
Liav A
5b3980b040 Userland: Utilize MS_NOREGULAR mount flag
For SystemServer, we simply ensure that the /dev mount is now mounted
with MS_NOREGULAR flag to ensure only non-regular files are created,
thus, achieving what DevTmpFS provided in its implementation, but in a
much more sane and clean way than how DevTmpFS did that.

For other userland applications, we simply make them being aware of this
flag so they can show an indication about this flag being used to the
user.
2022-10-22 19:18:15 +02:00
Smrtnyk
cb480fa3dc Browser: Show SameSite attribute in cookie storage inspector 2022-10-22 18:17:01 +02:00
Tobias Christiansen
a534e61b44 WebDriver: Implement GET /session/{id}/element/{id}/name endpoint 2022-10-22 13:44:49 +02:00
Tobias Christiansen
be6bbdaa3b WebContent+Friends: Add get_element_tag_name IPC and plumbing 2022-10-22 13:44:49 +02:00
Sam Atkins
851bece9fc Browser: Hide WebDriver debug messages behind WEBDRIVER_DEBUG 2022-10-21 19:59:03 +02:00
crpz1
87a9462b7f Magnifier: Increase window size
The help menu was not visible prior to this.
2022-10-21 17:16:01 +01:00
crpz1
466e0c4846 Magnifier: Add Always on Top 2022-10-21 17:16:01 +01:00
Sam Atkins
4d9c0c7b22 Browser: Add ability to delete cookies from Storage Inspector
Adds actions to delete either a single cookie, or all of them.

This looks weird, because the GUI doesn't update until you "Inspect >
Open Storage Inspector", but it does function. :^)
2022-10-20 21:52:44 +02:00
Tobias Christiansen
c11462f40e WebDriver: Introduce a WebDriverEndpoints class
This holds the Functions used by the WebDriver to not clutter up the
`Tab.h` file.
2022-10-20 21:48:12 +02:00
Tobias Christiansen
354a845d65 WebDriver: Implement GET /session/{id}/element/{id}/css/{name} 2022-10-20 21:26:10 +02:00
Tobias Christiansen
202b2be1f2 WebContent+Friends: Add IPC and plumbing for WebDriver endpoint
To use the `GET /session/{id}/element/{id}/css/{property name}`
WebDriver endpoint, two new IPC calls through the Browser are
implemented:
    - get_active_documents_type returns the type of the active document,
      which is either "xml" or "html"
    - get_computed_value_for_element returns the computed CSS value (as
      String) for the given element and CSS property name
2022-10-20 21:26:10 +02:00
Timothy Slater
038a833f0c PixelPaint: Add Polygonal Select Tool
Polygonal selection tool allows for the drawing of any arbitrary
polygonal shape. It tracks clicked points in a vector, upon double
clicking we finalize the polygon and generate the selection mask. The
user can press the escape key during selection to cancel.

The mask is generated as follows:

- First we calculate the size of the bounding rect needed to hold the
  polygon
- We add 2 pixels to height/width to allow us a 1 pixel border, the
  polygon will be centered in this bitmap
- Draw the polygon into the bitmap via Gfx::Painter, making sure to
  connect final polygon point to the first to ensure an enclosed shape
- Generate a selection mask the size of the bitmap, with all pixels
  initially selected
- Perform a flood fill from (0,0) which is guaranteed to be outside the
  polygon
- For every pixel reached by the flood fill, we clear the selected pixel
  from the selection mask
- Finally we merge the selection mask like other selection tools.
2022-10-19 23:04:07 +02:00
Timothy Slater
20f6485311 PixelPaint: Pass doubleclick events to tools 2022-10-19 23:04:07 +02:00
Timothy Slater
7b163573e6 PixelPaint: Ensure bitmap contains selected pixel before deleting
This fixes a bug which shows up when a layer is offset and the selection
range includes pixels that are outside the current layer bitmap rect. We
would still try to delete that pixel from the bitmap since there was no
contains() check.
2022-10-19 23:04:07 +02:00
Timothy Slater
53e4cc16ff PixelPaint: Make escape key clear selection for Wand Select Tool 2022-10-19 23:04:07 +02:00
Tobias Christiansen
e87456e38f WebDriver: Implement GET /session/{id}/element/{id}/property/{name} 2022-10-19 22:30:06 +02:00
Tobias Christiansen
3db92885cd WebContent+Friends: Add get_element_property IPC and plumbing 2022-10-19 22:30:06 +02:00
Tobias Christiansen
249350a7a3 WebDriver: Implement GET /session/{id}/element/{id}/attribute/{name} 2022-10-19 17:30:58 +02:00
Tobias Christiansen
3f5a620b5d WebContent+Friends: Add get_element_attribute IPC and plumbing 2022-10-19 17:30:58 +02:00
Tobias Christiansen
e6f71d5e05 WebDriver: Fix broken Optional<> returns through IPC 2022-10-19 15:32:31 +02:00
Tobias Christiansen
5d762bd448 WebDriver+Friends: Add IPC and plumbing for Element-getting
This extends the IPC calls `get_document_element` and
`query_selector_all` to be usable by the WebDriver. For this the
`WebDriverConnection` provides the same interfaces and takes care of
routing the data through the Browser.
2022-10-18 19:18:33 +02:00
snooze6214
d3353ee0e7 PixelPaint: Add action to invert selection 2022-10-18 18:57:12 +02:00
snooze6214
295fcd639f PixelPaint: Make Wand Select tool select correctly on moved layers
Before this commit, when the wand select tool was used on a layer that
was moved, it would make the selection relative to the image, and not
relative to the layer. This commit fixes that issue.
2022-10-18 18:56:33 +02:00
Tobias Christiansen
61dd7d5d86 WebDriver: Add/Expand some dbgln's
`update_cookie` was missing a dbgln and not all functions getting
arguments printed them.
2022-10-17 15:48:22 +02:00
Tobias Christiansen
122e2d2076 WebDriver: Implement POST /session/{id}/cookie endpoint
This allows the WebDriver to create a cookie.
We use a Web::Cookie::ParsedCookie to transport the data through IPC
to take advantage of the RFC6265 Section 5.3 implementation in the
CookieJar.
2022-10-17 15:48:22 +02:00
Tobias Christiansen
c710780852 Browser: Add update_cookie WebDriver IPC endpoint
Through this the WebDriver will be able to change cookies. Needed for
deleting cookies.
2022-10-17 11:31:30 +02:00
Tobias Christiansen
30360918d4 Browser: Allow changing of existing Cookies in the CookieJar
And attach all the plumbing through to Tab over BrowserWindow.
2022-10-17 11:31:30 +02:00
Fausto Tommasi
813ca5ebbe PixelPaint: Make Alt-Clicking with all tool act like the PickerTool
Refactored PickerTool functionality to the ImageEditor level and added a
flag to Tool Base Class to allow for tools to override Alt+Click
ColorPicker functionality
2022-10-17 09:39:57 +02:00
Chun Ngai Au
5bccb16e61 WindowServer: Add wallpaper backing bitmap
Fixes inconsistencies in redrawing the wallpaper when in stretch mode by
first drawing to a backing bitmap. To reduce unnecessary allocations,
the backing bitmap is only used for stretch mode.
2022-10-17 01:12:51 +02:00
Tobias Christiansen
a34f8c444b WebDriver: Implement GET /session/{id}/cookie/{name} endpoint 2022-10-16 16:32:59 +02:00
Tobias Christiansen
001699f2d6 WebDriver: Implement GET /session/{id}/cookie endpoint 2022-10-15 22:28:34 +02:00
Moustafa Raafat
a4fa604bde WebDriver: Implement POST /session/{id}/forward endpoint 2022-10-15 21:01:59 +02:00
Moustafa Raafat
9132656856 WebDriver: Implement POST /session/{id}/back endpoint 2022-10-15 21:01:59 +02:00
Tobias Christiansen
1179d951f6 WebDriver: Implement POST /session/{id}/refresh endpoint 2022-10-15 15:43:42 +01:00
ne0ndrag0n
323c403d43 NetworkSettings+SpiceAgent: Update and add required unveil paths 2022-10-15 05:59:39 +00:00
Lucas CHOLLET
2d6124049a LibAudio: Get rid of unused method Loader::file()
`aplay` and two files of `SoundPlayer` were relying on the include of
`LibCore/File.h` by `Loader.h`.
2022-10-14 23:11:23 +02:00
Mart G
7394316818 HexEditor: Render selection background without gaps between rows
The selected region in HexEditor is indicated by rendering a different
background color for the selected bytes.

Previously this background was rendered so that the background
rectangles were not contigous between different rows. This caused a high
contrast pattern that interfered with the readability of the hexadecimal
digits.

Now the background is rendered as a single contiguous block.
2022-10-14 16:24:51 +01:00
snooze6214
2b9cf5a7b4 PixelPaint: Unveil clipboard using the right path
Commit #3197c17 introduced a session based clipboard portal.
This made pixel-paint fail to launch, because it had an unveil that
used the old path to the clipboard. This commit fixes that and now
unveils the new session based clipboard portal.
2022-10-14 15:42:07 +02:00
kleines Filmröllchen
cb0b82ec46 Userland+LibCore: Remove legacy SERENITY_VERSION from Core::Version
This was being used as a default version argument in a couple of APIs,
so those need to change signature and the caller always needs to provide
a version.
2022-10-14 13:45:33 +02:00
Timothy Slater
92c203bba2 PixelPaint: Change BucketTool and WandTool to use new Bitmap flood fill
This updates the Bucket and Wand tools to leverage the new flood fill
algorithm added to Gfx::Bitmap instead of implementing it in each tool.
2022-10-14 13:39:33 +02:00
Gunnar Beutner
31bd5b1a02 AK+Userland: Stub out code that isn't currently implemented on AARCH64
Even though this almost certainly wouldn't run properly even if we had
a working kernel for AARCH64 this at least lets us build all the
userland binaries.
2022-10-14 13:01:13 +02:00
ne0ndrag0n
2affe67c75 Settings: Support for launching settings apps as root 2022-10-14 11:23:06 +02:00
ne0ndrag0n
b4456ecdbb Escalator: Add new method to privilege escalate within GUI 2022-10-14 11:23:06 +02:00
Linus Groh
5681115744 Browser: Set 'webdriver-active flag' when creating a new Tab 2022-10-13 11:14:45 +02:00
Sam Atkins
8c0f1da9f7 Browser: Add a basic WebDriver API
This adds a new option "--webdriver" that opens a local unix socket
in /tmp/browser_{pid} which the WebDriver server can use to send
commands to the Browser instance.

Co-authored-by: Florent Castelli <florent.castelli@gmail.com>
2022-10-12 23:07:42 +02:00
Mart G
279121fa10 HexEditor: Fix two off-by-one errors
The 'select all' feature now also selects the last byte of the document.
The find function now also selects the last byte of a match.
2022-10-12 18:15:44 +02:00
Ali Mohammad Pur
166a905951 Userland: Properly populate GENERATED_SOURCES
We previously put the generated headers in SOURCES, which did not mark
them as GENERATED (and did not produce a proper dependency).
This commit moves all generated headers into GENERATED_SOURCES, and
removes useless header SOURCES.
2022-10-12 15:55:15 +01:00
Mart G
c88058cea2 PixelPaint: Call update after clearing guides 2022-10-12 15:25:18 +01:00
Gunnar Beutner
344ca73930 TextEditor: Set window title before showing the main window
Previously TextEditor updated its window title after the window was
already visible. This causes the default title ("GUI::Window") to be
shown for a short period of time which was especially noticeable when
opening files.
2022-10-12 14:47:27 +02:00
MacDue
fef19aa589 PixelPaint: Add Hue/Saturation filter
This filter mimics the functionality from Photoshop and other image
editors, allowing you to adjust the hue, saturation, and lightness of
an image. I always found this a very handy feature :^)
2022-10-10 11:02:10 +01:00
MacDue
71fb1ed226 PixelPaint: Add InplaceFilter and convert FastBoxBlur to be one
This is a simple base class for filters that need to work on the image
in-place.
2022-10-10 11:02:10 +01:00
Zaggy1024
b71d13be82 VideoPlayer: Allow display of multiple frames by clicking the image
For testing purposes, this allows opening of any filename by passing it
as an argument.

Additionally, there is a --benchmark option that will just call decode
for 100 frames and then exit, printing the time spent in the decoder.
2022-10-09 20:32:40 -06:00
Zaggy1024
be0760871e LibVideo: Add support for VP9 superframes
This allows the second shown frame of the VP9 test video to be decoded,
as the second chunk uses a superframe to encode a reference frame and
a second to inter predict between the keyframe and the reference frame.
2022-10-09 20:32:40 -06:00
Zaggy1024
85fd56cf48 VideoPlayer: Display frames from the VP9 decoder
For testing purposes, the output buffer is taken directly from the
decoder and displayed in an image widget.

The first keyframe can be displayed, but the second will not decode
so VideoPlayer will stop at frame 0 for now.

This implements a BT.709 YCbCr to RGB conversion in VideoPlayer, but
that should be moved to a library for handling color space conversion.
2022-10-09 20:32:40 -06:00
Zaggy1024
b37ea6b414 LibVideo: Allow bit stream reads to throw errors
Errors are propagated to the user of the decoder so that they can be
aware of specific places where a read failed.
2022-10-09 20:32:40 -06:00
Zaggy1024
b4c7375119 VideoPlayer: Remove unused #include <LibAudio/ConnectionToServer.h> 2022-10-09 20:32:40 -06:00
Gunnar Beutner
be80ac619f Browser: Add a custom icon for the "New Window" action 2022-10-06 20:51:04 +02:00
Kemal Zebari
90719d34af Browser: Provide ability to create new browser windows
This change allows a user to spawn new browser processes by either
going to "File -> New Window" or by the shortcut "Ctrl + N".
2022-10-06 16:52:57 +01:00
Sergiy Stupar
8a37badc42 PixelPaint: Add actions to crop layer to selection/content 2022-10-06 12:29:16 +01:00
FrHun
6e2fc0285e FileManager: Group Toolbar overflow 2022-10-06 12:17:38 +01:00
Nico Weber
2af028132a AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places
Doesn't use them in libc headers so that those don't have to pull in
AK/Platform.h.

AK_COMPILER_GCC is set _only_ for gcc, not for clang too. (__GNUC__ is
defined in clang builds as well.) Using AK_COMPILER_GCC simplifies
things some.

AK_COMPILER_CLANG isn't as much of a win, other than that it's
consistent with AK_COMPILER_GCC.
2022-10-04 23:35:07 +01:00
Timothy Flynn
08ce8cb996 Applications: Use title-case for group box titles in settings
Capitalization was quite inconsistent, even amongst single settings
applications. This aligns group box titles to all be title case.
2022-10-04 18:19:45 +01:00
Timothy Flynn
5d15fdd6e6 BrowserSettings: Remove overly verbose dbgln statement
This is a bit much, especially with 850+ filters.
2022-10-04 18:19:45 +01:00
Tobias Christiansen
eca559d65d CalendarSettings: Add Weekend-specific settings
In some calendars, weekends start on other days than saturday and can
also have different lengths than 2 days. This patch allows you to set
these values, however they don't do anything yet as Serenity's Calendar
doesn't care about Weekends at the moment.
2022-10-04 12:13:54 -04:00
Lucas CHOLLET
2ff773a6ba Calculator: Add a Shrinking action
This action allow the user to shrink a number to a finite number of
decimal.
2022-10-03 15:12:47 -04:00
Lucas CHOLLET
e3b22c395d Calculator: Add a "Custom" entry to the rounding menu
This entry pop a dialog to ask the user to enter a value. The Calculator
will automatically put itself in this mode if you enter a number with
more digits in the fractional part than the actual maximum length.
2022-10-03 15:12:47 -04:00
Lucas CHOLLET
de568f87fd Calculator: Add a Rounding menu
This menu has three actions. Each one of them enable a different level
of rounding: to 0, 2 or 4 digits.
2022-10-03 15:12:47 -04:00
Timothy Flynn
7cab86ad28 Userland: Unveil /proc/all in applications which require it
These were missed in 7af5eef. It is needed for any application using
e.g. FileSystemAccessServer.
2022-10-03 17:09:21 +01:00
Timothy Flynn
25e0ab3ee4 Userland: Tighten promises by removing 'proc' where it isn't used
This is a partial revert of commit 7af5eef. After 97d15e9, the 'proc'
promise is not needed for operations using getsid().

This also fixes launching several applications in which 7af5eef added
the 'proc' promise only in the second call to pledge().
2022-10-03 17:09:21 +01:00
Peter Elliott
7af5eef0dd SystemServer+LoginServer+Userland: Switch to sid-based sockets
This commit does three things atomically:
- switch over Core::Account+SystemServer+LoginServer to sid based socket
  names.
- change socket names with %uid to %sid.
- add/update necessary pledges and unveils.

Userland: Switch over servers to sid based sockets

Userland: Properly pledge and unveil for sid based sockets
2022-10-03 11:11:29 +02:00
Monroe Clinton
086fccc2af Calendar: Fix crash when changing event date
We were capturing by reference which lead to the variables going
out of scope even when used in the lambda. Due to this the
update_starting_day_range lambda crashes when called.
2022-10-02 15:43:37 +02:00
MacDue
ddfe18783b Magnifier: Don't error if cancelling capture save 2022-10-01 14:06:53 +02:00
thankyouverycool
f27f2e0d3b Welcome: Use StandardPaths to load README.md 2022-10-01 13:39:10 +03:30
thankyouverycool
a6b8ac10f7 Welcome: Use fallible try_create_default_icon() 2022-10-01 13:39:10 +03:30
thankyouverycool
9fe5cadcc8 Welcome: Update GML
Moves more settings to GML to simplify construction and replaces
deprecated GML properties.
2022-10-01 13:39:10 +03:30
thankyouverycool
ca54a965a0 Welcome: Port to Core::Stream 2022-10-01 13:39:10 +03:30
thankyouverycool
72c0414a58 Welcome: Remove unnecessary include 2022-10-01 13:39:10 +03:30
thankyouverycool
929f31f564 Welcome: Add/remove SystemServer group entry to toggle startup
Previously Welcome relied on a bogus executable key value to disable
startup. This always printed an error on login and littered the config
file with a useless entry. Adding/removing the group as needed seems
a bit nicer.
2022-10-01 13:39:10 +03:30
Sam Atkins
a58d72656d Userland: Replace empty GUI::Widgets in GML with GUI::Layout::Spacer
This fixes the "Cancel" button on HackStudio's "New Project" dialog
being too small. It's also clearer what these actually are.
2022-09-29 08:31:15 -04:00
Timothy Slater
7fda016217 PixelPaint: Add option to make new layer from selection
New actions in the Layer Menu allows for the creation of a new layer
from the current selection. Layers can be made by copying the
selection or cutting it from the current layer. The new layer will be
sized to the bounding box of the selection. The newly produced layer
will be added to the layer stack.
2022-09-29 10:20:17 +01:00
Timothy Slater
e66763c223 PixelPaint: Add function to make layer from selection to ImageEditor 2022-09-29 10:20:17 +01:00
networkException
4230dbbb21 AK+Everywhere: Replace "protocol" with "scheme" url helpers
URL had properly named replacements for protocol(), set_protocol() and
create_with_file_protocol() already. This patch removes these function
and updates all call sites to use the functions named according to the
specification.

See https://url.spec.whatwg.org/#concept-url-scheme
2022-09-29 09:39:04 +01:00
Sam Atkins
1da53ef854 Welcome: Get LibWeb to parse Markdown documents for us 2022-09-28 23:58:26 +01:00
kleines Filmröllchen
5294fd671e PixelPaint: Use the parallel ImageProcessor to apply filters
The main advantage of this change is that heavy-weight filters do not
lock up the GUI anymore.

This first cut has several flaws:
- We do not account for modification of the referenced images while the
  filter is running. Depending on the exact filter behavior this might
  have all sorts of weird effects. A simple fix would be to show a
  progress dialog to the user, preventing them from performing other
  modifications in the meantime.
- We do not use the image processor for previews. Preview behavior has a
  couple of other considerations that are intentionally not addressed in
  this commit or pull request.
2022-09-27 14:23:11 +01:00
kleines Filmröllchen
ade868aa56 PixelPaint: Add a general-purpose parallel image processing pipeline
The ImageProcessor singleton is intended to be used by all sorts of
image processing which might take some time to complete; or other
background actions. We're not using BackgroundTask here because this
system is specifically designed to work with task queues and PixelPaint
interaction; e.g. it provides common image processing tasks such as
filter application.
2022-09-27 14:23:11 +01:00
kleines Filmröllchen
9483adee46 PixelPaint: Expose the GUI event loop from the ImageEditor
This allows processing threads to call back into the GUI.
2022-09-27 14:23:11 +01:00
kleines Filmröllchen
056b081e2d PixelPaint: Reference-count filters
For multi-threading filter application, shared ownership is much easier
to work with.
2022-09-27 14:23:11 +01:00
Marco Santos
5f76ab9836 Spreadsheet: Add toolbar actions to change the cell style 2022-09-27 13:38:11 +03:30
Roberto Bampi
69f7a59a34 Magnifier: Add the option to save captures 2022-09-26 17:28:54 +01:00
Liav A
50ed50752f LibEDID: Remove head index when retrieving an EDID from DisplayConnector
We simply don't need that field anymore, as it was used when one
FramebufferDevice could contain multiple framebuffers within it, each
for a connected screen head.
2022-09-24 15:36:19 +01:00
thankyouverycool
930e5c27df ClockSettings: Increase max visible items for time zone ComboBox 2022-09-22 21:37:26 +02:00
Sam Atkins
7a2da4cabf Browser+WebContent+LibJS: Support %c specifiers in Console.log()
...and the other Console methods.

This lets you apply styling to a log message or any other text that
passes through the Console `Formatter` operation.

We store the CSS on the ConsoleClient instead of passing it along with
the rest of the message, since I couldn't figure out a nice way of
doing that, as Formatter has to return JS::Values. This way isn't nice,
and has a risk of forgetting to clear the style and having it apply to
subsequent messages, but it works.

This is only supported in the Browser for now. REPL support would
require parsing the CSS and figuring out the relevant ANSI codes. We
also don't filter this styling at all, so you can `position: absolute`
and `transform: translate(...)` all you want, which is less than
ideal.
2022-09-21 20:03:49 +01:00
Sam Atkins
a875713f2e Browser: Ignore whitespace-only input in the JS console 2022-09-21 20:03:49 +01:00
Andreas Kling
4814e1bd65 Browser: Ignore title updates when history has no current item
The Browser::History class is oblivious to the state of the browsing
context's session history over on the LibWeb side. We need to hook a lot
more thing up here, but for now just ignore updates when there's no
current history item. This fixes a VERIFY() error on startup.
2022-09-21 13:06:17 +02:00
Orel
d8474805e8 SystemMonitor: Save configuration of columns
Save the columns configuration from the last run in the respective
config file, and add a function to check whether a column should be
visible by default.
2022-09-21 10:14:40 +01:00
Olivier De Cannière
d3601aedc5 Calendar: Add Settings button to configure the Calendar 2022-09-20 13:12:00 -04:00
Olivier De Cannière
6f69f4bb5e Calendar: Update month view on first_day_of_week setting change
Now when the user changes their preferred first day of the week in the
Calendar Settings, the Calendar application and applet views are update
accordingly without needing to restart them.
2022-09-20 13:12:00 -04:00
Olivier De Cannière
a1d98b825d Calendar: Add setting to choose default view
This commit adds an entry to the Calendar Settings to allow the user to
select between the month and year views as the startup default.
2022-09-20 13:12:00 -04:00
Olivier De Cannière
0eceed4fd7 Calendar: Add a Calendar settings dialog for the first day of the week
This commit adds a new settings dialog for the Calendar application and
applet. It allows the user to specify their preferred first day of the
week.
2022-09-20 13:12:00 -04:00
Sam Atkins
183b054695 SoundPlayer: Port M3UParser to Core::Stream
Also make the path parameter a StringView, since that's what gets passed
in.
2022-09-20 07:48:45 -04:00
Sam Atkins
2dea636f33 Run: Use Core::Stream API for command history file 2022-09-20 07:48:45 -04:00
Sam Atkins
aee52a458b PixelPaint: Remove unused Image::write_to_file() method
This seems to be a remnant from before FileSystemAccessClient was used.
2022-09-20 07:48:45 -04:00
Andreas Kling
d4acdac317 LibWeb+WebContent+Browser: Plumb visibility state from GUI to web pages
OOPWV now reacts to show/hide events and informs LibWeb about the state
change. This makes visibilitychange events fire when switching tabs. :^)
2022-09-20 10:32:14 +02:00
ne0ndrag0n
b16704d4db GamesSettings: Always ensure last card back selected is saved 2022-09-20 07:59:13 +01:00
Tommaso Peduzzi
f547b9be7b PixelPaint: Scale layer and preserve aspect ratio
This patch adds the ability to scale a layer and
preserve the aspect ratio.
When the Shift key is pressed, the aspect ratio is preserved.
2022-09-16 22:53:07 +02:00
Tommaso Peduzzi
293ab2cdc9 PixelPaint: Add scaling function to move tool
This patch adds scaling function to the move tool.
When the cursor is over the lower right corner of the layer, it changes.
This is to signify that the layer can be scaled by dragging the mouse.

There is currently no preview of the scaling.
Doing a resize every time the mouse moves leads to unexpected behavior.
2022-09-16 22:53:07 +02:00
Andrew Kaster
8ed5ed3ec0 LibGL: Make GL::create_context fallible
Propagate errors in places that are already set up to handle them, like
WebGLRenderingContext and the Tubes demo, and convert other callers
to using MUST.
2022-09-16 15:32:38 +02:00
Lucas CHOLLET
53eb35caba Calculator: Change internal representation to support perfect division
The purpose of this patch is to support addition, subtraction,
multiplication and division without using conversion to double. To this
end, we use the BigFraction class of LibCrypto. With this solution, we
can store values without any losses and forward rounding as the last
step before displaying.
2022-09-15 14:08:21 +01:00
Brian Gianforcaro
d0a1775369 Everywhere: Fix a variety of typos
Spelling fixes found by `codespell`.
2022-09-14 04:46:49 +00:00
networkException
802cf9bc69 Everywhere: Use my very shiny serenityos.org email :^) 2022-09-12 15:13:12 +01:00
networkException
45aeba15c8 CharacterMap: Allow resizing the unicode block list
Previously we would constrain the unicode block list to a width of 175,
causing it to stick to the splitter when manually resizing.

This patch allows resizing the list properly while retaining the new
width when resizing the window.
2022-09-11 23:25:08 +01:00
thankyouverycool
b70e4e9909 Spreadsheet+LibGUI: Set EmojiInputDialog as a CaptureInput modal
This has two advantages: First the picker no longer changes the active
window state of its parent. Visually this is an additional hint that the
dialog is "fragile" and will close on loss of focus. Second, because
it contains a search box, its own input won't be preempted by global
application shortcuts when typing (pending #15129). This is a problem
in apps like PixelPaint which use shortcuts without modifiers.
2022-09-09 11:27:38 -04:00
electrikmilk
fff79379d4 Spreadsheet: Add Insert Emoji action
This adds the Insert Emoji action to Spreadsheet.
2022-09-08 23:08:54 +01:00
electrikmilk
44a5deff40 TextEditor: Add Insert Emoji action
This adds the Insert Emoji action to Text Editor.
2022-09-08 23:08:54 +01:00
thankyouverycool
35e557c657 Browser+LibGUI+WindowServer: Open Button menus uniformly
Instead of letting buttons determine the relative position
of their menus, a workaround only used by Statusbar segments,
open them all uniformly for a nice, consistent UI.

Passing a rect to popup() now routes to open_button_menu(), an
analog to open_menubar_menu(), which adjusts the menu's popup
position in the same way. Fixes button menus obscuring the buttons
which spawn them and jutting out at odd corners depending on screen
position.
2022-09-08 10:17:27 +01:00
electrikmilk
6675865582 Browser: Add context menu icons
This adds two new icons for browser context menu items "Close Other
Tabs" and "Download".

This adds existing icons where they were missing in context menu items.
2022-09-08 10:02:37 +01:00
networkException
178164808c Calendar: Limit the starting day input range to the selected month
Previously we allowed entering any day value greater than one. With this
patch the maximum input value is dynamic based on the selected month and
year.
2022-09-06 17:37:44 +01: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
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
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
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
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
Timothy Slater
f2da577e77 PixelPaint: Change repeated code into a loop for Wand Select Tool 2022-08-31 18:19:46 +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
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
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
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
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
djwisdom
27f5a18ce6 HexEditor: Add Help->Manual entry in Menu 2022-08-29 09:25:29 +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
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
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
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
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
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
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
f833473df0 Apps+Demos+Dialogs: Remove unnecessary minimum window sizes
The new layout system conveniently calculates these for us now.
In the case of Mandelbrot where it needs to be overriden, make
sure to disable obey min widget size first. In EmojiInputDialog's
case, the window needs to be resized instead to center correctly.
2022-08-25 13:28:50 +02:00
James Bellamy
352d6545a9 WindowServer+DisplaySettings: Capitalize display mode dropdown
Every other dropdown in settings is capitalized apart from this one.
This commit fixes that.
2022-08-24 12:17:30 +02:00
electrikmilk
1a9d4ffecf PixelPaint: Add more icons
This adds menu item icons for Add Mask, Flatten Image, Fit Image To
View, and Generic 5x5 Convolution.

This modifies the menu item icon for Swap Colors to make the action more
obvious and improve accessibility.
2022-08-24 12:01:19 +02:00
Andreas Kling
34a09bbb54 PixelPaint: Add simple "Crop Image to Content" feature
This command finds the smallest non-empty content bounding rect
by looking for the outermost non-transparent pixels in the image,
and then crops the image to that rect.

It's implemented in a pretty naive way, but it's a start. :^)
2022-08-23 22:39:27 +02:00
Andreas Kling
5ded6904d8 PixelPaint: Make the default empty image transparent by default
It was previously white by default, but let's change that. :^)
2022-08-23 22:39:27 +02:00
Andreas Kling
28714deff6 PixelPaint: Avoid division-by-zero in HistogramWidget
This is more of a hack fix than anything else, but let's stop PixelPaint
from infinite-looping in HistogramWidget::paint_event().
2022-08-23 22:39:27 +02:00
Tim Schumacher
39a3775f48 Userland: Rely on a single authoritative source for the default PATH 2022-08-23 19:00:04 +01:00
Linus Groh
275dea9d98 LibJS: Remove {Bytecode::,}Interpreter::global_object()
The basic idea is that a global object cannot just come out of nowhere,
it must be associated to a realm - so get it from there, if needed.

This is to enforce the changes from all the previous commits by not
handing out global objects unless you actually have an initialized
realm (either stored somewhere, or the VM's current realm).
2022-08-23 13:58:30 +01:00
Linus Groh
b345a0acca LibJS+LibWeb: Reduce use of GlobalObject as an intermediary
- Prefer VM::current_realm() over GlobalObject::associated_realm()
- Prefer VM::heap() over GlobalObject::heap()
- Prefer Cell::vm() over Cell::global_object()
- Prefer Wrapper::vm() over Wrapper::global_object()
- Inline Realm::global_object() calls used to access intrinsics as they
  will later perform a direct lookup without going through the global
  object
2022-08-23 13:58:30 +01:00
Linus Groh
e3895e6c80 LibJS: Pass Realm to define_native_{accessor,function}()
This is needed so that the allocated NativeFunction receives the correct
realm, usually forwarded from the Object's initialize() function, rather
than using the current realm.
2022-08-23 13:58:30 +01:00
Linus Groh
7c468b5a77 LibJS: Pass Realm to GlobalObject::initialize_global_object()
Global object initialization is tightly coupled to realm creation, so
simply pass it to the function instead of relying on the non-standard
'associated realm' concept, which I'd like to remove later.

This works essentially the same way as regular Object::initialize() now.

Additionally this allows us to forward the realm to GlobalObject's
add_constructor() / initialize_constructor() helpers, so they set the
correct realm on the allocated constructor function object.
2022-08-23 13:58:30 +01:00
Linus Groh
b465f46e00 LibJS: Remove GlobalObject parameter from native functions 2022-08-23 13:58:30 +01:00
Linus Groh
25849f8a6d LibJS: Replace GlobalObject with VM in common AOs [Part 18/19] 2022-08-23 13:58:30 +01:00
Linus Groh
a022e548b8 LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]
This is where the fun begins. :^)
2022-08-23 13:58:30 +01:00
Linus Groh
999da617c5 LibJS: Remove GlobalObject from VM::this_value()
This is a continuation of the previous six commits.

The global object is only needed to return it if the execution context
stack is empty, but that doesn't seem like a useful thing to allow in
the first place - if you're not currently executing JS, and the
execution context stack is empty, there is no this value to retrieve.
2022-08-23 13:58:30 +01:00
Linus Groh
f3117d46dc LibJS: Remove GlobalObject from VM::throw_completion()
This is a continuation of the previous five commits.

A first big step into the direction of no longer having to pass a realm
(or currently, a global object) trough layers upon layers of AOs!
Unlike the create() APIs we can safely assume that this is only ever
called when a running execution context and therefore current realm
exists. If not, you can always manually allocate the Error and put it in
a Completion :^)

In the spec, throw exceptions implicitly use the current realm's
intrinsics as well: https://tc39.es/ecma262/#sec-throw-an-exception
2022-08-23 13:58:30 +01:00