Commit graph

31 commits

Author SHA1 Message Date
Andreas Kling
1e0f9d325c LibCore: Avoid a big malloc in CIODevice's internal buffering.
This heap allocation was totally avoidable and can be replaced by a stack
buffer instead. Dodges a bunch of mmap() traffic.
2019-05-14 16:36:29 +02:00
Andreas Kling
dbf7878998 LibCore: Using printf() inside CIODevices will now call CIODevice::printf().
Well this was confusing. Obviously this code should never be calling outside
to ::printf() anyway, so just use dbgprintf() instead.
2019-05-10 18:20:54 +02:00
Andreas Kling
7ce3b10568 CIODevice: Add some basic output facilities: write() and printf().
Being able to do file.printf() is extremely comfy, I have to say. :^)
2019-05-08 04:38:41 +02:00
Andreas Kling
dd299fe51a CObject: add_child() should set the child's parent. 2019-05-05 01:09:49 +02:00
Andreas Kling
202e922ce8 CLock: Remove a redundant call to gettid(). 2019-05-01 19:11:08 +02:00
Andreas Kling
65f2f19b41 CEventLoop: Protect the message queue with a Lock. 2019-04-29 15:57:49 +02:00
Andreas Kling
0a68e0046f LibCore: Make it possible to create a CFile for an existing file descriptor. 2019-04-26 02:22:21 +02:00
Andreas Kling
57da00b731 Include Makefile.common in all other Makefiles. 2019-04-21 04:09:39 +02:00
Andreas Kling
ab94a6be00 AK: Add String::copy(BufferType) helper.
This will create a String from any BufferType that has data() and size().
2019-04-20 14:13:40 +02:00
Andreas Kling
5eedb22834 Sprinkle use of AK::Vector in various places.
Some of these are less helpful than others. Avoiding a bunch of mallocs
in the event loop wakeup code is definitely nice.
2019-04-20 14:02:19 +02:00
Andreas Kling
301a269ca0 Get rid of SERENITY macro since the compiler already defines __serenity__
This makes it a bit easier to use AK templates out-of-tree.
2019-04-20 12:58:49 +02:00
Andreas Kling
405fe4f72c LibCore: Hide deferred_invoke() debug spam. 2019-04-20 12:48:49 +02:00
Andreas Kling
9e6b0ccc0e LibCore+LibGUI: Make CObject child events synchronous.
...and then make GWidget layout invalidation lazy. This way we coalesce
multiple invalidations into a single relayout and we don't have to worry
about child widgets not being fully constructed.
2019-04-18 22:57:24 +02:00
Andreas Kling
3b986da643 CEventLoop: Don't call gettimeofday() at all if there are no timers. 2019-04-18 13:23:59 +02:00
Andreas Kling
d73ed74d1c LibCore: Add CTimer::restart() and make set_interval() take effect soon. 2019-04-18 04:38:04 +02:00
Andreas Kling
7b3876383f LibCore: CIODevice::seek() should reset EOF state. 2019-04-18 02:09:15 +02:00
Andreas Kling
8e0611201e CEventLoop: Consolidate gettimeofday() syscalls. 2019-04-18 01:37:23 +02:00
Andreas Kling
04500c1ae2 GWidget: Add some new child z-ordering facilities.
- child_at(Point)
- move_to_front()
- move_to_back()
- is_frontmost()
- is_backmost()

This patch also makes it possible to receive the mouse event that triggers
a context menu before the context menu is shown. I'm not sure this is the
best design for context menus but it works for now.
2019-04-16 03:47:55 +02:00
Andreas Kling
b5759089d8 LibCore: Add CIODevice::seek(). 2019-04-16 00:51:05 +02:00
Andreas Kling
bc5148354f LibCore: Add a CConfigFile class, a simple INI file parser.
You open the configuration for an app like so:

    auto config = CConfigFile::get_for_app("MyApp");

This will then open ~/MyApp.ini and parse it for you.
Immediately start using it in Minesweeper to load the field size and mine
count from a config file.
2019-04-15 02:23:20 +02:00
Andreas Kling
a3e8fc3d9c LibCore: Add a convenience constructor for CTimer.
new CTimer(250, [] { thing_to_do_every_250_msec(); });
2019-04-14 05:44:15 +02:00
Andreas Kling
47a2982119 LibCore: Move LibGUI/GTimer to LibCore/CTimer. 2019-04-12 00:09:45 +02:00
Andreas Kling
667e678aa6 LibCore: Prune remaining knowledge about LibGUI. 2019-04-12 00:03:21 +02:00
Andreas Kling
d8e1545783 LibCore: Move LibGUI/GLock to LibCore/CLock. 2019-04-10 22:39:59 +02:00
Andreas Kling
ab1c84cf53 LibCore: Move HTTP classes from LibGUI to LibCore. 2019-04-10 22:28:10 +02:00
Andreas Kling
cfd6e6cc36 LibCore: Move GIODevice hierarchy from LibGUI to LibCore. 2019-04-10 20:22:23 +02:00
Andreas Kling
fc1d3074de LibCore: Move LibGUI/GNotifier to LibCore/CNotifier. 2019-04-10 17:35:43 +02:00
Andreas Kling
b2542414d7 LibCore: Add CEventLoop and make LibGUI/GEventLoop inherit from it.
This is shaping up to be quite nice.
2019-04-10 17:30:58 +02:00
Andreas Kling
2f1f51b8ab LibCore: Move LibGUI/GObject to LibCore/CObject. 2019-04-10 17:01:54 +02:00
Andreas Kling
b8062f69d8 LibCore: Add CEvent and make LibGUI/GEvent inherit from it. 2019-04-10 16:56:55 +02:00
Andreas Kling
5e0577a042 Introduce LibCore and move GElapsedTimer => CElapsedTimer.
I need a layer somewhere between AK (usable both by userspace and kernel)
and LibGUI (usable by userspace except WindowServer.) So here's LibCore.
2019-04-10 16:14:44 +02:00