Commit Graph

87 Commits

Author SHA1 Message Date
Andreas Kling
3005c0af69 WebContent: Add a little text file I drew of the server/client classes 2020-07-04 23:17:58 +02:00
Andreas Kling
a4b5350aff WebContent: Notify client when web content selection changes
The WebContentView widgets reacts to this by requesting a repaint.
2020-07-04 20:57:57 +02:00
Andreas Kling
8bd2fd8df9 Taskbar: Don't wrap minimized window titles in []
This actually looks a lot nicer without the [] and I'm not sure that
the visual cue about minimization state was actually useful.
2020-07-04 20:03:09 +02:00
Andreas Kling
b85a57ead7 WindowServer: Move window titles 1px to the right
This makes it look nicer with wide window icons.
2020-07-04 19:21:57 +02:00
Andreas Kling
d851863704 Userspace: Remove a bunch of unnecessary Kernel/API/KeyCode.h includes 2020-07-04 17:25:31 +02:00
Andreas Kling
11c4a28660 Kernel: Move headers intended for userspace use into Kernel/API/ 2020-07-04 17:22:23 +02:00
Andreas Kling
1dd1595043 LibGUI: Make GUI::Application a Core::Object
Having this on the stack makes whole-program teardown iffy. Turning it
into a Core::Object allows anyone who needs it to extends its lifetime.
2020-07-04 14:05:57 +02:00
Maciej Zygmanowski
fc79fefb5e WindowServer: Don't crash when invalid resolution requested 2020-07-03 12:31:40 +02:00
Peter Elliott
f833362536 WindowServer: don't send resize on resolution change unless needed
fixes #2575

The extra ResizeEvent would be handled after on_rect_change, and would
reset the size of main_widget to what it was before the resize.

Bonus: Less unnecessary events.
2020-06-29 16:50:40 +02:00
Nico Weber
12cbc4ad0d Everywhere: Replace some uses of fork/exec with posix_spawn
It's less code, and it's potentially more efficient once
posix_spawn is a real syscall.
2020-06-29 12:04:27 +02:00
sppmacd
abdf36b171 SystemMenu: Fix shutdown dialog
It was shutting down even if selected Restart.
2020-06-28 14:32:17 +02:00
Andreas Kling
e50fa413cb WindowServer: Move window title bar icons 1px to the right
This makes wider icons look better, since they no longer rub up against
the left edge.
2020-06-28 00:09:01 +02:00
Ruairidh MacLeod
6400122760
SystemServer: Fix typo (exist -> exit) (#2615)
Small typo that I noticed on the latest OS hacking video!
2020-06-23 14:52:15 +02:00
Andreas Kling
c74b5fd798 WebContent: Unveil access to the ImageDecoder service :^) 2020-06-23 14:28:45 +02:00
Andreas Kling
e3782a7f99 ImageDecoder: Add a new service for out-of-process image decoding :^)
The new ImageDecoder service (available for members of "image" via
/tmp/portal/image) allows you to decode images in a separate process.

This will allow programs to confidently load untrusted images, since
the bulk of the security concerns are sandboxed to a separate process.

The only API right now is a synchronous IPC DecodeImage() call that
takes a shbuf with encoded image data and returns a shared buffer and
metadata for the decoded image.

It also comes with a very simple library for interfacing with the
ImageDecoder service: LibImageDecoderClient. The name is a bit of a
mouthful but I guess we can rename it later if we think of something
nicer to call it.

There's obviously a bit of overhead to spawning a separate process
for every image decode, so this is mostly only appropriate for
untrusted images (e.g stuff downloaded from the web) and not necessary
for trusted local images (e.g stuff in /res)
2020-06-22 21:47:00 +02:00
Andreas Kling
79d3c5723f SystemServer: Put some debug spam behind #ifdefs 2020-06-22 21:18:55 +02:00
Andreas Kling
59537cf257 WebContent: Turn it into a MultiInstance service :^)
Port the WebContent service to the new MultiInstance mechanism that
Sergey added. This means that every new WebContentView gets its very
own segregated WebContent process.
2020-06-21 21:54:30 +02:00
Hüseyin ASLITÜRK
5950736efa WindowServer: Add a new IsMaximized message
New message to query window maximized state.
2020-06-18 23:18:11 +02:00
Andreas Kling
8c82d26668 LibWeb: Rename LayoutNode::render() to paint()
"Paint" matches what we call this in the rest of the system. Let's not
confuse things by mixing paint/render/draw all the time. I'm guilty of
this in more places..

Also rename RenderingContext => PaintContext.
2020-06-18 21:37:20 +02:00
Andreas Kling
cfab53903f LibWeb: Separate layout tree rendering into phases
CSS defines a very specific paint order. This patch starts steering us
towards respecting that by introducing the PaintPhase enum with values:

- Background
- Border
- Foreground
- Overlay (internal overlays used by inspector)

Basically, to get the right visual result, we have to render the page
multiple times, going one phase at a time.
2020-06-18 18:57:35 +02:00
Hüseyin ASLITÜRK
77c8a960ad NotificationWindow: Replace Label with Image component to show icons 2020-06-18 16:35:57 +02:00
Andreas Kling
2ad1c2d959 LibWeb: Add PageClient::palette() for view-agnostic palette access 2020-06-17 20:26:59 +02:00
Andreas Kling
0bac2ad3b3 WebContent: Allow the WebContent process to trigger repaints
After layout, we may want to repaint the page, so we now listen for the
PageClient::page_did_invalidate() notification and use it to drive a
client-side repaint.

Note that an invalidation request from LibWeb makes a full roundtrip
to the WebContent client and back since the client drives painting.
2020-06-17 20:09:44 +02:00
Andreas Kling
c45c5ded34 WebContent: Start work on browser process separation :^)
The "WebContent" service provides a very restricted instance of LibWeb
running as an unprivileged user account. This will be used to implement
process separation in Browser, among other things.

This first cut of the service only spawns a single WebContent process
when someone connects to /tmp/portal/webcontent. We will soon switch
this over to spawning a new process for each connection.

Since this feature is very immature, we'll be bringing it up inside of
Demos/WebView as a separate demo program. Eventually this will become
a reusable widget that anyone can embed and easily get out-of-process
web content in their GUI.

This is pretty, pretty cool! :^)
2020-06-17 20:09:44 +02:00
Andreas Kling
723f4e5ee6 Meta: Scale back overly informal user-facing strings
We were getting a little overly memey in some places, so let's scale
things back to business-casual.

Informal language is fine in comments, commits and debug logs,
but let's keep the runtime nice and presentable. :^)
2020-06-17 18:35:49 +02:00
Hüseyin ASLITÜRK
2f7e5a5e40 WindowServer: Replace character with code point
Replace u8 data type width u32. Remove character property from event and add code_point property for represent UTF-8 character.
2020-06-16 13:15:17 +02:00
Andreas Kling
1678aaa555 ProtocolServer+LibProtocol: Propagate HTTP status codes to clients
Clients now receive HTTP status codes like 200, 404, etc.
Note that a 404 with content is still considered a "successful"
download from ProtocolServer's perspective. It's up to the client
to interpret the status code.

I'm not sure if this is the best API, but it'll work for now.
2020-06-13 22:20:37 +02:00
Andreas Kling
4ab1b0b436 LibIPC: Only start responsiveness timer after sending client a message
Instead of always running the responsiveness timer for IPC clients,
we now only start it after sending a message. This avoids waking up
otherwise idle clients to do ping/pong busywork.
2020-06-13 13:47:01 +02:00
Matthew Olsson
e8e728454c AK: JsonParser improvements
- Parsing invalid JSON no longer asserts
    Instead of asserting when coming across malformed JSON,
    JsonParser::parse now returns an Optional<JsonValue>.
- Disallow trailing commas in JSON objects and arrays
- No longer parse 'undefined', as that is a purely JS thing
- No longer allow non-whitespace after anything consumed by the initial
  parse() call. Examples of things that were valid and no longer are:
    - undefineddfz
    - {"foo": 1}abcd
    - [1,2,3]4
- JsonObject.for_each_member now iterates in original insertion order
2020-06-13 12:43:22 +02:00
sppmacd
15f4043a7a AudioServer: removed AS prefix from class and file names
And moved everything to AudioServer namespace
2020-06-12 20:42:22 +02:00
Andreas Kling
2ce2c4810a LibIPC+WindowServer+LibGUI: Detect and highlight unresponsive GUI apps
IPC::ClientConnection now tracks the time since the last time we got
a message from the client and calls a virtual function on itself after
3 seconds: may_have_become_unresponsive().

Subclasses of ClientConnection can then react to this if they like.

We use this mechanism in WindowServer to send out a friendly Ping
message to the client. If he doesn't Pong within 1 second, we mark
the client as "unresponsive" and recompose all of his windows with
a darkened appearance and amended title until he Pongs us.

This is a little on the aggressive side and we should figure out a way
to wake up less often. Perhaps this could only be done to windows the
user is currently interacting with, for example.

Anyways, this is pretty cool! :^)
2020-06-11 22:46:49 +02:00
Andreas Kling
116cf92156 LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
2020-06-10 10:59:04 +02:00
Sergey Bugaev
701994bfd1 SystemServer: Add support for accepting socket connections :^)
You can now ask SystemServer to not only listen for connections on the socket,
but to actually accept them, and to spawn an instance of the service for each
client connection. In this case, it's the accepted, not listening, socket that
the service processes will receive using socket takeover.

This mode obviously requires the service to be a multi-instance service.
2020-06-09 21:12:34 +02:00
Sergey Bugaev
ac4c2f890f SystemServer: Add support for multi-instance services
For this kind of services, there's no single PID of a running instance;
there may be multiple, or no instances of the service running at any time.
No keepalive functionality is available in this mode, since "alive" doesn't
make sense for multi-instance services.

At the moment, there's no way to actually create multiple instances of
a service; this is going to be added in the next commit.
2020-06-09 21:12:34 +02:00
Andreas Kling
3654710c41 LibIPC+Services: Support URL as a native IPC type 2020-06-07 22:55:33 +02:00
Nico Weber
8630ef6df6 WindowServer: Make perror() strings slightly more detailed.
If one fails, it's now easier to see which one it is.
2020-06-05 09:29:19 +02:00
Hüseyin ASLITÜRK
9ec6ac31b8 WindowsServer: Add scancode value to KeyEvent 2020-06-03 21:52:40 +02:00
Andreas Kling
29029568ee WindowServer: Remove keyboard shortcut for toggling the system menu
100% of the time I activated this shortcut, I did not want to activate
this shortcut.
2020-06-01 19:24:10 +02:00
Andreas Kling
e263dc8427 Taskbar: Show window progress as a progress bar behind the window title
If a window in the taskbar has progress, we'll now draw that progress
in the form of a progress bar behind the window title on the taskbar
button for the window.
2020-05-30 23:00:35 +02:00
Andreas Kling
1d6ec51bee WindowServer+LibGUI: Add per-window progress
Each window now has an associated progress integer that can be updated
via the SetWindowProgress IPC call.

This can be used by clients to indicate the progress of ongoing tasks.
Any number in the range 0 through 100 indicate a progress percentage.
Any other number means "no progress"
2020-05-30 23:00:35 +02:00
Emanuele Torre
937d0be762 Meta: Add a script check the presence of "#pragma once" in header files
.. and make travis run it.

I renamed check-license-headers.sh to check-style.sh and expanded it so
that it now also checks for the presence of "#pragma once" in .h files.

It also checks the presence of a (single) blank line above and below the
"#pragma once" line.

I also added "#pragma once" to all the files that need it: even the ones
we are not check.
I also added/removed blank lines in order to make the script not fail.

I also ran clang-format on the files I modified.
2020-05-29 07:59:45 +02:00
Andreas Kling
a34258b3d7 ProtocolServer: Forget downloads after they are stopped
Stopping means the client no longer cares about the download, so we
should just forget about it in the server.
2020-05-27 18:30:29 +02:00
Sergey Bugaev
ae21b8ee56 Base: Replace TTYServer with text mode Shell
Now that we have SystemServer that can (re)spawn the Shell, we don't need a
separate server just for that.

The two shells (on tty0 and tty1) are configured to only be started when booting
in text mode. This means you can now simply say boot_mode=text on the kernel
command line, and SystemServer will set up the system and spawn a comfy root
shell for you :^)
2020-05-27 11:19:38 +02:00
Sergey Bugaev
856e4853f4 SystemServer: Add BootModes and Environment service options
SystemServer will now look at the boot mode, as specified on the kernel command
line, and only launch the services configured for that boot mode.
2020-05-27 11:19:38 +02:00
Sergey Bugaev
602c3fdb3a AK: Rename FileSystemPath -> LexicalPath
And move canonicalized_path() to a static method on LexicalPath.

This is to make it clear that FileSystemPath/canonicalized_path() only
perform *lexical* canonicalization.
2020-05-26 14:35:10 +02:00
Sergey Bugaev
4139838a93 Userland et al: Pledge sigaction when needed
* In some cases, we can first call sigaction()/signal(), then *not* pledge
  sigaction.
* In other cases, we pledge sigaction at first, call sigaction()/signal()
  second, then pledge again, this time without sigaction.
* In yet other cases, we keep the sigaction pledge. I suppose these could all be
  migrated to drop it or not pledge it at all, if somebody is interested in
  doing that.
2020-05-26 14:35:10 +02:00
Sergey Bugaev
c1a26f0b35 WindowServer: Don't crash when minimizing Eyes
Or any other window that globally tracks the mouse cursor.
2020-05-25 12:38:37 +02:00
Andreas Kling
897998017a ProtocolServer: Support request headers
You can now pass a dictionary of request headers when starting a new
download in ProtocolServer.

The HTTP and HTTPS protocol will include the headers in their requests.
2020-05-21 12:27:42 +02:00
Hüseyin ASLITÜRK
d18f6e82eb LibGUI: Replace up and down arrows with emoji 2020-05-20 13:40:24 +02:00
Andreas Kling
191073000e WindowServer: Remove WindowManager::invalidate(Window) API's
Instead, we now tell Windows to invalidate themselves. Window will then
pass on the requests to Compositor.

My basic idea here is that WindowManager should do window management,
dealing with incoming events, moving, resizing, etc. Compositor should
deal with painting the window stack in the right order with the least
amount of effort. :^)
2020-05-20 08:31:46 +02:00