Commit Graph

297 Commits

Author SHA1 Message Date
Andreas Kling
814346606f SystemServer: Drop GID before dropping UID
Otherwise the setgid() will fail :^)
2019-09-15 21:18:48 +02:00
Andreas Kling
c543ee5c5b WindowServer+LibGUI: Store a "data type" with the clipboard content
This will allow us to distinguish between different types of data
stored on the clipboard.
2019-09-14 09:19:05 +02:00
Andreas Kling
c8be606acf WindowServer: Avoid doing sqrt() in double-click detection
Compare the distance travelled squared against the max distance squared
to avoid using sqrt().

Thanks to Nagy Tibor for the suggestion :^)
2019-09-09 08:51:16 +02:00
Conrad Pankoff
040947ee47 TelnetServer: Implement basic telnet server
Fixes #407

Depends on #530 to run reliably.
2019-09-08 10:56:34 +02:00
Andreas Kling
423807d772 WindowServer: Don't transform quick far-apart clicks into double-clicks
We now require that the two clicks that make up a double-click be no
more than 4px apart.

This fixes the annoying behavior where you'd often get incorrect
double-click events on GUI widgets.
2019-09-08 10:16:33 +02:00
Jesse Buhagiar
ecbc0322c1 Applications: Create a display properties manager
An interactive application to modify the current display settings, such as
the current wallpaper as well as the screen resolution. Currently we're
adding the resolutions ourselves, because there's currently no way to
detect was resolutions the current display adapter supports (or at least
I can't see one... Maybe VBE does and I'm stupid). It even comes with
a very nice template'd `ItemList` that can support a vector of any type,
which makes life much simpler.
2019-09-07 16:51:15 +02:00
Andreas Kling
cb62890f8e WindowServer: Elide window titles that don't fit
Also skip painting the titlebar stripes and/or title entirely if we
don't have enough space for them.

Fixes #524.
2019-09-06 19:09:33 +02:00
Andreas Kling
73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
This was a workaround to be able to build on case-insensitive file
systems where it might get confused about <string.h> vs <String.h>.

Let's just not support building that way, so String.h can have an
objectively nicer name. :^)
2019-09-06 15:36:54 +02:00
Sergey Bugaev
22e6978c71 WindowServer+LibGUI+FontEditor: Encode special characters as UTF-8 2019-09-05 16:37:39 +02:00
Conrad Pankoff
6fb7eeb81a SystemServer: Use dbg() instead of dbgprintf() 2019-09-03 16:17:26 +02:00
Conrad Pankoff
a8bd43588b SystemServer: Allow more arguments for startup processes 2019-09-03 16:17:26 +02:00
Andreas Kling
353bf57378 WindowServer: Don't crash when trying to close an empty menu
It's not normal to add empty menus to an app's menubar, but just in
case someone does it anyway, let's not crash trying to close it.
2019-09-01 13:24:57 +02:00
Andreas Kling
63e6b09816 WindowServer+LibGUI: Add support for nested menus
It's now possible to add a GMenu as a submenu of another GMenu.
Simply use the GMenu::add_submenu(NonnullOwnPtr<GMenu>) API :^)

The WindowServer now keeps track of a stack of open menus rather than
just one "current menu". This code needs a bit more work, but the basic
functionality is now here!
2019-08-29 06:36:29 +02:00
Andreas Kling
4ec698d1b0 WindowServer: Fix off-by-one in menu height calculation
This removes the unecessary empty scanline at the bottom of menus and
makes it look nice and tidy when the bottom item is highlighted. :^)
2019-08-27 13:51:09 +02:00
Andreas Kling
9a80554943 WindowServer: Reverse the menu background colors
Let's try putting the warm gray under the icons/checkboxes. This makes
the checkboxes look more natural.
2019-08-27 13:24:05 +02:00
Andreas Kling
d3c21163a5 WindowServer: Don't highlight disabled menu items when hovered 2019-08-27 10:20:10 +02:00
Andreas Kling
2147b587b2 WindowServer: Improve look of disabled menu items somewhat 2019-08-27 06:57:14 +02:00
Andreas Kling
161c862f21 WindowServer: Add an icon for the system menu / About action
It's a little ladybug. Maybe someday we'll have a fancy icon, but until
then, this ladybug character is a cute placeholder. :^)
2019-08-27 06:53:23 +02:00
Andreas Kling
1077c15917 WindowServer: Add some app icons to the system menu 2019-08-26 21:15:35 +02:00
Andreas Kling
c0d81bea06 WindowServer: Make the global menubar selection consistent with items 2019-08-26 21:14:50 +02:00
Andreas Kling
0f48e3b007 WindowServer: Align menu separators correctly
These were off by one vertically, oops!
2019-08-26 20:53:33 +02:00
Andreas Kling
11bb88f513 WindowServer: Improve the menu look a bit
Take some inspiration from the first release of Visual Studio .NET and
add a left-hand stripe to contain the icons. And various other tweaks.
This isn't quite perfect, but it's pretty neat! :^)
2019-08-26 20:46:19 +02:00
Andreas Kling
1e604b7984 WindowServer+LibGUI: Show action icons in the menus when possible
Any GAction that has an icon assigned will now show up with that icon
when added to a menu as well.

I made the menu items 2px taller to accomodate the icons. I think this
turned out quite nice as well :^)
2019-08-26 18:54:44 +02:00
Andreas Kling
d522a6fe4c WindowServer: Improved look of checkable menu items
Paint a little checkbox frame for checkable items to make it obvious
that they are indeed checkable. This looks quite nice :^)

We also now shift all menu items to the right if we have any checkable
items in the menu.
2019-08-26 18:10:07 +02:00
Sergey Bugaev
3439a479af LibThread: Move CLock to LibThread::Lock
And adapt all the code that uses it.
2019-08-26 11:31:14 +02:00
Sergey Bugaev
8d59b10022 WindowServer: Port threading to LibThread 2019-08-26 11:31:14 +02:00
Sergey Bugaev
1ac7fedefe AudioServer: Port threading to LibThread 2019-08-26 11:31:14 +02:00
Andreas Kling
770cf498ca WindowServer: Oops, remove an assertion that won't fly with MBVGA 2019-08-19 13:50:09 +02:00
Andreas Kling
7038935f74 GraphicsBitmap: create_wrapper() should take pitch as a parameter
We shouldn't assume that the pitch of some arbitrary bitmap memory that
we're wrapping is going to be 16-byte aligned. Instead, just take the
pitch as a parameter.

Also update WindowServer to pass the pitch to the framebuffer bitmaps.
2019-08-19 13:45:22 +02:00
Sergey Bugaev
d11d847161 WindowServer: Fix an assertion
Now that the window used by a WSMenu is its child CObject, the menu also
receives CChildEvent's about the window, including CEvent::ChildAdded when
the window gets created. At this point, menu_window() still returns nullptr,
so stop unconditionally assuming that it doesn't. We should not care whether
or not we have a window for unrelated events anyway.
2019-08-19 13:43:40 +02:00
Andreas Kling
d5352b87b7 AudioServer: Turn ASMixer into a CObject
It was wrongly inheriting from RefCounted<AudioServer> without using
reference counting. Let's just make it a CObject instead.
2019-08-18 12:56:36 +02:00
Andreas Kling
93f14966c0 WindowServer: Make WSMenu's be children of the WSClientConnection 2019-08-18 12:05:33 +02:00
Andreas Kling
8aece8f5b7 WindowServer: Make WSCompositor the parent of its timers 2019-08-18 11:59:43 +02:00
Andreas Kling
9d57e7ed68 WindowServer: Tell WSWindows who their CObject parent is
Instead of using a weird "internal owner" pointer, just set the owning
object as the CObject::parent of WSWindow.
2019-08-18 11:52:19 +02:00
Conrad Pankoff
23b6ef29dd WindowServer: Detect framebuffer capabilities and settings
The main changes are twofold:

* Buffer flipping is now controlled by the m_screen_can_set_buffer flag
  in WSCompositor. This flag, in turn, is impacted by m_can_set_buffer
  flag, in WSScreen. m_can_set_buffer is set in the WSScreen constructor
  by checking the return value of fb_set_buffer. If the framebuffer
  supports this operation, it will succeed, and we record this fact. This
  information is then used by WSCompositor to set its own
  m_screen_can_set_buffer flag.

* WSScreen now only requests a resolution change of the framebuffer. The
  driver itself is ultimately responsible for what resolution or mode is
  actually set, so WSScreen has to read the response from that request,
  and has no choice but to accept the answer. This allows the driver to
  choose a "close enough" value to what was requested, or simply ignore
  it.

The result of this is that there is no special configuration necessary
for WindowServer to work with reduced-capability framebuffer devices.
2019-08-18 07:40:02 +02:00
Andreas Kling
c029f39895 SystemServer: Don't spawn a TTYServer on on /dev/tty0
tty0 receives input while WindowServer is up, which meant that having
a shell on tty0 would cause commands typed into Terminal to run twice,
once in Terminal's shell, and once on the tty0 shell.

Long term we shouldn't send input to any VirtualConsole while the
WindowServer is up, so this just fixes the immediate weirdness. :^)
2019-08-17 14:19:18 +02:00
Sergey Bugaev
6778abb999 Kernel+SystemServer: Mount filesystems and start TTYServer in userspace 2019-08-17 12:07:55 +02:00
Andreas Kling
f7251c74a9 WindowServer: Let's run without buffer flipping by default
Instead of having a special mode that we only use in QEMU, let's bring
ourselves closer to real hardware by not relying on the QEMU VGA card.
2019-08-16 17:07:40 +02:00
Andreas Kling
14888bd992 WindowServer: Add a mode for running without buffer flipping
We can't rely on all hardware to give us a way to flip between the back
and front buffer.

This mode should actually perform slightly better but may show some tearing
as we don't have a way to know when we're in vertical retrace.
2019-08-15 15:11:31 +02:00
Andreas Kling
af6483cabb WindowServer: Fix incorrect "window left" event after button drag
This fixes an issue where we'd send a "cursor has left the window"
message incorrectly to the client after a button was clicked and the
user moved the cursor a little without releasing the button.

The issue was that we didn't update the 'hovered_window' out param
in mouse event processing in the case where we had an active input
window set.
2019-08-12 18:36:33 +02:00
Conrad Pankoff
67a4256a98 Server: Add TTYServer, a rudimentary text console manager
This should probably call out to a login program at some point. Right now
it just puts a root terminal on tty{1,2,3}.

Remember not to leave your Serenity workstation unattended!
2019-08-12 13:52:20 +02:00
Conrad Pankoff
53ddbce0b3 Kernel: Use established device name and number for framebuffer
This is to prepare for other framebuffer implementations, for which it
would be inappropriate to use the /dev/bxvga device name.
2019-08-12 12:56:55 +02:00
Andreas Kling
028e834bb4 WindowServer: Use range-for with InlineLinkedList 2019-08-08 13:40:47 +02:00
Andreas Kling
3100e8dee5 IPCCompiler+AudioServer: Accept "//"-style comments in IPC defintions 2019-08-03 21:29:09 +02:00
Andreas Kling
8e684f0959 AudioServer: Port to the new generated IPC mechanism
Fork the IPC Connection classes into Server:: and Client::ConnectionNG.
The new IPC messages are serialized very snugly instead of using the
same generic data structure for all messages.

Remove ASAPI.h since we now generate all of it from AudioServer.ipc :^)
2019-08-03 19:49:19 +02:00
Andreas Kling
3c1bad99a2 AudioServer: Link against LibIPC
We're not using any of the functionality yet, but soon...
2019-08-03 17:25:54 +02:00
Andreas Kling
4fc15c9e6e AudioServer: The EnqueueBuffer response needs a success boolean
This was already in the current version of the code, I'm just updating
the soon-to-be-current IPC protocol version of it. :^)
2019-08-03 16:41:58 +02:00
Andreas Kling
aa8a3d4a89 IPCCompiler: Start working on a simple IPC definition language
Instead of doing everything manually in C++, let's do some codegen.
This patch adds a crude but effective IPC definition parser, along
with two initial definition files for the AudioServer's client and
server endpoints.
2019-08-03 15:17:41 +02:00
Andreas Kling
1c50dce7d2 SystemServer: Remove always-true "if (pid == 0)" check
This code should probably be structured differently to handle things
like children dying, etc. But not right now.

Found by PVS-Studio.
2019-08-01 14:08:43 +02:00
Andreas Kling
b46dbfe7e4 WindowServer: Fix bad assertion when setting wallpaper
The create_thread() syscall returns the thread ID now, not 0.
2019-07-31 18:04:06 +02:00