Commit graph

3987 commits

Author SHA1 Message Date
Andreas Kling
bc66221ee3 LibX86: Don't store the prefix/imm1/imm2 byte counts individually
We can shrink and simplify Instruction a bit by combining these into
a single "extra bytes" count.
2020-07-15 13:42:15 +02:00
Andreas Kling
4f8e86ad67 LibX86: Remove Instruction::m_handler
We can fetch the handler via Instruction::m_descriptor.
2020-07-15 13:42:15 +02:00
Sergey Bugaev
5fd8dbacb1 LibGUI+FileManager: Fix forgetting to map sorting proxy model indexes
Also assert indexes are valid in a few more places.

Finally fixes https://github.com/SerenityOS/serenity/issues/1440 and
https://github.com/SerenityOS/serenity/issues/2787 :^)
2020-07-15 13:41:46 +02:00
thankyouverycool
6a78db07f1 LibGUI: Add hover highlighting and keyboard controls to ComboBox
Adds a new highlighting effect to the actively selected row in
ComboBox ListView. ComboBoxEditor can now be controlled with
page up, page down, and the up and down arrow keys. ESC and loss
of focus now cause comboboxes to close. Now activates on mouseup
as well as return.
2020-07-15 13:19:44 +02:00
thankyouverycool
b2783a234a LibGUI: Use enum for TextEditor modes & add new DisplayOnly mode
Adds a new, more restrictive read-only state to TextEditor which
forbids copying, selecting, editor cursors, and context menus.
Provides a unique appearance on focus which accomodates ComboBox
widgets. All TextEditor modes are now accessed by enum and
set_mode() which sets the editor to Editable, ReadOnly or
DisplayOnly. Updates applications still using set_readonly().
2020-07-15 13:19:44 +02:00
thankyouverycool
dc716194c8 LibGUI: Add on_activity_change function to Window
Reports changes on the active/inactive state of a window.
2020-07-15 13:19:44 +02:00
Tom
7739497e34 FileManager: Allow double-clicking applications again
By adding a special LauncherType::Application we can still
get meta data for the application, but also know that we should
consider executing that binary as the default action. LaunchServer
will not do this for us, as it should probably not be allowed to
run arbitrary binaries that haven't been registered as handlers.
2020-07-15 00:11:30 +02:00
Tom
8ae37bccf1 LibGUI: Fix menu leak when default action changed 2020-07-15 00:11:30 +02:00
Tom
50903fd88c FileManager: Add "Open with" menu if alternative applications are available 2020-07-15 00:11:30 +02:00
Tom
535113bac4 Launcher: Provide launcher details to LibDesktop
This allows applications to get additional information,
such as name or icons, for each launch handler.
2020-07-15 00:11:30 +02:00
Tom
7498024805 LibGfx: Minor IntRect::shatter and FloatRect::shatter optimization
All the shards always intersect unless they're empty.
So rather than checking for intersection, just check
whether they're empty or not.
2020-07-15 00:09:28 +02:00
Nico Weber
4eb967b5eb LibC+Kernel: Start implementing sysconf
For now, only the non-standard _SC_NPROCESSORS_CONF and
_SC_NPROCESSORS_ONLN are implemented.

Use them to make ninja pick a better default -j value.
While here, make the ninja package script not fail if
no other port has been built yet.
2020-07-15 00:07:20 +02:00
Matthew Olsson
6075defd55 LibJS: Add Symbol.hasInstance tests 2020-07-14 20:15:19 +02:00
Matthew Olsson
b0296735a5 LibJS: Implement Symbol.hasInstance 2020-07-14 20:15:19 +02:00
Matthew Olsson
dd49ec17a2 LibJS: Implement spec-complient instance_of operation 2020-07-14 20:15:19 +02:00
Matthew Olsson
a51b2393f2 LibJS: Integrate iterator protocol into language features
Finally use Symbol.iterator protocol in language features :) currently
only used in for-of loops and spread expressions, but will have more
uses later (Maps, Sets, Array.from, etc).
2020-07-14 17:58:42 +02:00
thankyouverycool
4970c448bf LibGUI: Draw contiguous frame if GroupBox title is left empty 2020-07-14 17:55:39 +02:00
Nico Weber
1dfae92eac LibMarkdown: Reset offset to 0 on each new List line
Found by FuzzMarkdown.
2020-07-14 17:45:16 +02:00
Andreas Kling
ef84865c8c LibX86+UserspaceEmulator: Devirtualize and inline more instruction code
Use some template hacks to force GCC to inline more of the instruction
decoding stuff into the UserspaceEmulator main execution loop.

This is my last optimization for today, and we've gone from ~60 seconds
when running "UserspaceEmulator UserspaceEmulator id" to ~8 seconds :^)
2020-07-13 21:00:51 +02:00
Andreas Kling
7ea36f5ed0 LibX86: Don't build_opcode_table_if_needed() every instruction decode
Instead, just do this once at startup. :^)
2020-07-13 20:42:37 +02:00
Andreas Kling
868db2313f LibX86: Apply aggressive inlining to Instruction decoding functions
These functions really benefit from being inlined together instead
of being separated.

This yields roughly a ~2x speedup.
2020-07-13 20:34:54 +02:00
Andreas Kling
a27473cbc2 UserspaceEmulator+LibX86: Turn on -O3 optimization for emulation code
Since this code is performance-sensitive, let's have the compiler do
whatever it can to help us with the most important files.

This yields a ~8% speedup.
2020-07-13 20:23:00 +02:00
Tom
c8d3f8cdeb LibGUI: Add Options flags and OpenMultiple mode for FilePicker
If the application can't open more than one file, we should not
allow the user to select multiple.
2020-07-13 19:49:34 +02:00
Tom
d4c6ae8263 LibGUI: Add ability to disable multiselect for views 2020-07-13 19:49:34 +02:00
Tom
f266f0e880 LibGUI: Improve IconView performance with large selections
This implements the following optimizations:

* Rather than clearing a HashTable of selected items and re-populating
  it every time the selection rectangle changes, determine the delta
  by only examining the items that might be in the area where the
  selection may have changed compared to the previous area. Then
  only add/remove selection items as needed.

* When painting, only query and paint the items actually visible.
  Also, keep a local cache of item information such as calculated
  rectangles and selection state, so it doesn't have to be calculated
  over and over again.
2020-07-13 19:49:34 +02:00
Tom
b778804d20 LibGUI: Add ModelClient abstract class and allow registering clients
This solves a problem where the SortingProxyModel doesn't
receive the on_update call because other code overwrote
the handler later on.
2020-07-13 19:49:34 +02:00
Nico Weber
0e10a92ebc LibLine: Add Ctrl-N/P as history next/previous shortcuts 2020-07-13 19:48:53 +02:00
Nico Weber
b0384bb1bb LibLine: Move search-related updates into do_cursor_left/right
This way, arrow-left and arrow-right behave consistently with ctrl-b/ctrl-f.
2020-07-13 19:48:53 +02:00
Matthew Olsson
4c3a415dc3 LibJS: Add String Iterator tests 2020-07-13 15:07:29 +02:00
Matthew Olsson
c831fb17bf LibJS: Add StringIterator 2020-07-13 15:07:29 +02:00
thankyouverycool
332f349e07 LibGUI: Fix keybind conflicts in TreeView
Changes the shortcut to expand and collapse subtrees from alt to
ctrl+right/left arrows in TreeView. The current shortcuts conflict
with applications that already have navigation controls bound to alt
like file manager.
2020-07-13 14:27:23 +02:00
thankyouverycool
366d7e6d05 LibGUI: Only report toggled directories once on subtree collapse/expansion
This prevents redundant calls to on_toggle for the same indices when
subtrees are collapsed or expanded.
2020-07-13 14:27:23 +02:00
Andreas Kling
f1bbc39148 LibX86: ALWAYS_INLINE some Instruction members 2020-07-13 13:50:22 +02:00
Stefano Cristiano
a1e1aa96fb Toolchain: Allow building using CMake on macOS 2020-07-13 08:46:44 +02:00
Andreas Kling
226c0cfb20 LibVT: Don't scroll to bottom when pressing the right shift key 2020-07-12 14:32:39 +02:00
AnotherTest
9054811ace LibM: Add 'isnormal' 2020-07-12 01:19:48 +02:00
Andreas Kling
97f4cebc8d UserspaceEmulator+LibX86: Implement the LEA instruction
This piggybacks nicely on Instruction's ModR/M resolution code. :^)
2020-07-11 23:57:14 +02:00
Andreas Kling
9257657340 LibC: Some s/int/size_t/ in the malloc code 2020-07-11 23:57:14 +02:00
Matthew Olsson
43d955014d LibJS: Implement Symbol.toStringTag 2020-07-11 23:13:29 +02:00
Matthew Olsson
5ecd504f4e LibJS: Implement spec-compliant Object.prototype.toString 2020-07-11 23:13:29 +02:00
Matthew Olsson
531fdb2e82 LibJS: Prefer "define_property" over "put" 2020-07-11 18:54:13 +02:00
Matthew Olsson
c485c86015 LibJS: Use macros to enumerate well-known symbols
Not only is this a much nicer api (can't pass a typo'd string into the
get_well_known_symbol function), it is also a bit more performant since
there are no hashmap lookups.
2020-07-11 18:54:13 +02:00
Matthew Olsson
2ea85355fe LibJS: Start implementing iterable framework, add ArrayIterator
With the addition of symbol keys, work can now be done on starting to
implement the well-known symbol functionality. The most important of
these well-known symbols is by far Symbol.iterator.

This patch adds IteratorPrototype, as well as ArrayIterator and
ArrayIteratorPrototype. In the future, sometime after StringIterator has
also been added, this will allow us to use Symbol.iterator directly in
for..of loops, enabling the use of custom iterator objects. Also makes
adding iterator support to native objects much easier (as will have to
be done for Map and Set, when they get added).
2020-07-11 18:54:13 +02:00
Matthew Olsson
51bfc6c6b3 LibJS: Renamed Object::GetOwnPropertyReturnMode to Object::PropertyKind
This enum will be used by iterators, so it makes sense to use a more
general name.
2020-07-11 18:54:13 +02:00
Peter Elliott
0fd31ef598 LibGUI: Ignore KeyUp events by default
fixed #2576
2020-07-11 18:51:41 +02:00
Linus Groh
7241b9ca0c LibJS: Remove a few superfluous exception checks
We don't need to check for exceptions when defining properties on an
array we literally created ourselves a few lines earlier.
2020-07-11 18:38:51 +02:00
Tom
1c1ab71692 WindowServer/LibGUI: Add default menu items and allow default action for context menu
By specifying an optional Action for Menu::popup an application
can specify what item should be displayed as a default item.
2020-07-11 11:45:49 +02:00
Kevin Meyer
7b5ffe67cf LibWeb: Check if layout node is still present after dispatch_event
Fixes https://github.com/SerenityOS/serenity/issues/2638

Dispatching an event can change the document. Therefore another check
for the layout_root needs to be done.
2020-07-11 11:34:59 +02:00
Kevin Meyer
821043d798 LibWeb: Remove some unnecessary casts 2020-07-11 11:34:59 +02:00
Kevin Meyer
d5d732cc87 LibWeb: Fix EVENT_DEBUG dump compilation 2020-07-11 11:34:59 +02:00