Commit graph

2151 commits

Author SHA1 Message Date
Andreas Kling
100cb2a237 LibC: Various stdio correctness fixes. 2019-04-27 16:19:11 +02:00
Andreas Kling
679ac386eb Kernel: "Succeed" quietly for zero-length read() and write(). 2019-04-27 16:17:24 +02:00
Andreas Kling
8bce4b3f42 GTableView: Ignore double-clicks that hit the header section. 2019-04-26 23:13:05 +02:00
Andreas Kling
8f81a3f9dd LibGUI+WindowServer: Make it possible to have checkable GActions.
They show up as checkable GButtons in GToolBar, and with (or without) check
marks in menus.

There are a bunch of places to make use of this. This patch only takes
advantage of it in the FileManager for the view type actions.
2019-04-26 21:09:56 +02:00
Andreas Kling
9ff36afeaa GWindow: Fix crash when calling set_rect() repeatedly.
We throw away the backing store if the window rect changes size. Since the
resizing happens asynchronously at the mercy of the WindowServer, we might
end up in set_rect() again before gaining a new backing store. So there are
no guarantees that the back/front bitmaps exist here.
2019-04-26 20:08:30 +02:00
Andreas Kling
146aedc32c Minesweeper: Implement some feature requests.
Someone was playing this game and suggested a number of improvements so here
we go trying to address them:

- Add "chording" support, where you can click a numbered square using both
  mouse buttons simultaneously to sweep all non-flagged adjacent squares.

- Mis-flagged squares are now revealed as such on game over, with a special
  "bad flag" icon.

- The game timer now shows tenths of seconds. It also doesn't start until
  you click the first square.

- Add the three difficulty modes from the classic Windows version.
2019-04-26 19:54:31 +02:00
Andreas Kling
e90b501b31 GraphicsBitmap: munmap() pixels on destruction of self-allocating bitmaps. 2019-04-26 18:25:05 +02:00
Andreas Kling
d93c278d29 GWindow: Add resize(width, height) and resize(size). 2019-04-26 17:33:20 +02:00
Andreas Kling
b204b77b29 sh: Remove debug spam during command launch. 2019-04-26 17:33:06 +02:00
Andreas Kling
08bc5d44e7 Games: Use Makefile.common here too. 2019-04-26 15:14:28 +02:00
Andreas Kling
104af4a5dc LibGUI: Allow subclassing of GLabel. 2019-04-26 14:16:17 +02:00
Andreas Kling
ba2e97aa52 LibGUI: Track double-clicking per individual mouse button.
Clicking two separate buttons in quick succession shouldn't be interpreted
as a double click.
2019-04-26 14:15:11 +02:00
Andreas Kling
d4a8e2930e sh: Add a simple "export" command for setting environment variables. 2019-04-26 03:23:27 +02:00
Andreas Kling
490e89e240 LibC: Add execvpe() and make execvp()'ed children inherit environment. 2019-04-26 03:16:26 +02:00
Andreas Kling
0a68e0046f LibCore: Make it possible to create a CFile for an existing file descriptor. 2019-04-26 02:22:21 +02:00
Andreas Kling
c392c0d799 Userland: Add a simple /bin/tr program. 2019-04-26 00:57:37 +02:00
Andreas Kling
671dee9afa Userland: Add a simple /bin/sort program. 2019-04-26 00:53:57 +02:00
Andreas Kling
b5a1ee1d3e Userland: Add a simple /bin/head program. 2019-04-26 00:47:30 +02:00
Andreas Kling
8effdc807a LibC: Update stdio stream error state in more places. 2019-04-26 00:41:37 +02:00
Andreas Kling
1163e0a030 Kernel: Don't count kfree(nullptr) as a call to kfree().
This was causing the kmalloc/kfree call delta to accumulate errors.
2019-04-25 23:18:11 +02:00
Andreas Kling
96d4b701e6 sh: Make "cd" jump to the home directory. And also let's set $HOME.
Nobody else is setting $HOME right now, so we might as well do it here.
This should eventually be done by some sort of "login" program.
2019-04-25 23:09:21 +02:00
Andreas Kling
89e9aafbb5 sh: Support erasing a whole word with WERASE (^W). 2019-04-25 23:05:10 +02:00
Andreas Kling
71770e000b GTextEditor: Add very basic automatic indentation.
This is off by default, but enabled by TextEditor. It simply inserts the
same number of leading spaces as the previous line when hitting Enter. :^)
2019-04-25 22:56:09 +02:00
Andreas Kling
8a3d00ac02 GTableView: Double-click should only activate/edit valid indices. 2019-04-25 22:55:44 +02:00
Andreas Kling
e2e2c78332 GTextEditor: Double-clicking on a word should select that word. 2019-04-25 22:29:25 +02:00
Andreas Kling
44673c4f3b Kernel: Add a write cache to DiskBackedFS.
This way you can spam small write()s on a file without the kernel writing
to disk every single time. Flushes are included in the FS::sync() operation
and will get triggered regularly by syncd. :^)
2019-04-25 22:05:53 +02:00
Andreas Kling
e0cdc5db0d Ext2FS: Reduce debug spam in block allocation. 2019-04-25 22:05:32 +02:00
Andreas Kling
de4b77ef27 WindowServer: Ignore title change notifications for non-normal windows. 2019-04-25 17:38:16 +02:00
Andreas Kling
04b7def6ab sh: Add support for redirecting stdin and stdout with < and >.
This is certainly about time. The kernel has had all the necessary support
in place for months, and I just kept postponing working on the shell. :^)
2019-04-25 16:10:16 +02:00
Andreas Kling
df8e76a67c cat: Just use fd 0 when no arguments are passed.
I'm not sure why it seemed necessary at some point to open /dev/stdin rather
than simply using the already-open fd 0.
2019-04-25 16:01:28 +02:00
Andreas Kling
6c950f8f83 Kernel: Dump stack trace when kmalloc() fails. 2019-04-25 15:58:49 +02:00
Andreas Kling
e84faadb63 sh: Refactor command parsing into a separate class. 2019-04-25 14:34:25 +02:00
Andreas Kling
07de1147ad sh: Add basic command piping support. 2019-04-25 14:13:36 +02:00
Andreas Kling
aa84e2fc64 fgrep: Don't repeat old incoming data if fgets() failed. 2019-04-25 14:07:17 +02:00
Andreas Kling
d5578826af Kernel: Make it possible to look up FIFO's by ID.
This will be useful when implementing the /proc/PID/fd/N links where N is
a file descriptor referring to a FIFO.
2019-04-25 13:53:24 +02:00
Andreas Kling
eadcf720c0 Userland: Add a simple /bin/echo program. 2019-04-25 04:42:09 +02:00
Andreas Kling
737315c228 GTextEditor: Improve cursor positioning accuracy when using a mouse.
Put the cursor on the left or right side of a glyph when clicking it based
on distance to middle of glyphs. This is such an obvious change that makes
a small but noticeable difference in feel. :^)
2019-04-25 02:15:45 +02:00
Andreas Kling
7a5525edf4 GTextEditor: Go a little past the cursor for Home/End scroll-into-view.
When jumping to the start of a line, or to the end of a line, scrolling two
pixels past the end yields a pleasant effect.
2019-04-25 01:33:59 +02:00
Andreas Kling
2c51bc92af GTextEditor: Always call did_change() before set_cursor().
This is not very obvious and I need to come up with a better design, but for
now just make sure to call did_change() before calling set_cursor().
This is needed because set_cursor() will try to scroll the cursor into view,
and for right-aligned text, did_change() may change the content rect which
needs to be reflected by the time we call scroll_cursor_into_view().
2019-04-25 01:28:17 +02:00
Andreas Kling
4e715dbc71 GTextEditor: Account for the GFrame border in the painting code.
We were forgetting to translate the painter by the frame_thickness().
With this fixed, we can also do proper vertical centering of lines for
single-line editors, and things suddenly look nicer than ever! :^)
2019-04-25 01:11:35 +02:00
Andreas Kling
3543236e8f GScrollableWidget: The visible_content_rect() should be max content_size().
When computing the visible content rect, constrain the result to the content
size. The content shouldn't feel responsible for painting anything outside.
2019-04-25 00:05:48 +02:00
Andreas Kling
7dc4078a73 SharedGraphics: Add is_right_text_alignment(TextAlignment) helper.
This seems a tad bit more future-proof than manually checking all the valid
right-side TextAlignment values in clients.
2019-04-24 23:46:19 +02:00
Andreas Kling
0c88ce9ee3 GTextEditor: Expand the content "to-fill" for right aligned text.
When using a right-side text alignment, hook the resize event to make sure
that the content width is at least frame_inner_rect().width() wide.

This allows us to use content_width() as the anchor point for right aligned
text, rather than using the frame inner rect, which was clearly wrong in
the overflow case.
2019-04-24 23:42:49 +02:00
Andreas Kling
f1eba2295d GTextEditor: Make the line_widget_rect() span the widget horizontally. 2019-04-24 23:15:15 +02:00
Andreas Kling
4bea3a4aa6 GTextEditor: Turn off the ruler by default.
You're usually not gonna want the ruler. TextEditor can enable it manually.
2019-04-24 23:06:44 +02:00
Andreas Kling
5c240af3f7 GTextEditor: Fix line_content_rect() behavior with custom alignments. 2019-04-24 22:46:27 +02:00
Andreas Kling
62f0aae4ca GTextEditor: Add support for different text alignments.
Currently only CenterLeft and CenterRight are supported, but it would be
very straightforward to add other alignments as well.
2019-04-24 22:24:16 +02:00
Andreas Kling
16f6a3af3c Allow passing extra args to qemu via a SERENITY_EXTRA_QEMU_ARGS env var. 2019-04-24 21:06:16 +02:00
Andreas Kling
16cbfd3f4e Taskbar: Clicking a window button now toggles minimized state. 2019-04-24 02:48:02 +02:00
Andreas Kling
d7cf841d3d Kernel: Add a comment block about the Device class. 2019-04-24 02:37:57 +02:00