Commit Graph

135 Commits

Author SHA1 Message Date
Andreas Kling
4533539e8a Painter: Add text elision support (only right-hand side supported.)
Some window titles didn't fit on the taskbar buttons, so I needed a way
to collapse the remaining part of the text into "..."
2019-04-04 15:19:04 +02:00
Andreas Kling
19eb814850 LibGUI: Make it possible for GButton to be checkable. 2019-04-04 13:18:27 +02:00
Andreas Kling
c02c9880b6 AK: Add Eternal<T> and use it in various places.
This is useful for static locals that never need to be destroyed:

Thing& Thing::the()
{
    static Eternal<Thing> the;
    return the;
}

The object will be allocated in data segment memory and will never have
its destructor invoked.
2019-04-03 16:52:25 +02:00
Andreas Kling
5b296718d8 GraphicsBitmap: Use MappedFile. 2019-04-03 14:32:45 +02:00
Andreas Kling
c0009e3173 PNGLoader: Use MappedFile. 2019-04-03 14:15:35 +02:00
Andreas Kling
3dc3754cde Font: Clean up AK::MappedFile and use it for mapping font files. 2019-04-03 13:51:49 +02:00
Andreas Kling
17e02e7450 Move NetworkOrdered.h to AK/ since it's used in both kernel and userspace. 2019-04-02 20:04:54 +02:00
Andreas Kling
2334ffcbf8 WindowServer: Add a WSCursor class (a bitmap and a hotspot.)
Also import a bunch of cursors I drew. Only the default ("arrow") cursor is
ever used so far.
2019-03-31 22:09:10 +02:00
Andreas Kling
9538c06a45 LibGUI: Add a simple GSplitter container widget.
This allows you to put multiple widgets in a container and makes the space
in between them draggable to resize the two adjacent widgets.
2019-03-30 13:53:30 +01:00
Andreas Kling
f249c40aaa Rename Painter::set_clip_rect() to add_clip_rect().
It was confusing to see multiple calls to set_foo() in a row. Since this is
an intersecting operation, let's call it add_clip_rect() instead.
2019-03-29 15:01:54 +01:00
Andreas Kling
2e0f4da1f7 StylePainter: Fix underdraw in new button style. 2019-03-29 02:57:33 +01:00
Andreas Kling
d48f486634 LibGUI: Don't draw left and right side of surfaces that span entire window.
In other words, if a surface stretches from the left side of the window
all the way to the right side, skip shading and highlighting the sides.
This makes widgets blend together just slightly with the window. :^)
2019-03-29 02:20:22 +01:00
Andreas Kling
e2cd7529ab StylePainter: Tweak ButtonStyle::Normal highlights. 2019-03-28 17:46:24 +01:00
Andreas Kling
c7ab643883 Move LibGUI/GStyle to SharedGraphics/StylePainter.
I want to paint some buttons in WindowServer where we don't have LibGUI.
2019-03-28 17:32:38 +01:00
Andreas Kling
9fa21fa585 LibGUI: Add a GPainter class that inherits from Painter.
This gets rid of the last little piece of LibGUI knowledge in Painter.
2019-03-28 17:19:56 +01:00
Andreas Kling
0058da734e Kernel: Add Inode::truncate(size).
- Use this to implement the O_TRUNC open flag.
- Fix creat() to pass O_CREAT | O_TRUNC | O_WRONLY.
- Make sure we truncate wherever appropriate.
2019-03-27 16:42:30 +01:00
Andreas Kling
08085f48a0 SharedGraphics: Font::width() shouldn't add spacing to the very last glyph. 2019-03-25 13:35:24 +01:00
Andreas Kling
eabc097dd4 SharedGraphics: Oops, I was compiling puff() in SLOW mode for testing. 2019-03-24 00:53:16 +01:00
Andreas Kling
60d25f0f4a Kernel: Introduce threads, and refactor everything in support of it.
The scheduler now operates on threads, rather than on processes.
Each process has a main thread, and can have any number of additional
threads. The process exits when the main thread exits.

This patch doesn't actually spawn any additional threads, it merely
does all the plumbing needed to make it possible. :^)
2019-03-23 22:03:17 +01:00
Andreas Kling
92627154a7 FileManager: Add basic thumbnailing of PNG images.
These use nearest neighbor and are computed synchronously on directory load
so it's neither fast nor very beautiful. These issues both need work on
other parts of the system to fix.
2019-03-23 12:37:33 +01:00
Andreas Kling
86570d3b1a SharedGraphics: Add Painter::draw_scaled_bitmap().
It's just a simple nearest-neighbor scale with alpha blending but it gets
the job done.
2019-03-22 04:20:10 +01:00
Andreas Kling
7c0a185970 Use the PNG loader for all images, and get rid of the .rgb files. 2019-03-22 00:21:03 +01:00
Andreas Kling
796bc56a13 PNGLoader: Reduce unfiltering branchiness even more.
Use a dummy scanline for y=0 filled with all zeroes to avoid having to check
y on every iteration before grabbing color data from scanline[y - 1].
2019-03-21 16:55:31 +01:00
Andreas Kling
cd1afde48c PNGLoader: Templatize the unfiltering functions to reduce branchiness.
This also allows us to dodge processing alpha values in non-alpha PNGs
without a branch.
2019-03-21 16:45:04 +01:00
Andreas Kling
cfc521d57e PNGLoader: Reorganize the unfiltering code to make it easier to work with. 2019-03-21 16:19:11 +01:00
Andreas Kling
fe25f957e5 PNGLoader: Allocate enough space for the compressed data buffer up front.
This is a 2x speedup on wallpaper loading.
2019-03-21 14:08:14 +01:00
Andreas Kling
332b5a96f6 PNGLoader: Remove a bunch of unnecessary data copying.
Use ByteBuffer::wrap() to avoid copying buffers around a bit. This is about
a 10% speedup on loading a wallpaper-type PNG.
2019-03-21 13:58:40 +01:00
Andreas Kling
65348e7dc1 PNGLoader: Support for color type 2 (RGB triplets) and multiple IDAT chunks. 2019-03-21 05:25:54 +01:00
Andreas Kling
42755e98cf SharedGraphics: Implement a simple PNG decoder.
This is extremely unoptimized, but it does successfully load "folder32.png"
so it must be at least somewhat correct. :^)
2019-03-21 03:57:42 +01:00
Andreas Kling
67009cee8e IRCClient: Add ability to change nickname. 2019-03-20 04:21:58 +01:00
Andreas Kling
e15cc4509f LibGUI: More GInputBox refinements.
Fix some GBoxLayout bugs to make the buttons in GInputBox line up better.
There are still some imperfections due to rounding errors.
2019-03-19 03:00:42 +01:00
Andreas Kling
55aa819077 IRCClient: Colorize some channel messages (joins, parts, topics) 2019-03-18 20:56:45 +01:00
Andreas Kling
f4b8e4966f SharedGraphics: Add Color::to_string().
This generates a string in the format "rgba(%d, %d, %d, %d)".
2019-03-18 04:53:09 +01:00
Andreas Kling
4e451c1e92 Add client-side double buffering of window backing stores.
This prevents flicker and looks rather good. The main downside is that
resizing gets even more sluggish. That's the price we pay for now.
2019-03-17 04:23:54 +01:00
Andreas Kling
1c6dfc3282 AK: Make ByteBuffer's copy() and wrap() take void*.
This way we don't have to cast whatever we're passing to copy()/wrap().
2019-03-17 00:36:41 +01:00
Andreas Kling
ffe4522316 SharedGraphics: Allow passing a Font to text drawing functions.
This way we don't have to juggle around with calls to Painter::set_font()
which simplifies a bunch of places.
2019-03-09 21:24:12 +01:00
Andreas Kling
b8f999cbef About+LibGUI: Use a GBoxLayout for the About app. 2019-03-09 21:09:29 +01:00
Andreas Kling
88f6ce152f SharedGraphics: Add PainterStateSaver RAII helper and Point::operator-().
Two little things to help tidy up a bit in WSWindowManager.
2019-03-09 16:54:41 +01:00
Andreas Kling
f7097d21f6 SharedGraphics: Give painter a state stack and save()/restore() operations.
This will make some painting code a lot less confusing since there's no
need to manually undo translations, clips, etc.
2019-03-09 16:48:02 +01:00
Andreas Kling
eda0866992 Add a C++ helper class for working with shared buffers.
This is a bit more comfortable than passing the shared buffer ID manually
everywhere and keeping track of size etc.
2019-03-08 12:24:05 +01:00
Andreas Kling
949c98c5af LibGUI: Implement GToolbar separators. 2019-03-07 23:01:36 +01:00
Andreas Kling
9867fe1025 GTextEditor: Add a ruler column that always shows the line numbers. 2019-03-07 20:05:05 +01:00
Andreas Kling
ce35cddb1b GTextEditor: Let's use a Vector for the line backing store.
I'm eventually gonna want to replace this with something more clever,
like a automagically splicing vector or something, but for now, at least
we move away from immutable Strings.
2019-03-07 14:35:32 +01:00
Andreas Kling
1ac71d1fb1 GTextEditor: Improvements to cursor rendering.
The view now scrolls along with you as you move the cursor around.
2019-03-07 13:13:25 +01:00
Andreas Kling
31d6b640eb Add a bold variant of Katica and make that the system's default bold font.
..and do some minor tweaks to the font rendering code.
2019-03-06 14:50:27 +01:00
Andreas Kling
66a5ddd94a More work on the variable-width font support.
Katica is now the default system font, and it looks quite nice. :^)
I'm gonna need to refine the GTextBox movement stuff eventually,
but it works well-enough for basic editing now.
2019-03-06 14:06:40 +01:00
Andreas Kling
7f6c81d90f Implement basic support for variable-width fonts.
Also add a nice new font called Katica. It's not used anywhere yet but
I'm definitely itching to start using it. :^)
2019-03-06 12:52:41 +01:00
Andreas Kling
0a86366c71 Make a preparation pass for variable-width fonts. 2019-03-06 11:03:10 +01:00
Andreas Kling
91031346e5 Kernel: More signal handling improvements.
Finally fixed the weird flaky crashing when resizing Terminal windows.
It was because we were dispatching a signal to "current" from the scheduler.
Yet another thing I dislike about even having a "current" process while
we're in the scheduler. Not sure yet how to fix this.

Let the signal handler's kernel stack be a kmalloc() allocation for now.
Once we can do allocation of consecutive physical pages in the supervisor
memory region, we can use that for all types of kernel stacks.
2019-03-05 12:52:35 +01:00
Andreas Kling
ef4d517429 LibGUI: Tweak focus appearance and add it to GTableView. 2019-03-04 10:12:09 +01:00