Commit Graph

1515 Commits

Author SHA1 Message Date
Andreas Kling
6321b6ecc0 LibC: Move shbuf_* implementations to serenity.cpp 2020-02-28 12:55:58 +01:00
Andreas Kling
dcd619bd46 Kernel: Merge the shbuf_get_size() syscall into shbuf_get()
Add an extra out-parameter to shbuf_get() that receives the size of the
shared buffer. That way we don't need to make a separate syscall to
get the size, which we always did immediately after.
2020-02-28 12:55:58 +01:00
Andreas Kling
a1514369d7 LibC: Move shbuf_* API's to <serenity.h> 2020-02-28 12:55:58 +01:00
Andreas Kling
f72e5bbb17 Kernel+LibC: Rename shared buffer syscalls to use a prefix
This feels a lot more consistent and Unixy:

    create_shared_buffer()   => shbuf_create()
    share_buffer_with()      => shbuf_allow_pid()
    share_buffer_globally()  => shbuf_allow_all()
    get_shared_buffer()      => shbuf_get()
    release_shared_buffer()  => shbuf_release()
    seal_shared_buffer()     => shbuf_seal()
    get_shared_buffer_size() => shbuf_get_size()

Also, "shared_buffer_id" is shortened to "shbuf_id" all around.
2020-02-28 12:55:58 +01:00
Andreas Kling
3523071bb7 LibGUI: Disable the ColumnsView subview in MultiView for now
This is causing FilePicker to log a bunch of debug noise due to the
missing support for tree models in SortingProxyModel and it's not
helping anyone so let's just disable it.

This needs fixing in SortingProxyModel.
2020-02-27 14:43:35 +01:00
Liav A
0cda92d5da LibBareMetal: Remove unnecessary include 2020-02-27 13:05:12 +01:00
William McPherson
b1ed57e84b WavLoader: Add missing AK/OwnPtr.h include 2020-02-27 10:21:13 +01:00
Jesse Buhagiar
22cdf12ec4 LibCore: Allow ConfigFile::read_num_entry to handle negative numbers
Previously, this function was using `AK::String::to_uint()`, which is
wrong considering the function returns type `int`. This also means that
configuration files would revert to the default value on negative
values.
2020-02-26 11:48:53 +01:00
howar6hill
35024154cc DateTime: Fix a typo 2020-02-26 09:31:43 +01:00
Andreas Kling
ac53af6b7b LibGUI: Mouse events didn't hit table headers when vertically scrolled
Only take the horizontal scroll into account when hit testing the
table view headers.
2020-02-25 23:06:40 +01:00
Valtteri Koskivuori
24b5fd4c4c LibM: Implement floating point variants of various math functions 2020-02-25 20:48:42 +01:00
joshua stein
0d2bfe5c65 Build: Only look at SUBDIRS with Makefiles
If a directory is renamed or deleted before 'make clean', git will
delete the Makefile but leave all of the object and dependency files
around.  When make would try to recurse into that directory from the
wildcard, it would error out since there is no Makefile.
2020-02-25 19:56:48 +01:00
Andreas Kling
423c48b355 LibGUI: Fix ColumnsView.cpp build 2020-02-25 16:05:00 +01:00
DAlperin
8e1645423f
LibGUI: Make descendants of AbstractView define their own select_all() (#1201)
AbstractView does not know which column it's displaying which makes it
impossible to implement the select_all functionality up there. Now
descendants override the pure virtual select_all method and implement
it themselves.
2020-02-25 16:03:15 +01:00
joshua stein
32e6453b0b LibGfx: SystemTheme is a struct, not a class
SystemTheme.h:81:1: error: 'SystemTheme' defined as a struct here but previously declared as a class; this is valid, but may result in linker errors under the Microsoft C++ ABI
2020-02-25 15:32:58 +01:00
Andreas Kling
ceec1a7d38 AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
Andreas Kling
9c6f7d3e7d LibGUI: Actually store the column in MultiView::set_model_column()
We were only forwarding the value to the subviews, but not storing it
in m_model_column. This would cause MultiView::model_column() to return
the wrong value.

Thanks to Daniel Bos for spotting this! :^)
2020-02-25 10:47:30 +01:00
Emanuel Sprung
074d935c6e AK, LibGfx, LibGUI: Initialize various variables to zero.
The not initialized variables can lead to compiler warnings that
become errors with the -Werror flag.
2020-02-25 10:18:46 +01:00
Sergey Bugaev
cbf2881bf7 LibThread: Fix destroying background actions
In the old model, before bc319d9e88, the parent
(the background thread) would delete us when it exits (i.e. never), so we had to
keep track of our own refcount in order to destroy ourselves when we're done.

With bc319d9e88, the parent keeps additional
reference to us, so:
* There should be no need to explicitly ref() ourselves
* The unref() would not get rid of the last reference to us anymore

The latter is why all the BackgroundAction's were getting leaked. Fix this by
simply unparenting ourselves from the background thread when we're done.
2020-02-25 10:17:31 +01:00
Andreas Kling
ab9a0780e3 LibGUI: Show the columns view action in the toolbar (but disable it)
We'll enable it once ColumnsView is less crashy. :^)
2020-02-24 21:23:00 +01:00
Andreas Kling
90c4e6b000 LibThread: Post the completion callbacks to the *current* event loop
FilePicker was not showing thumbnails correctly because once each
thumbnail rendering BackgroundAction completed, it posted a deferred
invocation event to the *main* event loop.

Since FilePicker runs in a nested event loop, those completion
callbacks never ran until it was too late and the FilePicker was gone.
2020-02-24 21:18:35 +01:00
Andreas Kling
2ad405c789 LibGUI: Complain in SortingProxyModel::data() if map_to_target() fails
There is some sort of issue with using a SortingProxyModel together
with ColumnsView. This is a workaround to allow FilePicker to use a
MultiView for now, but this needs to be fixed separately somehow.
2020-02-24 20:54:27 +01:00
Andreas Kling
a5d7ea24e9 LibGUI: Use MultiView in FilePicker
This allows the user to switch between different view modes.

Fixes #1283.
2020-02-24 20:50:21 +01:00
Andreas Kling
1b2b35cc40 LibGUI: Add a MultiView widget, based on FileManager's "DirectoryView"
A MultiView is a combination of ItemView, TableView and ColumnsView
smashed into a single widget. You can switch between the view modes
by calling MultiView::set_view_mode().

Note that MultiView inherits from StackWidget, not AbstractView.
That's purely for practical reasons, although I'm not entirely sure
if there would be some benefit to having it inherit from AbstractView.
2020-02-24 20:48:42 +01:00
Andreas Kling
bc64f8c502 LibGUI: Make AbstractView::set_model() take a RefPtr<Model>
Let's face it: Taking RefPtr<T>&& arguments is obnoxious and puts too
much unnecessary burden on the caller.
2020-02-24 20:47:16 +01:00
Andreas Kling
ab6f694905 WindowServer+LibGUI: Allow changing a window's base size and increment
Previously it was only possible to change these window attributes when
creating a new window. This patch adds an IPC message that allows you
to change them at runtime.
2020-02-24 19:23:57 +01:00
Tibor Nagy
0086daf9b0 LibGUI: Scroll selected treeview entries into view 2020-02-24 15:12:47 +01:00
Liav A
43d570a1e3 AK: Add offset_in_page() method in PhysicalAddress class
This method is useful for later usage.
2020-02-24 11:27:03 +01:00
Tibor Nagy
5f913c67d9 LibGUI: Implement keyboard and mouse wheel events for SpinBox 2020-02-24 10:40:32 +01:00
Andreas Kling
3252a6925e LibGUI: Fix silly nullptr dereference in MessageBox::show()
Since we take the parent object as a raw pointer, we should handle the
case where it's null.
2020-02-24 09:15:51 +01:00
Andreas Kling
6c5100b644 LibGUI: Add helper for constructing new TabWidget tabs
This patch adds the following convenience helper:

    auto tab_widget = GUI::TabWidget::construct();
    auto my_widget = tab_widget->add_tab<GUI::Widget>("My tab", ...);

The above is equivalent to:

    auto tab_widget = GUI::TabWidget::construct();
    auto my_widget = GUI::Widget::construct(...);
    tab_widget->add_widget("My tab", my_widget);
2020-02-23 12:27:53 +01:00
Andreas Kling
c5d913970a LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
Tibor Nagy
6fcf4e48f8 LibGfx: Fix accidentally hardcoded font height in Font::clone() 2020-02-23 12:18:17 +01:00
Andreas Kling
bfd86c4631 LibGUI: Make GUI::Frame have the 2px sunken container look by default
The overwhelming majority of GUI::Frame users set the same appearance,
so let's just make it the default.
2020-02-23 11:10:52 +01:00
Andreas Kling
3d20da9ee4 Userspace: Use Core::Object::add() when building interfaces 2020-02-23 11:10:52 +01:00
Andreas Kling
00bf68adc6 LibGUI: Reduce header dependencies of ComboBox 2020-02-23 11:10:52 +01:00
Andreas Kling
45c25ffecd LibGUI: Use Core::Object::add() a whole bunch 2020-02-23 11:10:52 +01:00
Andreas Kling
428582e805 LibGUI: Don't require passing a parent to widget constructors
This is a step towards using Core::Object::add<T> more, which takes
care of parenting the newly created child automatically.
2020-02-23 11:10:52 +01:00
Andreas Kling
d9e459293b LibCore: Add Core::Object::add<T> helper for creating child objects
Consider the old pattern for creating a Core::Object parent and child:

    auto parent = Core::Object::construct(...);
    auto child = Core::Object::construct(..., parent);

The above was an artifact of the pre-reference-counting Object era.
Now that objects have less esoteric lifetime management, we can replace
the old pattern with something more expressive:

    auto parent = Core::Object::construct(...);
    auto child = parent->add<Core::Object>(...);

This reads a lot more naturally, and it also means we can get rid of
all the parent pointer arguments to Core::Object subclass constructors.
2020-02-23 11:10:52 +01:00
Andreas Kling
66bf10acef LibGUI: Add some missing widget classes to Forward.h 2020-02-23 11:10:52 +01:00
Andreas Kling
98fd6b8767 LibGfx: Add a way to construct an empty Font with arbitrary metrics 2020-02-23 11:10:52 +01:00
Shannon Booth
a52b3e8f2a LibC: Implement strchrnul() 2020-02-22 21:36:54 +01:00
Andreas Kling
a406a8c7d2 LibGUI: Remove debug spam when resizing table columns 2020-02-22 21:27:08 +01:00
Andreas Kling
28f1486627 LibCore: Log a more helpful message when Socket::connect() fails
Fixes #1272.
2020-02-22 16:41:31 +01:00
Andreas Kling
82fd09e8fe LibCore: Fix wrong return value in Core::Socket::destination_address() 2020-02-22 16:38:10 +01:00
Andreas Kling
99978b771d LibGUI: Take scroll offset into account when manipulating table headers
Fixes #1271.
2020-02-22 15:04:02 +01:00
Andreas Kling
34b81f17c2 LibELF: Avoid unnecessarily recomputing loop boundaries over and over 2020-02-22 11:25:15 +01:00
Tibor Nagy
2eb9620415 LibGUI: Improve TreeView keyboard navigation
This commit adds two new behaviour to the key event handler of
the TreeView widget:

Pressing left now jumps to the parent node if the current treenode
is closed or has no children.

Pressing right now jumps to the first children node if the current
treenode is open.
2020-02-21 20:18:44 +01:00
Andreas Kling
c4c1ad2289 Toolchain: Build demangling into LibC except during toolchain build 2020-02-21 18:54:57 +01:00
Andreas Kling
4198061534 LibELF: Use the ELF_STRTAB string constant instead of hard-coding 2020-02-21 16:16:23 +01:00