Commit Graph

263 Commits

Author SHA1 Message Date
Robin Burchell
ed25d524f2 ABuffer: move it and groove it 2019-07-17 09:47:52 +02:00
Robin Burchell
2df6f0e87f Work on AudioServer
The center of this is now an ABuffer class in LibAudio.
ABuffer contains ASample, which has two channels (left/right) in
floating point for mixing purposes, in 44100hz.

This means that the loaders (AWavLoader in this case) needs to do some
manipulation to get things in the right format, but that we don't need
to care after format loading is done.

While we're at it, do some correctness fixes. PCM data is unsigned if
it's 8 bit, but 16 bit is signed. And /dev/audio also wants signed 16
bit audio, so give it what it wants.

On top of this, AudioServer now accepts requests to play a buffer.
The IPC mechanism here is pretty much a 1:1 copy-paste from
LibGUI/WindowServer. It can be generalized more in the future, but for
now I want to get AudioServer working decently first :)

Additionally, add a little "aplay" tool to load and play a WAV file. It
will break with large WAVs (run out of memory, heh...) but it's a start.

Future work needs to make AudioServer block buffer submission from
clients until it has played the buffer they are requesting to play.
2019-07-17 09:39:31 +02:00
Andreas Kling
62335c5f0c WindowServer: Spawn a SystemDialog when activating the shutdown menu.
This allows us to ask the user for confirmation instead of just shutting
down the system abruptly.
2019-07-16 21:41:13 +02:00
Robin Burchell
818a29c964 WSEventLoop: Move message processing into WSClientConnection
Tidier encapsulation than splitting messages between two classes.
2019-07-14 15:29:59 +02:00
Robin Burchell
0a1bd03f1d WindowServer: Add a custom window type for Launcher
This keeps it out of the taskbar window list.
The stacking order is a little gnarly, but it seems to work OK still.
2019-07-14 00:06:47 +02:00
Robin Burchell
bee4544192 WSEventLoop: Treat invalid window types the same as unknown window types
And forcefully disconnect the client in both cases.
2019-07-14 00:06:47 +02:00
Robin Burchell
ffa8cb668f AudioServer: Assorted infrastructure work
* Add a LibAudio, and move WAV file parsing there (via AWavFile and AWavLoader)
* Add CLocalSocket, and CSocket::connect() variant for local address types.
  We make some small use of this in WindowServer (as that's where we
  modelled it from), but don't get too invasive as this PR is already
  quite large, and the WS I/O is a bit carefully done
* Add an AClientConnection which will eventually be used to talk to
  AudioServer (and make use of it in Piano, though right now it really
  doesn't do anything except connect, using our new CLocalSocket...)
2019-07-13 22:57:24 +02:00
Andreas Kling
85674aa498 WindowServer: Don't deliver the same mouse event twice.
We were sometimes delivering the same mouse event twice to the active input
window. This happened because we had already delivered it via the automatic
cursor tracking mechanism.
2019-07-13 11:50:39 +02:00
Robin Burchell
6c4024c04a Kernel: First cut of a sb16 driver
Also add an AudioServer that (right now) doesn't do much.
It tries to open, parse, and play a wav file. In the future, it can do more.

My general thinking here here is that /dev/audio will be "owned" by AudioServer,
and we'll do mixing in software before passing buffers off to the kernel
to play, but we have to start somewhere.
2019-07-13 08:00:24 +02:00
Robin Burchell
8a1a9e78d7 WSWindowManager: Ensure that we pick a single window to deliver a full stream of events to
This is effectively a mouse grab except that we don't require any client
coordination to request it (which is probably OK, and certainly a lot
simpler to implement).

This prevents e.g. dragging the mouse cursor out of paint and over the
terminal from selecting text unexpectedly.
2019-07-12 18:19:45 +02:00
Andreas Kling
64d9b43734 WindowServer: Use CProcessStatisticsReader in WSCPUMonitor. 2019-07-10 15:22:44 +02:00
Andreas Kling
1791ebaacd WindowServer: Convert dbgprintf() in WSWindowManager to dbg().
Here goes the first trial run for the new LogStream mechanism.
I like it so far. :^)
2019-07-04 07:07:40 +02:00
Andreas Kling
27f699ef0c AK: Rename the common integer typedefs to make it obvious what they are.
These types can be picked up by including <AK/Types.h>:

* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
2019-07-03 21:20:13 +02:00
Andreas Kling
575acfac98 WindowServer: Add a separator before "close" in window menus. 2019-06-30 15:59:11 +02:00
VAN BOSSUYT Nicolas
802d4dcb6b Meta: Removed all gitignore in the source tree only keeping the root one 2019-06-30 10:41:26 +02:00
Andreas Kling
315716d193 GUI: Use Win2K-like "warm gray" color instead of the older colder gray.
Someone suggested this a long time ago and I never got around to it.
So here we go, here's the warm gray! I have to admit I like it better. :^)
2019-06-30 09:23:16 +02:00
Andreas Kling
14b51253c0 WindowServer: Allow changing window opacity with Logo+MouseWheel.
This is just a silly little feature that I thought was a bit neat. :^)
2019-06-29 09:27:55 +02:00
Andreas Kling
2bd8118843 Kernel: Change the format of /proc/all to JSON.
Update ProcessManager, top and WSCPUMonitor to handle the new format.

Since the kernel is not allowed to use floating-point math, we now compile
the JSON classes in AK without JsonValue::Type::Double support.
To accomodate large unsigned ints, I added a JsonValue::Type::UnsignedInt.
2019-06-29 09:04:45 +02:00
Andreas Kling
872cccb8f7 WindowServer: Make use of the new Vector(initializer_list). 2019-06-28 20:21:28 +02:00
Andreas Kling
5980007e44 Userland: Fix many compiler warnings. 2019-06-22 15:47:08 +02:00
Andreas Kling
0deade2883 WindowServer: Fix compiler warnings. 2019-06-22 14:49:01 +02:00
Andreas Kling
550b0b062b AK: Rename RetainPtr.h => RefPtr.h, Retained.h => NonnullRefPtr.h. 2019-06-21 18:45:59 +02:00
Andreas Kling
c26e3ce86b Change "retain" to "ref" in various comments. 2019-06-21 18:40:24 +02:00
Andreas Kling
90b1354688 AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr. 2019-06-21 18:37:47 +02:00
Andreas Kling
77b9fa89dd AK: Rename Retainable => RefCounted.
(And various related renames that go along with it.)
2019-06-21 15:30:03 +02:00
Andreas Kling
ef1bfcb9d8 WindowServer: Move some event code from WSWindowManager to WSMenuBarKeeper. 2019-06-21 15:02:11 +02:00
Andreas Kling
ede598589a WindowServer: Make most of WSMenuBarKeeper private.
The outside world doesn't need to know about all this stuff.
2019-06-21 11:12:45 +02:00
Andreas Kling
2e9cc75d11 WindowServer+Taskbar: Let WindowServer manage the "window menus".
Taskbar now simply asks the WindowServer to popup a window menu when right
clicking on a taskbar button.

This patch also implements the "close" menu item, and furthermore makes the
window menu show up when you left-click a window's titlebar icon. :^)
2019-06-21 11:03:43 +02:00
Andreas Kling
9ac17c7bc9 WindowServer: Render the global menubar into a separate WSWindow.
Previously we were rendering the whole menubar on every compose(),
even if nothing changed about it. Now it's in its own window and can
be invalidated and painted separately.
2019-06-21 08:19:43 +02:00
Andreas Kling
8cb0c765ca LookupServer: Use a CFile for loading /etc/hosts.
This fixes an issue with the lines having extra bytes at the end due after
converting from ByteBuffer to String.
2019-06-20 21:48:33 +02:00
Andreas Kling
4080221547 WindowServer: Remove unused WSWindowManager::m_windows hash table. 2019-06-18 14:40:18 +02:00
Robin Burchell
862682b1bb SystemServer: Shut down after 5 seconds if testmode=1 is set on the kernel command line 2019-06-16 14:33:59 +02:00
Robin Burchell
c52d553249 WindowServer: Add a shutdown option to the menu, rather than forcing terminal use 2019-06-16 12:25:30 +02:00
Andreas Kling
39d1a9ae66 Meta: Tweak .clang-format to not wrap braces after enums. 2019-06-07 17:13:23 +02:00
Andreas Kling
e09c3a1ae8 SystemServer: Run clang-format on everything. 2019-06-07 11:47:46 +02:00
Andreas Kling
8358833bc8 WindowServer: Run clang-format on everything. 2019-06-07 11:47:19 +02:00
Christopher Dumas
0491d34d0c LookupServer: use /etc/hosts even for reverse lookups 2019-06-07 08:35:41 +02:00
Christopher Dumas
70a37f9a26 LookupServer: Load hostnames 2019-06-07 08:35:41 +02:00
Christopher Dumas
4f62176c3e LookupServer: Clang-Format 2019-06-07 08:35:41 +02:00
Christopher Dumas
908d9458c7 WindowServer: New API for Scaled Blit 2019-06-06 18:35:00 +02:00
Christopher Dumas
90d924a97c WindowServer: Implement scaled backgrounds and scaled blitting function 2019-06-06 18:35:00 +02:00
Christopher Dumas
c72953cf06 WindowServer: Clang-Format 2019-06-06 18:35:00 +02:00
Andreas Kling
01f1333856 LookupServer+LibC: Add support for reverse DNS lookups via gethostbyaddr().
LookupServer can now take two types of requests:

* L: Lookup
* R: Reverse lookup

The /bin/host program now does a reverse lookup if the input string is a
valid IPv4 address. :^)
2019-06-06 05:35:03 +02:00
Andreas Kling
3fa0b6cd92 WindowServer: Always update the maximize button icon when we should.
We were only updating it in the WSButton callback, not when changing the
maximized state by calling WSWindow::set_maximized().

Fixes #119.
2019-06-02 15:35:00 +02:00
Robin Burchell
b55b6cd7fc AK: Add implicit String -> StringView conversion
And tidy up existing view() users.
2019-06-02 12:55:51 +02:00
Andreas Kling
51581c21fc WindowServer+LibGUI: Add a way to bring a window to the front.
GWindow::move_to_front() can now be used to move a window to the top of
the window stack.

We use this in Terminal to bring the settings window to the front if it
already exists when it's requested, in case it's hiding behind something.
2019-06-01 20:10:37 +02:00
Andreas Kling
8d7fbbe1fb WindowServer: Don't reach the end of mode_to_enum() without returning. 2019-06-01 20:02:05 +02:00
Mustafa
a4726b846c ls: Show user name and group name if available. (#151)
Fixes #150
2019-06-01 13:23:35 +02:00
Robin Burchell
d31ce9eccd Misc: Add a simple init process
This doesn't do much right now, just fork off a bunch of stuff and set priorities.
2019-05-30 02:57:15 +02:00
Robin Burchell
0dc9af5f7e Add clang-format file
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
2019-05-28 17:31:20 +02:00
Andreas Kling
cbd858544d LibC: Move struct timeval to sys/time.h. #POSIX 2019-05-28 13:48:06 +02:00
Christopher Dumas
3e26faa226 removed extra impl of scaling 2019-05-27 21:40:53 +02:00
Christopher Dumas
da9c70598f centered backgrounds are now an option 2019-05-27 21:40:53 +02:00
Christopher Dumas
c23882dde1 can now tile background and made sure the IRC choose server popup still works 2019-05-27 21:40:53 +02:00
Christopher Dumas
e3f81bce49 IRC client setttings, Terminal settings, more WM settings 2019-05-27 21:40:53 +02:00
Christopher Dumas
63486b8438 implemented settings for window manager. 2019-05-27 21:40:53 +02:00
Christopher Dumas
d4a16d6031 Network stack is now configurable, and resolution is also configurable, but loading cursors causes a page-fault? 2019-05-27 21:40:53 +02:00
Robin Burchell
9b86eb9fad WSCompositor: Allow a compose to bypass the timer when it first happens
d66fa60fcf introduced the use of a timer
to coalesce screen updates. This is OK, but it does introduce update
latency.

To help mitigate the impact of this, we now have a second (immediate)
timer. When a compose pass is first triggered, the immediate timer will
allow the compose to happen on the next spin of the event loop (so, only
coalescing updates across a single event loop pass). Any updates that
trigger while the delayed timer is running, though, will be delayed to
that (~60fps) timer.

This fixes #103.
2019-05-26 18:22:33 +02:00
Robin Burchell
d66fa60fcf WSCompositor: Use a timer to schedule compose rather than an event
Really poor man's vsync. Still not actual vsync, but at least we won't
constantly spin buffers if we get many dirty rects.
2019-05-26 04:10:05 +02:00
Robin Burchell
79dba9a545 WSEventLoop: Don't assert when being told to construct a crazy window type
Seriously non-cool :(
2019-05-26 03:41:53 +02:00
Andreas Kling
41ebb3eba3 WindowServer: Tweak window titlebar look somewhat.
Add a subtle shadow to the titlebar text. Also make the titlebar one pixel
taller to fully accomodate the 90s "3D frame" effect. :^)
2019-05-25 21:55:53 +02:00
Andreas Kling
34150f0836 WindowServer: Remove unused old "middle border" color. 2019-05-25 21:19:42 +02:00
Andreas Kling
e478a2fb0a WindowServer: Don't draw titlebar separator for titlebar-less windows. 2019-05-25 04:17:21 +02:00
Christopher Dumas
957f8b84f2 WindowServer: Make it possible to turn off window title bars (#88)
Also, Launcher now does not use titlebars.
Only check if titlebar should be shown if the window type works with that.
2019-05-24 23:37:23 +02:00
Andreas Kling
d0bc21b96f WindowServer: Remove some unused WSWindowManager members. 2019-05-24 21:11:55 +02:00
Christopher Dumas
dd84dcf31f Launcher loads applications from Launcher.ini, is started by default, and is resized automatically
Co-Authored-By: Andreas Kling <awesomekling@gmail.com>
2019-05-24 20:40:09 +02:00
Andreas Kling
ad908f1395 WindowServer: Factor out compositing from WSWindowManager into WSCompositor.
This is far from finished and the two classes are awkwardly grabbing at each
other's innards, but here's a first step in the right direction.
2019-05-24 19:32:46 +02:00
Andreas Kling
abbcdba72e WindowServer: Add 2560x1440 resolution option.
Also expand the QEMU VGA memory size to 64 MB, since otherwise we won't
have enough memory for double-buffering the screen.
2019-05-24 14:02:17 +02:00
Robin Burchell
9aa9454c6b WindowServer: Don't eat a MouseUp when producing a MouseDoubleClick
Otherwise, double clicking a button will leave it in pressed state.
2019-05-21 16:43:56 +02:00
Andreas Kling
9df8d28542 WindowServer: Don't start window resize for MouseUp or MouseMove. 2019-05-20 11:06:10 +02:00
Andreas Kling
d65114afd7 WindowServer: Convert some assertions into client did_misbehave()'s. 2019-05-20 04:29:07 +02:00
Andreas Kling
091448b8f3 WindowServer: Use blocking sockets for client connections. 2019-05-20 04:08:09 +02:00
Andreas Kling
0b850cf726 WindowServer: Allow sending up to 32 invalidation rects inline.
Oops, it looks like I left the max inline rects limit at 1 while debugging
this code.. We can fit 32 rects in a single WSAPI message without needing
a second "extra data" message, so let's use the space we have!
2019-05-20 03:18:43 +02:00
Robin Burchell
a8864dc590 Kernel: Report EAGAIN from read() on a non-blocking socket if the buffer is empty
This is not EOF, and never should have been so -- can trip up other code
when porting.

Also updates LibGUI and WindowServer which both relied on the old
behaviour (and didn't work without changes). There may be others, but I
didn't run into them with a quick inspection.
2019-05-20 01:31:28 +02:00
Robin Burchell
5f597d0cb2 WindowServer: Improve client write handling a little
* EPIPE now correctly deletes the client connection
* EAGAIN (which is now returned by the kernel if the write buffer fills)
  terminates the connection also
2019-05-19 14:13:49 +02:00
Robin Burchell
ec0d598934 WSWindowManager: Add double click to maximize/restore 2019-05-18 15:54:10 +02:00
Andreas Kling
33d0916d29 WindowServer: Add support for fullscreen windows.
Fullscreen windows are rendered alone and above everything else when they
are active, and as part of the regular window stack order when something
else is active.

Currently windows cannot be made fullscreen after-the-fact, but must have
the fullscreen flag included in their CreateWindow message.

It should not possible to interact with the menu, taskbar or window frame
while the active window is fullscreened. :^)
2019-05-17 22:33:19 +02:00
Robin Burchell
5babcac289 Build: Install most headers to Root (and libcore.a/libgui.a)
This makes out-of-tree linking possible. And at the same time, add a
CMakeToolchain.txt file that can be used to build arbitrary cmake-using
applications on Serenity by pointing to the CMAKE_TOOLCHAIN_FILE when
running cmake:

    -DCMAKE_TOOLCHAIN_FILE=~/code/serenity/Toolchain/CMakeToolchain.txt
2019-05-17 21:59:48 +02:00
Robin Burchell
805e87a21c WindowServer: Add a more dynamic app list
This contains more stuff, and is easier to add to since it's just a vector :)
2019-05-17 14:20:44 +02:00
Andreas Kling
bcb7893156 WindowServer: Don't treat bottom titlebar edge as part of the border.
We were allowing initiation of resize from the bottom titlebar edge
since everything inside the window frame that's not either inside the
title bar, or inside the window content, is considered the border.
2019-05-16 20:29:42 +02:00
Andreas Kling
4e7e2950bc WindowServer: Fill unbacked windows with their background color.
This avoids flashing a content-less window frame during client startup.
2019-05-16 20:11:09 +02:00
Robin Burchell
c4610b825d WSWindowManager: Fix a small whoopsie with double click delivery
We must reset the click clock to invalid after delivering the double
click event. Otherwise, a subsequent click will make us (incorrectly)
deliver another double click.
2019-05-16 01:24:34 +02:00
Robin Burchell
f55965b5e8 WindowServer/GMenu: Adjust the popup position to fit the window inside the screen
Rather than passing a "top_anchored" bool. Fixes #22.
2019-05-16 01:22:54 +02:00
Robin Burchell
a4b0dfff43 Move double click events from LibGUI to the window server 2019-05-15 22:45:28 +02:00
Andreas Kling
dab9901235 WindowServer+LibGUI: Handle mouse wheel deltas in the mouse event stream.
The wheel events will end up in GWidget::mousewheel_event(GMouseEvent&)
on the client-side. This patch also implements basic wheel scrolling in
GScrollableWidget via this mechanism. :^)
2019-05-13 19:52:57 +02:00
Andreas Kling
852d648912 Fix "make clean" not deleting app binaries. 2019-05-13 14:56:18 +02:00
Andreas Kling
42cf09fdf1 WindowServer: Don't add maximize button to non-resizable windows.
The minimize button can stay though, since it doesn't change the window
size, just the visibility. :^)
2019-05-13 00:48:54 +02:00
Andreas Kling
8c4b7fe385 WindowServer: Make the ordering in the window switcher a bit more sane. 2019-05-13 00:08:56 +02:00
Andreas Kling
a20ce4d2b8 WindowServer: Rearrange minimize/maximize/close buttons (in that order.) 2019-05-12 21:33:25 +02:00
Andreas Kling
641893104a WindowServer: Add a maximize/unmaximize button to windows. 2019-05-12 21:32:02 +02:00
Andreas Kling
dddf45f563 Change String&& arguments to const String& in a couple of places.
String&& is more nuisance than anything, and the codegen improvement is
basically negligible since the underlying type is already retainable.
2019-05-12 14:57:15 +02:00
Andreas Kling
23e6c45e87 WindowServer: Show downscaled window thumbnails in the window switcher. 2019-05-12 04:15:25 +02:00
Andreas Kling
c9951bbe60 WindowServer: Improve window frames by giving them a raised frame look. :^) 2019-05-11 01:31:10 +02:00
Andreas Kling
d8ae6c31ce LibGUI+WindowServer: Improve checkmark appearance. 2019-05-10 22:50:42 +02:00
Andreas Kling
99aead4857 Kernel: Add a writev() syscall for writing multiple buffers in one go.
We then use this immediately in the WindowServer/LibGUI communication in
order to send both message + optional "extra data" with a single syscall.
2019-05-10 03:19:25 +02:00
Andreas Kling
5b2e122624 WindowServer: Don't launch a terminal when clicking system menu separators.
The menu item for launching a terminal was sharing ID's with the separators.
2019-05-07 17:11:28 +02:00
Andreas Kling
8750f93201 WindowServer: Don't invalidate the cursor on left button state change.
This was needed back when pressing the left button would cause the cursor
to switch colors.
2019-05-07 03:56:54 +02:00
Andreas Kling
dc919352b0 WindowServer: Don't send Paint messages to minimized windows.
There's no point in painting if it can't be seen anyway. We also make sure
to request a repaint when un-minimizing, so the window gets a chance to
repaint itself then.
2019-05-04 23:59:04 +02:00
Andreas Kling
6a5d92f0ad WindowServer+LibGUI: Allow changing whether windows have alpha channels.
Use this in Terminal to tell the window server to not bother with the alpha
channel in the backing store if we're running without transparency.
Semi-transparent terminals look neat but they slow everything down, so this
keeps things fast while making it easy to switch to the flashy mode. :^)
2019-05-03 21:07:16 +02:00
Andreas Kling
ea9a39a9f2 LibGUI+WindowServer: Add a GResizeCorner widget.
This widget is automatically included in GStatusBar, but can be added in
any other place, too. When clicked (with the left button), it initiates a
window resize (using a WM request.)

In this patch I also fixed up some issues with override cursors being
cleared after the WindowServer finishes a drag or resize.
2019-05-03 01:38:24 +02:00