Commit Graph

432 Commits

Author SHA1 Message Date
Conor Byrne
68d1469aea Taskbar: Show start menu when super key is pressed
This commit re-adds the functionality of the start menu appearing when
the super key is pressed
2021-04-19 20:03:25 +02:00
Conor Byrne
88ecfa164a LibGUI+WindowServer: Add WM_SuperKeyPressed event
This commit adds an event called WM_SuperKeyPressed which is sent to all
windows via WindowManagerServerConnection.
The event is fired from WindowManager when the super key is pressed,
which is the windows key on most keyboards :)
2021-04-19 20:03:25 +02:00
Maciej Zygmanowski
136f6fb7c8 WindowServer: Use VERIFY instead of assert in scale factor check 2021-04-19 17:30:07 +02:00
Linus Groh
8d490aba76 LibJS: Implement console.assert() 2021-04-18 18:28:17 +02:00
Linus Groh
e37421bddc Browser+WebContent: Fix HTML injection in console functions output 2021-04-18 18:28:17 +02:00
Andreas Kling
12546259ff Everywhere: Rename title_bar => titlebar 2021-04-18 16:35:18 +02:00
Andreas Kling
b937ebd121 WindowServer: Make MenuItemActivated IPC message pass identifier as u32
This is consistent with the actual storage type.
2021-04-17 22:26:58 +02:00
Andreas Kling
ec6debb46f WindowServer: Don't "enter" menu item when hovering over a separator
Since menu separator items don't have an associated identifier,
make sure we don't falsely report that we've enter item 0.

This fixes an issue where hovering over a separator would behave
as if we'd hovered over the first item in the menu wrt sending
MenuItemEntered.
2021-04-17 20:49:53 +02:00
Andreas Kling
ba7e1ca2fb WindowServer+LibGUI: Notify GUI clients about menu item enter/leave
We now send out MenuItemEntered and MenuItemLeft messages to the client
when the user hovers/unhovers menu items.

On the client side, these become GUI::ActionEvent, with one of two
types: ActionEnter or ActionLeave. They are sent to the Application.

This will allow GUI applications to react to these events.
2021-04-17 20:49:53 +02:00
Georgiy Komarov
f8c2beec7c
DHCPClient: Fix undefined behaviour when calling memcpy() (#6416)
Calling memcpy with null pointers results in undefined behaviour, even
if count is zero.

This in turns is exploited by GCC. For example, the following code:
    memcpy (dst, src, n);
    if (!src)
      return;
    src[0] = 0xcafe;
will be optimized as:
    memcpy (dst, src, n);
    src[0] = 0xcafe;
IOW the test for NULL is gone.
2021-04-17 20:49:22 +02:00
sin-ack
c8ef8d2db5 Taskbar: Use WM connection for window management operations
Since WM operations are moved to a separate endpoint pair, Taskbar now
uses those to perform window management related operations.
Additionally, it now explicitly declares to WindowServer that it is a
window manager.
2021-04-17 13:06:25 +02:00
sin-ack
aa56f9a1e0 LibGUI+WindowServer: Separate window manager IPC from regular IPC
With this patch the window manager related functionality is split out
onto a new endpoint pair named WindowManagerServer/Client.  This allows
window manager functionality to be potentially privilege separated in
the future.  To this end, a new client named WMConnectionClient
is used to maintain a window manager connection.  When a process
connects to the endpoint and greets the WindowServer as a window manager
(via Window::make_window_manager(int)), they're subscribed to the events
they requested via the WM event mask.

This patch also removes the hardcoding of the Taskbar WindowType to
receive WM events automatically.  However, being a window manager still
requires having an active window, at the moment.
2021-04-17 13:06:25 +02:00
Linus Groh
ba3bc6fef2 LibGUI+WindowServer: Fix some misaligned CMakeLists.txt SOURCES entries 2021-04-16 21:30:53 +02:00
Timothy Flynn
2381b19719 Browser+LibWeb+WebContent: Parse cookies in the OOP tab
To protect the main Browser process against nefarious cookies, parse the
cookies out-of-process and then send the parsed result over IPC to the
main process. This way, if the cookie parser blows up, only that tab
will be affected.
2021-04-16 19:19:31 +02:00
Nicholas-Baron
73dd293ec4 Everywhere: Add -Wdouble-promotion warning
This warning informs of float-to-double conversions. The best solution
seems to be to do math *either* in 32-bit *or* in 64-bit, and only to
cross over when absolutely necessary.
2021-04-16 19:01:54 +02:00
Linus Groh
e632186c17 WindowServer: Recalculate window rect when toggling menubar
This is important when the window is maximized or tiled (which
recalculate_rect() will both check), as we otherwise create a gap above
the window frame (when hiding the menubar) or push the frame off the
screen (when showing the menubar).
2021-04-16 17:28:05 +02:00
Linus Groh
0aebb9ec62 WindowServer: Replace window menu action magic numbers with enum
This makes it a lot easier to find where the action handling is
happening, just 1, 2, 3, 4 isn't very discoverable. :^)
2021-04-16 17:27:54 +02:00
sin-ack
5b95850e28 SystemServer+LibCore: Allow service to request multiple sockets
SystemServer only allowed a single socket to be created for a service
before this.  Now, SystemServer will allow any amount of sockets.  The
sockets can be defined like so:

[SomeService]
Socket=/tmp/portal/socket1,/tmp/portal/socket2,/tmp/portal/socket3
SocketPermissions=660,600

The last item in SocketPermissions is applied to the remainder of the
sockets in the Socket= line, so multiple sockets can have the same
permissions without having to repeat them.

Defining multiple sockets is not allowed for socket-activated services
at the moment, and wouldn't make much sense anyway.

This patch also makes socket takeovers more robust by removing the
assumption that the socket will always be passed in fd 3.  Now, the
SOCKET_TAKEOVER environment variable carries information about which
endpoint corresponds to which socket, like so:

SOCKET_TAKEOVER=/tmp/portal/socket1:3 /tmp/portal/socket2:4

and LocalServer/LocalService will parse this automatically and select
the correct one.  The old behavior of getting the default socket is
preserved so long as the service only requests a single socket in
SystemServer.ini.
2021-04-15 21:04:49 +02:00
Andreas Kling
b75d2d36e1 WindowServer: Clean up some of the code around menu item hovering
We were writing to the currently hovered menu item index in a bunch
of places, which made it very confusing to follow how it changes.

Rename Menu::set_hovered_item() to set_hovered_index() and use it
in more places instead of manipulating m_hovered_item_index.
2021-04-15 20:50:24 +02:00
Tom
d10b95622b WindowServer: Fix window shadow rendering glitch
Some small window shadows were missing a small section of the top/bottom
and/or left/right center shadow.
2021-04-15 10:22:04 +02:00
Idan Horowitz
bc9cd55da4 Browser+LibWeb: Add support for spoofing the browser user agent
This is helpful when testing certain sites like twitter.com which
display differently based on the user agent.
2021-04-14 23:06:32 +02:00
Timothy Flynn
c00760c5f9 Browser+LibWeb+WebContent: Track the source of document.cookie requests
To implement the HttpOnly attribute, the CookieJar needs to know where a
request originated from. Namely, it needs to distinguish between HTTP /
non-HTTP (i.e. JavaScript) requests. When the HttpOnly attribute is set,
requests from JavaScript are to be blocked.
2021-04-14 16:07:46 +02:00
Andreas Kling
a2baab38fd Everywhere: It's now "Foobar", not "FooBar", and not "foo bar"
I hereby declare these to be full nouns that we don't split,
neither by space, nor by underscore:

- Breadcrumbbar
- Coolbar
- Menubar
- Progressbar
- Scrollbar
- Statusbar
- Taskbar
- Toolbar

This patch makes everything consistent by replacing every other variant
of these with the proper one. :^)
2021-04-13 16:58:15 +02:00
Andreas Kling
bf1ef6533c FileManager+FileOperation: Show byte progress of current file
What I meant for the GUI progress bars to show:

- Bytes copied of the current file
- Files copied of the total set

What it actually showed:

- Bytes copied of the total bytes
- Files copied of the total set

This patch fixes it by showing byte progress of the current file
instead of byte progress of total bytes.
2021-04-13 10:12:50 +02:00
Andreas Kling
4205038c45 FileOperation: Add a new helper program for out-of-process file ops
This is a helper program for FileManager that performs a file operation
in a separate process and reports progress on standard out.

This initial implementation only supports the "Copy" operation and does
not do any detailed error handling.
2021-04-13 10:12:50 +02:00
Valtteri Koskivuori
d5e1250061 WindowServer: Fix notification placement
No more top bar, no more extra padding. Spacing is equal on the top and
on the left, so it looks pretty tidy.
2021-04-12 18:11:43 +02:00
Andreas Kling
767bd8cc88 WindowServer: Strip Alt-shortcut marker ('&') when measuring menu texts
We were including these markers when computing the sizes of menus,
causing them to get a little too much padding.
2021-04-12 15:24:17 +02:00
Linus Groh
da177c6517 LibJS: Make Errors fully spec compliant
The previous handling of the name and message properties specifically
was breaking websites that created their own error types and relied on
the error prototype working correctly - not assuming an JS::Error this
object, that is.

The way it works now, and it is supposed to work, is:

- Error.prototype.name and Error.prototype.message just have initial
  string values and are no longer getters/setters
- When constructing an error with a message, we create a regular
  property on the newly created object, so a lookup of the message
  property will either get it from the object directly or go though the
  prototype chain
- Internal m_name/m_message properties are no longer needed and removed

This makes printing errors slightly more complicated, as we can no
longer rely on the (safe) internal properties, and cannot trust a
property lookup either - get_without_side_effects() is used to solve
this, it's not perfect but something we can revisit later.

I did some refactoring along the way, there was some really old stuff in
there - accessing vm.call_frame().arguments[0] is not something we (have
to) do anymore :^)

Fixes #6245.
2021-04-12 09:38:57 +02:00
Timothy Flynn
1ef48d50ff LibWeb+WebContent: Hook document.cookie to the backend cookie storage 2021-04-11 18:24:34 +02:00
Andreas Kling
54cd8dfc4d LibWeb+WebContent: Support image context menus in OOPWV
You can now right-click images in web content and get a context menu.
2021-04-11 16:49:25 +02:00
Gunnar Beutner
8ca5b8c065 LibC: Move S_* defines into <fcntl.h>
According to the Single UNIX Specification, Version 2 that's where
those macros should be defined. This fixes the libiconv port.

This also fixes some (but not all) build errors for the diffutils and nano ports.
2021-04-11 09:51:20 +02:00
Andreas Kling
19fb62dd15 WindowServer: Alt shortcuts and book title capitalization in menus
Specifically, in window menus. :^)
2021-04-10 10:29:42 +02:00
Andreas Kling
2bac9eb79d WindowServer: Cache internal Alt shortcuts on the Menu object
This way we don't have to recompute the set of shortcut keys every
time we're handling an in-menu keydown event.
2021-04-09 17:08:49 +02:00
Andreas Kling
0fc2651303 WindowServer: Support Alt shortcuts inside menus as well
Menu items can now also have Alt shortcut, and they work the same way
top-level menu Alt shortcuts do. This replaces the previous "type to
search" mechanism we had in menus.
2021-04-09 17:08:49 +02:00
Andreas Kling
2b9bc605d2 LibGfx: Add a Gfx::TextAlignment parameter to Painter::draw_ui_text() 2021-04-09 17:08:49 +02:00
Andreas Kling
b7a25bfaac LibGfx: Adjust parameter order for Painter::draw_ui_text()
Let's put the rect first so it's the same as draw_text().
2021-04-09 17:08:49 +02:00
AnotherTest
c6607719d2 DHCPClient: Retry DISCOVER for interfaces that fail
Attempts are spaced out with exponential backoff, cut at 10 minutes per
attempt.
Also avoid trying to acquire an IP on interfaces that aren't up.
Fixes #6126.
Fixes #6125.
2021-04-06 08:38:44 +02:00
Andreas Kling
1f4dc670d4 WindowServer: Select first item when opening a menu via Alt shortcut
To make keyboard navigation a little nicer, select the first/top menu
item right away.
2021-04-05 23:15:43 +02:00
Andreas Kling
d80fb6d9c0 WindowServer: Support Alt+Character menu shortcuts :^)
This patch adds support for opening menus via keyboard shortcuts.
Use an ampersand in a menu name to automatically create a keyboard
shortcut (Alt + the character following the ampersand.)

Menus with an Alt shortcut have a small underline under the shortcut
character for discoverability.
2021-04-05 23:15:43 +02:00
Andreas Kling
1c57bf9094 Taskbar: Use GUI::Button::set_menu() for the start menu button :^) 2021-04-05 18:09:04 +02:00
Andreas Kling
9b740f218b WindowServer+LibGUI: Notify clients when menus become visible/hidden
This will allow clients to react to these events.
2021-04-05 18:09:04 +02:00
Linus Groh
23b659e9c3 WindowServer: Exclude WindowType::Desktop windows from Super key actions
The desktop window is (and must be) considered resizable by
WindowServer, but none of the Super+<something> key actions should apply
to it (window minimizing/maximizing/tiling).

Fixes #5363.
2021-04-05 17:06:58 +02:00
Dawid Wolosowicz
f7184e967e WindowServer: Make applet area use the same color role as the taskbar
So far the taskbar has been using the "Button" as a color role, despite
rest of the applet area using "Window" color role. Although it all
looked alright on most system themes, it broke for the Nord theme.
2021-04-05 14:30:35 +02:00
Idan Horowitz
e8d2d73d55 DHCPClient: Store current IP address instead of relaying on the yiaddr
Real DHCP servers might decide to send the DHCPAck directly to the
specified ciaddr instead of as a unicast or multicast, resulting in
the ack being ignored by the network adapter when we are requesting
a new IPv4 address instead of renewing an existing lease, as the
yiaddr (and as a result the ciaddr) is set to the offered address in
that case instead of the current ip address.
2021-04-04 22:38:27 +02:00
Idan Horowitz
6b360834f2 DHCPClient: Dont set DHCPOption::ServerIdentifier on DHCPRequest
Some real DHCP servers dont set the siaddr field in the DHCPOffer to
their IPv4 (and instead leave it blank - 0.0.0.0), which results in
the server assuming the DHCPRequest is not directed at him when it
has the ServerIdentifier option attached that specifies 0.0.0.0 as
the targeted server. So instead we just omit the option and let the
DHCP servers decipher the target themselves based on the requested IP.
2021-04-04 22:38:27 +02:00
Idan Horowitz
47fa8d83bb DHCPClient: Parse MacAddress parts using StringUtils
The current parsing code assumed the ascii lowercase letters came after
the ascii numbers, which is not the case, and as such corrupted any mac
address that included hex letters (a-f). We likely did not notice this
as QEMU's emulated MAC is made up of only hex digits.
2021-04-04 21:22:25 +02:00
Dawid Wolosowicz
863bc35399 WindowServer: Propagate theme change to the applet area
Fixes: #6056
2021-04-04 20:52:39 +02:00
Dawid Wolosowicz
182f9582d2 WindowServer: Use non-translated rect to fill the applet area's store
Fixes #6061
2021-04-04 20:52:39 +02:00
Andreas Kling
0069020e6c WindowServer+LibGUI: Rename WindowType::MenuApplet => Applet 2021-04-04 17:55:50 +02:00
Linus Groh
e8739ddab7 LibWeb+WebContent: Keep track of screen rect
It is now possible to get the up-to-date screen rect from a Web::Page.
2021-04-04 00:37:54 +02:00
Linus Groh
96b26ec125 Everywhere: Replace uses of GUI::Desktop's on_rect_change and remove it 2021-04-04 00:37:54 +02:00
Andreas Kling
22d13d8b1a Taskbar: Tweak taskbar widget margins
Basically, nudge everything down 1 pixel.
2021-04-02 23:33:17 +02:00
thankyouverycool
14e074cd24 LibGUI+Calendar: Inherit from Frame class
Fixes incorrect painting with variable thickness and cuts down
on some layout boilerplate.
2021-04-02 22:23:21 +02:00
Daniël van de Burgt
a106f852d3
WindowServer+MouseSettings: Add ability to configure double-click speed (#5876)
This adds a double-click speed slider control to the Mouse Settings
panel, and value labels for both the movement speed and double-click
speed sliders.

To allow for updating and persisting the configured double-click
speed through the WindowServer, two IPC calls - `SetDoubleClickSpeed`
and `GetDoubleClickSpeed` - have been added.
2021-04-02 16:08:18 +02:00
Andreas Kling
3e3d196f06 WindowServer: Un-nest MenuManager::handle_mouse_event() a bit 2021-04-02 10:54:50 +02:00
Andreas Kling
ea34ba6fa6 WindowServer+LibGfx: Rename menu_bar => menubar
We had a mix of "menu_bar" and "menubar". Let's just use "menubar"
everywhere since that feels the most natural to write.
2021-03-31 23:38:26 +02:00
Andreas Kling
0e798234c7 WindowServer+LibGfx: Remove code for drawing the old-style menu bar 2021-03-31 23:38:26 +02:00
Andreas Kling
2231205863 Taskbar: Reposition the applet area when the desktop rect changes 2021-03-30 23:43:24 +02:00
Andreas Kling
0cd60a28ba WindowServer+LibGUI: Plumb mouse/enter/leave events to applet windows
Since applet windows live in the applet area window, the AppletManager
has to keep track of which applet is hovered and send the appropriate
enter/leave events to the applet windows.

This makes applet tooltips work again. :^)
2021-03-30 23:43:24 +02:00
Andreas Kling
9bbc1c9c93 WindowServer+Taskbar: Show applets in taskbar :^)
WindowServer now collects applet windows into an "applet area" which is
really just a window that a WM (window management) client can position
via IPC.

This is rather hackish, and I think we should come up with a better
architecture eventually, but this brings back the missing applets since
the global menu where they used to live is gone.
2021-03-30 23:43:24 +02:00
Timothy Flynn
5b617df496 LibWeb+WebContent: Support displaying tooltips in OOPWV 2021-03-30 21:21:17 +02:00
Andreas Kling
6d913db9fe WindowServer: Install WindowServer headers
This is a bit clunky since we really only need WindowType.h and don't
really want to consider any other headers "public" but this is just
to make the SDL port build again now that LibGUI includes WindowType.h
from WindowServer.

Long term we should probably figure out a way to only install "API"
headers from libraries.
2021-03-30 20:20:32 +02:00
thankyouverycool
d90d07ba52 Taskbar: Update ClockWidget to Calendar view changes
And give it a nice comfy spot in its new home.
2021-03-30 10:34:34 +02:00
Timothy Flynn
855920fe13 Browser+LibWeb+WebContent: Add action to clear resource cache 2021-03-30 10:27:49 +02:00
Andreas Kling
50a8e0e495 LibGUI+WindowServer: Keep canonical WindowType enum in WindowServer
Having the same enum in two places was annoying. Let's just "using"
the WindowServer::WindowType enum into the GUI namespace.
2021-03-29 22:39:18 +02:00
Andreas Kling
2036d7518a SystemServer: Call endgrent() after we're finished looking up groups 2021-03-29 20:44:41 +02:00
Idan Horowitz
13266e7d99 SystemServer: dynamically fetch device group IDs
Fixes a couple of FIXMEs that were complaining about the harcoded
group IDs.
2021-03-29 19:38:56 +02:00
Idan Horowitz
754f87875f SystemServer: chown all available TTY devices to the tty group
Since we have 6 TTYs available 2 of the 6 were not being chowned and as
such they were not available to the tty group.
2021-03-29 19:38:56 +02:00
Idan Horowitz
9f656b6fa9 LibCoreDump+CrashDaemon: Compress coredumps
Most coredumps contain large amounts of consecutive null bytes and as
such are a prime candidate for compression.

This commit makes CrashDaemon compress files once the kernel finishes
emitting them, as well as adds the functionality needed in LibCoreDump
to then parse them.
2021-03-28 20:42:33 +02:00
Tom
b8f462a78b WindowServer: Add menu item fade-out animation upon activation 2021-03-28 20:42:21 +02:00
Tom
7e9c265cc0 WindowManager: Allow disabling window hit testing altogether
This allows us to disable hit testing for transparent windows that
don't use alpha channels.
2021-03-28 20:42:21 +02:00
Andreas Kling
526b4bbfdb WindowServer: Add ability to show/hide window menubars
This patch adds a toggle item to the window menu that controls window
menubar visibility. This is available in all windows with a menu.
2021-03-28 13:40:40 +02:00
Andreas Kling
71a9a14c17 WindowServer: Make Window::event() protected 2021-03-28 11:25:57 +02:00
Andreas Kling
6f45c27d06 WindowServer: Don't call Core::Object::event() directly
To make sure event filters are respected, we should not be calling
event() directly, but rather dispatch_event().
2021-03-28 11:19:18 +02:00
Linus Groh
e288541a9b Taskbar: Set window title as taskbar button tooltip
This way it's easier to find the right window when many are open at the
same time, as all buttons share a limited amount of horizontal space and
titles get truncated quickly.
2021-03-27 16:28:21 +01:00
Linus Groh
2fde87e67d WindowServer: Also keep menus open when activated via Ctrl + return key
I see no reason to limit this awesome feature to mouse clicks. :^)
2021-03-27 11:33:41 +01:00
Cesar Torres
0198ecca21 AudioServer: don't set an upper limit on volume in mixer
Let's not limit volume so we can play clips at over 100% without
the need to process the audio samples twice.
2021-03-27 10:20:55 +01:00
Cesar Torres
0d5e1e9df1 Everywhere: rename 'Sample' type to 'Frame'
Because it's what it really is. A frame is composed of 1 or more samples, in
the case of SerenityOS 2 (stereo). This will make it less confusing for
future mantainability.
2021-03-27 10:20:55 +01:00
Andreas Kling
d9f8f6a2d0 WindowServer: Add an IPC call for taking a screenshot
This patch adds Messages::WindowServer::GetScreenBitmap. It returns the
currently displayed on-screen bitmap as-is, as a Gfx::ShareableBitmap.
2021-03-26 20:33:23 +01:00
Timothy Flynn
557927f25b LibWeb+WebContent: Support displaying favicons in OOPWV
In single process mode, the browser will display a page's favicon in
both the location bar and tab. This adds the same support for multi-
process mode.
2021-03-26 16:55:51 +01:00
Andreas Kling
ecb0ae9c33 WindowServer: Keep menu open when activating a menu item with Ctrl held
This makes it easy to "try out" different options (like system themes!)
in a menu without having to re-open the menu over and over. :^)
2021-03-26 14:45:15 +01:00
Andreas Kling
b31b904ad0 WindowServer: Redraw all menus on system theme change 2021-03-26 14:42:38 +01:00
Andreas Kling
4b6fba1e4c WindowServer+LibGfx: Make menubar menus slightly larger
Also make sure the left/right padding is equally large.
2021-03-26 14:25:37 +01:00
Andreas Kling
3020f5efd9 Taskbar: Add more prominent Help app icon in the start menu 2021-03-26 13:54:56 +01:00
Andreas Kling
b8a9f433f9 Taskbar: Move "About SerenityOS" to the top of the start menu 2021-03-26 13:31:10 +01:00
Linus Groh
b220c89c5c WindowServer: Adjust position of flipped submenus by menu item height
Fixes #5950.
2021-03-26 09:25:22 +01:00
Linus Groh
8461100bf7 WindowServer: Add clip rect to menubar painter
Fixes #5951.
2021-03-26 09:25:22 +01:00
Andreas Kling
6203a4a2e9 WindowServer: Remove unused Menu->MenuBar link and "title font"
We kept a backpointer from the Menu to its containing MenuBar, but it
was not used for anything so let's remove it.

Since all menus have the same font now, there's no need to track a
separate "title font".
2021-03-26 09:12:32 +01:00
Andreas Kling
dfb81242f3 WindowServer: Redraw window menubars when moving with arrow keys
Also, make sure we don't draw a menu in hovered state while another
menu is open.

Fixes #5949.
2021-03-26 08:59:32 +01:00
Andreas Kling
6ae174f80a WindowServer: Remove some leftover unused menubar things 2021-03-26 08:54:33 +01:00
Andreas Kling
baae3f706a Taskbar: Only show H:M:S by default, move date to tooltip 2021-03-25 23:32:00 +01:00
Andreas Kling
e9db10e3a9 WindowServer+LibGUI: Remove the global menubar :^)
This leaves menu applets running but invisible, and that's a regression
we need to take care of obviously. But not today, because it's getting
too late.
2021-03-25 23:27:11 +01:00
Andreas Kling
1108c41790 WindowServer: Don't fill the active menubar menu with selection color 2021-03-25 23:19:57 +01:00
Andreas Kling
327866520a WindowServer: Remove "system menu" concept from WindowServer 2021-03-25 23:08:34 +01:00
Andreas Kling
619a223800 SystemMenu: Remove SystemMenu service
This has been replaced by the Taskbar's start menu.
2021-03-25 23:08:29 +01:00
Andreas Kling
73a2045c5b Taskbar: Add start menu :^)
This will replace the system menu in the top left of the screen.
The button behavior doesn't feel quite perfect yet, but this will
work for now!
2021-03-25 22:55:10 +01:00
Andreas Kling
0668b5beef Taskbar: Integrate clock widget into taskbar window
Instead of running the clock widget as a separate menu applet,
let's just draw a clock here in the taskbar window.
2021-03-25 22:14:09 +01:00
Andreas Kling
fc84076f18 WindowServer: Remove SetApplicationMenubar IPC message 2021-03-25 22:14:09 +01:00
Andreas Kling
fcc8e3484f WindowServer: Remove the global app menu
The SetApplicationMenu IPC message is still there, since we also need
to clean up all of the client code before we can remove that.
2021-03-25 22:14:09 +01:00
Andreas Kling
05cc7d69ac WindowServer: Tweak the look of menus
Paint menus with a flatter outline instead of giving them the regular
window border.
2021-03-25 22:14:09 +01:00
Andreas Kling
e76771bfad WindowServer+LibGfx: Show menus in windows! :^)
This patch begins the transition away from the global menu towards
per-window menus instead.

The global menu looks neat, but has always felt clunky, and there
are a number of usability problems with it, especially in programs
with multiple windows.

You can now call GUI::Window::set_menubar() to add a menubar to
your window. It will be specific to that one window only.
2021-03-25 22:14:09 +01:00
Nick Johnson
9d09594e44 Notification: Remove default image
This takes up a lot of space if it is not used, and the default image
does not give value. Therefore, we hide the image widget if an invalid
image is passed.
2021-03-22 12:46:16 +01:00
Nick Johnson
e17752fc91 Notification: Use on_close
on_close_request is not called at any point if close is explicitly
called, so we must instead use on_close.
2021-03-22 12:46:16 +01:00
Nick Johnson
8f6894d250 LibGUI+Notification: Add mutable notifications
This commit puts all of the remaining pieces in place. This adds a
mechanism to update the text, title, and icon of an image. If an image
is not provided, the default ladybug will be shown.
2021-03-22 12:46:16 +01:00
Nick Johnson
0fd1e6f062 LibGUI+Notification: Add notification closing
Closing a notification will now allow it to be shown again, as
m_showing being false means it can be re-shown.
2021-03-22 12:46:16 +01:00
Nick Johnson
ef4144c183 Notification: Member-ize updatable components
Changes the necessary widgets to be pointers so we can later change
their underlying data.
2021-03-22 12:46:16 +01:00
Nick Johnson
f2814dd6c1 Notification: Allow getting window by ID
This is a neccessity so a connection can get the notification it is
connected to for later updates.
2021-03-22 12:46:16 +01:00
Nick Johnson
a437430294 Notification: Give a unique internal ID
This will allow us to later query the notifications from a connection
and safely update it without exposing it to any other applications, as
it is session based.
2021-03-22 12:46:16 +01:00
Jean-Baptiste Boric
ade6343fca Userland: Fix printf specifiers with off_t
In theory we should probably use the 'j' qualifier, but we don't
support it.
2021-03-17 23:22:42 +01:00
Andreas Kling
f59ad2dc57 Everywhere: Remove pessimizing and redundant move() 2021-03-17 16:30:15 +01:00
Andreas Kling
e0f32626bc LibGfx: Rename 32-bit BitmapFormats to BGRA8888 and BGRx888x
The previous names (RGBA32 and RGB32) were misleading since that's not
the actual byte order in memory. The new names reflect exactly how the
color values get laid out in bitmap data.
2021-03-16 11:50:03 +01:00
Elie Donadio
3a5a9a683f Apply suggestions from code review
Small adjustments, as suggested by linus.

Co-authored-by: Linus Groh <mail@linusgroh.de>
2021-03-15 16:08:31 +01:00
ElDonad
a0c0d781e8 LaunchServer: added additional file parameters
This small commit should allow to specify additionnal parameters in the
form of URL queries, when opening a file via a "file://" url through the
LaunchServer.
2021-03-15 16:08:31 +01:00
Andreas Kling
ef1e5db1d0 Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)
Good-bye LogStream. Long live AK::Format!
2021-03-12 17:29:37 +01:00
thankyouverycool
142ca4b818 WindowServer+LibGfx: Enumerate Disallow cursor 2021-03-12 09:59:03 +01:00
Andreas Kling
6e2a29d038 WindowServer: Don't open system menu on super key press while dragging 2021-03-11 19:00:24 +01:00
Andreas Kling
38f11cc1ba Everywhere: Rename "logo" key to "super" key
This seems to be the most common way to refer to this key, so let's
call it what people actually call it.
2021-03-11 18:55:16 +01:00
Emanuele Torre
1f81bc6879 Everywhere: Remove unnecessary whitespace at the end of some lines. 2021-03-08 09:20:53 +01:00
Andreas Kling
7f9f916470 LibWeb: Make tiled backgrounds scroll with content
Previously the page background was always draw relative to the viewport
instead of following with the content. This should eventually become
an opt-in mode (via CSS "background-attachment") but for now let's have
the default behavior be that backgrounds scroll with content.

Also take this opportunity to move the background painting code from
the two web views to a shared location in InitialContainingBlockBox.
2021-03-07 13:49:20 +01:00
speles
6c087480cf LaunchServer: Use new FileManager flags instead of two arguments 2021-03-07 11:00:36 +01:00
Brendan Coles
4ae3bfa40d WebServer: Serve X-Frame-Options and X-Content-Type-Options HTTP headers 2021-03-06 15:04:16 +01:00
speles
e97865e982 WebContent: Set correct scroll offset for PageHost painting 2021-03-06 14:54:12 +01:00
Tom
c73dfe5bf6 WindowServer: Mark screen dirty when changing highlighted window
Because the z-order changes we not only need to recompute occlusions
but we also need to mark the screen area of the previous and new
highlighted window as dirty.

Fixes #5599
2021-03-03 08:20:11 +01:00
Tom
87c1b1a25d WindowServer: Use active shadow for highlighted window
If we're switching through windows we should also use the active
shadow for the highlighted window.
2021-03-03 08:20:11 +01:00
Tom
c57d719d62 WindowServer: Prepare dirty rects if only the frame was invalidated 2021-03-03 08:20:11 +01:00
Angus Gibson
0e881bc5d7 LibWeb: Handle scrolling an OutOfProcessWebView
When a mousewheel scroll event isn't handled by the web content
itself (e.g. an overflowed box or similar), the event needs to get
passed back up to the OutOfProcessWebView.
2021-03-02 13:20:03 +01:00
speles
e964d238b8 FileManager+LaunchServer: Add launching FileManager with focus on file 2021-03-01 11:16:18 +01:00
speles
dff31d5885 LaunchServer: Make spawn() helper accept arguments list 2021-03-01 11:16:18 +01:00
Adam Hodgen
bedcd9cd88 LibWeb: Support setting the cursor in OutOfProcessWebView 2021-02-28 18:19:52 +01:00
Brandon Scott
51f073ff39 WebContent: Added IPC calls for initializing JS console and sending input 2021-02-28 15:30:17 +01:00
Linus Groh
e265054c12 Everywhere: Remove a bunch of redundant 'AK::' namespace prefixes
This is basically just for consistency, it's quite strange to see
multiple AK container types next to each other, some with and some
without the namespace prefix - we're 'using AK::Foo;' a lot and should
leverage that. :^)
2021-02-26 16:59:56 +01:00
AnotherTest
857cdee0d0 AK: Make dbgln_if() avoid evaluating the arguments when disabled
Naturally, this makes the `enabled` flag on dbgln() obsolete.
2021-02-24 13:07:28 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
Brandon Scott
306501fd4a WebContent: Added IPC calls for getting source 2021-02-23 16:23:56 +01:00
Andreas Kling
ded8c728d2 LibWeb: Plumb wheel events from widget layer to EventHandler 2021-02-22 21:46:54 +01:00
Tom
b4c0314f1d WindowServer: Don't close context menus when hovering over menu bar 2021-02-22 09:09:26 +01:00
Tom
35363a972a WindowServer: Reset menu position when opened by the menu bar
Also, only mark the menu bar item as opened if a menu was actually
opened through the menu bar.

These changes allow a menu to be used both in the menu bar as well
as a context menu.

Fixes #5469
2021-02-22 09:09:26 +01:00
Tom
2d29bfc89e WindowServer: Re-evaluate the mouse cursor when alpha hit-testing
A window repaint may change the alpha value, resulting in a different
hit test outcome. In those cases, re-evaluate the cursor hit testing
after a window was painted, and update the cursor if needed.
2021-02-21 22:34:00 +01:00
Andreas Kling
86a3363ddf DHCPClient: Actually randomize transaction ID's (XID)
We were using unseeded rand() for the XID, which meant that our DHCP
XID's were 100% predictable.

Switch to using AK::get_random<u32>() instead. :^)
2021-02-21 11:01:55 +01:00
Andreas Kling
e928022bb3 DHCPClient: Silence a debug message 2021-02-21 10:57:39 +01:00
Tom
7143a6026d Taskbar: Remove window button if a window state change demands it
We didn't add buttons for certain window types or states when the
window was created, but when a window with a button changed its
state to where we would not have created the button, we didn't
remove the existing button.
2021-02-21 10:33:28 +01:00
Tom
1c31bcb24e WindowServer: Allow changing frameless state after a window is created 2021-02-21 10:33:28 +01:00
Tom
101c6b01ed WindowServer: Improve small tooltips/windows shadows a bit
This fixes some artifacts with very small tooltip windows.
2021-02-20 22:28:11 +01:00
Linus Groh
5e07c27e25 LibWeb: Implement Window.prompt() 2021-02-20 12:19:46 +01:00
Sahan Fernando
e920c74cae WindowServer: Restore cursor when marking window as responsive 2021-02-19 20:30:25 +01:00
Tom
06ee8c5aa8 WindowServer: Ignore other button presses while moving/resizing windows
Fixes #5334
2021-02-18 07:45:44 +01:00
Tom
6af4d35e8e WindowServer: Apply the backing bitmap's scale when alpha hit-testing
Fixes #5390
2021-02-18 07:45:22 +01:00
Andreas Kling
c4438d6fd4 WindowServer: Unbreak "pick new active window" algorithm
We lost the ability to pick a suitable new active window when I added
the support for tool windows.
2021-02-17 16:52:08 +01:00
AnotherTest
cc889b3976 DHCPClient: Set ServerIdentifier and RequestedAddress in DHCP REQUESTs
Some dhcp servers require these to be there - otherwise, the ack gets
dropped somewhere.
2021-02-17 14:41:36 +01:00
AnotherTest
ce3b24723a DHCPClient: Set the client IP field of the DHCP DISCOVER message
This is the field that tells the DHCP server which IP we want, not
setting it is quite silly :P
2021-02-17 14:41:36 +01:00
AnotherTest
3440dbb1fc DHCPClient: Don't reject packets smaller than the max size
It's acceptable to have less padding in a packet, the only requirement
is to have a single byte of 'END' in the DHCP fields.
2021-02-17 14:41:36 +01:00
AnotherTest
c0703f48fe DHCPClient: Fix incorrect BOOTP Broadcast flag value
This is supposed to be the MSB, not the LSB.
2021-02-17 14:41:36 +01:00
Andreas Kling
11c8596ad3 WindowServer+LibGUI+LibGfx: Add WindowType::ToolWindow
Tool windows are secondary windows with a smaller title bar. The sit on
the layer above normal windows, and cannot be minimized.

These are intended for complex yet non-modal interactions with the
content of a primary window, such as find/replace windows, property
windows, etc.
2021-02-16 16:26:29 +01:00
Nick Vella
15c1f7a40d WindowServer, LibGUI: Variable minimum window sizes
Minimum window size can now be customised and set at runtime via the
SetWindowMinimumSize WindowServer message and the set_minimum_size
LibGUI::Window method. The default minimum size remains at 50x50.

Some behind-the-scenes mechanics had to be added to LibGUI::Window to
ensure that the minimum size is remembered if set before the window is
shown. WindowServer sends a resize event to the client if it requests a
size on create that's smaller than it's minimum size.
2021-02-16 15:46:03 +01:00
Tom
d590e0c946 WindowServer: Add support for alpha channel based hit testing
This enables implementing non-rectangular window shapes, including
non-rectangular window frames.
2021-02-15 23:07:49 +01:00
Jean-Baptiste Boric
e616cb35ba WindowManager: Fix default menu item on key down
This fixes the key down behavior on Terminal's Edit menu, which tried
to hover the disabled menu item Copy if there was nothing selected.
2021-02-15 19:37:14 +01:00
Jean-Baptiste Boric
f8cb068354 WindowManager: Select top-level menus with left/right keys 2021-02-15 19:37:14 +01:00
Jean-Baptiste Boric
7ee6c66ee9 WindowManager: Make the Logo key open the system menu 2021-02-15 19:37:14 +01:00
Tom
be48a89b35 WindowServer: Fix double click handling while using cursor tracking
We need to first deliver the mouse event and possibly the double click
event and record these facts. Then, we need to iterate all global
tracking listeners and deliver the mouse event (but not the double
click event) to any such listener, unless they already had these
events delivered.

Fixes #4703
2021-02-15 11:03:49 +01:00
Sergey Bugaev
373d135e74 LookupServer: Implement a DNS server :^)
LookupServer can now itself server as a DNS server! To service DNS clients, it
uses the exact same lookup logic as it does for LibIPC clients. Namely, it will
synthesize records for data from /etc/hosts on its own (you can use this to
configure host names for your domain!), and forward other questions to
configured upstream DNS servers. On top of that, it implements its own caching,
so once a DNS resource record has been obtained from an upstream server,
LookupServer will cache it locally for faster future lookups.

The DNS server part of LookupServer is disabled by default, because it requires
you to run it as root (for it to bind to the port 53) and on boot, and we don't
want either by default. If you want to try it, modify SystemServer.ini like so:

[LookupServer]
Socket=/tmp/portal/lookup
SocketPermissions=666
Priority=low
KeepAlive=1
User=root
BootModes=text,graphical

and enable server mode in LookupServer.ini like so:

[DNS]
Nameservers=...
EnableServer=1

If in the future we implement socket takeover for IP sockets, these limitations
may be lifted.
2021-02-15 09:14:42 +01:00
Sergey Bugaev
56831ed81f LookupServer: Misc tweaks 2021-02-15 09:14:42 +01:00
Sergey Bugaev
19cfed329e LookupServer: Make lookup() return DNSAnswer's instead of strings
This way, we propagate proper TTL. None of the callers currently care, though.
2021-02-15 09:14:42 +01:00
Sergey Bugaev
3fba6bfb5e LookupServer: Move cache check into the outer lookup() method
Where it belongs, alongside the /etc/hosts check. The inner lookup() method is
really about talking to a specific DNS server.

Also, don't bail out on a empty name. An empty DNSName is actually '.' — a
single dot — aka the DNS root.
2021-02-15 09:14:42 +01:00
Sergey Bugaev
af6aac8c55 LookupServer: Store /etc/hosts as Vector<DNSAnswer>
...just like we store m_lookup_cache, in other words.

This immediately lets us match on types: for instance we will now only resolve
1.0.0.127.in-addr.arpa to localhost if asked for type PTR, not for type A. In
the future, this could also let us have the same /etc/hosts name resolve
to *multiple* addresses.
2021-02-15 09:14:42 +01:00
Sergey Bugaev
e9387e43db LookupServer: Store DNSName's in HashMap's directly
DNSName can now take care of case conversion when comparing using traits.
It still intentionally doesn't implement operator ==; you have to explicitly
decide whether you want case-sensitive or case-insensitive comparison.

This change makes caches (and /etc/hosts) case-transparent: we will now match
domains if they're the same except for the case.
2021-02-15 09:14:42 +01:00
Sergey Bugaev
bacbde31f3 LookupServer: Move case randomization into DNSName
* DNSName knows how to randomize itself
* DNSPacket no longer constructs DNSQuestion instances, it receives an already
  built DNSQuestion and just adds it to the list
* LookupServer::lookup() explicitly calls randomize_case() if it needs to
  randomize the case.
2021-02-15 09:14:42 +01:00
Sergey Bugaev
89f718c4c5 LookupServer: Don't cache DNS questions
We should only cache RRs (which we represent as instances of DNSAnswer), now
which questions generated them.
2021-02-15 09:14:42 +01:00
Sergey Bugaev
80f7489df0 LookupServer: Fix serializing name data in DNS answers
When serializing a RR of type PTR, we should use the DNS name serialization
format, not a raw string.
2021-02-15 09:14:42 +01:00
Sergey Bugaev
d6f7ced4f1 LookupServer: Move DNS name serialization to DNSName class 2021-02-15 09:14:42 +01:00
Sergey Bugaev
42bc5f2cc1 LookupServer: Move parse_dns_name() -> DNSName::parse()
While at it, refactor it slightly.
2021-02-15 09:14:42 +01:00
Sergey Bugaev
ae1e82fd2f LookupServer: Introduce DNSName
This is a wrapper around a string representing a domain name (such as
"example.com"). It never has a trailing dot.

For now, this class doesn't do much except wrap the raw string. Subsequent
commits will add or move more functionality to it.
2021-02-15 09:14:42 +01:00
Tom
0138f13bfe WindowServer: Improvements to support alpha channel in window frames
This fixes some issues handling the alpha channel that may be present
in rendered window frames.

Fixes #5303
2021-02-13 00:39:33 +01:00
Tom
7e06afb822 WindowServer: Recompute occlusions when changing window's alpha channel
Fixes #4845
2021-02-12 08:57:42 +01:00
Tom
cf1c159ed5 WindowServer: Allow different shadows for active/inactive windows
Also allow specifying different shadows for the task and menu bar.
2021-02-11 23:36:11 +01:00
DexesTTP
2acbb811b1 LibCore: Added FileWatcher, a binding for the watch_file syscall
This wrapper abstracts the watch_file setup and file handling, and
allows using the watch_file events as part of the event loop via the
Core::Notifier class.

Also renames the existing DirectoryWatcher class to BlockingFileWatcher,
and adds support for the Modified mode in this class.
2021-02-11 13:13:32 +01:00
Linus Groh
0304ab3e67 WindowServer: Fix compositing of fullscreen window
I honestly don't know the internals of all this and what exactly is
going on, but this fixes compositing of the fullscreen window. By trial
and error I found that specifically m_invalidated_all needs to be set to
false, so it's probably different behaviour in prepare_dirty_rects(),
which depends on that...
Either way, the code composing all windows in non-fullscreen mode calls
Window::clear_dirty_rects() for each, so not doing that for the fullscreen
window as well seems like an oversight.

Fixes #4810.
2021-02-11 13:12:17 +01:00
Tom
e1333724ea WindowServer: Blit backing bitmap with transparency for hung windows
We should respect the opacity of the window when painting the window
content of a hung application.
2021-02-11 13:11:57 +01:00
Tom
dd0833107f WindowServer: Fix clearing area not covered by backing bitmap
We only cleared the area not covered by the backing bitmap if a
rendering rectangle intersected with the backing bitmap. But because
we are potentially calling the render function many times we need
to always clear the area not covered by the backing bitmap, whether
it intersects or not.

Fixes #5291
2021-02-11 13:11:57 +01:00
Itamar
653c3d5812 NotificationWindow: Set notification text as tooltip content 2021-02-10 23:04:54 +01:00
Tom
f8d65e57ba WindowServer: Don't re-render the window frame when not needed
Merely moving a window shouldn't require re-rendering the window
frame anymore now that we cache the rendered frame in bitmaps. This
reduces CPU usage significantly when moving windows.
2021-02-10 23:03:22 +01:00
Andreas Kling
1ad65b173b LibWeb+WebContent: Support window.confirm() in OOPWV 2021-02-10 09:13:30 +01:00
Tom
a807d92a32 WindowServer: Fix switching between shadows and no shadows with themes
We weren't properly handling switching between having a shadow and
not having a shadow when switching themes. This allows an empty string
in the theme configuration for a shadow path, meaning no shadow should
be rendered.
2021-02-10 09:12:49 +01:00
Tom
5d4c4bd372 WindowServer: Occlusion calculation fixes
We didn't properly determine whether a window was fully covered, which
caused some artifacts in certain cases.

Fixes #5283
2021-02-10 09:12:49 +01:00
Andreas Kling
f24b674d7a LibWeb+WebContent: Don't relayout page on every scroll event
The WebContent process was redoing page layout every time you scrolled
the page. This was a huge CPU hog for no reason. Fix this by only doing
a relayout when the viewport is resized, not when it moves around.
2021-02-09 22:40:16 +01:00
Tom
964894dee6 WindowServer: Allow specifying different shadows for menus and tooltips
Also update the Redmond 2000 theme to drop shadows more Redmond-like.
2021-02-09 22:27:14 +01:00
Camisul
8c220dee03 WindowServer: Vertically maximize window
Button now can handle middle and right clicks.
Added 2 new handlers in button class: on_right_click for Right mouse
button and on_middle_click for middle mouse button.

Added functionality to vertically maximize window with middle mouse
click on the maximize window button.

Also added a way to vertically maximize window by resizing window
height-wise lower than the maximum window height.
2021-02-09 21:36:11 +01:00
Tom
e1ee59ac9d WindowServer: Recompute occlusions and re-render shadows on theme change
Since theme changes may change geometrics, which are also affected by
window shadows, we need to recompute occlusions as well as re-render
window frames.
2021-02-09 21:33:54 +01:00
Tom
db0149056f WindowServer: Don't render shadow for frameless windows
Fixes CatDog rendering odd square shadow.
2021-02-09 19:18:00 +01:00
Tom
3d374954eb WindowServer: Try harder to avoid re-rendering window shadow
We only really need to re-render the simple window shadow when
the size of the frame changes. So, for all other cases only re-render
the window frame without rendering the shadow.
2021-02-09 18:47:43 +01:00
Tom
0ce4b9d7db WindowServer: Implement simple window shadows
This implements simple window shadows around most windows, including
tooltips. Because this method uses a bitmap for the shadow bits,
it is limited to rectangular window frames. For non-rectangular
window frames we'll need to implement a more sophisticated algorithm.
2021-02-09 18:47:43 +01:00
Tom
15a1d9aa94 WindowServer: Cache rendered window frame in bitmap
This only renders the window frame once until the size of the window
changes, or some other event requires re-rendering. It is rendered
to a temporary bitmap, and then the top and bottom part is stored
in one bitmap as well as the left and right part. This also adds
an opacity setting, allowing it to be rendered with a different
opacity.

This makes it easier to enhance window themes and allows using
arbitrary bitmaps with e.g. alpha channels for e.g. shadows.
2021-02-08 19:02:04 +01:00
Tom
8ff34f96b6 WindowServer: Calculate transparent frame occlusions
If a window frame has transparency, include these areas in the
transparency rendering area so that we can render them flicker-free.
2021-02-08 19:02:04 +01:00
AnotherTest
09a43969ba Everywhere: Replace dbgln<flag>(...) with dbgln_if(flag, ...)
Replacement made by `find Kernel Userland -name '*.h' -o -name '*.cpp' | sed -i -Ee 's/dbgln\b<(\w+)>\(/dbgln_if(\1, /g'`
2021-02-08 18:08:55 +01:00
Ben Wiederhake
7961e09c29 Everywhere: Add semantically-missing includes
For example, FindInFilesWidget.h mentions GUI::TableView, but did not include
it. On the other hand, all source files that include FindInFilesWidget.h
also include TableView.h, so the issue is only cosmetical.
2021-02-08 18:03:57 +01:00
DragonAlex98
885974fc3c
WindowServer: Don't close menu when clicking on item with submenu (#5239)
When clicking on a menu item with a submenu, don't close the menu.
2021-02-07 12:28:42 +01:00
Sergey Bugaev
1dad63824b LookupServer: Unify DNSRequest & DNSResponse
They're really the same thing: a DNS packet can contain both questions and
answers, and there's a single bit in the header that determines whether the
packet represents a query or a response. It'll be simpler for us to represent
both types of packets using the same class.

This class can be both serialized and deserialized to/from a raw DNS packet.
2021-02-06 17:52:47 +01:00
Sergey Bugaev
e3135e7ca5 LookupServer: Rename DNSPacket -> DNSPacketHeader
This is a more appropriate name for what the class represents, and we'll be
reusing the name DNSPacket for something different soon.
2021-02-06 17:52:47 +01:00
Sergey Bugaev
d8967e4dff LookupServer+LibC: Pass IP addresses in binary
Now that we no longer depend on the textual IPC format, we can pass IP addresses
in the format most code actually has and needs it: in binary. The only places we
actually have to deal with textual address representation is:

* When reading /etc/hosts, we have to parse textual addresses & convert them to
  binary;
* When doing reverse lookups, we have to form a pseudo-hostname of the form
  x.x.x.x.in-addr.arpa.

So we do the conversion in those two cases.

This also increases uniformity between how we handle A (IPv4 address) and other
resource record types. Namely, we now store the raw binary data as received from
a DNS server.
2021-02-06 17:52:47 +01:00
Sergey Bugaev
547130584c LookupServer: Switch to LibIPC :^)
The ad-hoc IPC we were doing with LookupServer was kinda gross. With this,
LookupServer is a regular IPC server. In the future, we want to add more APIs
for LookupServer to talk to its clients (such as DHCPClient telling LookupServer
about the DNS server discovered via DHCP, and DNS-SD client browsing for
services), which calls for a more expressive IPC format; this is what LibIPC is
perfect for.

While the LookupServer side is using the regular LibIPC mechanics and patterns,
the LibC side has to hand-roll LibIPC format serialization without actually
using LibIPC. We might be able to get rid of this in the future, but for now it
has to be like that. The good news is the format is not that bad at all.
2021-02-06 16:12:18 +01:00
Sergey Bugaev
314f966745 LookupServer: Move into LookupServer namespace 2021-02-06 16:12:18 +01:00