Commit Graph

444 Commits

Author SHA1 Message Date
Ali Mohammad Pur
7ac196974d Everywhere: Replace Vector<T*> with nonnull entries with Vector<T&> 2021-06-08 19:14:24 +02:00
Andreas Kling
cb295ab644 WindowServer+Magnifier: Make Magnifier buttery smooth :^)
This patch moves the magnifier rect computation over to the server side
to ensure that the mouse cursor position and the screen image never get
out of sync.
2021-06-07 10:22:25 +02:00
Andreas Kling
4c47b3951d Clipboard: Tighten pledge promises a bit earlier :^) 2021-06-06 17:56:34 +02:00
Eugene Barnett
4ef85de9dc WindowServer: Add a GetDesktopDisplayScale IPC request
Tells you which scale factor is configured in window manager.
2021-06-06 15:56:43 +02:00
Tom
2c8309c841 WindowServer: Simplify determining transparent/opaque occlusions
By moving the logic to determine what window areas (shadow, frame,
content) into WindowFrame::opaque/transparent_render_rects we can
simplify the occlusion calculation and properly handle more
arbitrary opaque/transparent areas.

This also solves the problem where we would render the entire
window frame as transparency only because the frame had a window
shadow.
2021-06-06 09:37:27 +01:00
Ali Mohammad Pur
51c2c69357 AK+Everywhere: Disallow constructing Functions from incompatible types
Previously, AK::Function would accept _any_ callable type, and try to
call it when called, first with the given set of arguments, then with
zero arguments, and if all of those failed, it would simply not call the
function and **return a value-constructed Out type**.
This lead to many, many, many hard to debug situations when someone
forgot a `const` in their lambda argument types, and many cases of
people taking zero arguments in their lambdas to ignore them.
This commit reworks the Function interface to not include any such
surprising behaviour, if your function instance is not callable with
the declared argument set of the Function, it can simply not be
assigned to that Function instance, end of story.
2021-06-06 00:27:30 +04:30
Gunnar Beutner
d840608a51 Taskbar: Make sure LibGUI/Desktop.h is usable in ports
Now that Desktop.h includes Services/Taskbar/TaskbarWindow.h we have
to install Taskbar's header files so that Desktop.h can be used in
ports or when building software in-target.
2021-06-04 19:11:13 +02:00
Gunnar Beutner
19c4e74f70 Taskbar: Allow creating menus for sub-categories
This change allows creating sub-categories in app files, e.g. with
Category=Games/Puzzles.
2021-06-04 09:38:25 +02:00
Max Wipfli
bc8d16ad28 Everywhere: Replace ctype.h to avoid narrowing conversions
This replaces ctype.h with CharacterType.h everywhere I could find
issues with narrowing conversions. While using it will probably make
sense almost everywhere in the future, the most critical places should
have been addressed.
2021-06-03 13:31:46 +02:00
Brian Gianforcaro
d0dbb014a0 WindowServer: Switch Window to IntrusiveList from InlineLinkedList
Another small step towards unifying IntrusiveList / InlineLinkedList.
2021-06-03 13:27:40 +02:00
Matthew Jones
0ff09d4f74 WindowServer: Add sanity checks to create_window IPC 2021-06-03 08:27:57 +02:00
Matthew Jones
b0682a73ee WindowServer: Position popup menu with offset of 1 pixel 2021-06-03 08:21:01 +02:00
Matthew Jones
ea4116f5bd LibGUI+LibGfx+WindowServer: Sanity check window size dimensions
Previous to this commit, if a `Window` wanted to set its width or height
greater than `INT16_MAX` (32768), both the application owning the Window
and the WindowServer would crash.

The root of this issue is that `size_would_overflow` check in `Bitmap`
has checks for `INT16_MAX`, and `Window.cpp:786` that is called by
`Gfx::Bitmap::create_with_anonymous_buffer` would get null back, then
causing a chain of events resulting in crashes.

Crashes can still occur but with `VERIFY` and `did_misbehave` the
causes of the crash can be more readily identified.
2021-06-02 23:59:57 +01:00
Gunnar Beutner
b5778675a5 WindowServer: Use RefPtr instead of raw pointers
Now that we have static initializers and destructors we can use
RefPtr here.
2021-06-02 18:08:11 +02:00
Matthew Jones
00c8b74ab4 InspectorServer: Add is_inspectable IPC 2021-06-02 11:19:04 +02:00
Gunnar Beutner
cdb070cdfb WindowServer: Don't crash when we can't allocate a bitmap
When the client specifies an absurdly large window size
render_to_cache() fails to allocate a bitmap and crashes.

Refs #7688.
2021-06-02 10:17:42 +01:00
Matthew Jones
33eb9a6ddc WindowServer: Use user-defined background color, if defined
Use the configured desktop background color, if defined, otherwise
default to the current theme's background color. If a user chooses
a background color via "desktop settings", then this new color
will always be used.

Switching themes will delete the user-defined background color, so
the background color resets to the theme's defined color.
2021-06-02 09:40:53 +02:00
Gunnar Beutner
5b86a8bad1 InspectorServer: Remove extraneous curly brackets 2021-06-01 23:36:44 +04:30
Max Wipfli
a603e69599 AK+Everywhere: Replace usages of URLParser::urlencode() and urldecode()
This replaces all occurrences of those functions with the newly
implemented functions URL::percent_encode() and URL::percent_decode().
The old functions will be removed in a further commit.
2021-06-01 09:28:05 +02:00
Edwin Hoksberg
e68780e1ad WebServer: Put dbgln's behind WEBSERVER_DEBUG
These dbgln's caused excessive load in the WebServer process,
accounting for ~67% of the processing time when serving a webpage
with a bunch of resources like serenityos.org/happy/2nd/.
2021-05-30 17:41:56 +01:00
Linus Groh
75ea1bd346 WebServer: Exit when the given port is invalid
Similar to an invalid listen address, we should not fallback to the
default port (8000) but instead exit with an error.
2021-05-30 14:11:53 +01:00
Linus Groh
7fa3033ca8 WebServer: Replace printf()/fprintf(stderr) with outln()/warnln() 2021-05-30 14:07:58 +01:00
Edwin Hoksberg
2deffeb74d WebServer: Add optional listen address argument
With this we can make the Webserver listen on
another address than the default of "0.0.0.0".
2021-05-30 13:03:59 +01:00
Andreas Kling
4190fd2199 LibWeb: Rename Web::Frame to Web::BrowsingContext
Our "frame" concept very closely matches what the web specs call a
"browsing context", so let's rename it to that. :^)

The "main frame" becomes the "top-level browsing context",
and "sub-frames" are now "nested browsing contexts".
2021-05-30 12:39:53 +02:00
Andrew Kaster
1a0eed705c DHCPClient: Avoid unaligned access when parsing options
Just casting a void* to a T* and dereferencing it is not particularly
safe. Also UBSAN was complaining. Use memcpy into a default constructed
T instead and require that the T be trivially copyable.
2021-05-27 15:18:03 +02:00
Gunnar Beutner
e17a5dc2b9 DHCPClient: Rename struct members for InterfaceDescriptor
Public members shouldn't have an "m_" prefix.
2021-05-27 15:53:49 +04:30
Gunnar Beutner
106def9de7 DHCPClient: Remove unused #includes 2021-05-27 15:53:49 +04:30
Gunnar Beutner
c73116b2e2 DHCPClient: Resend DHCP packets when we don't receive an answer
Previously we'd only only send one DHCP request for network interfaces
which were up when DHCPClient started. If that packet was lost we'd
never send another request for those interfaces.

Also, if an interface were to appear after DHCPClient started (not
that that is possible at the moment) we wouldn't send requests for
that interface either.
2021-05-27 15:53:49 +04:30
Jean-Baptiste Boric
e4394b1605 LibGfx: Use anonymous buffer instead of raw anon_fd for Gfx::Bitmap
Instead of using a low-level, proprietary API inside LibGfx, let's use
Core::AnonymousBuffer which already abstracts anon_fd and offers a
higher-level API too.
2021-05-24 13:31:01 +02:00
Jean-Baptiste Boric
8e6241b78b LookupServer: Fix missing POSIX includes 2021-05-23 18:10:29 +02:00
Jean-Baptiste Boric
5ced9a3dfb ImageDecoder: Fix narrowing cast of loop count 2021-05-23 18:10:29 +02:00
Andreas Kling
67b47d62f3 WebContent: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
6b2f24018d RequestServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
bf33b5df6e WebSocket: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
03df8882df InspectorServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
78b57fcea3 NotificationServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
5424372d50 AudioServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
e7fc46879e LaunchServer: Remove unnecessary greet() message 2021-05-23 09:53:55 +02:00
Andreas Kling
de07dab184 ImageDecoder: Remove unnecessary greet() message
This didn't do anything except induce an IPC stall during startup.
2021-05-23 09:53:55 +02:00
Andreas Kling
c9e849a968 LibCore: Make all processes opt out of InspectorServer by default
This functionality, while neat, isn't really something you need enabled
all the time. Let's make it opt-in instead. Pass MakeInspectable::Yes
to the Core::EventLoop constructor if you want your program to become
inspectable.
2021-05-22 23:30:40 +02:00
Andreas Kling
b5d73c834f Userland: Rename LibThread => LibThreading
Also rename the "LibThread" namespace to "Threading"
2021-05-22 18:54:22 +02:00
Andreas Kling
9c2786b872 Userland: Remove SymbolServer and the "symbol" user+group 2021-05-22 18:54:22 +02:00
Andreas Kling
636c43db6c WindowServer: Notify window-less clients about theme/font changes 2021-05-22 10:21:52 +02:00
Andreas Kling
59fd1f40ce WindowServer: Store system font queries in WindowServer.ini :^)
Changes to the system font settings are now persisted in /etc.
Note that you still need to restart the system for changes to fully
apply in all programs.
2021-05-21 20:15:51 +02:00
Andreas Kling
c778130d63 WindowServer+LibGUI: Add an IPC API to change the current system fonts
This patch adds a set_system_fonts() IPC API that takes the two main
font queries as parameters. We'll probably expand this with additional
queries when we figure out what they should be.

Note that changing the system fonts on a live system mostly takes
effect in newly launched programs. This is because GUI::Widget will
currently cache a pointer to the Gfx::FontDatabase::default_font()
when first constructed. This is something we'll have to fix somehow.

Also note that the settings are not yet persisted.
2021-05-21 20:15:51 +02:00
Andreas Kling
bb23e61fbf LibGfx+WindowServer: Have WindowServer broadcast system font settings
Instead of everybody getting their system fonts from Gfx::FontDatabase
(where it's all hardcoded), they now get it from WindowServer.

These are then plumbed into the usual Gfx::FontDatabase places so that
the old default_font() and default_fixed_width_font() APIs keep working.
2021-05-21 20:15:51 +02:00
Linus Groh
d60ebbbba6 Revert "Userland: static vs non-static constexpr variables"
This reverts commit 800ea8ea96.

Booting the system no longer worked after these changes.
2021-05-21 10:30:52 +01:00
Lenny Maiorani
800ea8ea96 Userland: static vs non-static constexpr variables
Problem:
- `static` variables consume memory and sometimes are less
  optimizable.
- `static const` variables can be `constexpr`, usually.
- `static` function-local variables require an initialization check
  every time the function is run.

Solution:
- If a global `static` variable is only used in a single function then
  move it into the function and make it non-`static` and `constexpr`.
- Make all global `static` variables `constexpr` instead of `const`.
- Change function-local `static const[expr]` variables to be just
  `constexpr`.
2021-05-21 10:07:06 +01:00
Andreas Kling
e95e64972c Clipboard+LibGUI: Remove unnecessary client/server greeting message 2021-05-20 22:12:42 +02:00
Andreas Kling
ec8363aec3 WindowServer+LibGUI: Make client/server greeting faster
Instead of doing a full IPC round-trip for the client and server to
greet each other upon connecting, the server now automatically sends
a "fast_greet" message when a client connects.

The client simply waits for that message to arrive before proceeding.
(Waiting is necessary since LibGUI relies on the palette information
included in the greeting.)
2021-05-20 22:12:42 +02:00