Commit Graph

820 Commits

Author SHA1 Message Date
Jami Kettunen
cece0d230d Applications: Add new keyboard shortcuts & update few existing ones 2020-01-01 01:23:27 +01:00
Jami Kettunen
7f15604f72 HexEditor: Clarify in InputBox which offset (Hex/Dec) you're Going To 2020-01-01 01:23:27 +01:00
Jami Kettunen
74a18c86c9 Applications: Implement some missing MenuBars & AboutDialogs 2019-12-31 01:46:42 +01:00
Jami Kettunen
33b8d37dd3 Applications: Space out SystemMonitor & TextEditor in AboutDialogs 2019-12-31 01:46:42 +01:00
Andreas Kling
50677bf806 Kernel: Refactor scheduler to use dynamic thread priorities
Threads now have numeric priorities with a base priority in the 1-99
range.

Whenever a runnable thread is *not* scheduled, its effective priority
is incremented by 1. This is tracked in Thread::m_extra_priority.
The effective priority of a thread is m_priority + m_extra_priority.

When a runnable thread *is* scheduled, its m_extra_priority is reset to
zero and the effective priority returns to base.

This means that lower-priority threads will always eventually get
scheduled to run, once its effective priority becomes high enough to
exceed the base priority of threads "above" it.

The previous values for ThreadPriority (Low, Normal and High) are now
replaced as follows:

    Low -> 10
    Normal -> 30
    High -> 50

In other words, it will take 20 ticks for a "Low" priority thread to
get to "Normal" effective priority, and another 20 to reach "High".

This is not perfect, and I've used some quite naive data structures,
but I think the mechanism will allow us to build various new and
interesting optimizations, and we can figure out better data structures
later on. :^)
2019-12-30 18:46:17 +01:00
Jesse Buhagiar
ba98666b05 DisplayProperties: Add a menubar
Add a menubar to the `DisplayProperties` application to make it
more consistent with the other programs in the system.
2019-12-30 14:03:31 +01:00
Tibor Nagy
62d79a77d6 FontEditor: Add glyph spacing spinbox 2019-12-30 14:02:12 +01:00
Andreas Kling
6a94214502 About: Embrace the SerenityOS name 2019-12-29 19:07:52 +01:00
Andreas Kling
c74cde918a Kernel+SystemMonitor: Expose amount of per-process clean inode memory
This is memory that's loaded from an inode (file) but not modified in
memory, so still identical to what's on disk. This kind of memory can
be freed and reloaded transparently from disk if needed.
2019-12-29 12:45:58 +01:00
Andreas Kling
0d5e0e4cad Kernel+SystemMonitor: Expose amount of per-process dirty private memory
Dirty private memory is all memory in non-inode-backed mappings that's
process-private, meaning it's not shared with any other process.

This patch exposes that number via SystemMonitor, giving us an idea of
how much memory each process is responsible for all on its own.
2019-12-29 12:28:32 +01:00
Andreas Kling
7b2dd7e116 LibDraw+LibGUI: Allow changing individual colors in a Palette
Palette is now a value wrapper around a NonnullRefPtr<PaletteImpl>.
A new function, set_color(ColorRole, Color) implements a simple
copy-on-write mechanism so that we're sharing the PaletteImpl in the
common case, but allowing you to create custom palettes if you like,
by getting a GWidget's palette, modifying it, and then assigning the
modified palette to the widget via GWidget::set_palette().

Use this to make PaintBrush show its palette colors once again.

Fixes #943.
2019-12-29 00:47:49 +01:00
joshua stein
b624eaaf78 Build: consider IPCCOMPILER and FORMCOMPILER just for ordering
Build them if they don't exist, but don't care about them being
newer or older than the target.

I believe this is what was causing build loops where IPCCompiler was
being run a second time, rebuilding its .h file, then a library
would depend on that .h file and get re-archived, then an
application would need relinking, and something in that whole
process would trigger IPCCompiler running again touching its .h
file.
2019-12-28 21:09:33 +01:00
joshua stein
0b501335f5 Build: wrap make invocations with flock(1)
Lock each directory before entering it so when using -j, the same
dependency isn't built more than once at a time.

This doesn't get full -j parallelism though, since one make child
will be sitting idle waiting for flock to receive its lock and
continue making (which should then do nothing since it will have
been built already).  Unfortunately there's not much that can be
done to fix that since it can't proceed until its dependency is
built by another make process.
2019-12-28 21:09:33 +01:00
Valtteri Koskivuori
415a5d68ce Build: Fix missing IPC dependency for Browser.
It forgot to compile IPC for ProtocolClient before building the browser.
2019-12-27 15:52:12 +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
b830639912 PaintBrush: Add a "rectangle tool"
Fill, line, and gradient modes initially supported :^)
2019-12-26 21:22:29 +01:00
William McPherson
6cf4468506 Piano: Factor wave rendering to its own function 2019-12-25 16:14:11 +01:00
William McPherson
bc65971df6 Piano: Use switch statements on m_wave_type 2019-12-25 16:14:11 +01:00
William McPherson
e80061c808 Piano: Move m_front_buffer/m_back_buffer off heap 2019-12-25 16:14:11 +01:00
William McPherson
b3b522bae2 Piano: Initialize m_note_on[]
This was being read before initialization.
2019-12-25 16:14:11 +01:00
William McPherson
2573c33ffe Piano: Rename "release" to "decay"
That's not release!
2019-12-25 16:14:11 +01:00
William McPherson
27ebf3ff32 Piano: Initialize keys[] at member definition 2019-12-25 16:14:11 +01:00
joshua stein
c127d16326 Build: support library and generator dependencies
Instead of directly manipulating LDFLAGS, set LIB_DEPS in each
subdirectory Makefile listing the libraries needed for
building/linking such as "LIB_DEPS = Core GUI Draw IPC Core".

This adds each library as an -L and -l argument in LDFLAGS, but
also adds the library.a file as a link dependency on the current
$(PROGRAM).  This causes the given library to be (re)built before
linking the current $(PROGRAM), but will also re-link any binaries
depending on that library when it is modified, when running make
from the root directory.

Also turn generator tools like IPCCompiler into dependencies on the
files they generate, so they are built on-demand when a particular
directory needs them.

This all allows the root Makefile to just list directories and not
care about the order, as all of the dependency tracking will figure
it out.
2019-12-25 10:11:09 +01:00
Andreas Kling
a79bac428b LibGUI+LibDraw: Add "Palette" concept for scoped color theming
GApplication now has a palette. This palette contains all the system
theme colors by default, and is inherited by a new top-level GWidget.
New child widgets inherit their parents palette.

It is possible to override the GApplication palette, and the palette
of any GWidget.

The Palette object contains a bunch of colors, each corresponding to
a ColorRole. Each role has a convenience getter as well.

Each GWidget now has a background_role() and foreground_role(), which
are then looked up in their current palette when painting. This means
that you no longer alter the background color of a widget by setting
it directly, rather you alter either its background role, or the
widget's palette.
2019-12-24 21:27:16 +01:00
Andreas Kling
b6eba388e3 LibDraw: Add Selection and SelectionText system theme colors 2019-12-24 12:13:49 +01:00
Shannon Booth
bbe99ae960 SystemMonitor: Remove uneeded cast from unsigned to int
GVariant now supports unsigned ints :^)
2019-12-24 11:11:13 +01:00
Shannon Booth
889a60a6ed Browser: Stop reloads from pushing to history 2019-12-24 00:20:05 +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
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
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
joshua stein
23158aef2e Build: only setup git defines for About application 2019-12-20 23:55:08 +01:00
joshua stein
ac25438d54 Build: clean up build system, use one shared Makefile
Allow everything to be built from the top level directory with just
'make', cleaned with 'make clean', and installed with 'make
install'.  Also support these in any particular subdirectory.

Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as
it runs.

Kernel and early host tools (IPCCompiler, etc.) are built as
object.host.o so that they don't conflict with other things built
with the cross-compiler.
2019-12-20 20:20:54 +01:00
Andreas Kling
ea91f24a49 QuickShow: Allow dropping an image file on the QuickShow window
We now try to open image files dropped on us from FileManager. :^)

The QuickShow code is not exactly well-factored, and should be fixes up
to not do the same thing twice, etc.
2019-12-20 20:07:10 +01:00
Andreas Kling
f276030969 QuickShow: Don't disable background fill 2019-12-20 20:07:10 +01:00
Andreas Kling
6425b8714a TextEditor: Handle drop events
We now handle drop events with data type "url-list". This makes it
possible to drop a file from FileManager on TextEditor to open it.
2019-12-20 20:07:10 +01:00
Hüseyin ASLITÜRK
1c9742a4a5 DisplayProperties: Highlight current resolution at startup 2019-12-19 10:34:44 +01:00
Zyper
413618454b PaintBrush: Shift key constrains LineTool angle
Holding Shift key will constrain the LineTool's line angle to 15 degrees
increments. Many graphics editors have similar feature.
2019-12-17 21:21:24 +01:00
Zyper
b185c7f58a PaintBrush: Tools can receive KeyUp events 2019-12-17 21:21:24 +01:00
Andreas Kling
931e4b7f5e Kernel+SystemMonitor: Prevent userspace access to process ELF image
Every process keeps its own ELF executable mapped in memory in case we
need to do symbol lookup (for backtraces, etc.)

Until now, it was mapped in a way that made it accessible to the
program, despite the program not having mapped it itself.
I don't really see a need for userspace to have access to this right
now, so let's lock things down a little bit.

This patch makes it inaccessible to userspace and exposes that fact
through /proc/PID/vm (per-region "user_accessible" flag.)
2019-12-15 20:11:57 +01:00
Andreas Kling
39a6d29b39 SystemMonitor: Make the memory map the "default view"
The memory map is a lot more interesting than the "open files" view :^)
2019-12-15 20:00:19 +01:00
Hüseyin ASLITÜRK
22b190e4be DisplayProperties: Start at top left position for full view at low resoluations. 2019-12-15 19:50:54 +01:00
Andreas Kling
3fbc50a350 Kernel+SystemMonitor: Expose the number of set CoW bits in each Region
This number tells us how many more pages in a given region will trigger
a CoW fault if written to.
2019-12-15 16:53:00 +01:00
William McPherson
69d05fbf44 Piano: Add triangle wave and noise
The squad is complete :^)

You can find the equation for the triangle wave here:
https://en.wikipedia.org/wiki/Triangle_wave
We're using this one:
|x mod 4 - 2| - 1
Modifications have been made to correct the frequency and phase:
|(4x + 1) mod 4 - 2| - 1

The white noise is generated by calling rand() and dividing it by
RAND_MAX to get a value from 0 to 1. Then it's adjusted to fit between
-1 and 1.
2019-12-13 19:30:14 +01:00
Tommy Nguyen
091c783626 FileManager: Check which widget has focus for context menu actions
This fixes the issue where application shortcuts only operated on the
TreeView.
2019-12-12 23:53:12 +01:00
Tommy Nguyen
17f3948b15 FileManager: Add a context menu to the TreeView
This adds a context menu to the TreeView with the ability to copy/paste, create
new directories, etc. This does not address the issue mentioned above where
using the global application shortcut does not apply to whatever view has
focus.
2019-12-12 11:19:02 +01:00
Andreas Kling
fd5eb79d19 LibGUI: Make GMenu inherit from CObject
This is primarily to make it possible to pass a GMenu* where a CObject*
is expected.
2019-12-09 21:05:44 +01:00
Andreas Kling
92b46d9814 SystemMonitor: Show information about purgeable memory
This patch exposes some fields about purgeable memory regions.
We now also show total purgeable volatile and non-volatile memory in
the big process table.
2019-12-09 19:16:58 +01:00