Commit graph

12150 commits

Author SHA1 Message Date
Andreas Kling
2614ef550c LibWeb: Only paint focus outline when browser window has focus
This is communicated through the PaintContext::has_focus() flag.
2020-08-15 00:05:45 +02:00
Andreas Kling
c1e0047b48 LibGUI: When focusing a TextEditor via keyboard, select all contents
This feels very natural and allows you to start typing immediately
knowing it will replace whatever was in the text box before.
2020-08-15 00:05:45 +02:00
Andreas Kling
75b8f4e4e6 LibGUI: Make focus events more aware of why focus is changing
This patch adds GUI::FocusEvent which has a GUI::FocusSource.
The focus source is one of three things:

- Programmatic
- Mouse
- Keyboard

This allows receivers of focus events to implement different behaviors
depending on how they receive/lose focus.
2020-08-15 00:05:45 +02:00
Andreas Kling
110b3d89d3 LibGUI: Export GUI_FOCUS_DEBUG to visualize the focused widget
Using a command-line argument for this clashed with ArgsParser so let's
use an environment variable instead. I feel like Sergey told me to do
this at some point anyway. :^)
2020-08-15 00:05:45 +02:00
Andreas Kling
01022eb5d6 LibWeb: Allow focusing individual (focusable) elements with Tab key
You can now cycle through focusable elements (currently only hyperlinks
are focusable) with the Tab key.

The focus outline is rendered in a new FocusOutline paint phase.
2020-08-15 00:05:45 +02:00
Andreas Kling
5939af14d4 LibWeb: Pass non-accepted keydown events to PageView's base class
This will allow LibGUI's normal mechanisms to take over if the web
engine is not interested in the event right now.
2020-08-15 00:05:45 +02:00
Andreas Kling
7698feb8ce LibWeb: Add NonDocumentTypeChildNode::next_element_in_pre_order()
This is handy for traversing only the elements in a document.
2020-08-15 00:05:45 +02:00
Andreas Kling
a37331e236 Lagom: Add LibHTTP to Lagom (it builds fine without changes) 2020-08-15 00:05:45 +02:00
Muhammad Zahalqa
33cb41edcb LibThread: Lockable - add forwarding constructor 2020-08-14 18:15:10 +02:00
Muhammad Zahalqa
746f6ea36d Kernel: mark kmalloc with attributes 2020-08-14 18:14:23 +02:00
Andreas Kling
bbe2d4a2d9 LibJS+LibWeb: Clear exceptions after call'ing JavaScript functions
Decorated Interpreter::call() with [[nodiscard]] to provoke thinking
about the returned value at each call site. This is definitely not
perfect and we should really start thinking about slimming down the
public-facing LibJS interpreter API.

Fixes #3136.
2020-08-14 17:31:07 +02:00
Andreas Kling
c5127389ca LibJS: Assert that there's no exception on entry in Interpreter::call() 2020-08-14 17:30:34 +02:00
Nico Weber
19b329ee96 ifconfig: Fix capitalization of "kiB" 2020-08-14 16:09:58 +02:00
Nico Weber
d5b2233f2e ResourceGraph: add tooltips to cpu and memory graphs
The tooltip doesn't update while it's visible.
2020-08-14 16:09:58 +02:00
Andreas Kling
6b8807be6e AK: Fix obvious bad vector access in IPv4Address::from_string()
Fixes #3137.
2020-08-14 15:10:58 +02:00
AnotherTest
2336c62901 2048: Move out the 'undo' action to the app menu/action 2020-08-14 15:10:31 +02:00
AnotherTest
d97025567a 2048: Make the scoring system less 'lame' 2020-08-14 15:10:31 +02:00
Peter Nelson
e36fce9cfc Docs: explain how to enable QEMU hardware acceleration on Windows
Describes how to enable QEMU hardware acceleration on Windows using the
Windows Hypervisor Platform feature.
2020-08-14 15:09:59 +02:00
Peter Nelson
d00df4e721 Docs: clarify steps to use Windows-native QEMU when building under WSL
This now descibes how to get the regular `make run` workflow to work
under Windows using native QEMU. It describes how to override the QEMU
binary path, as well as overriding the SerenityOS disk image file
location with a native Windows path.

Also fixes some minor spelling and punctuation issues.
2020-08-14 15:09:59 +02:00
Peter Nelson
a8ad0d120d Meta: allow override of QEMU -cpu argument via environment variable
Introduces a SERENITY_QEMU_CPU environment variable that allows
overriding of the qemu -cpu command line parameter. If not specified,
the argument defaults to "max".

The primary motivation behind this is to be able to enable or disable
specific features for the vCPU in order to workaround QEMU issues with
certain hardware accelerators. For example, QEMU on Windows with WPHX
sometimes fails to start unless Virtual Machine eXtensions are
disabled. This can now be done with:

  export SERENITY_QEMU_CPU="max,vmx=off"
2020-08-14 15:09:59 +02:00
AnotherTest
d9a1cb440c Shell: Restore input offset when failing to parse a redirection
This fixes #3051
2020-08-14 14:51:31 +02:00
Andreas Kling
b97e42dcaa LibGUI: Make ModelSelection non-copyable and non-movable
These are meant to be attached to an AbstractView at all times.
2020-08-14 12:15:11 +02:00
Andreas Kling
9bdd8ec3f3 LibWeb: Don't paint a text cursor in unfocused frames 2020-08-14 12:15:11 +02:00
Andreas Kling
be76abfdb3 LibWeb: Send keydown events to the focused frame 2020-08-14 12:15:11 +02:00
Andreas Kling
6b4a7d1ee3 LibWeb: Add "focused frame" concept, one focused Frame per Page
Focus currently only moves when doing a mousedown in a frame.
2020-08-14 12:15:11 +02:00
Linus Groh
d1d9545875 LibJS: Add missing reserved words to Token::is_identifier_name()
This is being used in match_identifier_name(), for example when parsing
property keys - the list was incomplete, likely as some token types were
added later, leading to some unexpected syntax errors:

> var e = {};
undefined
> e.extends = "a";
e.extends = "a";
  ^
Uncaught exception: [SyntaxError]: Unexpected token Extends. Expected IdentifierName (line: 1, column: 3)

Fixes #3128.
2020-08-14 10:58:51 +02:00
AnotherTest
0950fd1438 Shell: Start writing a man page
This patch adds two man pages describing the parts of the shell that
have been so far finalised.
2020-08-14 10:31:52 +02:00
Nico Weber
a2b99dd3ea disasm: Print correct offset-relative jumps in ELF file disassembly 2020-08-14 10:29:41 +02:00
Nico Weber
8126104a03 Inspector: Require horizontal scrollbars less often
Make the window a bit larger, and give the left pane a Fixed
size policy, so that it takes up less than half the window.
2020-08-14 10:29:01 +02:00
Linus Groh
895ab8e745 WindowServer: Take MenuApplet windows into account for hovered_window
This finally makes tooltips on menu applets the same as everywhere else!

Here's what went wrong:
WindowManager::process_mouse_event() receives a Window*&, determines the
hovered window and sets it accordingly. However there's a branch that
tests for menubar_rect().contains(event.position()) and returns early -
which resulted in hovered_window never being set to any MenuApplet
window, even hovered ones.

The hovered_window result is being used in WindowManager::event() and
passed to WindowManager::set_hovered_window(), which is responsible for
creating WindowLeft and WindowEntered events when the hovered window
changes, as a result of the mentioned chain of events this also never
happens for MenuApplet windows.
The WindowLeft event would the cause Window::handle_left_event() in
LibGUI to be called, which unsets the window's hovered widget, which
is necessary for the widget to receive a subsequent Enter event -
again, all of this never happened.

Now it's working as expected though, so we can start using tooltips on
menu applets :^)
2020-08-14 10:28:03 +02:00
Linus Groh
e77991e63a LibGUI: Fix Widget::screen_relative_rect() for WindowType::MenuApplet
This was using window()->position(), which is unset for windows with
WindowType::MenuApplet. Now it checks the window type and then uses
rect_in_menubar() for MenuApplet windows and rect() for everything else.

This makes tooltips show up for MenuApplet windows, previously they were
positioned off-screen :^)
2020-08-14 10:28:03 +02:00
Linus Groh
e58d3b8481 LibGUI: Add Window::window_type()
We already have Window::set_window_type(), so a getter for m_window_type
makes sense as well.
2020-08-14 10:28:03 +02:00
Andreas Kling
28c68fb241 AK: Fix bad vector access in two-part IPv4 address parsing 2020-08-13 21:12:59 +02:00
Andreas Kling
21bb269919 LibGUI: Add ModelIndex::model()
Let's expose this so we can use it in some assertions later.
2020-08-13 21:09:39 +02:00
Nico Weber
df62e54d1e
Kernel: Request random numbers for syscall stack noise in larger chunks (#3125)
Cuts time needed for `disasm /bin/id` from 2.5s to 1s -- identical
to the time it needs when not doing the random adjustment at all.

The downside is that it's now very easy to get the random offsets
with out-of-bounds reads, so it does make this mitigation less
effective.
2020-08-13 21:05:08 +02:00
Andreas Kling
6d9b59f1b7 Kernel: Simplify the way we check for "serial_debug" on command line 2020-08-13 20:18:11 +02:00
Andreas Kling
b777640fef Kernel: Remove strdup() since nothing uses it 2020-08-13 20:18:11 +02:00
Andreas Kling
5099e76ce6 LibGUI: Remove unused bool SortingProxyModel::m_sorting 2020-08-13 20:18:11 +02:00
Andreas Kling
686ee2bf04 LibGUI: Rename ModelClient::on_model_update() => model_did_update()
This follows the typical client callback naming scheme used elsewhere
and doesn't collide with the "on_foo" Function hook convention.
2020-08-13 20:18:11 +02:00
Andreas Kling
4088beb8eb LibGUI: Remove Model::sibling() since it's the same as index()
... I'm not sure what the idea was here, but since these functions do
the same thing, let's only have index().
2020-08-13 20:18:11 +02:00
Andreas Kling
fe19cf0ff2 LibGUI: Move Model::index() out of line 2020-08-13 20:18:11 +02:00
Andreas Kling
82e949aa7c LibGUI: Rename SortingProxyModel "target" to "source" instead 2020-08-13 20:18:11 +02:00
Nico Weber
db6a4f2954 Kernel: Fix rng regression from bc7a149039 2020-08-13 19:28:15 +02:00
Muhammad Zahalqa
11b9e8b366 LibC: Some calloc() and realloc() improvements (#3108)
If the space cannot be allocated, the original memory block shall remain
unchanged and the function should return nullptr.

Also add a function attribute and some null checks.
2020-08-13 19:16:15 +02:00
Panagiotis Vasilopoulos
dcfc54d767 AK: Add initial support for obscure IPv4 address notations
This change aims to add support for obscure IPv4 address notations, such as 1.1 (which should be equal to 1.0.0.1), or the hypothetical address 1 (which is equal to 0.0.0.1). This is supported on other platforms as well, such as Linux, Windows, *BSD, and even Haiku.
2020-08-13 19:02:47 +02:00
Muhammad Zahalqa
138595961b LibC: mark strdup & strndup as __attribute__((malloc)) 2020-08-13 18:53:32 +02:00
Nico Weber
6e1d6d1ff5 Kernel: Don't request a random u32 when all but 5 bits are immediately masked off 2020-08-13 18:52:24 +02:00
Nico Weber
924951e426 Shell: Add test for 37d5e3e0df / #3073 2020-08-13 18:45:39 +02:00
Linus Groh
675d8eec60 LibGUI: Fix ColorPicker custom color offset
Previously the ColorPicker would get the custom color directly from the
window, this was changed in d7d5788469 to
get the color from the underlying bitmap instead - without taking the
bitmap's scaling into effect though, so resulting colors were off by
quite a bit.

Fixes #3113.
2020-08-13 16:58:31 +02:00
Linus Groh
728d4649e4 LibGUI: Fix ComboBox desktop intersection rect
Subtracting 128 from the desktop rect's height was far to much and
and leading to weird rendering issues - now it's calculated exactly from
taskbar and menubar heights as well as a little additional offset to
make it fit perfectly.

Fixes #3115.
2020-08-13 16:06:02 +02:00