Much redundancy is removed from package scripts with this system.
It also supports simple dependency management, uninstalling (through
BSD ports style plist files), cleaning up after itself (with clean,
clean_dist, clean_all commands), etc.
Have these programs instantiate a GApplication to ensure they get a
connection to the WindowServer, otherwise the clipboard will not work.
Sorry Sergey! :^)
This makes it so that "on_connected" always gets called first.
Since accepted sockets are connected before construction, they have
to manually set CSocket::m_connected.
If we can't already read when we enter recvfrom() on a LocalSocket,
we'll now block the current thread until we can.
Also added a buffer_for(FileDescription&) helper so that the client
and server can share some of the code. :^)
GEventLoop was just a dummy subclass of CEventLoop anyway. The only
thing it actually did was make sure a GWindowServerConnectionw was
instantiated. We now take care of that in GApplication instead.
CEventLoop is now non-virtual and a little less confusing. :^)
1) Off-by-one in block allocation when block size != 1 KB
Due to a quirk in the on-disk layout of ext2, file systems with a block
size of 1 KB have block #1 as their first block, while all others start
on block #0.
2) We had no fallback mechanism when the preferred group was full
We now allocate blocks from the preferred block group as long as it's
possible, and fall back to a simple scan through all groups when the
preferred one is full.
Put one unused page on each side of VM allocations to make invalid
accesses more likely to generate crashes.
Note that we will not add this guard padding for mmap() at a specific
memory address, only to "mmap it anywhere" requests.
Okay, I've spent a whole day on this now, and it finally kinda works!
With this patch, CObject and all of its derived classes are reference
counted instead of tree-owned.
The previous, Qt-like model was nice and familiar, but ultimately also
outdated and difficult to reason about.
CObject-derived types should now be stored in RefPtr/NonnullRefPtr and
each class can be constructed using the forwarding construct() helper:
auto widget = GWidget::construct(parent_widget);
Note that construct() simply forwards all arguments to an existing
constructor. It is inserted into each class by the C_OBJECT macro,
see CObject.h to understand how that works.
CObject::delete_later() disappears in this patch, as there is no longer
a single logical owner of a CObject.
Since we're moving to a world of ref-counting, we can't have weird
behaviors like "windows delete themselves when you close them."
The "close app when there are no more windows" mechanism is moved
to GWindow::hide(). Now, we close the app when it has no more
windows on screen.
We were only deleting the pointee when the ObjectPtr was destroyed.
If the ObjectPtr is cleared before that, we should also delete the
pointee. This is not the most important class to get right, since
it will go away as soon as we're able to switch to RefPtr.
It's pretty confusing when a CObject is owned both by its parent-child
relationship, but also by an ObjectPtr member in the parent.
In those cases, we have to make sure we both unparent the child *and*
reove it from the ObjectPtr.
This will become a bit less confusing when ObjectPtr becomes RefPtr,
although still not crystal clear. I'm not sure what the solution is.