Commit Graph

5740 Commits

Author SHA1 Message Date
Andreas Kling
fd06164fa0 WindowServer: Recompute window occlusions on window stack changes
When adding/removing windows, or moving a window from the front to the
back, we have to recompute everyone's occlusion states.
2019-12-27 11:44:37 +01:00
Andreas Kling
74968f0ec1 WindowServer: Don't send paint events to occluded windows
We wouldn't be able to see what they paint anyway, and nobody should
be using paint events to drive program logic.
2019-12-27 11:40:29 +01:00
Andreas Kling
c7847d7c81 WindowServer+LibGUI: Mark window bitmaps volatile in occluded windows
WindowServer now tracks whether windows are occluded (meaning that
they are completely covered by one or more opaque windows sitting above
them.) This state is communicated to the windows via WindowStateChanged
messages, which then allow GWindow to mark its backing store volatile.

This reduces the effective memory impact of windows that are not at all
visible to the user. Very cool. :^)
2019-12-27 11:34:40 +01:00
Valtteri Koskivuori
5d1acdda82 AK: Fix unused parameter bug in SinglyLinkedList (#928) 2019-12-27 10:29:28 +01:00
Andreas Kling
d1c16944ce gron: Implement a simplified variant of @tomnomnom's "gron"
This program takes JSON input and turns it into JavaScript statements
that construct the same data step by step. This format is much more
greppable than what "jp" gives us. :^)
2019-12-27 03:27:37 +01:00
Stefano Cristiano
49a789ad04 Build: Allow building serenityOS ext2 root filesystem on macOS host 2019-12-27 02:19:55 +01:00
Stefano Cristiano
b62dbcbf59 Build: Disable compiling tests on macOS host
Tests fail to compile for a mix of reasons, some due to macOS file systems
being by default case-insensitive and some specific to clang.
Both issues are better left to a dedicated set of PR that addressed them.
2019-12-27 02:19:55 +01:00
Stefano Cristiano
1222b94ab8 LibCore: Allow LibCore to be compiled on macOS host
Compiling LibCore on macOS is needed if one wants to compile host tools
(like IPCCompiler) on a non Linux host.
These changes could be possibly reverted once "event loop" functionality
and "base library" (Vector, String etc.) will be split in two separate libraries,
updating all relevant projects.
2019-12-27 02:19:55 +01:00
Stefano Cristiano
aab412bd85 LibCore: Fix errors when compiling LibCore using clang instead of gcc 2019-12-27 02:19:55 +01:00
Stefano Cristiano
250f6b9a1e Build: Disable unknown GCC specific warnings when compiling host tools using clang 2019-12-27 02:19:55 +01:00
Stefano Cristiano
18e3e4f236 Build: Make sure that RANLIB and AR use cross-compiler provided executables
This is very much needed when compiling host tools on macOS for example
2019-12-27 02:19:55 +01:00
Stefano Cristiano
9537ce918c Toolchain: Statically link serenity cross-compiler on macOS to keep the cross-toolchain self contained 2019-12-27 02:19:55 +01:00
Conrad Pankoff
fe3311d458 AK: Simplify const T& versions of append/insert in SinglyLinkedList 2019-12-27 02:15:45 +01:00
Conrad Pankoff
115b315375 Kernel: Add kernel-level timer queue (heavily based on @juliusf's work)
PR #591 defines the rationale for kernel-level timers. They're most
immediately useful for TCP retransmission, but will most likely see use
in many other areas as well.
2019-12-27 02:15:45 +01:00
Conrad Pankoff
13cf7e76b9 AK: Add insert_{before,after}(iterator, value) to SinglyLinkedList 2019-12-27 02:15:45 +01:00
Andreas Kling
abdd5aa08a Kernel: Separate runnable thread queues by priority
This patch introduces three separate thread queues, one for each thread
priority available to userspace (Low, Normal and High.)

Each queue operates in a round-robin fashion, but we now always prefer
to schedule the highest priority thread that currently wants to run.

There are tons of tweaks and improvements that we can and should make
to this mechanism, but I think this is a step in the right direction.

This makes WindowServer significantly more responsive while one of its
clients is burning CPU. :^)
2019-12-27 00:52:30 +01:00
Andreas Kling
23e16a3e2e LibGUI: Remove bitrotted automatic keybinds feature
This feature hasn't been working at all for several months, so let's
just remove it and simplify GWindow event handling.
2019-12-27 00:52:30 +01:00
Shannon Booth
c85bdff57a PaintBrush: Add an "ellipse tool"
The tool currently supports drawing an elliptical line of a specified
thickness. Further improvements can include adding a fill mode, and
holding down shift to draw a perfect circle.

Closes #375.
2019-12-27 00:52:17 +01:00
Shannon Booth
123b5c9d34 LibDraw: Add draw_ellipse_intersecting function
This functon will draw an ellipse which is intersecting the corners of
the rect given. It is a very naive implementation, taking 200 samples of
points around the ellipse, and drawing straight lines between each of
these points.

The ellipses look good enough to me though!
2019-12-27 00:52:17 +01:00
Conrad Pankoff
0b3a868729 Kernel: Simplify force_pio logic in PATA driver (#923) 2019-12-26 22:57:58 +01:00
Andreas Kling
95034fdfbd Kernel: Move PC speaker beep timing logic from scheduler to the syscall
I don't know why I put this in the scheduler to begin with.. the caller
can just block until the beeping is finished.
2019-12-26 22:31:26 +01:00
Andreas Kling
154d10e4e9 Kernel: Process::for_each_in_pgrp() should not include dead processes
We don't care about dead processes that were once members of a specific
process group.

This was causing us to try and send SIGINT to already-dead processes
when pressing Ctrl+C in a terminal whose pgrp they were once in.

Fixes #922.
2019-12-26 22:20:39 +01:00
Andreas Kling
43da941de5 LibGUI: Use NeverDestroyed<T> for the global GWindow tables
We don't need these to be destroyed on exit, since that would race with
the destruction of static global RefPtr<GWindow>'s.

Fixes #900.
2019-12-26 22:13:50 +01:00
Andreas Kling
f607cab235 AK: Add NeverDestroyed<T>, for things that should never be destroyed
This template allows you to define static globals without having them
destroyed on exit.
2019-12-26 22:12:45 +01:00
Shannon Booth
b830639912 PaintBrush: Add a "rectangle tool"
Fill, line, and gradient modes initially supported :^)
2019-12-26 21:22:29 +01:00
Shannon Booth
70a2355963 LibDraw: Add dx/dy_relative_to() helper functions for Points 2019-12-26 21:22:29 +01:00
Tibor Nagy
f0a82e1bcc Base: Add 3x upscaled Liza fonts
Upscaled with hq3x then cleaned up the glyphs manually.
2019-12-26 14:35:51 +01:00
Andreas Kling
519cb80a96 LibGUI+WindowServer: Mark minimized window backing stores as volatile
WindowServer will now send out a WindowStateChanged message to clients
when one of their windows is minimized.

This is then forwarded to the GWindow, which will try to mark its
underlying window backing store as volatile.

This allows the kernel to steal the memory used by minimized windows
in case it starts running low. Very cool! :^)
2019-12-26 12:06:07 +01:00
Andreas Kling
23591f2a95 munch: Add a simple userland program for chewing up lots of memory 2019-12-26 11:48:34 +01:00
Andreas Kling
c1f8291ce4 Kernel: When physical page allocation fails, try to purge something
Instead of panicking right away when we run out of physical pages,
we now try to find a PurgeableVMObject with some volatile pages in it.
If we find one, we purge that entire object and steal one of its pages.

This makes it possible for the kernel to keep going instead of dying.
Very cool. :^)
2019-12-26 11:45:36 +01:00
Andreas Kling
dafd715743 ProcFS: Fix inconsistent numbers in /proc/memstat
We were listing the total number of user/super pages as the number of
"available" pages in the system. This was then misinterpreted in the
SystemMonitor program and displayed wrong in the GUI.
2019-12-26 11:43:42 +01:00
Andreas Kling
6fd655102e Kernel: Add Lock::is_locked() 2019-12-26 11:43:23 +01:00
Andreas Kling
9d681beaf0 LibC: Oops x2, we can't use "bool" in stdlib.h either 2019-12-26 10:30:34 +01:00
Andreas Kling
b1fc5d9143 LibC: Oops, we can't use [[nodiscard]] when this is included from C 2019-12-26 10:24:37 +01:00
Andreas Kling
22776589f0 HackStudio: Fix failure to open files
Use FileSystemPath to figure out that "./foo.cpp" == "foo.cpp"
2019-12-26 10:19:44 +01:00
Shannon Booth
64842fd0ac LibHTML: Remove fixed FIXME 2019-12-26 10:05:59 +01:00
Shannon Booth
bbf878e987 LibC: Implement tmpfile() 2019-12-26 10:05:59 +01:00
Shannon Booth
f6bd4f8691 LibC: Use shared functon to generate unique filenames
Move some dupliated code into __generate_unique_filename()
2019-12-26 10:05:59 +01:00
Conrad Pankoff
17aef7dc99 Kernel: Detect support for no-execute (NX) CPU features
Previously we assumed all hosts would have support for IA32_EFER.NXE.
This is mostly true for newer hardware, but older hardware will crash
and burn if you try to use this feature.

Now we check for support via CPUID.80000001[20].
2019-12-26 10:05:51 +01:00
Andreas Kling
5be6a43860 LibDraw: Add MenuBaseText and MenuSelectionText color roles
This allows the very aesthetic "Hotdog Stand" theme to have quite
reasonable looking menus.
2019-12-26 00:58:46 +01:00
Conrad Pankoff
5330593e38 Base: Add Hotdog Stand theme 2019-12-26 00:46:16 +01:00
Andreas Kling
965cae47b4 Ports: Build nesalizer in release mode
Together with the new futex-backed pthread_cond_t, this makes nesalizer
run downright well on my machine. :^)
2019-12-25 23:57:25 +01:00
Andreas Kling
a089125d0f AudioServer: Block the mixer thread when there's nothing to do
Use a pthread_cond_t to have the ASMixer thread wait until a client has
connected and added a buffer queue to the "pending mixing" vector.

This solves the long-standing issue of the system "idling" at ~8% CPU.
2019-12-25 23:54:07 +01:00
Andreas Kling
4a8683ea68 Kernel+LibPthread+LibC: Add a naive futex and use it for pthread_cond_t
This patch implements a simple version of the futex (fast userspace
mutex) API in the kernel and uses it to make the pthread_cond_t API's
block instead of busily sched_yield().

An arbitrary userspace address is passed to the kernel as a "token"
that identifies the futex and you can then FUTEX_WAIT and FUTEX_WAKE
that specific userspace address.

FUTEX_WAIT corresponds to pthread_cond_wait() and FUTEX_WAKE is used
for pthread_cond_signal() and pthread_cond_broadcast().

I'm pretty sure I'm missing something in this implementation, but it's
hopefully okay for a start. :^)
2019-12-25 23:54:06 +01:00
Andreas Kling
4b8b100b83 Ports: Fix SDL2 install step
Ports using CMake already install into the right place, so we don't
need to do the usual port system DESTDIR override.
2019-12-25 23:18:08 +01:00
Andreas Kling
99e0d8de2f Toolchain: Fixup CMake toolchain script to install things in /usr
Also stop clobbering the host's /usr/local/share for DATAROOTDIR.
2019-12-25 23:17:10 +01:00
Andreas Kling
b5bcecef09 LibDraw: Remove bogus LibC/ prefix on SharedBuffer.h include
This class really doesn't belong in LibC anyway, does it? Mehh.
2019-12-25 22:50:17 +01:00
Andreas Kling
9e55bcb7da Kernel: Make kernel memory regions be non-executable by default
From now on, you'll have to request executable memory specifically
if you want some.
2019-12-25 22:41:34 +01:00
Andreas Kling
0b7a2e0a5a Kernel: Set NX bit for virtual addresses 0-1MB and 2-8MB
This removes the ability to jump into kmalloc memory, etc.
Only the kernel image itself is allowed to exec, located between 1-2MB.
2019-12-25 22:24:28 +01:00
Andreas Kling
d3b40547f7 LibDraw: Fix 1px wide glitch in progress bar painting at some widths
Make sure we always line up the "hole" in the progress bar with the
right side of the paint rect. This fixes a 1px wide glitch seen when
using a darker system theme.
2019-12-25 21:59:37 +01:00