Commit Graph

18814 Commits

Author SHA1 Message Date
Hendiadyoin1
b8d381690c UserspaceEmulator: use outln_if 2021-04-16 20:03:35 +02:00
Hendiadyoin1
2e11b2d35a AK: Add outln_if and warnln_if
This uses the same gating mechanism as dbgln_if and should be equivalent
to #define flag etc
2021-04-16 20:03:35 +02:00
Jagger De Leo
2976311536 PixelPaint: Add keyboard zoom shortcuts
You can now use Ctrl+= and Ctrl+- to zoom in and out.
2021-04-16 19:57:28 +02:00
Jagger De Leo
b48b8c372e PixelPaint: Add Zoom Reset button to new View Menubar.
If you lose your image while panning and zooming around, it is handy to
have a reset function to get back home. :^)
2021-04-16 19:57:28 +02:00
Idan Horowitz
223472c57f LibJS: Dont try to serialize symbol-keyed properties
As per the specification: "All Symbol-keyed properties will be
completely ignored, even when using the replacer function."
2021-04-16 19:22:29 +02:00
Idan Horowitz
fff7aceb9d LibJS: Accept symbol property in ObjectPrototype::hasOwnProperty
This is used by discord.com and allowed by the specification
(https://tc39.es/ecma262/#sec-topropertykey)
2021-04-16 19:22:29 +02:00
Timothy Flynn
2381b19719 Browser+LibWeb+WebContent: Parse cookies in the OOP tab
To protect the main Browser process against nefarious cookies, parse the
cookies out-of-process and then send the parsed result over IPC to the
main process. This way, if the cookie parser blows up, only that tab
will be affected.
2021-04-16 19:19:31 +02:00
Timothy Flynn
6e10c2cdb7 LibCore+LibIPC: Add IPC coder for Core::DateTime
Since LibCore cannot depend on LibIPC, the coders are defined in LibIPC
just like they are for Core::AnonymousBuffer.
2021-04-16 19:19:31 +02:00
Timothy Flynn
99e1d8a359 AK: Add type alias for AK::Optional 2021-04-16 19:19:31 +02:00
Timothy Flynn
67884f6747 LibWeb: Impose a sane max cookie size
Drop cookies larger than 4KiB. This value is the RFC's recommendation:
https://tools.ietf.org/html/rfc6265#section-6.1
2021-04-16 19:19:31 +02:00
Gunnar Beutner
da92c0e1ca Ports: Build shared libraries for a few more ports
This manually builds shared libraries for a bunch of ports. Using
libtool would be preferable but that's currently broken so I'm
linking the shared libraries manually.
2021-04-16 19:04:24 +02:00
Gunnar Beutner
c9d5358685 Ports: Make sure ports are installed into /usr/local 2021-04-16 19:04:24 +02:00
Gunnar Beutner
960079b020 LibELF: Add support for loading libraries from /usr/local 2021-04-16 19:04:24 +02:00
Gunnar Beutner
594d480391 Toolchain+Ports: Move the CMake toolchain file into a subdirectory 2021-04-16 19:04:24 +02:00
Gunnar Beutner
c6c1e2037b Toolchain: Add platform definition for CMake
This also ensures that pkg-config finds packages in /usr/local
and changes the install prefix to /usr/local.
2021-04-16 19:04:24 +02:00
Nicholas-Baron
73dd293ec4 Everywhere: Add -Wdouble-promotion warning
This warning informs of float-to-double conversions. The best solution
seems to be to do math *either* in 32-bit *or* in 64-bit, and only to
cross over when absolutely necessary.
2021-04-16 19:01:54 +02:00
AnotherTest
6606d70826 LibDebug/Dwarf: Use dbgln_if() instead of '#if DWARF_DEBUG' 2021-04-16 19:00:30 +02:00
Gunnar Beutner
03d705d531 UserspaceEmulator: Print stacktrace for unhandled exceptions 2021-04-16 19:00:30 +02:00
Gunnar Beutner
b731db6691 LibDebug: Add support for StandardOpcodes::FixAdvancePc 2021-04-16 19:00:30 +02:00
Gunnar Beutner
4f6914a0c0 LibDebug: Add array bounds check for m_source_files 2021-04-16 19:00:30 +02:00
Linus Groh
a5d4ef462c LibJS: Remove #if !defined(KERNEL)
AK::JsonValue::{is,as}_double() is not available in the kernel, but that
doesn't affect LibJS.
2021-04-16 18:57:58 +02:00
sin-ack
091d352526 Kernel: Add some missing socket ioctls
This patch adds a few missing ioctls which were required by Wine.
SIOCGIFNETMASK, SIOCGIFBRDADDR and SIOCGIFMTU are fully implemented,
while SIOCGIFFLAGS and SIOCGIFCONF are stubs.
2021-04-16 18:57:35 +02:00
sin-ack
afb04cf544 man: Update SystemServer(5) documentation with new Socket style
This patch adds new information about the usage of multiple sockets with
eager services and the new socket takeover mechanism exposed by
SystemServer.
2021-04-16 18:22:10 +02:00
Gunnar Beutner
1aa34d9d6a Ports: Update the gcc port to 10.3.0 2021-04-16 17:57:22 +02:00
Gunnar Beutner
3d8311ac7b Ports: Remove obsolete patch for mrsh 2021-04-16 17:56:12 +02:00
Gunnar Beutner
92749d9a76 LibC: Don't call initializers in crt0
The dynamic linker is already taking care of this for us. Now
that crt0 is statically linked into each executable and shared
library this breaks things because initializers are invoked twice.

Before this PR this didn't crash because crt0 and its _start()
function was contained in LibC and thus only LibC's initializers were
invoked several times which wasn't as much of a problem because
these initializers didn't have any side effects (such as malloc/free).

However, user programs are more likely to have constructors with side
effects, e.g.:

    std::string g_test("hello!");

This would allocate memory when the constructor is invoked. When it is
invoked again the original allocation would be leaked and another copy
of the string would get allocated. Worse still, when the destructors are
invoked twice the memory would get free'd twice which would likely
crash the program.
2021-04-16 17:56:12 +02:00
Gunnar Beutner
50e4cad4a0 Toolchain+LibC: Don't link LibC against crt0
Instead GCC should be used to automatically link against crt0
and crt0_shared depending on the type of object file that is being
built.

Unfortunately this requires a rebuild of the toolchain as well
as everything that has been built with the old GCC.
2021-04-16 17:56:12 +02:00
Gunnar Beutner
67516fa555 LibC: Shared libraries shouldn't have an entry point
The _start() function attempts to call main() which is a
problem when trying to build a shared library with --no-undefined:

  $ echo > t.c
  $ gcc -shared -Wl,--no-undefined -o t.so t.c
  /usr/local/lib/gcc/i686-pc-serenity/10.2.0/../../../../i686-pc-serenity/bin/ld:
  /usr/lib/crt0_shared.o: in function `_start':
  ./Build/i686/../../Userland/Libraries/LibC/crt0_shared.cpp:56: undefined reference to `main'
  collect2: error: ld returned 1 exit status

Also, unless explicitly requested by the user shared libraries
should not have an entry point (e.g. _start) at all.
2021-04-16 17:56:12 +02:00
Matthew Olsson
d719e745fb AK: Fix incorrect formatter signing of numbers between -1.0 and 0.0
Floating point numbers are casted to i64 and passed to the integer
formatting logic, and the floating point portion of the number is
handled separately. However, casting to i64 when the number is between
-1.0 and 0.0 produces 0, so the sign would be lost. This commit fixes
that by using put_u64 instead, which allows us to manually provide the
is_negative flag.
2021-04-16 17:42:42 +02:00
João Moreno
bf8223926a
Documentation: Fix the path to the disk image on WSL 2021-04-16 17:41:21 +02:00
FalseHonesty
a5b4d4434e LibDebug: Fix typo in handle_special_opcode method name
handle_sepcial_opcode -> handle_special_opcode :)
2021-04-16 17:40:24 +02:00
Federico Guerinoni
e9837bed33
Ports: Bump git to 2.31.1 2021-04-16 17:38:54 +02:00
Linus Groh
e632186c17 WindowServer: Recalculate window rect when toggling menubar
This is important when the window is maximized or tiled (which
recalculate_rect() will both check), as we otherwise create a gap above
the window frame (when hiding the menubar) or push the frame off the
screen (when showing the menubar).
2021-04-16 17:28:05 +02:00
Linus Groh
0aebb9ec62 WindowServer: Replace window menu action magic numbers with enum
This makes it a lot easier to find where the action handling is
happening, just 1, 2, 3, 4 isn't very discoverable. :^)
2021-04-16 17:27:54 +02:00
sin-ack
5b95850e28 SystemServer+LibCore: Allow service to request multiple sockets
SystemServer only allowed a single socket to be created for a service
before this.  Now, SystemServer will allow any amount of sockets.  The
sockets can be defined like so:

[SomeService]
Socket=/tmp/portal/socket1,/tmp/portal/socket2,/tmp/portal/socket3
SocketPermissions=660,600

The last item in SocketPermissions is applied to the remainder of the
sockets in the Socket= line, so multiple sockets can have the same
permissions without having to repeat them.

Defining multiple sockets is not allowed for socket-activated services
at the moment, and wouldn't make much sense anyway.

This patch also makes socket takeovers more robust by removing the
assumption that the socket will always be passed in fd 3.  Now, the
SOCKET_TAKEOVER environment variable carries information about which
endpoint corresponds to which socket, like so:

SOCKET_TAKEOVER=/tmp/portal/socket1:3 /tmp/portal/socket2:4

and LocalServer/LocalService will parse this automatically and select
the correct one.  The old behavior of getting the default socket is
preserved so long as the service only requests a single socket in
SystemServer.ini.
2021-04-15 21:04:49 +02:00
Andreas Kling
4316e817db Welcome: Fix build breakage 2021-04-15 21:00:55 +02:00
Nicholas-Baron
c4ede38542 Everything: Add -Wnon-virtual-dtor flag
This flag warns on classes which have `virtual` functions but do not
have a `virtual` destructor.

This patch adds both the flag and missing destructors. The access level
of the destructors was determined by a two rules of thumb:
1. A destructor should have a similar or lower access level to that of a
   constructor.
2. Having a `private` destructor implicitly deletes the default
   constructor, which is probably undesirable for "interface" types
   (classes with only virtual functions and no data).

In short, most of the added destructors are `protected`, unless the
compiler complained about access.
2021-04-15 20:57:13 +02:00
Andreas Kling
b75d2d36e1 WindowServer: Clean up some of the code around menu item hovering
We were writing to the currently hovered menu item index in a bunch
of places, which made it very confusing to follow how it changes.

Rename Menu::set_hovered_item() to set_hovered_index() and use it
in more places instead of manipulating m_hovered_item_index.
2021-04-15 20:50:24 +02:00
Andreas Kling
9f4e37e342 Applications: Rename Serendipity => Welcome
Let's stick to the theme of "the most obvious name possible"
2021-04-15 20:50:24 +02:00
Andreas Kling
ff312d8aa6 Applets: Remove unused UserName applet 2021-04-15 20:38:12 +02:00
Idan Horowitz
ad8e2f481d LibWeb: Expose the MouseEvent::{clientX, clientY} attributes
These provide the cursor coordinate within the viewport at which the
event occurred (as opposed to the page relative coordinates exposed via
offsetX, offsetY).
2021-04-15 20:22:08 +02:00
Idan Horowitz
815934a95d LibWeb: Expose the HTMLElement::{offsetLeft, offsetTop} attributes
These describe the border box of an element relative to their parent.
2021-04-15 20:22:08 +02:00
Idan Horowitz
c5769a7033 LibWeb: Check radius sign in CanvasRenderingContext2D::{arc, ellipse}
As required by the specification: 'If either radiusX or radiusY are
negative, then throw an "IndexSizeError" DOMException.'
2021-04-15 20:22:08 +02:00
Idan Horowitz
00114ab01d LibWeb: Add a naive implemention of CanvasRenderingContext2D::fill_text
This doesnt actually account for several unimplemented attributes
(like ltr/rtl, alignment, etc) yet, so this should be expanded in
the future.
2021-04-15 20:22:08 +02:00
Idan Horowitz
a257ef0f35 LibWeb: Add support for optional double arguments with no default value
This is implemented by emitting AK::Optional, similar to optional
boolean arguments.
2021-04-15 20:22:08 +02:00
Idan Horowitz
0072581693 LibWeb: Emit optional boolean variable definition in WrapperGenerator
The removed if in this commit was inside the else branch of an if with
the same condition, making it a no-op, as well as breaking optional
booleans.
2021-04-15 20:22:08 +02:00
AnotherTest
dbc5b05b7a LibM: Use fptan/fpatan instead of approximating atan2/tan
The previous versions were very inaccurate, and sometimes wrong.
2021-04-15 17:50:16 +02:00
AnotherTest
801daf47f0 LibGfx+LibWeb: Wire up CanvasRenderingContext2D.ellipse()
Note that this is *extremely* naive, and not very good at being correct.
2021-04-15 17:50:16 +02:00
AnotherTest
6c05d6d370 LibGfx: Add a Path::arc_to() helper
...That just uses elliptical_arc_to().
2021-04-15 17:50:16 +02:00
AnotherTest
598a6d46c7 LibGfxDemo: Add an elliptic arc next to the Bezier curves
Because why not.
2021-04-15 17:50:16 +02:00