Commit Graph

1001 Commits

Author SHA1 Message Date
Sergey Bugaev
b64cee4589 LibC: Remove a leftover default_stream
Long ago, there was a fourth stdio default stream, stddbg, connected to the
debug console. It has since been replaced by the dbgputstr() and dbgputch()
syscalls.

3fce2fb205

Remove the last remains of stddbg, as fd 3 is soon going to be reused for socket
takeover.
2019-11-26 19:58:25 +01:00
Andreas Kling
aa49419173 LibCore: Make CFile::open() truncate when opening something "WriteOnly"
Unless we're also opening to append (and/or if the file is required to
be a new file), CFile::open(WriteOnly) will now truncate the file.
2019-11-26 14:32:59 +01:00
Andreas Kling
6d1c4ae5a9 LibHTML: Implement basic <form> and <input> element support
This patch adds "submit" inputs and default (text box) inputs, as well
as form elements that can be submitted.

Layout of input elements is implemented via a new LayoutWidget class
that allows you to put an arbitrary GWidget in the layout tree.
At the moment, the DOM node sets the initial size of the LayoutWidget,
and then the positioning is done by the normal layout algorithm.

We also now support submitting a <form method="GET">, which does a full
replacing load with a URL based on the form's action + a query string
built from the name/value of input elements within the submitted form.

This is pretty neat! :^)
2019-11-25 21:21:55 +01:00
Andreas Kling
8dc6f7cd4f LibHTML: Give Frame a (weak) back-pointer to the HtmlView
This will be the official path from DOM/layout code to the HtmlView
for now. Perhaps in the future we will have a fancier abstraction.
2019-11-25 21:19:21 +01:00
Andreas Kling
94bc46ee70 LibHTML: Improve CSS parser's handling of values somewhat
Now we just skip over url() and rgb() instead of crashing on them.
2019-11-25 20:04:04 +01:00
Andreas Kling
847b232680 LibHTML: Divide the "line spacing" evenly between lines of text
Before this patch, all of the excess spacing caused by line-height was
"padding" the line boxes below the text.

To fix this, we make line box fragments use the font height as their
height, and then let the inline layout algorithm adjust the Y positions
to distribute the vertical space.
2019-11-25 18:14:52 +01:00
Andreas Kling
320c79cb48 LibHTML: Join border edges nicely when painting boxes
Always paint border edges so they join nicely with their buddy edges.
This makes borders look nice even if all sides have different widths.

Also switch the border code to using floating point numbers since
otherwise things get very ugly very fast.
2019-11-25 14:37:04 +01:00
Andreas Kling
05b1ecf1b1 LibHTML: Draw each CSS border edge separately with their own style
The borders still look very wrong with any border-width other than 1,
but at least we can see that they have the right color, and end up in
mostly the right place :^)
2019-11-25 13:17:14 +01:00
Andreas Kling
e691d16f1c LibHTML: Decrement the pending loads counter when a load finishes
This ensures that the browser statusbar shows the correct number of
still pending resource loads.
2019-11-25 11:47:25 +01:00
Andreas Kling
7ef51293c7 LibVT: Unbreak semi-transparent terminal background painting
I broke semi-transparent terminals when I added support for alpha
blending to Painter::fill_rect().

When we fill the terminal widget background, we don't want blending to
take place, we're just looking to replace with an exact color, so now
we can use Painter::clear_rect() for that.
2019-11-25 11:35:52 +01:00
Andreas Kling
c645d9fe4a LibDraw: Add Painter::clear_rect() for filling a rect without blending
Sometimes you want to fill a rect with a specific color without alpha
blending it with whatever's already there.
2019-11-25 11:34:55 +01:00
Andreas Kling
5036b888ac LibHTML: Store the HTML parser input along with the created Document
This will allow us to "view source" later on, long after parsing has
finished and turned it into a DOM.
2019-11-25 00:27:41 +01:00
Andreas Kling
0d2659c0a2 LibHTML: Use LibProtocol for HTTP requests :^)
This moves all of the browser networking to ProtocolServer.
2019-11-24 14:24:59 +01:00
Andreas Kling
653e61d9cf LibProtocol: Add a Download object so users don't have to manage ID's
LibProtocol::Client::start_download() now gives you a Download object
with convenient hooks (on_finish & on_progress).

Also, the IPC handshake is snuck into the Client constructor, so you
don't need to perform it after instantiating a Client.

This makes using LibProtocol much more pleasant. :^)
2019-11-24 13:22:01 +01:00
Andreas Kling
35c26a06fc LibCore: Move puff() from LibDraw to LibCore
Since it's used both by CGzip and PNGLoader, it seems most appropriate
to keep this in LibCore.
2019-11-23 23:43:37 +01:00
Andreas Kling
eb85103271 ProtocolServer: Send the download payload to clients as a shared buffer
The DownloadFinished message from the server now includes a buffer ID
that can be mapped into the client program.

To avoid prematurely destroying the buffer, the server will hang on to
it until the client lets it know that they're all good. That's what the
ProtocolServer::DisownSharedBuffer message is about.

In the future it would be nice if the kernel had a mechanism to allow
passing ownership of a shared buffer along with an IPC message somehow.
2019-11-23 22:11:44 +01:00
Andreas Kling
fd4349a9f2 ProtocolServer+LibProtocol: Introduce a server for handling downloads
This patch adds ProtocolServer, a server that handles network requests
on behalf of its clients. The first protocol implemented is HTTP.

The idea here is to use a plug-in architecture where any number of
protocols can be added and implemented without having to mess around
with each client program that wants to use the protocol.

A simple client API is provided through LibProtocol::Client. :^)
2019-11-23 21:50:32 +01:00
Andreas Kling
20c957ef61 LibCore: Have CNetworkJob protect itself during the on_finish callback
Otherwise, the callback may trigger the destruction of the CNetworkJob
and make it difficult to continue execution correctly.
2019-11-23 21:42:02 +01:00
Andreas Kling
fc14bdd442 LibGUI: Don't recompute line-wrapping over and over during set_text()
This makes the TextEditor start up fast for large files again.
2019-11-23 17:41:14 +01:00
Andreas Kling
84cb91de38 AudioServer: Broadcast muted state changes to all clients 2019-11-23 17:21:12 +01:00
Andreas Kling
00ab9488ad LibDraw: Start work on a GIF decoder (not yet functional!)
Here comes the first part of a GIF decoder. It decodes up to the point
of gathering all the LZW-compressed data. The next step is to implement
decompression, and then turn the decompressed data into a bitmap using
the color maps, etc.
2019-11-23 16:50:21 +01:00
Andreas Kling
630d5b3ffd LibIPC+AudioServer: Allow unsolicited server-to-client IPC messages
Client-side connection objects must now provide both client and server
endpoint types. When a message is received from the server side, we try
to decode it using both endpoint types and then send it to the right
place for handling.

This now makes it possible for AudioServer to send unsolicited messages
to its clients. This opens up a ton of possibilities :^)
2019-11-23 16:50:21 +01:00
Andreas Kling
5a84944dc8 LibVT: Don't scroll to bottom for Ctrl/Alt/Shift
It's nice that we scroll the cursor into view when typing in a terminal
but it's not necessary when pressing only Ctrl, Alt of Shift.
2019-11-23 16:50:21 +01:00
Andreas Kling
107011f119 AudioServer: Allow muting the system audio
This patch adds muting to ASMixer, which works by substituting what we
would normally send to the sound card with zero-filled memory instead.
We do it this way to ensure that the queued sample buffers keep getting
played (silently.)

This is obviously not the perfect way of doing this, and in the future
we should improve on this, and also find a way to utilize any hardware
mixing functions in the sound card.
2019-11-22 21:44:02 +01:00
Andreas Kling
61ba19f031 LibHTML: Handle stand-alone attribute selectors
A selector like "[foo]" is now parsed as a universal selector component
with an attribute match type. Pretty neat :^)
2019-11-21 20:19:00 +01:00
Andreas Kling
c02f560f73 LibHTML: Parse <element attribute=value> correctly
We were not committing the attribute at all in this case.
2019-11-21 20:18:18 +01:00
Andreas Kling
8946e50986 LibHTML: Implement some attribute selector support
This patch adds a[foo] and a[foo=bar] attribute selectors.

Note that an attribute selector is an optional part of a selector
component, and not a component on its own.
2019-11-21 20:07:43 +01:00
Andreas Kling
54a6ae9201 LibHTML: Make the HTML parser handle <div attr> and <div attr="">
We were not producing the correct DOM attribute in either of those
cases. "<div attr>" would produce no attribute, and the other would
produce an attribute with null value (instead of an empty value.)
2019-11-21 20:06:10 +01:00
Andreas Kling
9f0ca1bfb0 LibHTML: Paint text background color before the underline decoration 2019-11-21 13:15:11 +01:00
Till Mayer
b0b523e973 FileManager: Added properties dialog
The user can rename files, change the permissions and view different
properties of the file.
2019-11-20 23:23:57 +01:00
Andreas Kling
e630ad5927 GTableView: Don't allow resizing columns to a negative width
This is definitely not perfect but better than letting you put the
GTableView into a weird state with negative column widths. :^)
2019-11-20 22:27:12 +01:00
Andreas Kling
e08d605f72 GTableView: Don't hover-highlight unsortable column headers
The hover highlight is meant to indicate that the button is pressable.
Non-sortable columns are not pressable.
2019-11-20 22:23:51 +01:00
Andreas Kling
16c290e8d5 GTableView: Highlight the hovered column header
This makes it feel even *more* like a proper button.
2019-11-20 22:19:30 +01:00
Andreas Kling
191535d626 LibGUI: Make the GTableView column headers behave like proper buttons
Previously they would resort based on the column immediately when you
mousedown on them. Now we track the click event and show the header
in a pressed state, etc. The usual button stuff :^)
2019-11-20 22:11:43 +01:00
Andreas Kling
0b0017bbbd LibGUI: Make the GTableView row background colors a little brighter
This has been bothering me for a long time.. :^)
2019-11-20 21:52:34 +01:00
Andreas Kling
386bf8b763 LibVT: Don't implicitly copy the selection on double-click or mouse-up 2019-11-20 21:47:12 +01:00
Andreas Kling
dabdd484f7 LibVT: Add a context menu to TerminalWidget
Starting with only the copy and paste actions. But I'm sure we can come
up with some more things to put here. :^)
2019-11-20 21:47:12 +01:00
Andreas Kling
dbf8d6bc1e Terminal+LibVT: Switch Terminal to using explicit copy/paste actions
Instead of implicitly copying whatever you select, and pasting when you
middle-click, let's have traditional copy and paste actions bound to
Ctrl+Shift+C and Ctrl+Shift+V respectively.
2019-11-20 21:47:12 +01:00
Andreas Kling
6fa26c73e2 LibVT: Use the middle mouse button for pasting (instead of right)
This will allow us to show a context menu when you right-click,
which will feels more consistent with the rest of the Serenity desktop.
2019-11-20 21:47:12 +01:00
Andreas Kling
9a6388f718 LibHTML: Render a background-color behind line box fragments if needed 2019-11-19 19:23:14 +01:00
Andreas Kling
5a04472470 LibHTML: Fix bug in removal of trailing whitespace from line boxes
This code was using the text from the DOM as a reference for how much
whitespace to remove from the end of a line box.

Since the DOM may contain uncollapsed whitespace, it would sometimes
be out of sync with the collapsed text used by the rest of the layout
system.
2019-11-19 19:21:47 +01:00
Andreas Kling
1fe2cca439 LibHTML: Use LayoutText::text_for_rendering() in layout tree dumps
This way the fragment offsets make a lot more sense, since they assume
whitespace has already been collapsed.
2019-11-19 18:36:33 +01:00
Andreas Kling
dce7646882 LibHTML: Failed font lookups should use a bold fallback when fitting
If we fail to find the font specified by a page, but we do have some
font-weight information, use a bold fallback font for bold weights.
2019-11-19 18:23:58 +01:00
Andreas Kling
1fd5869490 LibHTML: Tolerate empty CSS rules
A rule that contains nothing but whitespace is still a valid rule.
2019-11-19 18:23:18 +01:00
Andreas Kling
56dad2272c LibHTML: Implement the universal selector ("*") 2019-11-19 18:23:09 +01:00
Andreas Kling
516708aab2 LibHTML: Don't crash when stringifying an unknown CSS property
Instead, just log that it happened, and then we can track it down.
2019-11-19 18:21:12 +01:00
Andreas Kling
e87b9e2d7c LibHTML: Add the CSS "position" property to CSS/Properties.json 2019-11-19 18:20:54 +01:00
Andreas Kling
0405ab91aa LibHTML+AK: Move URL completion from Document to AK::URL
Completing a relative URL based on a base URL seems like generally
useful functionality.
2019-11-19 17:46:36 +01:00
Andreas Kling
0ddde627b1 Lagom: Fix build 2019-11-19 11:14:26 +01:00
Andreas Kling
a12292bd03 LibHTML: LayoutImage should not dereference a null bitmap
This was happening when trying to render a bitmap that we couldn't
decode properly.
2019-11-18 20:26:32 +01:00
Andreas Kling
89a0d873ba LibHTML: Update tree dumping code now that everything is floating point 2019-11-18 20:26:15 +01:00
Andreas Kling
c8e02e60a6 HackStudio+LibGUI: Implement matching curly brace highlighting
This works for C++ syntax highlighted text documents by caching the C++
token type in a new "arbitrary data" member of GTextDocumentSpan.

When the cursor is placed immediately before a '{' or immediately after
a '}', we highlight both of these brace buddies by changing their
corresponding spans to have a different background color.

..and spans can also now have a custom background color. :^)
2019-11-18 19:10:06 +01:00
Andreas Kling
5f7f97355e LibDraw: Add named colors "MidCyan" and "DarkCyan"
I need these for .. a thing. :^)
2019-11-18 19:02:10 +01:00
Andreas Kling
b7a840fd0d LibHTML: Respect the line-height property if set
It's now possible to override the line-height via CSS. It will still
default to 1.4 if not specified.
2019-11-18 16:54:20 +01:00
Andreas Kling
a14cc573b0 LibHTML: Implement some basic floating point CSS value parsing 2019-11-18 16:54:03 +01:00
Andreas Kling
c628ebda0f LibHTML: Use floating point numbers throughout the layout tree 2019-11-18 16:30:18 +01:00
Andreas Kling
da23864c8d LibHTML: Let's just build host-side tools in makeall.sh instead
Instead of trying to build the host-side code generator helpers right
before we need them in the LibHTML build process, just build them ahead
of time in makeall.sh, like we already do for {IPC,Form}Compiler.
2019-11-18 16:30:18 +01:00
Andreas Kling
85d7afb6df LibHTML: Make all .cpp files implicitly depend on the generated sources
Hopefully this will make Travis generate sources before building all
the other files.
2019-11-18 15:36:30 +01:00
Andreas Kling
a116a4a180 LibHTML: Get rid of dual Makefile setup
It's no longer possible to build LibHTML on the host machine since it
depends on LibGUI now. This patch gets rid of the dual Makefiles in
LibHTML since we only support Serenity builds anyway.

Also clean the code generator directory before building it.
2019-11-18 14:51:46 +01:00
Andreas Kling
1309c45cc6 LibHTML: Fix code generator dependencies for initial build
Fixes #796.
2019-11-18 13:09:33 +01:00
Andreas Kling
040fee370d LibHTML: Expand the "padding" shorthand property
This expands in the same way as "margin".
2019-11-18 12:34:52 +01:00
Andreas Kling
b08de46480 LibHTML: Implement basic 'max-width' and 'min-width' support
These CSS properties constrain the computed width of a block-level box
to a maximum, followed by a minimum value.

This makes the "better mother fricken website" look more like it's
intended to (which helps makes the author's point, I suppose.)
2019-11-18 12:26:08 +01:00
Andreas Kling
df16c9676b LibHTML: Tolerate "px" suffix on CSS lengths
We only support "px" units (and "auto") but we shouldn't choke just
because someone actually says "10px" instead of just "10"
2019-11-18 12:15:23 +01:00
Andreas Kling
00d171e4d6 LibHTML: Implement the "margin" shorthand property
This is a very bulky way of doing this, and doesn't seem sustainable to
implement every shorthand property this way, but it's a place to start.

The "margin" CSS property now expands into its four longhands as far as
my understanding of the specs.

Note that shorthand expansion happens when we *resolve* style, not when
we parse CSS. I'm not sure this is correct anymore, I think other UA's
may actually expand shorthands into the declaration directly at parse
these days. If so, we should do this at parsing as well.
2019-11-18 11:51:02 +01:00
Andreas Kling
e6e41e4fb8 LibHTML: Start building a simple code generator for CSS properties
Code for parsing and stringifying CSS properties is now generated based
on LibHTML/CSS/Properties.json

At the moment, the file tells us three things:

- The name of a property
- Its initial value
- Whether it's inherited

Also, for shorthand properties, it provides a list of all the longhand
properties it may expand too. This is not actually used in the engine
yet though.

This *finally* makes layout tree dumps show the names of CSS properties
in effect, instead of "CSS::PropertyID(32)" and such. :^)
2019-11-18 11:48:41 +01:00
Andrew Kaster
618aebdd8a Kernel+LibPthread: pthread_create handles pthread_attr_t
Add an initial implementation of pthread attributes for:
  * detach state (joinable, detached)
  * schedule params (just priority)
  * guard page size (as skeleton) (requires kernel support maybe?)
  * stack size and user-provided stack location (4 or 8 MB only, must be aligned)

Add some tests too, to the thread test program.

Also, LibC: Move pthread declarations to sys/types.h, where they belong.
2019-11-18 09:04:32 +01:00
Dan MacDonald
aae26a3a1e LibC: Add O_ACCMODE to fcntl.h 2019-11-18 08:55:45 +01:00
Andreas Kling
9c35feb14c LibC: jmp_buf and sigjmp_buf should be distinct types
This makes it possible to build 'vim' with more features enabled.
2019-11-17 21:01:26 +01:00
Andreas Kling
5eef2f78b0 LibC: isatty() should return 1 for success, 0 for error 2019-11-17 20:11:56 +01:00
Andreas Kling
3da6d89d1f Kernel+LibC: Remove the isatty() syscall
This can be implemented entirely in userspace by calling tcgetattr().
To avoid screwing up the syscall indexes, this patch also adds a
mechanism for removing a syscall without shifting the index of other
syscalls.

Note that ports will still have to be rebuilt after this change,
as their LibC code will try to make the isatty() syscall on startup.
2019-11-17 20:03:42 +01:00
Andreas Kling
e34ed04d1e Kernel+LibPthread+LibC: Create secondary thread stacks in userspace
Have pthread_create() allocate a stack and passing it to the kernel
instead of this work happening in the kernel. The more of this we can
do in userspace, the better.

This patch also unexposes the raw create_thread() and exit_thread()
syscalls since they are now only used by LibPthread anyway.
2019-11-17 17:29:20 +01:00
Andreas Kling
6685be36a0 LibDraw: Add Rect::from_two_points(Point, Point)
This returns the rectangle between two given Points. Thanks Owlinator
for suggesting this much easier way of doing it :^)
2019-11-17 16:37:42 +01:00
Andreas Kling
32ff660aa5 LibC: Oopsie, add the missing semicolons to __bswap32() and __bswap64()
Well that was a lot of flailing around.
2019-11-17 15:37:46 +01:00
Andreas Kling
31447d58fb LibC: Add back __bswap{16,32,64}() to endian.h 2019-11-17 14:34:40 +01:00
Andreas Kling
5f459ee929 LibC: Unbreak endian.h
There were some missing semicolons so this file didn't compile.
Also add some macro paranoia parentheses while we're here.
2019-11-17 12:53:50 +01:00
Andreas Kling
794758df3a Kernel: Implement some basic stack pointer validation
VM regions can now be marked as stack regions, which is then validated
on syscall, and on page fault.

If a thread is caught with its stack pointer pointing into anything
that's *not* a Region with its stack bit set, we'll crash the whole
process with SIGSTKFLT.

Userspace must now allocate custom stacks by using mmap() with the new
MAP_STACK flag. This mechanism was first introduced in OpenBSD, and now
we have it too, yay! :^)
2019-11-17 12:15:43 +01:00
Andreas Kling
89c0b158da LibDraw: Add support for colors with alpha in Painter::fill_rect()
This code is naive, but it works and looks okay. :^)
2019-11-16 19:26:17 +01:00
Andreas Kling
196b64c0ae LibC: Move realpath() to <stdlib.h> 2019-11-16 17:29:09 +01:00
Andreas Kling
fbcab844de LibC: Move the creat() and open() families to <fcntl.h>
Since POSIX says that's where they belong :^)
2019-11-16 17:29:09 +01:00
Ørjan Malde
84bedd5528 LibC: use GCC __builtin_bswap{16,32,64} to provide __bswap functions 2019-11-16 17:17:26 +01:00
Ørjan Malde
a55fb98d0a LibC: fix arpa/inet.h guards 2019-11-16 16:27:48 +01:00
Ørjan Malde
faff1361c3 LibC: properly populate endian.h 2019-11-16 16:27:48 +01:00
Brandon Scott
3069988a75 LibC: Implemented getc_unlocked, stubbed flockfile
Implemented getc_unlocked and stubbed out flockfile() and funlockfile().
2019-11-16 12:50:50 +01:00
Brandon Scott
bda36853c9 LibC: Implemented mkstemp in stdlib
Implemented mkstemp method in stdlib.
2019-11-16 12:50:50 +01:00
Brandon Scott
48b1c82d53 LibC: Added missing signal flags
Added missing signal flags to signal.h
2019-11-16 12:50:50 +01:00
Brandon Scott
f999e30afd LibC: Added execlp method and new pathconf setting
Added execlp method, and _PC_PIPE_BUF setting to pathconf method.
2019-11-16 12:50:50 +01:00
Brandon Scott
eb719aa726 LibC: Added some missing directory type constants
Added some missing directory type constants to dirent.h
2019-11-16 12:50:50 +01:00
Brandon Scott
57eb37160c LibC: Added additional fields to lconv struct
Added some additional fields to the lconv structure that were missing
and set all their defaults.
2019-11-16 12:50:50 +01:00
Andreas Kling
66a2b582c3 LibPthread: Implement a basic first pthread mutex
This patch adds these API's:

- pthread_mutex_init()
- pthread_mutex_lock()
- pthread_mutex_unlock()

No mutex attributes are supported yet, so we only do the simplest mutex
wihout recursive locking.
2019-11-16 12:23:36 +01:00
Rok Povsic
95df049071 Terminal: Add selecting whole line on triple click
The line is also added to clipboard
2019-11-15 23:58:06 +01:00
Andreas Kling
57f7009b9e GTextEditor: Allow GTextDocumentSpans to be "skippable"
Setting the is_skippable flag on a GTextDocumentSpan will now cause the
cursor to skip over that span when moving with Ctrl+Left/Right.
2019-11-15 21:03:15 +01:00
Andreas Kling
27a30fdc2a GTextEditor: Allow moving the cursor span-wise with Ctrl+Left/Right
This allows you to move token by token when using HackStudio to edit
a C++ file.

Fixes #767.
2019-11-15 21:02:24 +01:00
ctfloyd
a3520bfdfd GTextEditor: Alt+Shift+S alphabetically sorts selected lines 2019-11-15 21:01:12 +01:00
Andreas Kling
69efa3f630 Kernel+LibPthread: Implement pthread_join()
It's now possible to block until another thread in the same process has
exited. We can also retrieve its exit value, which is whatever value it
passed to pthread_exit(). :^)
2019-11-14 20:58:23 +01:00
Till Mayer
00e56cda0c LibC: open/openat: Make sure path is not a nullptr before dereferencing
open and openat both try to get the length of the path string. When
the path was a nullptr, strlen tried to dereference it, causing a
segfault.
2019-11-14 08:32:03 +01:00
Andreas Kling
69ca9cfd78 LibPthread: Start working on a POSIX threading library
This patch adds pthread_create() and pthread_exit(), which currently
simply wrap our existing create_thread() and exit_thread() syscalls.

LibThread is also ported to using LibPthread.
2019-11-13 21:49:24 +01:00
Andreas Kling
812ee330e6 GTreeView: Make it possible to multi-select with the Ctrl modifier 2019-11-11 22:20:02 +01:00
Andreas Kling
524da0ad01 LibGUI: Add "Vector<GWidget*> GWidget::child_widgets()"
This is quite inefficient since it constructs a new Vector each time.
2019-11-11 22:20:02 +01:00
Andreas Kling
3ef287eb9f GTreeView: Always repaint in response to did_update_model()
This could definitely be more efficient, but this is more correct than
doing nothing at all. :^)
2019-11-11 22:20:02 +01:00
Emanuel Sprung
e7affa24dc LibC, LibM: Add functions needed to compile python3 2019-11-11 22:04:16 +01:00
Andreas Kling
dd2900eda0 Launcher: Remove the Launcher app, and all hacks in support of it
The Launcher's functionality has been replaced by the app shortcuts in
the system menu.

There were various window management hacks to ensure that the launcher
stayed below all other windows while also being movable, etc.
2019-11-11 13:13:08 +01:00
Andreas Kling
37329f829b LibCore: Add CConfigFile::open() for opening an arbitrary INI file 2019-11-11 13:13:08 +01:00
Andreas Kling
cab9933834 GToolBar: Make buttons exclusive if action belongs to exclusive group
This was probably what I had originally intended when I first wrote the
GActionGroup stuff, but it seems to have been forgotten.
2019-11-10 22:49:02 +01:00
Andreas Kling
5951c7ca05 LibC: Add strtok_r() and make strtok() a wrapper around it 2019-11-10 21:19:08 +01:00
masi456
7e7451c427 WindowServer: Don't de-maximize windows immediately (#756)
At least 5 pixels of dragging in some direction needed until a window
gets de-maximized.
2019-11-10 18:28:01 +01:00
Andreas Kling
18348cebf1 Kernel+LibC: Implement the openat() syscall
POSIX's openat() is very similar to open(), except you also provide a
file descriptor referring to a directory from which relative paths
should be resolved.

Passing it the magical fd number AT_FDCWD means "resolve from current
directory" (which is indeed also what open() normally does.)

This fixes libarchive's bsdtar, since it was trying to do something
extremely wrong in the absence of openat() support. The issue has
recently been fixed upstream in libarchive:

https://github.com/libarchive/libarchive/issues/1239

However, we should have openat() support anyway, so I went ahead and
implemented it. :^)

Fixes #748.
2019-11-10 13:51:27 +01:00
Andreas Kling
4f27745136 LibC: Implement a very naive mbtowc()
This just copies the short char into the wide char without any decoding
whatsoever. A proper implementation should look at the current LC_CTYPE
and implement multi-byte decoding.
2019-11-10 13:46:52 +01:00
Andreas Kling
12e0fab580 LibC: iconv.h needs stddef.h for size_t 2019-11-10 13:07:51 +01:00
Andreas Kling
528e6b27f6 Terminal: Clip out the scrollbar when painting the terminal buffer
This avoids the terminal background color sometimes flashing through
the scrollbar for a brief moment.
2019-11-10 13:00:03 +01:00
Andreas Kling
3a01df9fb1 GWidget: Fix accidentally ignored set_relative_rect() with empty size
To protect the layout system from negative input values, we were using
an empty Rect() whenever an empty rect (width/height <= 0) was provided
to set_relative_rect().

This caused Terminal's scrollbar code to fail, since it relies on first
setting only the scrollbar width on startup, and then setting up the
proper geometry in response to the initial resize event.

Fixes #753.
2019-11-10 12:57:37 +01:00
Andreas Kling
ca538b6cee LibGUI: Add a simple GWidget class registry/factory
You can now register a GWidget subclass with REGISTER_GWIDGET(class)
and it will be available for factory construction through the new
GWidgetClassRegistration interface.

To obtain a GWidgetClassRegistration for a given class name, you call
GWidgetClassRegistration::find(class_name). You can also iterate over
all the registered classes using GWCR::for_each(callback).

This will be very useful for implementing a proper GUI designer, and
also in the future for things like script bindings.

NOTE: All of the registrations are done in GWidget.cpp at the moment
since I ran into trouble with the fricken linker pruning the global
constructors this mechanism relies on. :^)
2019-11-10 12:57:37 +01:00
Marcel Schneider
a353d16ff4 LibCore: Rename class Gzip -> CGZip 2019-11-10 12:52:23 +01:00
Marcel Schneider
c40935e79f LibCore: Add Content-Encoding handling to CHttpJob 2019-11-10 12:52:23 +01:00
Marcel Schneider
4fe5503b17 LibCore: Add a gzip implementation 2019-11-10 12:52:23 +01:00
Andreas Kling
bbc2f5205f LibC: Fix wrong syscall identifier for shm_unlink()
I renamed "shm_close" to "shm_unlink" since there's no such thing as
shm_close(), but forgot to update LibC, oops!
2019-11-09 22:42:54 +01:00
Andreas Kling
874ebbe4a5 LibC: shm_unlink() was making an unlink() syscall internally
I guess that tells us how well-tested the SHM implementation is.
2019-11-09 22:42:19 +01:00
Paweł Cholewa
c2a8c4cedd LibC: Minor changes to make nasm work
* Added some missing macros to headers
 * Stubbed strftime() time function to not assert
 * Added "rt" mode to fopen(), working just like "r" or "rb"
2019-11-09 20:52:34 +01:00
Andreas Kling
70a4678d77 LibHTML: Paint a magenta rectangle around the currently inspected node
Document now tracks one "inspected" node, set by set_inspected_node()
which is called by Browser's DOM inspector view on_selection callback.
2019-11-09 11:58:50 +01:00
Andreas Kling
7fcb21c935 LibHTML: Add document icon in DOMTreeModel and keep document alive 2019-11-09 11:58:20 +01:00
Andreas Kling
29b2117564 LibGUI: Make GTreeView fire the on_selection hook
GTreeView was forgetting to call to base in did_update_selection().
This prevented GAbstractView from firing the on_selection hook and we
ended up with only the on_selection_change hook firing.
2019-11-09 11:57:08 +01:00
Andreas Kling
ce9b9c129d LibGUI: Include internal_data() in GModelIndex LogStream output 2019-11-09 11:56:28 +01:00
Andreas Kling
e3d975e943 LibHTML+Browser: Add a simple DOM inspector popup window
LibHTML now provides a DOMTreeModel which can be used to view a given
Document's DOM tree. :^)
2019-11-09 11:31:03 +01:00
Rhin
503fe37eaa TextEditor: Enable/disable undo & redo buttons based on availability (#740) 2019-11-09 08:50:39 +01:00
Andreas Kling
e52fe07d2e GTableView: Paint with white background when model-less
This matches the behavior of GTreeView.
2019-11-09 00:41:00 +01:00
Andreas Kling
d22d9874f7 LibGUI: Allow overriding the button size when constructing GToolBar
This makes it easy to create a toolbar housing buttons of a size other
than 16x16.
2019-11-09 00:41:00 +01:00
Andreas Kling
0d2495e4e7 LibGUI: Allow construction of vertical GToolBars
There's currently a small paint glitch for vertical toolbars due to the
way StylePainter::paint_surface() draws a MidGray line at the bottom of
whatever a "surface" is supposed to be.
2019-11-09 00:41:00 +01:00
Andreas Kling
fa77a57257 GTextEditor: Allow moving the selected line(s) up/down in bulk
You can now press Ctrl+Shift+Up/Down in a GTextEditor and the currently
selected line(s) will all move together one step up/down.

If there is no selection, we move the line with the cursor on it. :^)
2019-11-08 20:14:42 +01:00
Andreas Kling
c16b1a515e GTextEditor: Add a way to flush any pending on_change notifications
Since on_change handlers can alter the text document we're working on,
we have to make sure they've been run before we try looking at spans.
This fixes some flakiness when a paint happened before HackStudio had
a chance to re-highlight some C++ while editing it.

The design where clients of GTextEditor perform syntax highlighting in
the "arbitrary code execution" on_change callback is not very good.
We should find a way to move highlighting closer to the editor.
2019-11-08 19:51:10 +01:00
Andreas Kling
8a024a3305 LibGUI: Rename GEventLoop.{cpp,h} => GWindowServerConnection
The GEventLoop class is long gone, and the only class in these files is
GWindowServerConnection, so let's update the file names. :^)
2019-11-08 11:40:25 +01:00
Andreas Kling
69883bea6f LibHTML: Update the removed node's siblings in TreeNode::remove_child()
Oops, we forgot to update the node's siblings' sibling pointers when
removing a node from the tree.

Thanks to Owlinated for pointing this out! :^)
2019-11-07 22:45:12 +01:00
rhin123
96c1e36ed3 TextEditor: Added redo functionality & proper stack manipulation
Added redo functionality & added m_undo_stack_index that moves back &
forth on the stack depending on the undo's & redo's.
2019-11-07 22:29:59 +01:00
Andreas Kling
0355146af9 LibHTML: Ignore case in <!DOCTYPE> tags :^) 2019-11-07 21:39:15 +01:00
Andreas Kling
71f249fd2c LibHTML: Draw box borders even if we don't have a border-color
In those cases we should fall back to currentColor, which is hackishly
implemented by falling back to "color" for now.
2019-11-07 21:36:32 +01:00
Andreas Kling
ee2cafc15c LibHTML: Fix the default style for <hr> elements
This was broken because we don't expand CSS shorthand properties (yet.)
2019-11-07 21:35:59 +01:00
Andreas Kling
56764a2db8 LibHTML: Don't swallow '}' as part of CSS property values 2019-11-07 21:20:18 +01:00
Andreas Kling
397acde846 LibHTML: Turn "&mdash;" into "-" in the parser for now
Ultimately we should deal with all the various HTML entitites.
2019-11-07 21:19:48 +01:00
Andreas Kling
b88ff97537 LibHTML: Make the CSS parser return RefPtr's
It should be possible for the CSS parser to fail, and we'll know it
failed if it returns nullptr. Returning RefPtr's makes it actually
possible to return nullptr. :^)
2019-11-07 17:58:54 +01:00
Andreas Kling
a377e8d3f5 LibHTML+IRCClient: Add an escape_html_entities() helper
This simple helper escapes '<', '>' and '&' so they can be used in HTML
text without interfering with the parser.

Use this in IRCClient to prevent incoming messages from messing with
the DOM :^)
2019-11-06 22:40:01 +01:00
Andreas Kling
ac2cc7d78f LibHTML: Make parse_html_document() return a RefPtr
Parsing might not always succeed, so let's have a way to signal errors.
2019-11-06 20:54:50 +01:00
Andreas Kling
794f2d5645 LibHTML: Rename parse_html() => parse_html_document() 2019-11-06 20:52:18 +01:00
Andreas Kling
f5cf8d4ad8 Revert "LibHTML: Rename parse_html() => parse_html_document()"
This reverts commit f6439789db.
Oops, I committed unrelated changes here, let me clean that up..
2019-11-06 20:51:07 +01:00
Andreas Kling
f6439789db LibHTML: Rename parse_html() => parse_html_document() 2019-11-06 20:31:56 +01:00
Andreas Kling
635717ed0f LibHTML: Add parse_html_fragment()
This function parses a partial DOM and returns it wrapped in a document
fragment node (DocumentFragment.)

There are now two entrances into the HTML parser, one for parsing full
documents, and one for parsing fragments. Internally the both wrap the
same parsing function.
2019-11-06 20:30:39 +01:00
Andreas Kling
f404a1dc16 LibHTML: Add DocumentFragment
Right now this is just a simple ParentNode subclass with its node type
being DOCUMENT_FRAGMENT_NODE.
2019-11-06 20:27:53 +01:00
Andreas Kling
26493a3039 LibHTML: Add TreeNode::remove_child()
This removes a child from the tree and returns it to the caller.
It optionally (but by default) calls removed_from(parent) on the child.
2019-11-06 20:26:17 +01:00
Andreas Kling
49635e62fa LibELF: Move AK/ELF/ into Libraries/LibELF/
Let's arrange things like this instead. It didn't feel right for all of
the ELF handling code to live in AK.
2019-11-06 13:42:38 +01:00
Andreas Kling
f3f0b08d43 LibHTML: Build some foundation for text selection
Add LayoutPosition and LayoutRange classes. The layout tree root node
now has a selection() LayoutRange. It's essentially a start and end
LayoutPosition.

A LayoutPosition is a LayoutNode, and an optional index into that node.
The index is only relevant for text nodes, where it's the character
index into the rendered text.

HtmlView now updates the selection start/end of the LayoutDocument when
clicking and dragging with the left mouse button.

We don't paint the selection yet, and there's no way to copy what's
selected. It only exists as a LayoutRange.
2019-11-05 22:13:26 +01:00
Andreas Kling
d3558b6137 LibCore+LibGUI: Allow inserting a CObject/GWidget before another
When adding a widget to a parent, you don't always want to append it to
the set of existing children, but instead insert it before one of them.

This patch makes that possible by adding CObject::insert_child_before()
which also produces a ChildAdded event with an additional before_child
pointer. This pointer is then used by GWidget to make sure that any
layout present maintains the correct order. (Without doing that, newly
added children would still be appended into the layout order, despite
having a different widget sibling order.)
2019-11-05 20:41:27 +01:00
Till Mayer
ac9907ee61 SoundPlayer: Changed some small cosmetic things
Renamed "Position" to "Elapsed". "channel/channels" automatically
changes now when more than one channel exist. The current file name
is now displayed in the window title.
2019-11-05 19:50:11 +01:00
Till Mayer
94a9649945 AWavLoader: Fixed incorrect computation of m_loaded_samples
m_loaded_samples was incremented with the value of the processed
buffer. This causes m_loaded_samples to be bigger at some point
than m_total_samples when downsampling, as the buffer would contain
more samples than actually loaded.
2019-11-05 19:50:11 +01:00