Commit Graph

269 Commits

Author SHA1 Message Date
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