summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/Clipboard.cpp
AgeCommit message (Collapse)Author
2022-02-25LibGUI: Rename ClipboardServerConnection=>ConnectionToClipboardServerItamar
This was done with CLion's automatic rename feature.
2022-02-25Userland: Rename IPC::ServerConnection=>IPC::ConnectionToServerItamar
This was done with CLion's automatic rename feature.
2022-02-19LibGUI: Guard against use-after-free in Clipboard::the()Itamar
We now make sure that a VERIFY will fail if Clipboard::the() is called after the destruction of its static-local variables.
2022-01-28Userland: Fix unnecessary heap allocation of singleton objectsDaniel Bertalan
In order to avoid having multiple instances, we were keeping a pointer to these singleton objects and only allocating them when it was null. We have `__cxa_guard_{acquire,release}` in the userland, so there's no need to do this dance, as the compiler will ensure that the constructors are only called once.
2022-01-24Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOrSam Atkins
Apologies for the enormous commit, but I don't see a way to split this up nicely. In the vast majority of cases it's a simple change. A few extra places can use TRY instead of manual error checking though. :^)
2022-01-15LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServersin-ack
This change unfortunately cannot be atomically made without a single commit changing everything. Most of the important changes are in LibIPC/Connection.cpp, LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp. The notable changes are: - IPCCompiler now generates the decode and decode_message functions such that they take a Core::Stream::LocalSocket instead of the socket fd. - IPC::Decoder now uses the receive_fd method of LocalSocket instead of doing system calls directly on the fd. - IPC::ConnectionBase and related classes now use the Stream API functions. - IPC::ServerConnection no longer constructs the socket itself; instead, a convenience macro, IPC_CLIENT_CONNECTION, is used in place of C_OBJECT and will generate a static try_create factory function for the ServerConnection subclass. The subclass is now responsible for passing the socket constructed in this function to its ServerConnection base; the socket is passed as the first argument to the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before any other arguments. - The functionality regarding taking over sockets from SystemServer has been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket implementation of this functionality hasn't been deleted due to my intention of removing this class in the near future and to reduce noise on this (already quite noisy) PR.
2021-11-21LibGUI: Make clipboard bitmap parsing more robustBen Wiederhake
In particular, malicious programs used to be able to set arbitrary values as "format", which could cause UB (most likely a crash). Furthermore, we do not transmit palette data, so an application sending an indexed bitmap cannot possibly expect the other side to receive a useful image. Therefore, we refuse to build a bitmap.
2021-11-21LibGUI+Everywhere: Make sync requests to Clipboard server more obviousBen Wiederhake
2021-11-21LibGUI: Make clipboard-as-bitmap parsing less data-race-yBen Wiederhake
This encourages the caller to first fetch data and type atomically, and then parse that, instead of potentially making multiple requests.
2021-11-11Everywhere: Pass AK::ReadonlyBytes by valueAndreas Kling
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_create()Andreas Kling
Another one that was used in a fajillion places.
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_create_wrapper()Andreas Kling
2021-11-08LibCore: Use ErrorOr<T> in Core::AnonymousBufferAndreas Kling
2021-09-06Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safeAli Mohammad Pur
2021-07-27LibGUI: Add a ClipboardClient for GUI::ClipboardTheFightingCatfish
Anyone who inherits from `GUI::Clipboard::ClipboardClient` will receive clipboard notifications via `clipboard_content_did_change()`. Update ClipboardHistoryModel, TextEditor and TerminalWidget to inherit from this class.
2021-07-21LibGfx: Use "try_" prefix for static factory functionsAndreas Kling
Also mark them as [[nodiscard]].
2021-07-03Everywhere: Use IPC include syntaxTimothy
Remove superfluous includes from IPCCompiler's generated output and add include directives in IPC definitions where appropriate.
2021-05-23Userland: Mark subclasses of IPC::{Client,Server}Connection finalAndreas Kling
2021-05-23LibIPC: Remove unnecessary IPC::ServerConnection::handshake()Andreas Kling
This is no longer used by any of our IPC pairs.
2021-05-20Clipboard+LibGUI: Remove unnecessary client/server greeting messageAndreas Kling
2021-05-10LibGUI: Add Clipboard::clear()Sergey Bugaev
Does exactly what it says on the tin :^)
2021-05-10Clipboard+LibGUI: Make set_clipboard_data asynchronousAndreas Kling
There's no need for GUI applications to block after the clipping is already in flight.
2021-05-03Userland: Update IPC calls to use proxiesGunnar Beutner
This updates all existing code to use the auto-generated client methods instead of post_message/send_sync.
2021-05-03Userland: Change IPC funcs to use plain arguments instead of a structGunnar Beutner
Instead of having a single overloaded handle method each method gets its own unique method name now.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-16LibGfx: Rename 32-bit BitmapFormats to BGRA8888 and BGRx888xAndreas Kling
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-02-01LibIPC: Stop sending client ID to clientsAndreas Kling
The client ID is not useful to normal clients anymore, so stop telling everyone what their ID is.
2021-01-20LibGfx: Give Bitmap a scale factorNico Weber
Gfx::Bitmap can now store its scale factor. Normally it's 1, but in high dpi mode it can be 2. If a Bitmap with a scale factor of 2 is blitted to a Painter with scale factor of 2, the pixels can be copied over without any resampling. (When blitting a Bitmap with a scale factor of 1 to a Painter with scale factor of 2, the Bitmap is painted at twice its width and height at paint time. Blitting a Bitmap with a scale factor of 2 to a Painter with scale factor 1 is not supported.) A Bitmap with scale factor of 2 reports the same width() and height() as one with scale factor 1. That's important because many places in the codebase use a bitmap's width() and height() to layout Widgets, and all widget coordinates are in logical coordinates as well, per Documentation/HighDPI.md. Bitmap grows physical_width() / physical_height() to access the actual pixel size. Update a few callers that work with pixels to call this instead. Make Painter's constructor take its scale factor from the target bitmap that's passed in, and update its various blit() methods to handle blitting a 2x bitmap to a 2x painter. This allows removing some gnarly code in Compositor. (In return, put some new gnarly code in LibGfxScaleDemo to preserve behavior there.) No intended behavior change.
2021-01-17Clipboard+LibGUI: Move clipboard service to anonymous filesAndreas Kling
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling