Commit graph

5445 commits

Author SHA1 Message Date
Andreas Kling
1726c17d0d AK: Handle LogStream operator<<(size_t)
This has been an annoyingly missing feature for some time.
2019-12-09 17:51:21 +01:00
Dan MacDonald
91fc6a056b LibC: Add PRIXPTR definition to inttypes.h 2019-12-09 16:33:14 +01:00
Andreas Kling
2e38df7bd1 Kernel: Assert that device major/minor hasn't already been registered
It would be a bug to have multiple devices with the same major/minor
so let's have an assertion for that.
2019-12-09 15:51:10 +01:00
Kevin Murphy
8621304447 WindowServer: Fix typo in drag&drop cursor rect computation :^) (#863) 2019-12-09 09:23:39 +01:00
Andreas Kling
e339c2bce8 WindowServer: Disambiguate "dragging" a bit, use "moving" more instead
Windows that are being moved around by the user are now called "moving"
windows instead of "dragging" windows, to avoid confusion with the
drag and drop stuff.
2019-12-08 23:41:02 +01:00
Andreas Kling
39c2d04a9b WindowServer: Add a dedicated drag cursor 2019-12-08 20:29:14 +01:00
Dan MacDonald
8423be2593 Ports: Update nesalizer port to use Serenity fork 2019-12-08 20:04:59 +01:00
Andreas Kling
f5dfb29607 LibGUI+WindowServer: Allow specifying an optional drag bitmap
This bitmap is displayed alongside the dragged text underneath the
mouse cursor while dragging.

This will be a perfect fit for dragging e.g files around. :^)
2019-12-08 17:08:39 +01:00
Andreas Kling
183ee5847c LibDraw: Add GraphicsBitmap::to_shareable_bitmap()
This function returns the bitmap itself if it's already backed by a
SharedBuffer object, otherwise it creates a shareable copy of itself
and returns that.
2019-12-08 17:07:44 +01:00
Andreas Kling
a7f414bba7 LibGUI+WindowServer: Start fleshing out drag&drop functionality
This patch enables basic drag&drop between applications.
You initiate a drag by creating a GDragOperation object and calling
exec() on it. This creates a nested event loop in the calling program
that only returns once the drag operation has ended.

On the receiving side, you get a call to GWidget::drop_event() with
a GDropEvent containing information about the dropped data.

The only data passed right now is a piece of text that's also used
to visually indicate that a drag is happening (by showing the text in
a little box that follows the mouse cursor around.)

There are things to fix here, but we're off to a nice start. :^)
2019-12-08 16:50:23 +01:00
Andrew Kaster
e09a02ad3f SystemMonitor: Show thread name instead of process name
Add the thread name to CThreadStatistics and display it in the
system monitor's process model instead of the process name.
2019-12-08 14:09:29 +01:00
Andrew Kaster
f67d007864 AudioServer: Set the mixer thread name to "AudioServer[mixer]" 2019-12-08 14:09:29 +01:00
Andrew Kaster
0b38a553b1 LibThread: Allow setting thread name in constructor
Thread now has an optional thread_name parameter to the consturctor
that will call pthread_setname_np if given.
2019-12-08 14:09:29 +01:00
Andrew Kaster
baf7e247e3 LibPThread: Add pthread_set/getname_np
These wrappers call the set_thread_name and get_thread_name syscalls
respectively.
2019-12-08 14:09:29 +01:00
Andrew Kaster
9058962712 Kernel: Allow setting thread names
The main thread of each kernel/user process will take the name of
the process. Extra threads will get a fancy new name
"ProcessName[<tid>]".

Thread backtraces now list the thread name in addtion to tid.

Add the thread name to /proc/all (should it get its own proc
file?).

Add two new syscalls, set_thread_name and get_thread_name.
2019-12-08 14:09:29 +01:00
Tommy Nguyen
875ab0cf10 FileManager: Add separate context menus for entries
Ref: #826

Right-clicking a directory no longer has the "Open in TextEditor" entry.
Right-clicking the directory view now allows you to create a new directory.
2019-12-08 14:07:06 +01:00
Andreas Kling
5e6368948e Ports: Remove "no-sound" patch for nesalizer
Our SDL port now has an audio backend for Serenity :^)
2019-12-08 11:54:02 +01:00
Andreas Kling
20500e2949 AudioServer: Install headers 2019-12-08 11:40:38 +01:00
Andreas Kling
7c0fb91ca4 LibAudio: Install library and headers 2019-12-08 11:40:30 +01:00
Andreas Kling
a0e38922bd Kernel: Break out of the idle loop on WaitQueue wake instead of on IRQ
Now that we have proper wait queues to drive waiter wakeup, we can use
the wake actions to break out of the scheduler's idle loop when we've
got a thread to run.
2019-12-08 00:33:35 +01:00
Andreas Kling
1f95ea1b6d Ports: Make nesalizer build look in the $SERENITY_ROOT/Root for SDL
It would be nice if we could get ports to stop detecting things in
the host system. Then we wouldn't need this kind of hackery as much.
2019-12-07 23:02:59 +01:00
Andreas Kling
cd55f76727 Shell: Use _exit() in the forked child if execvp() fails
If we can't find an executable to exec() after forking, we don't want
to run the atexit() handlers in the child process. Just use _exit()
instead to avoid this.

This was causing us to write out the shell history to ~/.history every
time a "command not found" error was printed.
2019-12-07 22:40:54 +01:00
Andreas Kling
c399abe3e2 Ports: Make nesalizer build and run (still no sound)
The "nesalizer" emulator can now play NES games on Serenity. :^)
2019-12-07 16:54:04 +01:00
Andreas Kling
1670ee5aba LibPthread: Condition variables should use CLOCK_MONOTONIC by default
It's the only clock we have at the moment, so it's a logical choice :^)
2019-12-07 16:07:48 +01:00
Andreas Kling
e7dfd40dc3 LibPthread: Mark the pthread_cond_t "waiting" flag as volatile
Oops, this is not gonna work if the compiler can optimize out all the
reads from this flag. :^)
2019-12-07 15:34:00 +01:00
Andreas Kling
96e8c8a4e5 LibPthread: Add stubs for pthread_{get,set}schedparam()
These should be the last thing needed to make SDL build with threads
support. I think we can survive just fine with stubs of these for now,
especially given that the kernel doesn't care super much about thread
priorities anyway.
2019-12-07 15:32:48 +01:00
Andreas Kling
615553be5f LibPthread: Implement simple thread-specific keys
This patch adds pthread_key_create() and pthread_{get,set}specific().
There's a maximum of 64 thread-specific keys for simplicity.

Key destructors are not invoked on thread exit.
2019-12-07 15:21:18 +01:00
Andreas Kling
2b45b7a45c LibPthread: Implement pthread_sigmask() 2019-12-07 14:52:27 +01:00
Andreas Kling
95b086f47f Kernel+LibPthread: Implement pthread_detach() 2019-12-07 14:52:27 +01:00
Andreas Kling
9ddfe694f2 LibPthread: Implement pthread_mutexattr_init() and _destroy() 2019-12-07 14:52:27 +01:00
Andreas Kling
eaab7f5672 LibPthread: Don't set errno in pthread functions
POSIX says that pthread API's don't set errno directly. If there is an
error, it should be the return value from the function instead.
2019-12-07 14:52:27 +01:00
Andreas Kling
babb726212 LibPthread: Implement pthread_mutex_trylock() 2019-12-07 14:52:27 +01:00
Andreas Kling
594c7f2d83 LibPthread: Implement pthread_self() 2019-12-07 14:52:27 +01:00
Andreas Kling
d08061103d LibPthread: Implement pthread_mutex_destroy() 2019-12-07 14:52:27 +01:00
Andreas Kling
cc1ef6dadb LibPthread: Implement condition variables
This feels like a pretty naive implementation, but I think it can work.
Basically each waiter creates an object on its stack that is then
added to a linked list inside by the pthread_cond_t.

Signalling is then done by walking the list and unsetting the "waiting"
flag on as many of the waiters as you like.
2019-12-07 14:52:27 +01:00
Andreas Kling
db2bfe14e9 LibIPC: Install libipc.a into /usr/lib 2019-12-07 14:52:27 +01:00
Максим Тарасов
3273dd0478 Ports: Add m4 port (#856) 2019-12-07 13:14:08 +01:00
Andreas Kling
c5ff0da93c ProcFS: Fix typo in /proc/net/local 2019-12-07 09:40:30 +01:00
Larkin
e5e0924c0b Ports: Use unzip to extract zips if bsdtar unavailable (#855) 2019-12-06 19:45:57 +01:00
Larkin Nickle
d14d6218d1 Ports: Add termcap port 2019-12-06 19:45:32 +01:00
Sasan Hezarkhani
8cea5c053d TextEditor: `Fix bug when document is marked dirty on open.
Currently, when `set_text()` is called on GTextDocument a change is
triggered and all clients registered get a document_did_set_text
call. This in turn causes the TextEditorWidget to mark the document
as dirty even on the first open, which makes for a weird experience.
2019-12-06 19:45:13 +01:00
Andreas Kling
f93c0dc489 LibIPC: Get client/server PIDs using getsockopt(SO_PEERCRED)
Instead of passing the PIDs back and forth in a handshake "Greet"
message, just use getsockopt(SO_PEERCRED) on both sides to get the same
information from the kernel.

This is a nice little simplification of the IPC protocol, although it
does not get rid of the handshake since we still have to pass the
"client ID" from the server to each client so they know how to refer
to themselves. This might not be necessary and we might be able to get
rid of this later on.
2019-12-06 18:39:59 +01:00
Andreas Kling
23e802518d Kernel: Add getsockopt(SO_PEERCRED) for local sockets
This sockopt gives you a struct with the PID, UID and GID of a socket's
peer process.
2019-12-06 18:38:36 +01:00
Andreas Kling
6e6e0b9de8 WindowServer: Compute some layout rects in WSMenuManager up front
Currently menu applets are laid out relative to the "audio rect" which
is the rect of the little audio muted state icon thingy.

There was an issue where applets would be placed at a negative X coord
if they were added to the WindowServer before the first time drawing
the menubar.
2019-12-05 19:59:54 +01:00
Andreas Kling
20bbeba6d5 CPUGraph: Launch the CPUGraph menu applet on startup 2019-12-05 19:44:22 +01:00
Andreas Kling
86d84f1654 WindowServer: Remove WSCPUMonitor
We'll still have a CPU graph, just not in the WindowServer process.
2019-12-05 19:43:56 +01:00
Andreas Kling
c3029a6a1f MenuApplets: Add CPUGraph, our first menu applet :^)
This implements the WSCPUMonitor functionality in a separate process.
2019-12-05 19:38:08 +01:00
Andreas Kling
44d5388e78 WindowServer: Add basic menu applet concept
It's now possible to create a little applet window that sits inside the
system's menubar. This is done using the new CreateMenuApplet IPC call.

So far, it's possible to assign a backing store ID, and to invalidate
rects for repaint. There is no way to get the events from inside the
applet just yet.

This will allow us to move the CPU graph and audio thingy to separate
applet processes. :^)
2019-12-05 19:36:01 +01:00
Andreas Kling
2d18fc8052 LibGUI: Move tooltip window rects if they don't end up on screen
This makes the quick launch button tooltips actually readable. :^)
2019-12-05 17:59:06 +01:00
Andreas Kling
e1862fe2f5 WindowServer: Move window minimize animation to a separate function
Move this from WSCompositor::compose() to a separate run_animations()
function to keep compose() readable. We might want to add some more
animations later.
2019-12-05 17:44:10 +01:00