Commit graph

40443 commits

Author SHA1 Message Date
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
thankyouverycool c5dd72ac71 LibGUI: Remember size and position of hidden Windows
And don't reset windowless rects on resize events. Fixes child
windows reappearing at [0,0] and with the wrong dimensions after
being hidden.
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
thankyouverycool 46d6347035 LibGUI+WindowServer: Initialize minimum window size to zero
And remove unnecessary workarounds to the old limit of {50, 50} and
the cautious but arbitrary limit of {1, 1} for other WindowTypes.
Null rects are already the default when calculating minimum window
size and are the least restrictive but valid value.

Also returns early during minimum size calculations for frameless
windows, and verifies against negative minimum sizes and failure to
disable widget min size before setting a minimum window size. Layout
automatically overrides this setting each relayout otherwise.
2022-08-25 13:28:50 +02:00
davidot 8b8cee3172 LibCrypto: Implement a (mostly) proper to_double for UnsignedBigInteger
SignedBigInteger can immediately use this by just negating the double if
the sign bit is set.
For simple cases (below 2^53) we can just convert via an u64, however
above that we need to extract the top 53 bits and use those as the
mantissa.

This function currently does not behave exactly as the JS spec specifies
however it is much less naive than the previous implementation.
2022-08-24 23:27:17 +01:00
davidot 2290fbc2a0 LibCrypto: Make a VERIFY a static_assert since it only uses constants 2022-08-24 23:27:17 +01:00
davidot fce2b33758 LibJS: Allow BigInts as destructuring property names
These are simply treated as their numerical value which means that above
2^32 - 1 they are strings.
2022-08-24 23:27:17 +01:00
davidot e663504df1 LibJS: Fix that leftshift for BigInts did not round down
For negative number this previously rounded towards zero instead of the
intended always rounding down.
2022-08-24 23:27:17 +01:00
davidot cb49c07fb7 LibJS: Use the new BigInt compare_to_double algorithm :^)
Although this is much more complicated it does not seem to impact
performance that much even when looking only at values in which the
previous casting to i32 was correct.
2022-08-24 23:27:17 +01:00
davidot b5c00830c2 LibCrypto: Add a way to compare a SignedBigInteger with a double
This supports any double value (except for NaNs) instead of having to
cast the double to some smaller type which doesn't work for very large
values.
2022-08-24 23:27:17 +01:00
Brian Gianforcaro 14264ca022 Ports: Update gcc to version 12.2.0 2022-08-24 22:24:34 +00:00
Brian Gianforcaro 46f41f40a2 Ports: Update binutils to version 2.39 2022-08-24 22:24:34 +00:00
Brian Gianforcaro 344a0e00c8 Toolchain: Update GDB to version 12.1 2022-08-24 22:24:34 +00:00
Brian Gianforcaro e9e8111f4a Toolchain: Update binutils to version 2.39 2022-08-24 22:24:34 +00:00
Brian Gianforcaro 7ac3dffe9e Toolchain: Update gcc to version 12.2.0 2022-08-24 22:24:34 +00:00
Andreas Kling c713e76941 Tests/Kernel: Make sure inaccessible area in TestEFault is actually that
We were relying on luck to make the mapping before our first mmap() be
inaccessible. Let's make it explicit.
2022-08-24 18:35:41 +02:00
Andreas Kling 2c72d495a3 Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage
I believe this to be safe, as the main thing that LockRefPtr provides
over RefPtr is safe copying from a shared LockRefPtr instance. I've
inspected the uses of RefPtr<PhysicalPage> and it seems they're all
guarded by external locking. Some of it is less obvious, but this is
an area where we're making continuous headway.
2022-08-24 18:35:41 +02:00
Andreas Kling 5a804b9a1d Kernel: Make PhysicalPage::ref() use relaxed memory order
When incrementing a reference count, it should be sufficient to use
relaxed ordering. Note that unref() still uses acquire-release.
2022-08-24 18:35:41 +02:00
Ryan Liptak 032e06b762 Meta: Only include headings for populated groups/subgroups in emoji.txt
The primary motivation for this is to make `generate-emoji-txt.sh` more
useful for generating a compact list of new emoji being added (e.g.
for use in commit messages / PRs) if it's run with an emoji image
directory that contains only the new emojis.
2022-08-24 15:55:42 +01:00
Andreas Kling 0dd88fd836 Kernel: Remove unnecessary forward declaration of s_mm_lock 2022-08-24 14:57:51 +02:00
Andreas Kling ac3ea277aa Kernel: Don't take MM lock in ~PageDirectory()
We don't need the MM lock to unregister a PageDirectory from the CR3
map. This is already protected by the CR3 map's own lock.
2022-08-24 14:57:51 +02:00
Andreas Kling 5beed613ca Kernel: Don't take MM lock in MemoryManager::dump_kernel_regions()
We have to hold the region tree lock while dumping its regions anyway,
and taking the MM lock here was unnecessary.
2022-08-24 14:57:51 +02:00
Andreas Kling 05156cac94 Kernel: Don't take MM lock in MemoryManager::enter_address_space()
We're not accessing any of the MM members here. Also remove some
redundant code to update CR3, since it calls activate_page_directory()
which does exactly the same thing.
2022-08-24 14:57:51 +02:00
Andreas Kling 2607a6a4bd Kernel: Update comment about what the MM lock protects 2022-08-24 14:57:51 +02:00
Andreas Kling da24a937f5 Kernel: Don't wrap AddressSpace's RegionTree in SpinlockProtected
Now that AddressSpace itself is always SpinlockProtected, we don't
need to also wrap the RegionTree. Whoever has the AddressSpace locked
is free to poke around its tree.
2022-08-24 14:57:51 +02:00
Andreas Kling d3e8eb5918 Kernel: Make file-backed memory regions remember description permissions
This allows sys$mprotect() to honor the original readable & writable
flags of the open file description as they were at the point we did the
original sys$mmap().

IIUC, this is what Dr. POSIX wants us to do:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/mprotect.html

Also, remove the bogus and racy "W^X" checking we did against mappings
based on their current inode metadata. If we want to do this, we can do
it properly. For now, it was not only racy, but also did blocking I/O
while holding a spinlock.
2022-08-24 14:57:51 +02:00
Andreas Kling 30861daa93 Kernel: Simplify the File memory-mapping API
Before this change, we had File::mmap() which did all the work of
setting up a VMObject, and then creating a Region in the current
process's address space.

This patch simplifies the interface by removing the region part.
Files now only have to return a suitable VMObject from
vmobject_for_mmap(), and then sys$mmap() itself will take care of
actually mapping it into the address space.

This fixes an issue where we'd try to block on I/O (for inode metadata
lookup) while holding the address space spinlock. It also reduces time
spent holding the address space lock.
2022-08-24 14:57:51 +02:00
Andreas Kling cf16b2c8e6 Kernel: Wrap process address spaces in SpinlockProtected
This forces anyone who wants to look into and/or manipulate an address
space to lock it. And this replaces the previous, more flimsy, manual
spinlock use.

Note that pointers *into* the address space are not safe to use after
you unlock the space. We've got many issues like this, and we'll have
to track those down as wlel.
2022-08-24 14:57:51 +02:00
Andreas Kling d6ef18f587 Kernel: Don't hog the MM lock while unmapping regions
We were holding the MM lock across all of the region unmapping code.
This was previously necessary since the quickmaps used during unmapping
required holding the MM lock.

Now that it's no longer necessary, we can leave the MM lock alone here.
2022-08-24 14:57:51 +02:00
Andreas Kling dc9d2c1b10 Kernel: Wrap RegionTree objects in SpinlockProtected
This makes locking them much more straightforward, and we can remove
a bunch of confusing use of AddressSpace::m_lock. That lock will also
be converted to use of SpinlockProtected in a subsequent patch.
2022-08-24 14:57:51 +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 b0eabae52e Base: Add more emojis
Adds 16 new emojis, improves 4 emojis, and respectfully adds U+1F595 :^)
2022-08-24 12:16:33 +02:00
Jelle Raaijmakers eb6b78b950 Ports: Set correct path in .la files for libvorbis
These libtool archives incorrectly pointed to `/usr/local` causing
other ports not to be able to find the libvorbis libraries.

We cannot use `configure --prefix=...` since that will add up with our
fixed `make DESTDIR=...` logic, causing the path to be duplicated.

We can also not change that `DESTDIR` logic without influencing all
other port builds.

Finally, `configure --with-sysroot=...` doesn't work since not all
other ports (such as SDL_mixer) have a recent enough libtool to
understand the sysroot syntax.

So let's `sed` this and be done with it :^)
2022-08-24 12:14:18 +02:00