Commit graph

4411 commits

Author SHA1 Message Date
Andreas Kling e002cbb06b Build: Add some -Wno-unknown-warning-option flags to CXXFLAGS
Patch from Anonymous.
2020-09-01 12:00:53 +02:00
AnotherTest 084a5c6a90 LibLine: Reset suggestion state on any non-tab key
This fixes the following (and more!):
```sh
$ /bin/dis<tab><tab><backspace><backspace><backspace><backspace><tab>
$ /bink_benchmark
```
2020-08-31 23:06:07 +02:00
Luke 124c52b3b5 LibWeb: Implement document ready state 2020-08-31 23:05:51 +02:00
Luke 8aabec1c94 LibWeb: Expose window.self and window.frames
"self" is a way to refer to the global object that will work in both
a window context and a web worker context.

"frames" apparently used to return a list of frame objects according
to MDN, but it now just returns the window object.
2020-08-31 23:05:10 +02:00
asynts 1c8312fa50 LibCompress: Fix a bug when wrapping around the buffer. 2020-08-31 23:04:55 +02:00
asynts 0ebf56efb0 LibCompress: Add support for dynamic deflate blocks. 2020-08-31 23:04:55 +02:00
asynts d5c5507a0e LibCompress: Deflate: Don't assert that the codes are valid. 2020-08-31 23:04:55 +02:00
asynts c4799576ea LibCompess: Add missing state update in DeflateDecompressor::read. 2020-08-31 23:04:55 +02:00
asynts ef7bec6a3b LibCompress: CanonicalCode: Don't leave unused code uninitialized. 2020-08-31 23:04:55 +02:00
Peter Nelson 259f8541fc LibGfx: implement GIF RestorePrevious frame disposal mode 2020-08-31 18:54:44 +02:00
Peter Nelson c3ee5e3451 LibGfx: clear previous GIF frame to transparent instead of whole image 2020-08-31 18:54:44 +02:00
Andreas Kling a8d52a68f6 LibWeb: Take care of a FIXME in the "in table text" insertion mode 2020-08-31 18:51:34 +02:00
AnotherTest 9adbbff4dd LibC: Partially implement 'freopen' 2020-08-31 09:14:11 +02:00
thankyouverycool 199c1da31c LibGUI: Hide ResizeCorner in StatusBar when window is maximized
Fully expands status bars when maximized and prevents maximized
windows from being erroneously resized.
2020-08-31 09:08:26 +02:00
Sergey Bugaev f808810d00 LibC: Deprecate strcpy(), strncpy(), strcat() and strncat() :^)
And also mark strlcpy() and strlcat() with __attribute__((warn_unused_result)).

Since our code is warning-free, this ensures we never misuse those functions.
(Or are very sure about doing it when turning off the warning for a particular
piece of code.)
2020-08-30 17:35:27 +02:00
Sergey Bugaev 1cdd798ac7 LibC: Replace some strncpy() calls with memcpy()
In case we know exactly how many bytes we're copying (and not copying a string
while limiting its length to that of a buffer), memcpy() is a more appropriate
function to call.

Also, fix null-terminating the %c pointer.
2020-08-30 17:35:27 +02:00
Sergey Bugaev 34353e18cf LibC: Misc fixes and improvements in netdb 2020-08-30 17:35:27 +02:00
Sergey Bugaev 0817ef563e LibC: strcpy a socket address at compile time
This way, we'd get compile-time errors if the address was too long for the buffer.
2020-08-30 17:35:27 +02:00
Sergey Bugaev 852454746e Everywhere: Port to String::copy_characters_to_buffer() 2020-08-30 17:35:27 +02:00
Sergey Bugaev 17109a3a31 LibC: Use AK::String-backed buffers instead of static buffers
Also, refactor the hell out of pwd.cpp & grp.cpp
2020-08-30 17:35:27 +02:00
Linus Groh 16da91b7e7 LibWeb: Remove redundant .prettierrc
Now that LibJS's .prettierrc has been moved to the repository root (as
we start having .js files in /res), we don't need to keep a second,
identical copy for the LibWeb tests.
2020-08-30 17:31:08 +02:00
Nico Weber 9ad5a261f7 LibCore: Let DateTime::create()/set_time() take summer time into account
DateTime::create() takes a date/time in local time, but it set
tm_isdst to 0, which meant it was in local winter time always.
Set tm_isdst to -1 so that times during summer time are treated
in summer time, and times in winter time are treated as winter
time (when appropriate). When the time is adjusted backward by
one hour, the same time can be in winter time or summer time,
so this isn't 100% reliable, but for most of the year it should
work fine.

Since LibJS uses DateTime, this means that the Date tuple
ctor (which creates a timestamp from year/month/day/hours/etc
in local time) and getTime() should now have consistent (and
correct) output, which should fix #3327.

In Serenity itself, dst handling (and timezones) are unimplemented
and this doens't have any effect yet, but in Lagom this has an effect.
2020-08-30 16:56:47 +02:00
Andreas Kling 57dd3b66c5 Kernel+LibC+UE: Implement sleep() via sys$clock_nanosleep()
This doesn't need to be its own syscall either. :^)
2020-08-30 13:21:24 +02:00
Andreas Kling f857f3ce4c Kernel+LibC+UE: Implement usleep() via sys$clock_nanosleep()
This doesn't need to be its own syscall. Thanks @BenWiederhake for
the idea. :^)
2020-08-30 10:45:51 +02:00
Andreas Kling 95ed363b15 LibGfx: Fix Lagom build (possible uninitialized variable warnings) 2020-08-30 10:40:40 +02:00
Ben Wiederhake db422fa499 LibJS: Avoid unnecessary lambda
Especially when it's evaluated immediately and unconditionally.
2020-08-30 10:31:04 +02:00
Peter Nelson b742d593dd LibGfx: use Gfx::Color instead of local struct for GIF colour map 2020-08-30 10:27:36 +02:00
Peter Nelson c8eccc00b1 LibGfx: only cache last decoded GIF frame
GIFLoader now uses a single frame buffer to cache the last decoded
frame. This drastically reduces memory usage at the small expense of
re-decoding frames on each loop.
2020-08-30 10:27:36 +02:00
Peter Nelson 786872e4c9 LibGfx: add support for interlaced GIFs 2020-08-30 10:27:36 +02:00
Peter Nelson 1341025da7 LibGfx: correctly handle GIF frame disposal modes
RestoreBackground disposal mode is now a transparent fill to allow
background to show through.

RestorePrevious disposal mode now restores the previous frame.
2020-08-30 10:27:36 +02:00
asynts 3f1dfc2e97 LibCompress: Implement gzip. 2020-08-30 09:56:10 +02:00
asynts 9664453739 LibCore: Add InputFileStream and OutputFileStream. 2020-08-30 09:56:10 +02:00
Ben Wiederhake e59c415ae3 LibVT+Terminal: Mark default action in context menu 2020-08-30 09:47:49 +02:00
Ben Wiederhake d8e22fedc3 Libraries: Unbreak building with extra debug macros 2020-08-30 09:43:49 +02:00
AnotherTest e75247a75b DisplaySettings+LibGUI: Move ItemListModel into LibGUI
Without this model, comboboxes are abysmal to work with, so let's not
redefine it every time.
2020-08-29 17:42:03 +02:00
thankyouverycool 2f9a071072 Base+LibGUI: Refresh filetype icons for consistency
Improves ini icon depth and adds complementary 16x16/32x32 icons
for music and sound filetypes.
2020-08-29 16:19:02 +02:00
Andreas Kling b084411258 LibGUI: Make Del/Backspace clear cell w/ "any key pressed" edit trigger
This doesn't feel 100% right but it's better than inserting some goofy
whitespace when pressing these keys.
2020-08-29 01:04:22 +02:00
Andreas Kling c3b3a078f3 LibGUI: Make SortingProxyModel update all view cursors on resort
Otherwise they will be stale indexes, which is no good. :^)
2020-08-29 00:18:35 +02:00
Andreas Kling fed53e19c7 LibGUI: Make AbstractView::set_cursor() scrolling into view optional
Sometimes you just want to set the cursor programmatically without
scrolling the view to make the cursor visible.
2020-08-29 00:17:42 +02:00
Andreas Kling 734035857e LibGUI: Allow AbstractView::set_cursor(ModelIndex(), ...)
This should be a valid way to clear the cursor.
2020-08-29 00:16:58 +02:00
Andreas Kling 6316525d50 LibGUI: Add optional "tab key navigation" to AbstractView
If enabled, the view cursor will move right/left when pressing
tab/shift+tab.
2020-08-28 21:09:38 +02:00
Andreas Kling 70d3dd5b87 LibGUI: Make TableView::move_cursor() public
It was already public in the base class, so hiding it here was just
a mistake.
2020-08-28 21:02:46 +02:00
Andreas Kling 1847219cbf LibGUI: Let's make F2 the standard "edit key"
This matches what other systems do, and allows Return to become
the unambiguous "activation key" instead. :^)
2020-08-28 20:55:25 +02:00
Andreas Kling 12dfeb9845 LibGUI: Allow rollback of model editing delegate input
In the StringModelEditingDelegate convenience class, we simply hook up
the escape key to editor rollback. This means you can cancel an ongoing
cell edit by pressing escape. :^)
2020-08-28 20:50:12 +02:00
Andreas Kling 5daa19fdab LibGUI: Implement a basic "any key pressed" edit trigger for TableView
This trigger allows you to initiate cell editing by simply starting to
type something into the cell. :^)
2020-08-28 20:47:02 +02:00
Andreas Kling f3e4b62be9 LibGUI: Add AbstractView "edit triggers" to improve editing control
This API allows the embedder of a view to decide which actions upon
the view will begin editing the current item.

To maintain the old behavior, we will begin editing when an item is
either double-clicked, or when the "edit key" (return) is pressed.
2020-08-28 20:40:12 +02:00
AnotherTest a2113909c3 LibJS: Do not consider un-labeled Block scopes as breakable 2020-08-28 20:19:56 +02:00
AnotherTest 8e89233bba LibJS: Demonstrate weird behaviour with 'break' 2020-08-28 20:19:56 +02:00
Andreas Kling 2222fc5e08 LibGUI: Add optional grid and cursor styles to TableView 2020-08-28 17:09:30 +02:00
Ben Wiederhake 1c60ea235e LibCrypto: Do not silently ignore key size mismatch
Before, when the actually passed key was too long, the extra bytes were silently
ignored. This can lead to all sorts of trouble, so ... don't do that.

The original intention was maybe to support non-integer amounts of key bytes.
But that doesn't happen anyway with AES.
2020-08-28 11:36:57 +02:00
Ben Wiederhake 6020a4f274 LibGUI: Remove unused String member 2020-08-28 09:15:47 +02:00
Andreas Kling d2d2361152 LibGUI: Unbreak PageUp/PageDown in AbstractTableView
These key events need to trigger a move_cursor() as well.
2020-08-27 19:29:50 +02:00
Andreas Kling 9947262eaa LibGUI: Ctrl+clicking on an AbstractView should move cursor
Don't just toggle the selection of the index, also move the cursor to
where the user is clicking.
2020-08-27 18:41:54 +02:00
Andreas Kling 9cf37901cd LibGUI: Add a cursor to AbstractView, separate from the selection
Views now have a cursor index (retrievable via cursor_index()) which
is separate from the selection.

Until now, we've been using the first entry in the selection as
"the cursor", which gets messy whenever you want to select more than
one index in the model.

When setting the cursor, the selection is implicitly updated as well
to maintain the old behavior (for the most part.)

Going forward, this will make it much easier to implement things like
shift-select (extend selection from cursor) and such. :^)
2020-08-27 18:36:31 +02:00
Andreas Kling cd2c82a380 LibGUI: Remove unused variables in AbstractTableView::mousedown_event() 2020-08-27 18:13:47 +02:00
Andreas Kling 0b9d765f6b LibGUI: Add AbstractView::move_cursor() and share some movement logic
A view can now be told to move its cursor in one of multiple directions
as specified by the CursorMovement enum.

View subclasses can override move_cursor(CursorMovement) to implement
their own cursor behavior. By default, AbstractView::move_cursor() is
a no-op.

This patch improves code sharing between TableView and TreeView. :^)
2020-08-27 17:47:19 +02:00
thankyouverycool ebba297b42 Base: Move 16x16 common icons to /res/icons/16x16/
Drops the '16' suffix from filenames. Resizes inconsistent
audio-volume icons to intended size.
2020-08-27 15:38:02 +02:00
thankyouverycool 0bb2025b69 Base: Create /res/icons/serenity for misc. sized system icons 2020-08-27 15:38:02 +02:00
thankyouverycool 61ba39dfa0 Base: Create /res/graphics/ and relocate system art assets 2020-08-27 15:38:02 +02:00
Tom 4463fed398 LibGUI: Splitter should only override cursor if within grabbable area
Fixes #3284
2020-08-27 10:42:15 +02:00
Andreas Kling 55f7ddfb8c LibGUI: Don't make views sort by column 0 by default
If you want to sort by some column, you can tell the view which one.
2020-08-27 10:37:31 +02:00
AnotherTest 7465c51ef2 Base+LibGUI+Spreadsheet: Add icons for Spreadsheet
Also adds a Spreadsheet.af.
2020-08-27 10:27:20 +02:00
Ben Wiederhake 9f7ec33180 Meta: Force semi-colon after MAKE_AK_NONXXXABLE()
Before, we had about these occurrence counts:
COPY: 13 without, 33 with
MOVE: 12 without, 28 with

Clearly, 'with' was the preferred way. However, this introduced double-semicolons
all over the place, and caused some warnings to trigger.

This patch *forces* the usage of a semi-colon when calling the macro,
by removing the semi-colon within the macro. (And thus also gets rid
of the double-semicolon.)
2020-08-27 10:12:04 +02:00
Ben Wiederhake 6454969d6b LibCore: Remove data pointer from CustomEvent
It wasn't used anywhere.

Also, if it were used, then it should have been marked AK_NONCOPYABLE().
Or even more cleanly, it should use a RefPtr<> or OwnPtr<> instead of
a 'naked' pointer. And because I didn't want to impose any such decision
on a possible future use case that we don't even know, I just removed
that unused feature.
2020-08-27 10:12:04 +02:00
Andreas Kling 9f2338a5f5 LibWeb: Turn the <table height> attribute into the CSS height property
This matches what other engines do.
2020-08-26 21:17:05 +02:00
asynts 7c53f14bbc LibCompress: Implement DEFLATE properly.
Now we have an actual stream implementation that can read arbitrary
(dynamic codes aren't supported yet) deflate encoded data. Even if
the blocks are really large.

And all of that happens with a single buffer of 32KiB. DEFLATE is
amazing!
2020-08-26 21:07:53 +02:00
Andreas Kling e3bfe0b509 LibWeb: Fix sometimes missing text selection highlight
There's no selection if it starts and ends at the same column, but only
if both columns are in the same node. :^)
2020-08-26 21:00:26 +02:00
Andreas Kling 8cc2a55cff LibGUI: Update AbstractTableView row header sizes on set_row_height() 2020-08-26 20:50:54 +02:00
Andreas Kling c4347a16cf LibGUI: Make AbstractTableView row height configurable
The row height is per-table, not per-row, but this is still nice.
2020-08-26 20:34:07 +02:00
Andreas Kling 9a0f40d4b5 LibGUI: Add a top-left-corner button to table views
If both the row and column headers are visible, we now also show a
button in the top left corner. This avoids the headers overlapping
each other when you scroll the contents.

In the future, this could be hooked up to a "select all" action.
2020-08-26 17:00:40 +02:00
Andreas Kling 447b65bf7b LibGUI: Add (optional) row headers to GUI::TableView
You can now get row headers in your TableView by simply calling:

    table_view.row_header().set_visible(true)

Note that rows are not yet resizable.
2020-08-26 17:00:40 +02:00
Andreas Kling 49a5038a1a LibGUI: Avoid implementing vertical HeaderView section resize for now
Resizable rows will require a bunch of changes in the table view layout
code, so let's not make the normal resizing areas grabbable for now.
2020-08-26 17:00:40 +02:00
Andreas Kling e418bdf95b LibGUI: Don't update key column when clicking vertical headers
Vertical headers are only concerned with rows, after all.
2020-08-26 17:00:40 +02:00
Andreas Kling 5b46835a9d LibGUI: Fix HeaderView::section_rect() for vertical headers
Vertical headers shouldn't worry about horizontal padding.
2020-08-26 17:00:40 +02:00
Andreas Kling c241ab75cd LibGUI: Simplify HeaderView::mouseup_event() slightly 2020-08-26 17:00:40 +02:00
Andreas Kling 3f4df7c6da LibGUI: Reset hovered section when mouse cursor leaves a HeaderView 2020-08-26 17:00:40 +02:00
thankyouverycool 45901d4141 LibGUI+HackStudio: Associate new icons with their extensions 2020-08-26 16:59:34 +02:00
thankyouverycool 208cb995ba WindowServer+LibGfx: Move title bar button layout to WindowTheme 2020-08-26 08:53:14 +02:00
Nico Weber 1ab8939077 AK+LibC+LibCore: Have fewer implementations of day_of_week
The implementation in LibC did a timestamp->day-of-week conversion
which looks like a valuable thing to have. But we only need it in
time_to_tm, where we already computed year/month/day -- so let's
consolidate on the day_of_week function in DateTime (which is
getting extracted to AK).
2020-08-26 08:52:07 +02:00
Nico Weber b9cbb4fd00 LibC: Minor style tweaks to tm_to_time 2020-08-26 08:52:07 +02:00
Nico Weber 2236385e1f AK+LibC+LibCore: Add a days_in_year function 2020-08-26 08:52:07 +02:00
Nico Weber a7a18b478e AK+LibC+LibCore: Have fewer implementations of days_in_month 2020-08-26 08:52:07 +02:00
Nico Weber dcb81fc199 LibCore: Use is_leap_year more in DateTime 2020-08-26 08:52:07 +02:00
Nico Weber c85e679e2d AK+LibCore+Kernel: Have fewer implementations of day_of_year
The JS tests pointed out that the implementation in DateTime
had an off-by-one in the month when doing the leap year check,
so this change fixes that bug.
2020-08-26 08:52:07 +02:00
Nico Weber 2c1b84b3e1 LibJS: Add some more tests, mostly around leap years 2020-08-26 08:52:07 +02:00
Nico Weber 9b17082899 AK+LibC+Kernel: Have fewer implementations of year_to_days_in_epoch
I believe the implementation in RTC.cpp had an off-by-one
in the year passed to is_leap_year(). If that's true, then this
fixes that too.
2020-08-26 08:52:07 +02:00
Nico Weber 84ed257959 AK+LibC+LibCore+Kernel: Have fewer implementations of is_leap_year 2020-08-26 08:52:07 +02:00
AnotherTest 394e4c04cd LibJS: Add a helper for calling JS::Function's with arguments
The fact that a `MarkedValueList` had to be created was just annoying,
so here's an alternative.
This patchset also removes some (now) unneeded MarkedValueList.h includes.
2020-08-26 08:45:01 +02:00
Rewi Haar 521e730df1 LibWeb: Calculate selection based on glyph centers
Previously you had to drag all the way to the end of a glyph to select
it; now you just need to drag past the center.  Also fixes #2959.
2020-08-26 08:44:31 +02:00
Ben Wiederhake cd93fb9656 LibC: Deduplicate declaration of strcasecmp 2020-08-26 00:55:13 +02:00
Andreas Kling 9a25dd99c3 LibGUI: HeaderView should always notify parent when sections resize
The view needs to recompute the scrollable content size whenever this
happens, so let's always notify it. Previously we were only doing this
when resizing columns with interactively (not programmatically.)
2020-08-26 00:51:35 +02:00
Andreas Kling cfc30b11ba LibGUI: Rename table view's "cell painting delegate" to "column *"
What you install with this API is a delegate that manages painting of
all the items in a specific column, so let's make the API reflect that.
2020-08-26 00:51:35 +02:00
Andreas Kling 44e371635e LibGUI: Move table view headers into their own widget
This patch introduces the HeaderView class, which is a widget that
implements the column headers of TableView and TreeView.

This greatly simplifies event management in the view implementations
and also makes it much easier to eventually implement row headers.
2020-08-26 00:51:35 +02:00
Andreas Kling eca6ff353e LibGUI: Make Splitter inherit from Widget instead of Frame
It wasn't using any of the Frame features, so I'm not sure what the
idea here was.
2020-08-26 00:51:35 +02:00
Andreas Kling ac78531756 LibGUI: Clip GUI::Frame children to the frame_inner_rect()
This way we don't draw the frame border underneath our children. :^)
2020-08-26 00:51:35 +02:00
Andreas Kling a265d40d6e LibGUI: Allow widgets to clip their child widgets
This patch adds Widget::children_clip_rect() which can be overridden
to tighten clipping of a widget's children. The default implementation
simply returns Widget::rect().
2020-08-26 00:51:35 +02:00
Andreas Kling af16552624 LibGUI: Add Widget focus proxies
A Widget can now have a focus proxy widget. Questions about focus are
redirected to the proxy if present. This is useful if a widget could
logically get focus, but wants one of its child widgets to actually
handle it.
2020-08-26 00:51:35 +02:00
Sergio Ahumada 9ba3862ee9 LibC: Prospective fix for openssl build
serenity/Build/Root/usr/include/sys/socket.h:93:26: error: 'sockaddr_un' undeclared here (not in a function)
   93 |         char data[sizeof(sockaddr_un)];
      |                          ^~~~~~~~~~~
make[2]: *** [<builtin>: bss_fd.o] Error 1
2020-08-26 00:46:04 +02:00
LepkoQQ 777b298880 LibGUI: Change window size and margin in ColorPicker 2020-08-26 00:38:23 +02:00
LepkoQQ 9e75c124a8 LibGUI: Add spinbox for alpha channel in ColorPicker 2020-08-26 00:38:23 +02:00