Commit graph

619 commits

Author SHA1 Message Date
Brendan Coles 64536f19f0 WindowServer: MenuManager::handle_mouse_event() return if window is null
Previously the WindowServer would assert `topmost_menu->menu_window()`
and crash.

Fixes #1716
2020-04-09 20:00:23 +02:00
Andreas Kling 53f63058b9 WindowServer: Remove long-unused COMPOSITOR_DEBUG logging 2020-04-07 23:01:45 +02:00
Andreas Kling a53cf81374 LibCore: Add Core::Timer::create_single_shot()
This is just a convenience function for creating single-shot timers.
2020-04-07 23:01:43 +02:00
Brendan Coles 6476f690fe WindowServer: Menu::popup() should return when the menu is empty
Previously the WindowServer would assert `!is_empty()` and crash.

Fixes #1689
2020-04-07 21:26:52 +02:00
AnotherTest 3ab6c5fd09 DHCPClient: Log errors and cleanup the code
Prior to this, we ran the DHCP client as a high-priority service, but
making the system feel laggy "for some network stuff" is not the
greatest of ideas :^)
2020-04-06 10:58:40 +02:00
AnotherTest 3e8cf79efa Servers: Add a new DHCP client
This adds a DHCPClient...Server that leases IPv4s.
2020-04-05 09:50:48 +02:00
Andreas Kling fc5067afd2 ProtocolServer+LibProtocol: Reject unhandled URLs instead of asserting
StartDownload requests for unhandled protocols (or invalid URLs) will
now refuse to load instead of asserting. A failure code is sent back
to LibProtocol and Protocol::Client::start_download() returns nullptr.

Fixes #1604.
2020-04-04 20:01:36 +02:00
Andreas Kling c56c8c8953 WindowServer: Remove applets from AppletManager on client disconnection
Disconnecting from WindowServer without explicit calls to DestroyWindow
would leave nulled-out WeakPtr's in the AppletManager applet list.

This led to a null dereference when adding a new applet, since we were
assuming the list contained no nulled-out applets.

This patch fixes the issue by always unregistering applet windows from
the AppletManager in ~ClientConnection(). We also do an extra pass of
pruning any nulled-out WeakPtrs from the applet list when adding to it.

Fixes #1551.
2020-03-31 13:55:28 +02:00
Andreas Kling 012a4eb0b5 WindowServer+NotificationServer: Vertical title bar for notifications
This patch adds a specialized window type for notifications. They now
have a title bar on the right-hand side, with a close button.

This removes the need for the "Done" button in notifications, giving us
a bit more horizontal space overall.

Design based on a mock-up from @xTibor :^)
2020-03-30 17:03:15 +02:00
Andreas Kling 8c5fa05c39 WindowServer: Use Gfx::ShareableBitmap for SetWindowIconBitmap 2020-03-29 19:37:23 +02:00
Andreas Kling 7cfe712f4d LibGfx+LibIPC: Add Gfx::ShareableBitmap, a bitmap for easy IPC usage
With this patch, it's now possible to pass a Gfx::ShareableBitmap in an
IPC message. As long as the message itself is synchronous, the bitmap
will be adopted by the receiving end, and disowned by the sender nicely
without any accounting effort like we've had to do in the past.

Use this in NotificationServer to allow sending arbitrary bitmaps as
icons instead of paths-to-icons.
2020-03-29 19:37:23 +02:00
Hüseyin ASLITÜRK adf524015a WindowServer: Add methods for set background color and wallpaper mode 2020-03-29 19:36:37 +02:00
Benjamin Rottler 401becb922 NotificationServer: Update locations of notifications after closing one
When multiple notifications are open and one notification in the
beginning or in the middle is closed the location of the remaining
notification windows are updated so that there is no gap between them.
2020-03-28 16:07:47 +01:00
Andreas Kling faedb763ca NotificationServer: Allow showing an icon in notifications
We currently use icon paths for this because I didn't want to deal with
implementing icon bitmap sharing right now. In the future it would be
better to post a bitmap somehow instead of a path.
2020-03-26 20:38:28 +01:00
Alex Muscar fefc2665d6
WindowServer: Don't ignore mouse events after showing modal window (#1495)
Fixes #1464
2020-03-25 16:26:33 +01:00
Andreas Kling 424a3f5ac3 WindowServer+LibGUI: Add a way to get notified at display refresh rate
This patch adds GUI::DisplayLink, a mechanism for registering callbacks
that will fire at the display refresh rate.

Note that we don't actually know the screen refresh rate, but this is
instead completely driven by WindowServer's compositing timer. For all
current intents and purposes it does the job well enough. :^)
2020-03-22 21:13:23 +01:00
Chris bb70d0692b WindowServer: Improve the close button shape 2020-03-22 19:57:58 +01:00
Itamar bd9f14e27e SystemServer: Add WorkingDirectory support
Services can now have their initial working directory
configured via `SystemServer.ini`.

This commit also configures Terminal's working directory
to be /home/anon
2020-03-18 08:23:31 +01:00
Chyza 7967c80222 WindowServer: Resize maximised/tiled windows after resolution change
Previously windows would either extend past the screen or stay at their
previous smaller size in the corner, now they are resized to fit the new
resolution.
2020-03-15 19:01:40 +01:00
Shannon Booth 5dc5b8a2b6 LibCore: Rename Udp classes to UDP
The kernel was already using the UDP prefix, and the TCP LibCore classes
are also uppercased. Let's rename for consistency.

Also order the LibCore Makefile alphabetically, because everywhere else
seems to be doing that :)
2020-03-14 23:56:12 +01:00
Shannon Booth e9687ee50e WindowServer: Control menu title font from menubar
It makes a little more sense for the menubar to control what the font of
the menu title is, as opposed to the menu manager. Menumanager now
simply uses the font that the menu wants it to use.
2020-03-10 09:37:34 +01:00
Andreas Kling 37fc6c117c Userspace: Add missing #includes now that AK/StdLibExtras.h is smaller 2020-03-08 13:06:51 +01:00
Shannon Booth 6a3b12664a LibGUI: Move Icon and FontDatabase into the GUI namespace
We also clean up some old references to the old G prefixed GUI classes

This also fixes a potential bug with using: C_OBJECT_ABSTRACT(GAbstractButton)
instead of C_OBJECT_ABSTRACT(AbstractButton)
2020-03-07 01:33:53 +01:00
Andreas Kling 8bb361889c AK: Remove Optional::operator bool()
This was causing some obvious-in-hindsight but hard to spot bugs where
we'd implicitly convert the bool to an integer type and carry on with
the number 1 instead of the actual value().
2020-03-06 10:32:58 +01:00
Andreas Kling 028c011760 LibCore: Make Core::Object::add<ChildType> return a ChildType&
Since the returned object is now owned by the callee object, we can
simply vend a ChildType&. This allows us to use "." instead of "->"
at the call site, which is quite nice. :^)
2020-03-04 21:04:06 +01:00
Andreas Kling 0f3e57a6fb LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients 2020-03-04 14:26:16 +01:00
Andreas Kling 4697195645 LibGUI: Use set_layout<LayoutType>() in lots of client code 2020-03-04 13:49:48 +01:00
Andreas Kling a26b63a958 LibGUI: Remove Button& parameter from Button::on_click hook
There was but a single user of this parameter and it's a bit tedious
to write it out every time, so let's get rid of it.
2020-03-03 17:02:38 +01:00
Andreas Kling 686ade6b5a AK: Make quick_sort() a little more ergonomic
Now it actually defaults to "a < b" comparison, instead of forcing you
to provide a trivial less-than comparator. Also you can pass in any
collection type that has .begin() and .end() and we'll sort it for you.
2020-03-03 16:02:58 +01:00
Andreas Kling fbe9aad70a WindowServer: Clear the current resize candidate when in menus
While the menu system is swallowing mouse events, just clear any resize
candidate we had set. This ensures that we don't end up with a resize
cursor when slipping into a menu-controlled part of the screen.

Fixes #1306.
2020-03-01 14:21:38 +01:00
Andreas Kling 1e6ec22017 WindowServer: Remove a whole bunch of unused WindowManager members 2020-03-01 14:13:05 +01:00
Andreas Kling 042baa4e8d WindowServer: Put some WindowManager debug spam inside #ifdefs 2020-03-01 13:58:29 +01:00
Andreas Kling a1514369d7 LibC: Move shbuf_* API's to <serenity.h> 2020-02-28 12:55:58 +01:00
Andreas Kling f72e5bbb17 Kernel+LibC: Rename shared buffer syscalls to use a prefix
This feels a lot more consistent and Unixy:

    create_shared_buffer()   => shbuf_create()
    share_buffer_with()      => shbuf_allow_pid()
    share_buffer_globally()  => shbuf_allow_all()
    get_shared_buffer()      => shbuf_get()
    release_shared_buffer()  => shbuf_release()
    seal_shared_buffer()     => shbuf_seal()
    get_shared_buffer_size() => shbuf_get_size()

Also, "shared_buffer_id" is shortened to "shbuf_id" all around.
2020-02-28 12:55:58 +01:00
Andreas Kling 8460d02651 WindowServer: Remove some old unused debugging code from Compositor 2020-02-28 12:55:58 +01:00
Liav A 151f32b827 WindowServer: Return richer result when changing resolutions
Now we return a boolean value from set_resolution() in the Compositor
and Screen class. Also, the WindowServer IPC now returns a richer result
after changing the resolution, which can be used in clients later.
2020-02-28 12:16:05 +01:00
Liav A f14c5b29b4 WindowServer: Add a debug message 2020-02-28 12:16:05 +01:00
Andreas Kling e52d1a02c8 WindowServer: Stop trying to boost things since it's not working
Let's temporarily disable the boosting calls until we have a solution
for boosting in the new multi-user world. The error messages keep
confusing people into thinking they're doing something wrong.
2020-02-27 14:29:35 +01:00
joshua stein 0d2bfe5c65 Build: Only look at SUBDIRS with Makefiles
If a directory is renamed or deleted before 'make clean', git will
delete the Makefile but leave all of the object and dependency files
around.  When make would try to recurse into that directory from the
wildcard, it would error out since there is no Makefile.
2020-02-25 19:56:48 +01:00
Andreas Kling ceec1a7d38 AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
Andreas Kling ab6f694905 WindowServer+LibGUI: Allow changing a window's base size and increment
Previously it was only possible to change these window attributes when
creating a new window. This patch adds an IPC message that allows you
to change them at runtime.
2020-02-24 19:23:57 +01:00
Andreas Kling 3d20da9ee4 Userspace: Use Core::Object::add() when building interfaces 2020-02-23 11:10:52 +01:00
Brian Gianforcaro c0ee0bdc46 TTYServer: Use unveil() 2020-02-22 21:19:58 +01:00
Tibor Nagy ba7281a7b2 WindowServer: Use system theme for the drag and drop popups 2020-02-21 20:19:06 +01:00
Shannon Booth 088d7be19c WindowServer: Stop exposing open_menu_stack in MenuManager
The open menu stack is an internal data structure that outside classes
shouldn't really need to know about. Add MenuManager::has_open_menu()
so that the WindowManager can still know whether a menu is open or not.
2020-02-20 15:11:31 +01:00
Shannon Booth 238b6871e0 WindowServer: Fix not all menus closing after system menu toggle
We were failing to check if the current menu being set was already open.
This could result in multiple occurrences of the menu in the open menu stack.

When we close all menus descending from a menu we only delete the first
occurrence of a given menu from the menu stack (a fair assumption to make as
a menu should only be open once).

Because of this a menu (or multiple instances of it) could remain in the open
menu stack when it should actually be closed, leading to goofy behaviour.

Fixes #1238
2020-02-20 15:11:31 +01:00
Tibor Nagy bbfefb8827 WindowServer: Geometry labels should follow the system theme 2020-02-20 14:19:30 +01:00
Tibor Nagy 1da3be82ad WindowServer: MenuManager should use selection text color from system theme 2020-02-20 14:19:30 +01:00
Andreas Kling eaa680ab8e WindowServer+LibGUI: Force full window repaints after theme change
We were not repainting windows that were occluded at the time of the
theme changing. This patch adds a way to bypass occlusion testing when
invalidating window rects.

Fixes #1249.
2020-02-19 16:46:28 +01:00
Andreas Kling ef38c49619 WindowServer+LibGUI+LibHTML: Fix build with -std=c++2a 2020-02-19 12:03:01 +01:00