Commit Graph

5749 Commits

Author SHA1 Message Date
Andreas Kling
a3257a7c6c LibGUI: Respect more system theme colors in GToolBar 2019-12-24 02:37:56 +01:00
Andreas Kling
7b78f63f85 LibGUI: More system theme support in GTabWidget and GTableView 2019-12-24 02:25:50 +01:00
Andreas Kling
8ae826f5c3 LibDraw: Give Color::lightened() an amount argument 2019-12-24 02:25:50 +01:00
Andreas Kling
2cdab2c925 Themes: Add a simple "Dark" theme :^) 2019-12-24 02:25:50 +01:00
Andreas Kling
df3a2dba43 LibDraw: Add Button and ButtonText system theme colors
These are now separate from the Window and WindowText colors.
2019-12-24 02:25:50 +01:00
Andreas Kling
9171aef724 LibGUI: Use SystemColor::Text in more places 2019-12-24 02:25:50 +01:00
Andreas Kling
79f7482ad3 WindowServer: Paint window frame button symbols in SystemColor::Text 2019-12-24 02:25:50 +01:00
Conrad Pankoff
9a8032b479 Kernel: Disallow loading a module twice without explicitly unloading it
This ensures that a module has the chance to run its cleanup functions
before it's taken out of service.
2019-12-24 02:20:37 +01:00
Shannon Booth
ff3003c645 Meta: Add ccls-cache to gitignore 2019-12-24 02:19:59 +01:00
Shannon Booth
26c9c27407 Build: Fix shellcheck warnings in makeall.sh
"SC2115: Declare and assign separately to avoid masking return values."
2019-12-24 02:19:59 +01:00
Shannon Booth
ef6eb07468 Build: Meta: Allow makeall.sh and run to be called from any directory
These scripts assume that they are called from within Kernel/ directory.
For convenience, set the current working directory in the scripts to the
path where they are located.
2019-12-24 02:19:59 +01:00
Conrad Pankoff
0fdbe08637 Kernel: Fix debug message and kernel stack region names in thread setup 2019-12-24 01:28:38 +01:00
Conrad Pankoff
0cb89f5927 Kernel: Mark kernel stack regions as... stack regions 2019-12-24 01:28:38 +01:00
Conrad Pankoff
b557aab884 Kernel: Move ring0 stacks out of kmalloc_eternal
This allows us to use all the same fun memory protection features as the
rest of the system for ring0 processes. Previously a ring0 process could
over- or underrun its stack and nobody cared, since kmalloc_eternal is the
wild west of memory.
2019-12-24 01:28:38 +01:00
Conrad Pankoff
3aaeff483b Kernel: Add a size argument to validate_read_from_kernel 2019-12-24 01:28:38 +01:00
Andreas Kling
a3590ca602 LibGUI: Paint GResizeCorner with SystemColor::Window background 2019-12-24 00:21:09 +01:00
Shannon Booth
889a60a6ed Browser: Stop reloads from pushing to history 2019-12-24 00:20:05 +01:00
Conrad Pankoff
131f14ed62 Meta: Add environment variable to specify bochs command in run script 2019-12-23 23:11:57 +01:00
Andreas Kling
411058b2a3 WindowServer+LibGUI: Implement basic color theming
Color themes are loaded from .ini files in /res/themes/
The theme can be switched from the "Themes" section in the system menu.

The basic mechanism is that WindowServer broadcasts a SharedBuffer with
all of the color values of the current theme. Clients receive this with
the response to their initial WindowServer::Greet handshake.

When the theme is changed, WindowServer tells everyone by sending out
an UpdateSystemTheme message with a new SharedBuffer to use.

This does feel somewhat bloated somehow, but I'm sure we can iterate on
it over time and improve things.

To get one of the theme colors, use the Color(SystemColor) constructor:

    painter.fill_rect(rect, SystemColor::HoverHighlight);

Some things don't work 100% right without a reboot. Specifically, when
constructing a GWidget, it will set its own background and foreground
colors based on the current SystemColor::Window and SystemColor::Text.
The widget is then stuck with these values, and they don't update on
system theme change, only on app restart.

All in all though, this is pretty cool. Merry Christmas! :^)
2019-12-23 20:33:01 +01:00
William McPherson
7c8bbea995 Piano: Add piano roll
m_roll_notes[] is an array of 2 bools, pressed and playing. A roll note
is highlighted if it is pressed or in the currently playing column, but
the note is only actually played if the roll note is both pressed and
playing.

We change columns every m_tick which is currently 10 frames. The delay
is synchronised with this. change_roll_column() tracks the previous
column and current column to be played. Each roll note in the previous
column is set to "not playing" and the underlying audio note is turned
off if it was pressed. For the current column, each roll note is set to
playing and the underlying audio note is turned on if pressed.
2019-12-23 15:08:15 +01:00
William McPherson
ebaadda6bd Piano: Make note() callable by multiple sources
Rather than checking key codes and mouse positions, we should have a
more general way to play notes. You can call note() either with a
KeyCode or a PianoKey directly.

Additionally, m_note_on[] is now an array of integers instead of bools.
This allows multiple sources to play a note. This is kind of like a
"reference counted note": two sources can increment the note and it will
only turn off once they have both decremented it back to 0.

We are now only using keys[] to prevent multiple consecutive calls to
keydown_event() (when a key is held), since that would result in playing
a note many times.
2019-12-23 15:08:15 +01:00
William McPherson
165765145c Piano: Remove redundant logic in fill_audio_buffer
"If 0, set to val" is the same as "add val".
2019-12-23 15:08:15 +01:00
Sergey Bugaev
c96c33624d Ports: Build gcc with -j $(nproc)
GCC is a huge project that takes a lot of time to build; let's at least
make this a little less painful by using all the available CPU cores.
2019-12-23 14:55:17 +01:00
Sergey Bugaev
fdbdbcd775 Ports: Update gcc to 9.2.0
To keep the self-hosting build working (note that it's
still broken even with this change).

This reuses the patch from commit c73aa662bb.
2019-12-23 14:55:17 +01:00
Sergey Bugaev
ccfc9d8923 Ports: Do not download sources if they're already present
When running ./package.sh to rebuild an already installed port, we would not
want to spend time re-downlodaing the same tarball again. Ideally, this should
use some sort of hash checking to ensure the file is not truncated or something,
but this is good enough for now.
2019-12-23 14:55:17 +01:00
Sergey Bugaev
1025fb53ee Build: Ensure "install" is a phony target
See https://github.com/SerenityOS/serenity/issues/897
2019-12-23 14:55:17 +01:00
Shannon Booth
456a4bc108 LibDraw: Parse all CSS standardised color keywords 2019-12-23 10:56:59 +01:00
Andreas Kling
5ff9ac1276 HackStudio: Show the project name as the root in the project tree 2019-12-23 10:55:34 +01:00
Andreas Kling
6e27b14a4a HackStudio: Sort the project tree alphabetically
I had to turn the tree nodes into RefCounted objects since it's not
possible to quick_sort() a Vector<OwnPtr<T>> at the moment.
2019-12-23 10:55:34 +01:00
Andreas Kling
d9706ee882 HackStudio: Show the project file list in a tree view
Replace the boring list view with an awesome tree view :^)
2019-12-23 10:55:34 +01:00
Andreas Kling
c1b4e8aef0 LibGUI: Activate GTreeView indexes when double clicking leaf nodes
This seems pretty sensible to me. I'm unsure if we should activate
nodes that have children, or just toggle them.
2019-12-23 10:55:34 +01:00
Andreas Kling
a12c2df43f LibPthread: Okay I'm dumb, let's convert mutex locks into Atomic<u32>& 2019-12-22 20:25:09 +01:00
Andreas Kling
2e280417e2 Build: Let's say "C++" while building .cpp files 2019-12-22 19:52:24 +01:00
Andreas Kling
823ee63095 AudioServer: Remove any pending mixer queues whose client disconnected
We were pumping the sound device full of silence even after the last
audio client disconnected.
2019-12-22 18:30:43 +01:00
Andreas Kling
11d49aedd8 AK: Add Vector::remove_all_matching() 2019-12-22 18:29:12 +01:00
Andreas Kling
9e3e13e410 LibPthread: Fix typo in pthread_mutex_lock()
We were casting the pthread_mutex_t* instead of pthread_mutex_t::lock
to an Atomic<u32>. This still worked fine, since "lock" is the first
member of pthread_mutex_t.
2019-12-22 17:25:55 +01:00
Andreas Kling
cb6a00c512 Run: Fix broken packet logging argument to QEMU (disabled by default) 2019-12-22 15:56:16 +01:00
Andreas Kling
8874ad7946 Net: Shrink the NetworkTask packet buffer
This thing was overflowing the NetworkTask's kernel stack. Oops!
2019-12-22 14:54:37 +01:00
Andreas Kling
0c97380ee6 LibPthread+LibC: Support PTHREAD_MUTEX_RECURSIVE
This allows SDL to build against our native recursive mutex instead
of providing its own. Also it's just a nice feature to have. :^)
2019-12-22 14:25:41 +01:00
Andreas Kling
523fd6533e Kernel: Unlock the Process when exit()ing
If there are more threads in a process when exit()ing, we need to give
them a chance to unwind any kernel stacks. This means we have to unlock
the process lock before giving control to the scheduler.

Fixes #891 (together with all of the other "no more main thread" work.)
2019-12-22 12:38:01 +01:00
Andreas Kling
f4978b2be1 Kernel: Use IntrusiveList to make WaitQueue allocation-free :^) 2019-12-22 12:38:01 +01:00
Andreas Kling
96cfddb3ac AK: Add IntrusiveList::take_first() 2019-12-22 12:38:01 +01:00
Andreas Kling
4b8851bd01 Kernel: Make TID's be unique PID's
This is a little strange, but it's how I understand things should work.

The first thread in a new process now has TID == PID.
Additional threads subsequently spawned in that process all have unique
TID's generated by the PID allocator. TIDs are now globally unique.
2019-12-22 12:38:01 +01:00
Andreas Kling
16812f0f98 Kernel: Get rid of "main thread" concept
The idea of all processes reliably having a main thread was nice in
some ways, but cumbersome in others. More importantly, it didn't match
up with POSIX thread semantics, so let's move away from it.

This thread gets rid of Process::main_thread() and you now we just have
a bunch of Thread objects floating around each Process.

When the finalizer nukes the last Thread in a Process, it will also
tear down the Process.

There's a bunch of more things to fix around this, but this is where we
get started :^)
2019-12-22 12:37:58 +01:00
Andrew Kaster
150837e7e8 LibC: Prevent assertions in malloc/free at exit time
This is a bit sad, but, with the Allocators as static globals their
destructors were running before some user code. Which doesn't really
make much sense, as none of the members of (at least the basic one) do
any real heavy lifting or have many resources to RAII.

To avoid the problem, just mmap the memory for the global arrays of
Allocators in __malloc_init and let the Kernel collect the memory when
we're done with the process.
2019-12-22 10:47:39 +01:00
Andrew Kaster
7edfdca4b2 LibGUI: Don't assert in ~GWidgetClassRegistration
These guys are all declared as globals, and their ASSERT_NOT_REACHED
in the destructor doesn't play nice with __cxa_atexit. As in, every
application will assert in __cxa_finalize if this assert isn't removed.
2019-12-22 10:47:39 +01:00
Andrew Kaster
824bbc7462 LibC: Support exit time destructors per the Itanium C++ ABI
Implement __cxa_atexit and __cxa_finalize per the Itanium spec,
and convert stdlib's atexit and exit() to to call them instead of
a custom 'C-only' atexit implementation.
2019-12-22 10:47:39 +01:00
Paweł Cholewa
e2dcf27a2e TextEditor: Ask before opening a file if current document is dirty
This commit should be a fix of issue #892
2019-12-22 09:10:26 +01:00
Andrew Kaster
aa0ee0e407 AK: InlineLinkedListIterator operator-> should return m_node directly
Little typo here. Don't think many people use this iterator :)
2019-12-22 09:07:47 +01:00
Andreas Kling
c5c1cc817e Kernel: Expose region executable bit in /proc/PID/vm
Also show it in SystemMonitor's process memory map table (as 'X') :^)
2019-12-21 16:26:42 +01:00