Commit Graph

1122 Commits

Author SHA1 Message Date
joshua stein
288fa07d85 LibCore: CSocketAddress: pull in netinet/in.h 2020-01-02 04:09:56 +01:00
joshua stein
f22322a06c LibC: move in_addr and sockaddr_in to netinet/in.h 2020-01-02 04:09:56 +01:00
Andreas Kling
8c8118fbf8 WindowServer+LibGUI: Taskbar should show all windows from each process
We were not sending the ID of the window that was listening for window
management (WM) events along with the WM messages. They only included
the "target" window's ID.

Since the taskbar's single window had the first window ID for its own
connection to the WindowServer, it meant that it would only receive
WM events for the first window ID in other processes as well.

This broke when I ported WindowServer to LibIPC.

Fix this by including the WM listener ID in all WM messages, and since
we're here anyway, get rid of a bunch of unnecessary indirection where
we were passing WM events through the WindowServer event loop before
sending them to the listener.
2020-01-02 03:29:21 +01:00
Andreas Kling
9619dab727 LibGUI: Tweak GAboutDialog text 2020-01-02 02:55:10 +01:00
Andrew Kaster
331f37d1a8 LibELF: Re-organize ELFDynamicObject::load and add PLT trampoline
ELFDynamicObject::load looks a lot better with all the steps
re-organized into helpers.

Add plt_trampoline.S to handle PLT fixups for lazy loading.
Add the needed trampoline-trampolines in ELFDynamicObject to get to
the proper relocations and to return the symbol back to the assembly
method to call into from the PLT once we return back to user code.
2020-01-01 23:54:06 +01:00
Andrew Kaster
f23dc4ea69 LibELF: Call DT_INIT method now that startfiles are correct for DSOs
We weren't calling the method here before because it was ill-formed.
No start files meant that we got the front half of the init section but
not the back half (no 'ret' in _init!). Now that we have the proper
crtbeginS and crtendS files from libgcc to help us out, we can assume
that DSOs will have the proper _init method defined.
2020-01-01 23:05:17 +01:00
joshua stein
275bc0d587 LibVT: fix pixel size calculations in terminal_did_resize
The scrollbar width must be factored in, and one too many
m_line_spacing were being factored into the height.  These caused an
initial terminal opening in 80x25 to get resized right away and
shrunk down to 77x24.
2020-01-01 19:33:19 +01:00
Andreas Kling
fc86460134 AK: Move the userspace SharedBuffer from LibC to AK
This always felt out-of-place in LibC.
2020-01-01 18:53:34 +01:00
Andrew Kaster
58517bc068 LibC: Use LibELF in dlfcn.cpp to dynamically load libraries 2020-01-01 17:48:41 +01:00
Andrew Kaster
a18b37880e LibELF: Add ELFDynamicObject to dynamically load libaries
This patch also adds some missing relocation defines to exec_elf.h,
and a few helper classes/methods to ELFImage so that we can use it
for our dynamically loaded libs and not just main program images from
the kernel :)
2020-01-01 17:48:41 +01:00
Andrew Kaster
21161342ef LibELF: Replace kprintf's in ELFImage.cpp with dbgprintf
This lets us use the class in userspace
2020-01-01 17:48:41 +01:00
Andrew Kaster
96a86463dd LibC: Move __cxa_finalize and __cxa_atexit code to their own file
These guys aren't really related to initializing the C runtime,
so move them to a new fancy file named C++ abi. Or rather, cxxabi :)
2020-01-01 17:48:41 +01:00
Conrad Pankoff
3d59db4be4 LibGUI: Close and cancel GDialog on escape
This is a small usability enhancement. If you press escape with a GDialog
focused, it will now return its "Cancel" status.
2020-01-01 02:02:29 +01:00
Andreas Kling
a69734bf2e Kernel: Also add a process boosting mechanism
Let's also have set_process_boost() for giving all threads in a process
the same boost.
2019-12-30 20:10:00 +01:00
Andreas Kling
610f3ad12f Kernel: Add a basic thread boosting mechanism
This patch introduces a syscall:

    int set_thread_boost(int tid, int amount)

You can use this to add a permanent boost value to the effective thread
priority of any thread with your UID (or any thread in the system if
you are the superuser.)

This is quite crude, but opens up some interesting opportunities. :^)
2019-12-30 19:23:13 +01:00
Andreas Kling
50677bf806 Kernel: Refactor scheduler to use dynamic thread priorities
Threads now have numeric priorities with a base priority in the 1-99
range.

Whenever a runnable thread is *not* scheduled, its effective priority
is incremented by 1. This is tracked in Thread::m_extra_priority.
The effective priority of a thread is m_priority + m_extra_priority.

When a runnable thread *is* scheduled, its m_extra_priority is reset to
zero and the effective priority returns to base.

This means that lower-priority threads will always eventually get
scheduled to run, once its effective priority becomes high enough to
exceed the base priority of threads "above" it.

The previous values for ThreadPriority (Low, Normal and High) are now
replaced as follows:

    Low -> 10
    Normal -> 30
    High -> 50

In other words, it will take 20 ticks for a "Low" priority thread to
get to "Normal" effective priority, and another 20 to reach "High".

This is not perfect, and I've used some quite naive data structures,
but I think the mechanism will allow us to build various new and
interesting optimizations, and we can figure out better data structures
later on. :^)
2019-12-30 18:46:17 +01:00
Andreas Kling
816d3e6208 LibHTML: Ignore all CSS rules starting with "@" for now 2019-12-30 17:09:00 +01:00
Andreas Kling
1b2c6e8f41 LibCore: Use JsonObject::get_ptr() in CProcessStatisticsReader
This removes a bunch of JsonValue copying from the hot path in thread
statistics fetching.

Also pre-size the thread statistics vector since we know the final size
up front. :^)
2019-12-30 14:51:34 +01:00
Tibor Nagy
edc3580756 LibDraw: Store glyph spacing information in the fonts headers 2019-12-30 14:02:12 +01:00
Andreas Kling
ef658594e4 LibIPC: Let's start building custom message codecs for LibIPC
Instead of using ByteBuffer (which always malloc() their storage) for
IPC message encoding, we now use a Vector<u8, 1024>, which means that
messages smaller than 1 KB avoid heap allocation entirely.
2019-12-30 02:41:45 +01:00
Andreas Kling
57f55f297b LibGUI: Call GWidget::resize_event() before doing widget layout
The widget layout system currently works by having layouts size the
children of a widgets. The children then get resize events, giving them
a chance to lay out their own children, etc.

In keeping with this, we need to handle the resize event before calling
do_layout() in a widget, since the resize event handler may do things
that end up affecting the layout, but layout should not affect the
resize event since the event comes from the widget parent, not itself.
2019-12-30 00:26:19 +01:00
Andreas Kling
aaaf04f393 LibGUI: Relayout GTextEditor on font change
Fixes #941.
2019-12-29 23:03:41 +01:00
Andreas Kling
411d293961 LibCore+LibGUI: Don't fire timers in non-visible windows by default
LibCore timers now have a TimerShouldFireWhenNotVisible flag which is
set to "No" by default.

If "No", the timer will not be fired by the event loop if it's within
a CObject tree whose nearest GWindow ancestor is currently not visible
for timer purposes. (Specificially, this means that the window is
either minimized or fully occluded, and so does not want to fire timers
just to update the UI.)

This is another nice step towards a calm and serene operating system.
2019-12-29 16:03:36 +01:00
Andreas Kling
f8f2b8b520 LibDraw: Fix text rendering in progress bars 2019-12-29 15:53:28 +01:00
Andreas Kling
c74cde918a Kernel+SystemMonitor: Expose amount of per-process clean inode memory
This is memory that's loaded from an inode (file) but not modified in
memory, so still identical to what's on disk. This kind of memory can
be freed and reloaded transparently from disk if needed.
2019-12-29 12:45:58 +01:00
Andreas Kling
0d5e0e4cad Kernel+SystemMonitor: Expose amount of per-process dirty private memory
Dirty private memory is all memory in non-inode-backed mappings that's
process-private, meaning it's not shared with any other process.

This patch exposes that number via SystemMonitor, giving us an idea of
how much memory each process is responsible for all on its own.
2019-12-29 12:28:32 +01:00
Andreas Kling
ffbe975ffc LibHTML: RenderingContext should keep the Palette alive
We were lugging around a reference to a temporary here.
2019-12-29 12:01:24 +01:00
Andreas Kling
7b2dd7e116 LibDraw+LibGUI: Allow changing individual colors in a Palette
Palette is now a value wrapper around a NonnullRefPtr<PaletteImpl>.
A new function, set_color(ColorRole, Color) implements a simple
copy-on-write mechanism so that we're sharing the PaletteImpl in the
common case, but allowing you to create custom palettes if you like,
by getting a GWidget's palette, modifying it, and then assigning the
modified palette to the widget via GWidget::set_palette().

Use this to make PaintBrush show its palette colors once again.

Fixes #943.
2019-12-29 00:47:49 +01:00
Andreas Kling
19d4f4c7b5 LibHTML: Add missing flock to Makefile (thanks jcs) 2019-12-28 23:58:52 +01:00
Stefano Cristiano
fa8cec6627 Build: Fix missing IPC dependency for LibHTML 2019-12-28 21:43:56 +01:00
joshua stein
0b501335f5 Build: wrap make invocations with flock(1)
Lock each directory before entering it so when using -j, the same
dependency isn't built more than once at a time.

This doesn't get full -j parallelism though, since one make child
will be sitting idle waiting for flock to receive its lock and
continue making (which should then do nothing since it will have
been built already).  Unfortunately there's not much that can be
done to fix that since it can't proceed until its dependency is
built by another make process.
2019-12-28 21:09:33 +01:00
Paweł Cholewa
b5c3bc6a71 LibC: implement fgetpos and fsetpos
They're just "front ends" for ftell and fseek, but they do their
job.

Fixes #913
2019-12-27 23:09:08 +01:00
Andreas Kling
2cbc3c6ee5 LibC+ping: Let's use the traditional timersub() et al prototypes
This also fixes the build, since ping.cpp already had a timersub().
2019-12-27 23:07:28 +01:00
Hüseyin ASLITÜRK
71922ee6a5 GListView: Fix for theme support. We have to use theme colors. 2019-12-27 22:47:31 +01:00
Mauri de Souza Nunes
0e49c842de LibC: Add timeval operations
This commit add macros for the timeval operations timeradd, timersub,
timercmp, timerisset, timerclear.
2019-12-27 22:43:43 +01:00
Andreas Kling
4d997308c2 LibC: Remove some functions we had two of 2019-12-27 16:55:10 +01:00
Andreas Kling
cbdd65e4d9 LibDraw: Remove redundant Rect copy constructor 2019-12-27 16:55:10 +01:00
Valtteri Koskivuori
2b9c9bf663 LibPthread: Log debug info to debug console instead of stdout (#931) 2019-12-27 15:53:02 +01:00
Andreas Kling
159289af03 WindowServer: Use the system theme for the fallback window background
When filling in some missing part of a window (typically happens during
interactive window resize) we now use the ColorRole::Background from
the system theme palette instead of expecting the clients to send us
the same information when creating windows.
2019-12-27 13:28:55 +01:00
Andreas Kling
c7847d7c81 WindowServer+LibGUI: Mark window bitmaps volatile in occluded windows
WindowServer now tracks whether windows are occluded (meaning that
they are completely covered by one or more opaque windows sitting above
them.) This state is communicated to the windows via WindowStateChanged
messages, which then allow GWindow to mark its backing store volatile.

This reduces the effective memory impact of windows that are not at all
visible to the user. Very cool. :^)
2019-12-27 11:34:40 +01:00
Stefano Cristiano
1222b94ab8 LibCore: Allow LibCore to be compiled on macOS host
Compiling LibCore on macOS is needed if one wants to compile host tools
(like IPCCompiler) on a non Linux host.
These changes could be possibly reverted once "event loop" functionality
and "base library" (Vector, String etc.) will be split in two separate libraries,
updating all relevant projects.
2019-12-27 02:19:55 +01:00
Stefano Cristiano
aab412bd85 LibCore: Fix errors when compiling LibCore using clang instead of gcc 2019-12-27 02:19:55 +01:00
Andreas Kling
23e16a3e2e LibGUI: Remove bitrotted automatic keybinds feature
This feature hasn't been working at all for several months, so let's
just remove it and simplify GWindow event handling.
2019-12-27 00:52:30 +01:00
Shannon Booth
123b5c9d34 LibDraw: Add draw_ellipse_intersecting function
This functon will draw an ellipse which is intersecting the corners of
the rect given. It is a very naive implementation, taking 200 samples of
points around the ellipse, and drawing straight lines between each of
these points.

The ellipses look good enough to me though!
2019-12-27 00:52:17 +01:00
Andreas Kling
43da941de5 LibGUI: Use NeverDestroyed<T> for the global GWindow tables
We don't need these to be destroyed on exit, since that would race with
the destruction of static global RefPtr<GWindow>'s.

Fixes #900.
2019-12-26 22:13:50 +01:00
Shannon Booth
b830639912 PaintBrush: Add a "rectangle tool"
Fill, line, and gradient modes initially supported :^)
2019-12-26 21:22:29 +01:00
Shannon Booth
70a2355963 LibDraw: Add dx/dy_relative_to() helper functions for Points 2019-12-26 21:22:29 +01:00
Andreas Kling
519cb80a96 LibGUI+WindowServer: Mark minimized window backing stores as volatile
WindowServer will now send out a WindowStateChanged message to clients
when one of their windows is minimized.

This is then forwarded to the GWindow, which will try to mark its
underlying window backing store as volatile.

This allows the kernel to steal the memory used by minimized windows
in case it starts running low. Very cool! :^)
2019-12-26 12:06:07 +01:00
Andreas Kling
9d681beaf0 LibC: Oops x2, we can't use "bool" in stdlib.h either 2019-12-26 10:30:34 +01:00
Andreas Kling
b1fc5d9143 LibC: Oops, we can't use [[nodiscard]] when this is included from C 2019-12-26 10:24:37 +01:00