Commit graph

643 commits

Author SHA1 Message Date
LuK1337 0a7041aad7 Taskbar: Pass full argv for exit action
We need to pass --now to `shutdown` command.
2021-08-07 01:37:28 +02:00
Andreas Kling 779316d468 Userland: Use Core::Process::spawn() instead of posix_spawn() in places
This replaces a bunch of very basic uses of posix_spawn() with the new
Core::Process::spawn().
2021-08-06 01:06:42 +02:00
Jelle Raaijmakers c7e72a52a3 Taskbar: Use provided AppFile icon instead of finding it ourselves 2021-08-04 13:54:08 +01:00
Timothy 73c1b1617a Everywhere: Replace most cases of exit() with Application::quit()
Application::quit() is nicer for most cases where exit() is used. Cases
where exit() is used intentionally for early termination are left
intact.
2021-08-03 18:55:52 +02:00
Karol Kosek 49ae73022c Taskbar: Set chdir to the home directory when opening applications
Although the chdir was set up for the applications opened from
the quick launch, the regular application list hadn't do this.

This meant that you could open a Terminal or HackStudio project
in the root directory, which isn't so bad, but it's better to stick
to the user home directory.
2021-08-03 09:12:33 +02:00
sin-ack 611370e7dc LibGUI, WindowServer: Greatly simplify menubar logic
Currently, any number of menubars can be plugged in and out of a window.
This is unnecessary complexity, since we only need one menubar on a
window. This commit removes most of the logic for dynamically attaching
and detaching menubars and makes one menubar always available. The
menubar is only considered existent if it has at least a single menu in
it (in other words, an empty menubar will not be shown).

This commit additionally fixes a bug wherein menus added after a menubar
has been attached would not have their rects properly setup, and would
therefore appear glitched out on the top left corner of the menubar.
2021-08-02 00:39:15 +02:00
Brian Gianforcaro 808aa31353 Services: Remove unused header includes 2021-08-01 08:10:16 +02:00
LuK1337 5fe3cc3b85 WindowServer: Don't draw separator between pin window & close for modals
Modal windows cannot be pinned and thus we end up drawing 2 separators.
2021-07-28 18:32:06 +02:00
sin-ack 4c9c85ac01 Userland: Make TextWrapping::Wrap opt-in
This was breaking many places which didn't expect text to wrap. Now,
the only place where text currently wraps is in GUI::Label.
2021-07-27 22:05:20 +02:00
Andreas Kling 751cb094ff LibGfx: Remove Gfx::ImageDecoder::bitmap() in favor of frame(index)
To transparently support multi-frame images, all decoder plugins have
already been updated to return their only bitmap for frame(0).

This patch completes the remaining cleanup work by removing the
ImageDecoder::bitmap() API and having all clients call frame() instead.
2021-07-27 01:29:50 +02:00
Andreas Kling d01b4327fa LibGfx: Improve ImageDecoder construction
Previously, ImageDecoder::create() would return a NonnullRefPtr and
could not "fail", although the returned decoder may be "invalid" which
you then had to check anyway.

The new interface looks like this:

    static RefPtr<Gfx::ImageDecoder> try_create(ReadonlyBytes);

This simplifies ImageDecoder since it no longer has to worry about its
validity. Client code gets slightly clearer as well.
2021-07-27 01:17:05 +02:00
sin-ack 48d4062b47 NotificationServer: Expand the notification when hovered
Now, instead of showing a tooltip, the entire notification will be
shown when the user hovers over a notification. In the future, limiting
the amount of lines shown within the notification and moving extra lines
to the tooltip again might be a good idea.
2021-07-26 21:14:39 +04:30
sin-ack e11940fd01 Userland: Move text wrapping/elision into the new TextLayout :^)
This class now contains all the fun bits about laying out text in a
rect. It will handle line wrapping at a certain width, cutting off lines
that don't fit the given rect, and handling text elision.
Painter::draw_text now internally uses this.

Future work here would be not laying out text twice (once actually
preparing the lines to be rendered and once to get the bounding box),
and possibly adding left elision if necessary.

Additionally, this commit makes the Utf32View versions of
Painter::draw_text convert to Utf8View internally. The intention is to
completely remove those versions, but they're kept at the moment to keep
the scope of this PR small.
2021-07-26 21:14:39 +04:30
Andreas Kling 7d4e3f01dd Taskbar: Unbreak application launchers in the start menu
Application launcher actions reference their applications by an index
into the global `g_apps` table. When skipping over settings apps,
we still have to increment the current app identifier.
2021-07-26 02:57:24 +02:00
Andreas Kling 4e2c5cd19e Taskbar: Show Settings app instead of Settings app category
The Settings app is basically a viewer for the Settings app category
anyway, so let's just direct users there instead of having the various
settings apps in the start menu.
2021-07-26 01:56:33 +02:00
Andreas Kling fb0c94ae84 WindowServer: Remove debug spam in MenuManager::refresh() 2021-07-25 18:01:24 +02:00
Andreas Kling 3f9e018d9a CrashDaemon: Remove BACKTRACE_DEBUG debugging code
This thing seems to work fine, no need to hang on to old debug code.
2021-07-22 23:34:33 +02:00
Tom fd60815c58 WindowServer: Fix rendering overlays when there's no desktop window
We were missing to account for areas that are not covered by any
window. If any of these areas are covered by an overlay we need to
render the wallpaper into transparency and also render the overlay
over them.

This fixes not rendering overlays properly when e.g. the FileManager
(desktop) crashed as there is no longer any window underneath.
2021-07-22 21:38:52 +02:00
Andreas Kling d79d768010 LaunchServer: Remove debug spam about incoming connections 2021-07-22 14:20:05 +02:00
Sam Atkins 9122967d5f FileOperation: Use LexicalPath::join() for all path joining 2021-07-22 12:48:44 +02:00
Sam Atkins 967314023c FileOperation: Implement 'Delete' operation 2021-07-22 12:48:44 +02:00
Sam Atkins e99200cc23 FileOperation: Combine 'sources' and 'destination' CL arguments
The upcoming 'Delete' operation has no destination, so this was the
best solution we could come up with for now. Perhaps ArgsParser
could support sub-commands, so we would define 'Copy', 'Move' and
'Delete' each as sub-commands with their own argument definitions.
That would make things like git's variety of commands possible.
2021-07-22 12:48:44 +02:00
Sam Atkins 0a62d517fd FileManager+FileOperation: Implement (and use) 'Move' command
`FileOperation Move ...` is now used for cut-and-paste in the
FileManager.
2021-07-22 12:48:44 +02:00
Sam Atkins a1b4ec1507 FileOperation: Extract execute_work_items() from perform_copy()
This is in preparation for a perform_move() function.
2021-07-22 12:48:44 +02:00
Sam Atkins 3267556ce4 FileOperation: Accept multiple source arguments
You can now list multiple files or directories and they will all be
copied to the destination. :^)

Note that this means you can pass the same file or directory multiple
times. It runs fine, just means that it does unnecessary work. But
figuring out if a file is already queued is probably more hassle than
it's worth, if it's even possible at all due to symlinks.
2021-07-22 12:48:44 +02:00
Sam Atkins ca039e6ba1 FileManager+FileOperation: Switch to east const
(And some adjustments based on MaxWipfli's feedback)
2021-07-22 12:48:44 +02:00
Karol Kosek f2c9ef3763 WindowServer: Reuse config variable from the class on theme change
When changing the theme, there were two Core::ConfigFile instances
(one class scoped -- m_config and one function scoped -- wm_config)
fighting over the file, resulting in not saving the new theme name
to the config. :^(

This makes WindowServer remember selected theme from the menu
after reboot!
2021-07-22 00:26:44 +02:00
Andreas Kling c7d891765c LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
2021-07-21 18:02:15 +02:00
Tom dbb9f891fb WindowServer: Re-use existing Screen instances and improve fallbacks
If a screen layout cannot be applied, instead of failing to start
WindowServer try to fall back to an auto-generated screen layout with
the devices that are detected.

Also, be a bit smarter about changing the current screen layout.
Instead of closing all framebuffers and bringing them back up, keep
what we can and only change resolution on those that we need to change
them on. To make this work we also need to move away from using an
array of structures to hold compositor related per-screen data to
attaching it to the Screen itself, which makes re-using a screen much
simpler.
2021-07-21 00:06:58 +02:00
Andreas Kling 59b6169b51 Taskbar: Update the start button width when system fonts change 2021-07-20 02:48:29 +02:00
Linus Groh 37cc110003 Taskbar: Launch apps in Terminal when RunInTerminal=true is specified
This feels a bit awkward right now, and needs code duplication - I think
adding a mechanism to the AppFile class to run the executable would be
neat, especially if we add an arguments field to app files - but this
will do for now.
2021-07-20 00:58:26 +01:00
Peter Elliott 2b37fad60b WindowServer: Add set_virtual_dekstop WindowManager message
Users can specify the row and column of the virtual desktop, and
WindowServer will animate to it.
2021-07-19 18:21:40 +02:00
Tom 18eeb3db87 WindowServer: Fix crash rendering fullscreen window
Fixes #8869
2021-07-19 10:24:58 +02:00
Tom 7ae46ae218 WindowServer: Fix menu over-drawing
We only need to re-draw the item being selected and the item being
deselected. We also don't care anymore if applets were added or
removed as we no longer have a global menu bar.
2021-07-18 23:55:13 +02:00
Tom 220886db4c WindowServer: Fix compositor overdraw issues related to transparency
We were re-rendering areas that were considered transparency areas even
though they weren't transparency areas or were occluded by opaque
areas.

In order to fix this, we need to be a bit smarter about what is above
and below any given window. Even though a window may have transparent
areas, if those are occluded by opaque window areas on top they are
not actually any areas that should be rendered at all. And the opposite
also applies, opaque window areas for windows below that are occluded
by transparent areas, do need to be rendered as transparency. This
solves the problem of unnecessary transparency areas.

The other problem is that we need to know what areas of a window's
dirty rectangles affect other windows, and where. Basically any
opaque area that is somehow below a transparent area that isn't
otherwise occluded, and any transparent area above any other window
area (transparent or opaque) needs to be marked dirty prior to
composing. This makes sure that all affected windows render these
areas in the correct order. To track these, we now have a map of
affected windows and the rectangles that are affected (because not all
of that window's transparency areas may be affected).
2021-07-18 18:39:20 +02:00
Tom 6bb1825366 WindowServer: Recompute occlusions when removing an overlay
This makes sure we don't needlessly render areas with transparency
that used to be occupied by an overlay.
2021-07-18 18:39:20 +02:00
Timothy 9e04ab936f WindowServer: Let clients mark windows as stealable by specific clients
This implements window stealing in WindowServer, which allows clients
to mark a window they own as 'stealable' by another client. Indicating
that the other client may use it for any purpose.

This also updates set_window_parent_from_id so that the client must
first mark its window as stealable before allowing other clients to
use it as a parent.
2021-07-18 17:21:28 +02:00
Timothy f5e0475bdf FileSystemAccessServer: Add expose_window_server_client_id()
This will expose the client id of the WindowServerConnection this
instance of FileSystemAccessServer is using.
2021-07-18 17:21:28 +02:00
Timothy 38594dde79 FileSystemAccessServer+TextEditor: Implement cross-process modal prompts
This transitions from synchronous IPC calls to asynchronous IPC calls
provided through a synchronous interface in LibFileSystemAccessClient
which allows the parent Application to stay responsive.

It achieves this with Promise which is pumping the Application event
loop while waiting for the Dialog to respond with the user's action.

LibFileSystemAccessClient provides a lazy singleton which also ensures
that FileSystemAccessServer is running in the event of a crash.

This also transitions TextEditor into using LibFileSystemAccessClient.
2021-07-18 17:21:28 +02:00
Timothy b77b631571 WindowServer: Add WindowServer::get_window_rect_from_client()
This allows a client to get the rect of a window in another client.
2021-07-18 17:21:28 +02:00
Timothy 88e6d18a61 WindowServer: Add WindowServer::async_set_window_parent_from_client()
This allows a client to set the parent for one of its local windows
where the parent window is in another client.
2021-07-18 17:21:28 +02:00
Timothy 522f6775a7 LibGUI+WindowServer: Expose WindowServer client id to the client
This allows an WindowServer client to identify itself and allow future
cross-client functionality in WindowServer.
2021-07-18 17:21:28 +02:00
Gunnar Beutner 56cbd00e94 SpiceAgent: Add Clipboard as a build dependency
SpiceAgent depends on header files built as part of the Clipboard
target.
2021-07-15 11:51:16 +02:00
Timothy Flynn ae910e4370 LibWeb: Add OOPWV IPC for selecting all text 2021-07-14 17:16:39 +02:00
Timothy Flynn 2fda6ce159 LibWeb: Add OOPWV IPC for retrieving selected text 2021-07-14 17:16:39 +02:00
Daniel Bertalan bb26cea291 WindowServer: Don't use GNU-style designator
Clang throws a fit when it encounters this code, since we already have
the standardized designated initializer syntax in C++20, which we should
use.
2021-07-14 13:12:25 +02:00
x-yl c8b13bd053 SpiceAgent: Support copying and pasting images 2021-07-14 12:33:07 +02:00
x-yl d4bb6a1a1e SpiceAgent: Add a new spice agent service :^)
A SPICE agent communicates with the host OS to provide nifty features
like clipboard sharing :^)

This patch implements only plain-text clipboard sharing.

See: github.com/freedesktop/spice-protocol/blob/master/spice/vd_agent.h
2021-07-14 12:33:07 +02:00
ForLoveOfCats 60713c5fcf KeyboardPreferenceLoader: Use correct default Num Lock config value 2021-07-13 23:25:07 +02:00
LuK1337 ac78f1e812 TaskbarWindow: Redraw start button when default font changes 2021-07-12 11:08:09 +02:00