Commit graph

297 commits

Author SHA1 Message Date
Andreas Kling
d9e39cb82d LibWeb: Support window.alert() in multi-process context
Alerts are now delegated to the embedding GUI process.
2020-09-12 14:49:29 +02:00
Andreas Kling
aba793fb3e LibIPC: Share most of the code between {Client,Server}Connection
This patch introduces IPC::Connection which becomes the new base class
of ClientConnection and ServerConnection. Most of the functionality
has been hoisted up to the base class since almost all of it is useful
on both sides.

This gives us the ability to send synchronous messages in both
directions, which is needed for the WebContent server process.
Unlike other servers, WebContent does not mind blocking on a response
from its client.
2020-09-12 14:49:29 +02:00
Andreas Kling
b4f307f982 LibGUI+WindowServer: Rename window "override cursor" to just "cursor"
Let's just say each window has a cursor, there's not really overriding
going on.
2020-09-11 14:26:37 +02:00
Andreas Kling
0f9be82826 LibGfx: Move StandardCursor enum to LibGfx
This enum existed both in LibGUI and WindowServer which was silly and
error-prone.
2020-09-10 19:25:13 +02:00
Tom
0c2d36d1cd WindowServer: Draw minimize animation inverted
Inverting the pixels makes the animation visible over most colors.
2020-09-08 10:45:35 +02:00
Tom
3a4a9d4c6b WindowServer: Fix invalidating window frame
When invalidating the frame we need to properly flag that so that
we trigger rendering the frame, even if "all" was flagged as being
invalidated. Otherwise it will only get rendered if anything else
happens to trigger it (such as focus change).

Fixes #3427
2020-09-07 19:39:48 +02:00
Andreas Kling
2e6d59b7b2 Clipboard: Add a key-value map alongside the clipboard storage
A clipping now consists of three things:

- The raw clip data
- A MIME type
- A key-value map (String, String) for anything you like
2020-09-05 16:52:24 +02:00
thankyouverycool
72deaa3423 WindowServer: Return correct IsMaximized response 2020-08-31 09:08:26 +02:00
Sergey Bugaev
852454746e Everywhere: Port to String::copy_characters_to_buffer() 2020-08-30 17:35:27 +02:00
Ben Wiederhake
ec842b21cf WindowServer: Unbreak building with extra debug macros 2020-08-30 09:43:49 +02:00
Andreas Kling
0a7d9319af ChessEngine: Move from Applications to Services
This is not a stand-alone application. :^)
2020-08-28 12:53:02 +02:00
Tom
6ea7e67b62 WindowServer: Fix minor flicker with transparent windows
Do not fill the backing store mismatch area with the solid window
color if the window is transparent. This caused some minor flicker
when such a window is e.g. snapped to the left/right or maximized.
2020-08-27 10:13:03 +02:00
thankyouverycool
208cb995ba WindowServer+LibGfx: Move title bar button layout to WindowTheme 2020-08-26 08:53:14 +02:00
asynts
10c6f062b3 AK: Add Endian.h header to replace NetworkOrdered.h. 2020-08-25 16:22:14 +02:00
Ben Wiederhake
46b04a79e5 DHCPClient: Prefer strlcpy over strncpy, fixes off-by-one
A malicious caller of set_params could have caused the ifr_name field to
lack NUL-termination. I don't think this was an actual problem, though, as
the Kernel always forces NUL-termination by overwriting ifr_name's last byte
with NUL.

However, it feels better to do it properly.

No behaviour change (probably).
2020-08-24 00:45:03 +02:00
Ben Wiederhake
e682967d7e LibCore: Prefer strlcpy over strncpy, fix overflow
A malicious caller can create a SocketAddress for a local unix socket with an
over-long name that does not fit into struct sock_addr_un.
- Socket::connet: This caused the 'sun_path' field to
  overflow, probably overwriting the return pointer of the call frame, and thus
  crashing the process (in the best case).
- SocketAddress::to_sockaddr_un: This triggered a RELEASE_ASSERT, and thus
  crashing the process.

Both have been fixed to return a nice error code instead of crashing.
2020-08-24 00:45:03 +02:00
Andreas Kling
85e818206c LibGfx+WindowServer: Simplify notification window frame theming
Don't require theme clients to provide the frame rect, the theme can
compute that internally based on the window rect.
2020-08-23 13:17:34 +02:00
Peter Elliott
45ed58865e LibGUI+WindowServer: Add resize_aspect_ratio()
When a resize_aspect_ratio is specified, and window will only be resized
to a multiple of that ratio. When resize_aspect_ratio is set, windows
cannot be tiled.
2020-08-23 01:05:22 +02:00
Andreas Kling
e374eb3035 LibGUI+WindowServer: Remove ResizeEvent::old_size()
Turns out nobody was using this information anyway, so let's not go
through all the trouble of plumbing it from WindowServer to LibGUI.

Fixes #3247.
2020-08-22 13:11:25 +02:00
Andreas Kling
80a9896e83 LibGfx+WindowServer: Simplify WindowTheme::paint_normal_frame() API
Don't require passing in the outer frame rect since the theme can
compute that itself, based on the window rect.
2020-08-21 21:16:13 +02:00
Tom
5c60a6a8fb WindowServer: Fix MenuApplets painting
We need to clip painting to the actual size to prevent corrupting
the area outside of the applet as the backing store is not
guaranteed to be perfectly in sync.

Fixes #3107
2020-08-21 12:00:24 +02:00
Muhammad Zahalqa
16e86a3dda
SystemServer: Minor #include cleanup in Service.cpp (#3227) 2020-08-20 20:57:39 +02:00
Tom
f503d3c046 WindowServer: Process dnd mouse events first
Fixes duplicate GUI::DragOperation instances being created.

Fixes #3151
2020-08-19 21:06:37 +02:00
Tom
4897eb8c3e Taskbar: Update and clear taskbar button rectangles
We need to update all button rectangles when the layout changed.
We also need to clear the taskbar button rectangle when we
remove a modal window button, so that WindowServer uses the
parent's taskbar button rectangle for the minimize animation.
2020-08-19 11:38:26 +02:00
Tom
2552e3be00 WindowServer: Find parent taskbar rect for minimize animation
If a modal window is being minimized, it may not have its own
taskbar rectangle. In that case, try finding a parent in the
modal window stack that does have one, and use that for the
animation.
2020-08-19 11:38:26 +02:00
Tom
c711d34276 WindowServer: Use same modal minimize/maximize logic with shortcuts
When minimizing/maximizing windows using the keyboard shortcuts
we should use the same logic dealing with modal windows as the
window frame buttons.
2020-08-18 19:50:33 +02:00
Sergey Bugaev
1671e1ac92 WindowServer+LibVT: Convert some dbgprintf() to dbg()
These kept annoying me, because these were the only two lines in the default
boot log that went unattributed.
2020-08-18 17:19:52 +02:00
Tom
a698a58d3c WindowServer: Fix flickering
Rather than blitting and rendering each window every time, only
render what actually changed. And while doing so, only render
the portions that are visible on the screen. This avoids flickering
because flipping framebuffers isn't always perfectly in sync with
the code, so it's possible that the flip happens slightly delayed
and we can briefly see the next iteration having partially completed.

Also, avoid touching the mouse cursor unless it is in an area that
needs updating. This reduces flickering unless it is over an area
that is updated often. And because we no longer render the entire
screen, we'll save the contents below the cursor so that we can
hide it before touching that area.

Fixes #2981
2020-08-18 12:12:27 +02:00
Andreas Kling
a50a9d67ee WindowServer: Close the framebuffer fd in ~Screen() 2020-08-17 18:05:35 +02:00
Andreas Kling
b6e18133ae LibWeb: Rename WebContentView => OutOfProcessWebView 2020-08-17 18:05:35 +02:00
Andreas Kling
56c3748dcc LibWeb: Rename PageView => InProcessWebView 2020-08-17 18:05:35 +02:00
Linus Groh
0cab3bca2f LibGUI: Add and use Window::center_on_screen()
Various applications were using the same slightly verbose code to center
themselves on the screen/desktop:

Gfx::IntRect window_rect { 0, 0, width, height };
window_rect.center_within(GUI::Desktop::the().rect());
window->set_rect(window_rect);

Which now becomes:

window->resize(width, height);
window->center_on_screen();
2020-08-15 17:38:19 +02:00
Andreas Kling
46e53417c9 SystemServer: Adjust assertion+comment for new dup2() behavior
dup2(fd, fd) will no longer clear CLOEXEC on the descriptor.
2020-08-15 11:14:09 +02:00
Tom
5f3d384454 WindowServer: Minimize the modal stack when minimizing from frame
Rather than only minimizing the modal window, minimize the entire
modal window stack just like when minimizing it from the task bar.
2020-08-15 01:28:18 +02:00
Linus Groh
895ab8e745 WindowServer: Take MenuApplet windows into account for hovered_window
This finally makes tooltips on menu applets the same as everywhere else!

Here's what went wrong:
WindowManager::process_mouse_event() receives a Window*&, determines the
hovered window and sets it accordingly. However there's a branch that
tests for menubar_rect().contains(event.position()) and returns early -
which resulted in hovered_window never being set to any MenuApplet
window, even hovered ones.

The hovered_window result is being used in WindowManager::event() and
passed to WindowManager::set_hovered_window(), which is responsible for
creating WindowLeft and WindowEntered events when the hovered window
changes, as a result of the mentioned chain of events this also never
happens for MenuApplet windows.
The WindowLeft event would the cause Window::handle_left_event() in
LibGUI to be called, which unsets the window's hovered widget, which
is necessary for the widget to receive a subsequent Enter event -
again, all of this never happened.

Now it's working as expected though, so we can start using tooltips on
menu applets :^)
2020-08-14 10:28:03 +02:00
Linus Groh
d979379a99 WindowServer: Handle global cursor tracking before ongoing drag/move/resize
In the case of an ongoing window drag/move/resize action
WindowManager::process_mouse_event() would return early, even before
delivering mouse events to windows with global cursor tracking enabled.
They would only continue to receive new mouse events once those actions
were completed.

Fixes #3116.
2020-08-13 15:54:17 +02:00
Ben Wiederhake
3ec7b8b33c Services: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Tom
8ffa4131ce WindowServer: Limit maximizing windows to top window in modal stack
When maximizing a window that is blocked by a modal window, only
maximize the top window in the stack. However, if the stack is
minimized, restore all of them in addition.

Fixes #3074
2020-08-10 21:02:11 +02:00
Andreas Kling
ecc8a42cd2 WindowServer: Use to_theme_window_type() a bit more 2020-08-10 13:05:02 +02:00
Andreas Kling
de1a54c378 WindowServer+LibGfx: Move window frame rect calculation to WindowTheme 2020-08-10 13:03:44 +02:00
Andreas Kling
c81c8b68bb WindowServer+LibGfx: Move notification window frame painting to LibGfx
ClassicWindowTheme can now also paint notification window frames.
2020-08-09 19:34:56 +02:00
Andreas Kling
e7460b6fb4 WindowServer+LibGfx: Move normal window frame painting to a WindowTheme
This patch introduces the ClassicWindowTheme, which is our default
theme implemented as a Gfx::WindowTheme subclass.

In this initial cut, we move normal window frame painting and title
bar metrics helpers out of WindowServer and into LibGfx.

This will eventually allow us much greater flexibility with theming
windows, and also makes it easier to build applications that want to
render a window with a specific style for some reason. :^)
2020-08-09 19:29:15 +02:00
Brian Gianforcaro
bcb4cb4543 AudioServer: Lock the process veil after startup
We can't do any file syscalls anyway because of the reduction of pledges,
so we might as well lock the veil anyway.
2020-08-07 09:10:14 +02:00
Nico Weber
ce95628b7f Unicode: Try s/codepoint/code_point/g again
This time, without trailing 's'. Ran:

    git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05 22:33:42 +02:00
Nico Weber
19ac1f6368 Revert "Unicode: s/codepoint/code_point/g"
This reverts commit ea9ac3155d.
It replaced "codepoint" with "code_points", not "code_point".
2020-08-05 22:33:42 +02:00
Andreas Kling
cb1fcd3eaf LaunchServer: Disown child processes after spawning 2020-08-04 18:17:16 +02:00
Andreas Kling
6e1cb2bae8 SystemMenu: Disown child processes after spawning 2020-08-04 18:17:16 +02:00
Andreas Kling
edefcc7f3a Taskbar: Disown quick-launched programs 2020-08-04 18:17:16 +02:00
Andreas Kling
7219f069a5 SystemMenu: Disown spawned programs 2020-08-04 18:17:16 +02:00
Andreas Kling
6e221adade LibWeb: Send key events to the WebContent process
This makes contenteditable work in multi-process mode. :^)
2020-08-03 19:58:59 +02:00
Andreas Kling
ea9ac3155d Unicode: s/codepoint/code_point/g
Unicode calls them "code points" so let's follow their style.
2020-08-03 19:06:41 +02:00
Tom
ad48bd1aca WindowServer: Bring window stack to front when clicking on frame
When clicking on a window's frame that is blocked by a modal
window, we want to bring the entire window stack to the front
regardless of where the user clicked in the frame (not just the
icon).
2020-08-03 18:34:39 +02:00
AnotherTest
97256ad977 ProtocolServer+LibTLS: Pipe certificate requests from LibTLS to clients
This makes gemini.circumlunar.space (and some more gemini pages) work
again :^)
2020-08-02 18:57:51 +02:00
Ben Wiederhake
597b0c9efd WindowServer: Redraw MenuApplets on add/delete 2020-08-02 11:00:50 +02:00
Nico Weber
6dd10ad8dc Themes: Fix default theme window stripes and shadow after #2811
Change #2811 made window title stripes and window title shadow themable,
but it used the same stripe and shadow color for all window modes.
This is fine for the new 'basalt' theme which uses the same color
in all four window modes, but it changed the default theme so that
background windows had brown stripes and a brown shadow.

Instead, make the title stripe and title shadow themable per window mode,
and change the default theme to restore the colors it had before
change #2811: The title stripe color is the same as Border1 for all
window modes, and the title shadow is the same as the title stripe
darkened by 0.6.
2020-08-01 19:26:54 +02:00
Peter Elliott
5ae9eee4a3 LibGUI+WindowServer: Provide default placement to windows
This prevents windows from being opened directly on top of eachother,
and provides default behavior for when window position is not specified.

The new behavior is as follows:
- Windows that have been created without a set position are assigned one
  by WindowServer.
- The assigned position is either offset from the last window that is
  still in an assigned position, or a default position if no such window
  is available.
2020-08-01 08:06:48 +02:00
thankyouverycool
c815fa7f47 Services: Convert WindowFrame button bitmaps to themable PNGs
Custom buttons can now be set using TitleButtonIcons under the
Paths group in themes. WindowFrame recognizes window-close.png,
window-minimize.png, window-maximize.png and window-restore.png
filenames.
2020-08-01 07:56:48 +02:00
Andreas Kling
ef711f501e LibWeb: Move the Page/Frame/EventHandler classes into Page/ 2020-07-28 19:28:29 +02:00
Ben Wiederhake
58dd9f2d2a SystemMenu: Add 'Themes' icon 2020-07-28 16:29:44 +02:00
Ben Wiederhake
a9d30a59d9 SystemMenu: Add icons for categories 2020-07-28 16:29:44 +02:00
Ben Wiederhake
404981a892 SystemMenu: Untangle app/category discovery and GUI building
I was a bit confused by the fact that a method named `build_system_menu()`
first enumerates a directory. Moving the app/category discovery to a dedicated
function that returns the GUI-relevant information makes this process a bit
less surprising.

As an added bonus, `g_app_category_menus` was actually only a temporary mapping,
and didn't need to be global. In theory, SystemMenu should use a handful fewer
of bytes now.
2020-07-28 16:29:44 +02:00
Ben Wiederhake
e8ed7f829e SystemMenu: Add icon to 'Exit' menu item 2020-07-28 16:29:44 +02:00
Andreas Kling
33d2ecdd79 WebServer: Show icons in directory listings :^)
Just adding some basic folder/file icon makes a big difference here.
2020-07-27 22:39:01 +02:00
Andreas Kling
7f70a6f0cb WebServer: Try to send an appopriate Content-Type header
Use Core::guess_mime_type_based_on_filename() for this. It's obviously
not perfect, but it works better than just sending "text/html" for
everything no matter what. :^)
2020-07-27 19:57:20 +02:00
Andreas Kling
5c7d54d50d WebServer: Use table tags in directory listings
Use tables to align stuff instead of putting everything in a <pre>.
2020-07-27 19:57:20 +02:00
Andreas Kling
efa117f801 WebServer: Use urlencode() in directory listings 2020-07-27 19:57:20 +02:00
thankyouverycool
c50f258b7a LibGUI+WindowServer: Allow applets to retrieve their location
MenuApplet windows can now call rect_in_menubar to return their
location in the MenuBar.
2020-07-26 11:32:12 +02:00
thankyouverycool
030f4150b8 WindowServer: Adjust MenuApplet position on resize
Applet rects are now recalculated when changed.
2020-07-26 11:32:12 +02:00
Andreas Kling
0d3d22f464 WindowServer: Use WindowManager::window_title_font() in one place
If we use this everywhere, it may one day become possible to change the
window title font.
2020-07-25 13:45:52 +02:00
Andreas Kling
0aef87b82c WindowServer: Center the window titlebar icons vertically
This feels a bit tricksy, but at least makes window icons look much
better with the "Basalt" theme. :^)
2020-07-25 13:43:56 +02:00
Andreas Kling
e2f45a4b0e WindowServer: Relayout window buttons immediately on theme change 2020-07-25 13:35:16 +02:00
Andreas Kling
299824de73 LibGUI: Rename GUI::Image => GUI::ImageWidget
"Image" was a bit too vague, "ImageWidget" is obviously a widget of
some sort.
2020-07-23 17:31:08 +02:00
Benoît Lormeau
60a7187db2 AudioServer: Give the AudioClient a way to keep track of the main mix volume 2020-07-21 19:02:25 +02:00
Nico Weber
a98d960ad4 Taskbar: Use Name from .af file as tooltip
With this, System Monitor has "System Monitor" instead of
"SystemMonitor" as tooltip, matching the app's title bar
and menu bar title.

Same for File Manager and Text Editor.
2020-07-18 15:51:46 +02:00
Andreas Kling
82c38f6fdf WindowServer: Decide on a window title before measuring its width
If we add "(Not responding)" to the title of an unresponsive window,
the title rect needs to be wider or we'll have text-on-stripes.

Thanks to @SharpOB for reporting this bug!
2020-07-18 01:50:24 +02:00
Nullspeak
51b2b0d5e5 WindowServer: New title bar vars for themes
The theming system can now control title bar height, title button
size, title stripe color and the title text shadow color.
The implemented theme metrics system could be later extended to LibGUI
to allow themes to change widget padding, border width, etc.
2020-07-17 23:19:08 +02:00
Tom
f591157eb8 WindowServer: Fix picking new active window after destroy
We need to mark windows as destroyed and not consider them
when picking a new active window. Fixes lost focus after
closing some windows.
2020-07-16 19:47:11 +02:00
Tom
603c17262c WindowServer: Fix traversing modal stack
When walking the modal window stack upwards, we need to check if
the top modal window is still a descendant of the window that
the parent is blocked by. Fixes not all windows being brought to
the front when trying to active a parent in the middle of the
modal window stack.
2020-07-16 19:47:11 +02:00
Tom
d87f876946 WindowServer: Fix crash when no active input window is set 2020-07-16 16:10:21 +02:00
Tom
a269e3e573 Taskbar: Don't create buttons for modal windows
Since the user can't really do much with windows that are blocked
by a modal window, there is no point in showing multiple buttons.
2020-07-16 16:10:21 +02:00
Tom
bbdf0665fc WindowServer: Expose window parent information and more modal improvements
* The parent information is necessary by the Taskbar to be able to
  determine a modal window's parent
* Minimize and maximize modal window stacks together
2020-07-16 16:10:21 +02:00
Tom
862ab82c19 WindowServer: Fixes for modal windows
This fixes a few problems with modal windows:

* If any child window, or any child window further down the
  tree is considered modal, then all windows in that chain
  are modal.
* When trying to activate a window blocked by a modal child
  bring the entire stack of modal windows to the front and
  activate the modal window.
* A window is modal if it has a parent and it's flagged as
  modal, regardless of whether the ClientConnection has
  created modal windows.

This technically supports diverging modal window trees as well,
where two modal windows share the same parent, allowing both to
be activated (including for input) but not the parent. And it
should also support modal window stacks of arbitrary depth.
2020-07-16 00:08:01 +02:00
Tom
d7c87e84f3 WindowServer: Don't make window active by hovering over the icon 2020-07-15 22:03:28 +02:00
Tom
8286e72187 WindowServer: Make Menus the input window when showing them
This solves a problem where windows don't receive a WindowInputLeft
event when popup menus are opened. This prevented ComboBox being
closed when right clicking the application on the task bar.
2020-07-15 22:02:53 +02:00
Tom
ec3737510d WindowServer: Add accessory windows
Accessory windows are windows that, when activated, will activate
their parent and bring all other accessory windows of that parent
to the front of the window stack. Accessory windows can only be
active input windows. The accessory window's parent is always the
active window regardless of whether it is also the active input
window.

In order to route input correctly, input is now sent to the active
input window, which can be any accessory window or their parent,
or any regular window.
2020-07-15 17:15:45 +02:00
Tom
7739497e34 FileManager: Allow double-clicking applications again
By adding a special LauncherType::Application we can still
get meta data for the application, but also know that we should
consider executing that binary as the default action. LaunchServer
will not do this for us, as it should probably not be allowed to
run arbitrary binaries that haven't been registered as handlers.
2020-07-15 00:11:30 +02:00
Tom
535113bac4 Launcher: Provide launcher details to LibDesktop
This allows applications to get additional information,
such as name or icons, for each launch handler.
2020-07-15 00:11:30 +02:00
Tom
1c1ab71692 WindowServer/LibGUI: Add default menu items and allow default action for context menu
By specifying an optional Action for Menu::popup an application
can specify what item should be displayed as a default item.
2020-07-11 11:45:49 +02:00
Tom
fc4e01a3c9 WindowServer: Add support for default MenuItem
This allows marking a MenuItem as a default action, e.g. in a
context menu for an action that reflects what e.g. a double click
would perform.

Also enhance the window menu to mark the close action as the
default, and when double clicked perform that action.

Fixes #1289
2020-07-11 11:45:49 +02:00
AnotherTest
684b04e02a WebServer: Allow the user to specify the base directory
This commit makes the WebServer accept a base path to serve.
This makes taking files out of the system significantly more simple
(depending on whom you ask).
2020-07-11 11:36:12 +02:00
Linus Groh
ec5845212d WindowServer: Apply the "wait" cursor to unresponsive windows 2020-07-07 23:11:39 +02:00
Linus Groh
899dcba158 WindowServer+LibGUI: Add "wait" cursor 2020-07-07 23:11:39 +02:00
Linus Groh
b8a8e417f1 WindowServer+LibGUI: Add "help" cursor 2020-07-07 23:11:39 +02:00
Linus Groh
62866208ee WindowServer+LibGUI: Add "resize row/column" cursors 2020-07-07 23:11:39 +02:00
Andreas Kling
787673b743 WindowServer: Turn an assertion that happens sometimes into a dbg()
It's very annoying to crash the WindowServer when something harmless
is a little weird.
2020-07-07 17:10:12 +02:00
Andreas Kling
7527b9ee72 WindowServer: set_active_window() should not assume window has a client
I saw this assertion fire once and I don't know how I made it happen,
but it seems fine for client-less windows to become active, they just
don't have a menubar to install.
2020-07-07 17:10:12 +02:00
Andreas Kling
92374fc942 LibWeb: Make context menus work in WebContentView
As usual, this was just a matter of plumbing the PageClient calls from
the WebContent side over to the WebContentView side. :^)
2020-07-07 12:24:29 +02:00
Andreas Kling
9169c8ca94 LibWeb: Make the WebContentView::on_load_start hook actually work :^) 2020-07-06 21:58:16 +02:00
Andreas Kling
32243e1df2 WebContent: Plumb link clicks to the WebContentView :^)
You can now react to links being clicked via the on_link_click hook.
2020-07-06 20:02:30 +02:00
Andreas Kling
6f059ee830 ProtocolServer: Turn this into a multi-instance service
Everyone who connects to ProtocolServer now gets his own instance.
This means that different users can no longer talk to the same exact
ProtocolServer process, enhanching security and stability.
2020-07-06 13:30:11 +02:00
Andreas Kling
a122a544da WebContent: Shut down WebContent process when last client disconnects
Note that there is only ever one client.
2020-07-06 13:30:11 +02:00
Andreas Kling
94ddb07e58 LibIPC+Services: Make ClientConnection take socket as NonnullRefPtr
This avoids getting into the awkward situation where the socket is
still part-owned by main() in multi-instance service. Also it just
reads nicer.
2020-07-06 13:30:11 +02:00
Andreas Kling
58b1ba2545 WebContent: Plumb hovered links from WebContent process over to widget
Also add a little GUI::StatusBar to the demo app so we can see the
hovered link URL's live. :^)
2020-07-05 16:59:20 +02:00
Andreas Kling
aac362b883 WebContent: Put some debug spam behind an #ifdef
This makes resizing the window a little less obnoxious. :^)
2020-07-05 16:49:40 +02:00
Andreas Kling
668fe61b1d WebContent: Coalesce pending paint events to reduce overdraw
Instead of painting synchronously whenever a Paint request comes in,
the WebContent process will now buffer pending paints and coalesce
them and defer the actual paint using a zero-timer.

This significantly reduces flickering already, without doing any
double-buffering in the WebContentView widget.
2020-07-05 16:26:15 +02:00
Andreas Kling
131bc8fd31 WebContent: Plumb scroll-into-view requests from server to client
The WebContentView widget will now be able to react to scroll-into-view
requests from the WebContent process.
2020-07-05 15:57:07 +02:00
Andreas Kling
c15f9e7593 WebContent: Plumb title changes over to the WebContentView
WebContentView now fires its on_title_change hook, like Web::PageView.
We use this in the WebView test app to update the window title. :^)
2020-07-04 23:40:17 +02:00
Andreas Kling
7cb7bcb924 WebContent: Illustrate multi- vs single-process diffs in documentation 2020-07-04 23:34:12 +02:00
Andreas Kling
e91871aed7 WebContent: Basic scrolling support! :^)
The WebContentView widget now inherits from GUI::ScrollableWidget and
will pass its scroll offset over to the WebContent process as it's
changing. This is not super efficient and can get a bit laggy, but it
will do fine as an initial scrolling implementation.

Just like the single-process Web::PageView widget, WebContentView also
paints scrolled content by translating the Gfx::Painter.
2020-07-04 23:19:32 +02:00
Andreas Kling
ada3c9ca46 WebContent: Put some debug spam behind an #ifdef 2020-07-04 23:19:12 +02:00
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