Commit Graph

4015 Commits

Author SHA1 Message Date
Andreas Kling
b615a5c780 LibGUI: Add a way for GWidgets to do custom layout on child hide/show
This solves an issue in GScrollableWidget where hiding one of the two
scrollbars needs to trigger a relayout since the other one should grow
into the "shared space" in the bottom right corner.

A GWidget can now override custom_layout() which will be called at any
time we would normally delegate work to the GLayout, e.g on resize
or child visibility changes, size policy changes, etc.
2019-09-01 20:51:20 +02:00
Andreas Kling
77a58119e7 GTextEditor: Hide the horizontal scrollbar when line-wrapping is on 2019-09-01 20:34:50 +02:00
Andreas Kling
906582d8df GTextEditor: Fix wrong width calculations with line-wrapping enabled
There were various little mistakes in the width calculations used by
the line-wrapping layout code.

With this patch, we should no longer see the horizontal scrollbar get
enabled with line-wrapping enabled. I will hide the scrollbar in a
separate patch.
2019-09-01 20:04:25 +02:00
Andreas Kling
74ca299b4b GTextEditor: Make visual lines stop after their last character
Instead of letting each visual line run to the end of the editor when
wrapping lines, stop each visual line where it runs ouf characters.

Fixes #493.
2019-09-01 17:30:23 +02:00
Andreas Kling
72a29d72d3 Rect: Add contains_vertically(y) and contains_horizontally(x) 2019-09-01 17:28:49 +02:00
Andreas Kling
c686264703 LibThread: Add missing install.sh script
This unbreaks the SDL port build.
2019-09-01 16:59:12 +02:00
Andreas Kling
127e1e0077 wc: Add missing newlines to some error messages 2019-09-01 15:32:09 +02:00
Andreas Kling
16628d0f8f VisualBuilder: Remove empty "Edit" menu
There was nothing in there anyway. We can add it back when we have some
edit actions :^)
2019-09-01 13:25:54 +02:00
Andreas Kling
353bf57378 WindowServer: Don't crash when trying to close an empty menu
It's not normal to add empty menus to an app's menubar, but just in
case someone does it anyway, let's not crash trying to close it.
2019-09-01 13:24:57 +02:00
Conrad Pankoff
6bb6176762 Shell: Support semicolons for separating commands 2019-09-01 12:44:33 +02:00
Rhin
3e6a0a0533 TextEditor: Stopped disappearing text at end of document (#505)
text_position_at() was returning -1 if the position wasn't in
the bounds of a visual line. Now if the position is past the last
line, we simply return the last line index instead of -1.

Fixes #502.
2019-09-01 12:34:14 +02:00
Andreas Kling
3e2e086011 LibGUI: Add a way for GWidget subclasses to learn that the font changed
Use this in GTextEditor to update the vertical scrolling step size so
we always scroll one-line-at-a-time.
2019-09-01 12:26:35 +02:00
rhin123
e7d15ccca4 VBForm: Set mouse type relative to how we resize the VBWidget 2019-08-30 07:45:12 +02:00
Andreas Kling
6fe0fa30f2 Kernel: Fix broken passing of String as printf() argument in realpath() 2019-08-29 21:01:33 +02:00
Andreas Kling
d720388acf Kernel: Support partial munmap()
You can now munmap() a part of a region. The kernel will then create
one or two new regions around the "hole" and re-map them using the same
physical pages as before.

This goes towards fixing #175, but not all the way since we don't yet
do munmap() across multiple mappings.
2019-08-29 20:57:02 +02:00
Andreas Kling
0e53b1d1ad Kernel: Add some convenient getters to Region
Add getters for the underlying Range, the access bits, and also add
contains(Range) which just wraps m_range.contains().
2019-08-29 20:55:40 +02:00
Andreas Kling
10e0e13bf3 Kernel: Add LogStream operator<< for Range 2019-08-29 20:54:50 +02:00
Andreas Kling
21ee24b995 GFontDatabase: Iterate the font database in alphabetical order
This makes font menus look nicer.
2019-08-29 19:30:48 +02:00
Andreas Kling
cfe09784a4 TextEditor: Clear the dirty flag in newly opened documents 2019-08-29 18:54:06 +02:00
Andreas Kling
a71e411b27 Terminal: Use a gear icon for the "Settings" menu 2019-08-29 18:19:40 +02:00
Andreas Kling
1689cc0b00 Base: Use the right shade of warm gray in the radio button bitmaps 2019-08-29 18:19:16 +02:00
Andreas Kling
35d9ac6dbf Ports: Add "curl" port :^) 2019-08-29 11:40:39 +02:00
Jesse Buhagiar
1112899a63 Kernel: Fixed FDC motor_enable()
Motor Enable now selects the correct drive. The ternary
operations were backwards. QEMU doesn't care (obviously) but
on a real PC, the drive doesn't actually ever get selected...
2019-08-29 10:18:39 +02:00
Andreas Kling
5d8aadaf38 Meta: Fix typo in ReadMe 2019-08-29 09:40:34 +02:00
Andreas Kling
72950f93a3 TextEditor: Move the Font menu inside the View menu
This will be our first user of the nested menus feature. :^)
2019-08-29 06:36:35 +02:00
Andreas Kling
63e6b09816 WindowServer+LibGUI: Add support for nested menus
It's now possible to add a GMenu as a submenu of another GMenu.
Simply use the GMenu::add_submenu(NonnullOwnPtr<GMenu>) API :^)

The WindowServer now keeps track of a stack of open menus rather than
just one "current menu". This code needs a bit more work, but the basic
functionality is now here!
2019-08-29 06:36:29 +02:00
Rhin
d3ebd8897f GTextEditor: Set content size based on the visual line rects (#500)
When we update our content size, the width & height is now calculated
from the visual line rect size. Also now after we recompute all visual
lines, if the total height is different, we re-update the content size.
2019-08-29 06:26:24 +02:00
Conrad Pankoff
b15a7c435f Kernel: Implement is_zero for RoutingDecision 2019-08-29 06:25:06 +02:00
Conrad Pankoff
302d521485 Kernel: Take a copy of MACAddress in RoutingDecision 2019-08-29 06:25:06 +02:00
Conrad Pankoff
498f8c01a2 Kernel: Use a public member for NetworkAdapter on_receive 2019-08-29 06:25:06 +02:00
Conrad Pankoff
6d1418aa7a Kernel: Add simple ARP routing layer
This replaces the previous placeholder routing layer with a real one!
It's still very primitive, doesn't deal with things like timeouts very
well, and will probably need several more iterations to support more
normal networking things.

I haven't confirmed that this works with anything other than the QEMU
user networking layer, but I suspect that's what nearly everybody is
using at this point, so that's the important target to keep working.
2019-08-29 06:25:06 +02:00
Conrad Pankoff
626e176cab Kernel: Remove IP configuration from LoopbackAdapter
This is configured in NetworkTask_main now, so there's no need to do it
here as well.
2019-08-29 06:25:06 +02:00
Conrad Pankoff
13abb3e88b Kernel: Remove now-unused singleton methods from our network devices 2019-08-29 06:25:06 +02:00
Conrad Pankoff
93c16590f1 Kernel: Remove specific devices from network code
By setting up the devices in init() and looping over the registered
network adapters in NetworkTask_main, we can remove the remaining
hard-coded adapter references from the network code.

This also assigns IPs according to the default range supplied by QEMU
in its slirp networking mode.
2019-08-29 06:25:06 +02:00
Conrad Pankoff
41e9ad5ea0 Kernel: Add const to packet data in send_raw call 2019-08-29 06:25:06 +02:00
Conrad Pankoff
36d349f7a7 Kernel: Add on_receive callback to NetworkAdapter 2019-08-29 06:25:06 +02:00
Conrad Pankoff
682fe48222 Kernel: Show netmask/gateway in ProcFS when available 2019-08-29 06:25:06 +02:00
Conrad Pankoff
1aa7437ad7 Kernel: Add netmask and gateway to NetworkAdapter 2019-08-29 06:25:06 +02:00
Conrad Pankoff
61bdf09d78 Kernel: Run NetworkTask in init stage 2 to allow use of locks 2019-08-29 06:25:06 +02:00
Conrad Pankoff
bed069bd14 Kernel: Ask for all relevant IRQs in rtl8139 driver 2019-08-29 06:25:06 +02:00
Conrad Pankoff
5f86a979ea Kernel: Ignore IPv6 packets; log unknown Ethernet payload types 2019-08-29 06:25:06 +02:00
Conrad Pankoff
4a4e66b2d0 Kernel/AK: Add is_zero helpers for IP and MAC addresses 2019-08-29 06:25:06 +02:00
Conrad Pankoff
fac1148679 Kernel: Always format MACAddress with two-byte hex digits in to_string 2019-08-29 06:25:06 +02:00
Conrad Pankoff
eb01735ec5 Kernel: Add list-compatible constructor for MACAddress 2019-08-29 06:25:06 +02:00
Brandon Scott
23e8715022 Userland: Add 'which' command (#497)
This mimics the shell's path resolution to locate the executable that
would execute if typing it as a command.
2019-08-29 06:23:22 +02:00
Andreas Kling
50ef2216fa GTextEditor: Optimize write_to_file() with ftruncate()
Compute the final file size and ftruncate() the destination file to the
right size immediately instead of incrementally appending to it.

This kind of optimization belongs in the kernel, but until we have it
there, this makes saving text files a whole lot faster. :^)
2019-08-28 19:32:45 +02:00
Sergey Bugaev
5d3696174b AK: Add a Utf8View type for iterating over UTF-8 codepoints
Utf8View wraps a StringView and implements begin() and end() that
return a Utf8CodepointIterator, which parses UTF-8-encoded Unicode
codepoints and returns them as 32-bit integers.

This is the first step towards supporting emojis in Serenity ^)
https://github.com/SerenityOS/serenity/issues/490
2019-08-28 13:46:02 +02:00
Conrad Pankoff
970e0147f7 AK: Make printf %x actually work properly
When printing hex numbers, we were printing the wrong thing sometimes. This
was because we were dividing the digit to print by 15 instead of 16. Also,
dividing by 16 is the same as shifting four bits to the right, which is a
bit closer to our actual intention in this case, so let's use a shift
instead.
2019-08-28 06:43:04 +02:00
Andreas Kling
b1763238d7 TextEditor: Ask the user before closing a dirty (modified) document
It's a little unfortunate that we have two separate code paths that can
lead to asking the user about this. Longer-term we should find a way to
unify these things.

Fixes #491.
2019-08-27 20:39:01 +02:00
Andreas Kling
c4b1456c88 GWindow: Allow clients to prevent close requests from closing
This is done by hooking the new on_close_request callback and returning
GWindow::CloseRequestDecision::StayOpen (instead of ...::Close.)
2019-08-27 20:35:37 +02:00