Commit Graph

2160 Commits

Author SHA1 Message Date
Andreas Kling
7ec1f6ab3c Kernel: Add File, a base class for anything that a FileDescriptor can wrap.
FileDescriptor is getting out of control, and the layering isn't quite right
so let's make a File class that everything can inherit from. Then we can
stop worrying about all kinds of specifics in FileDescriptor.
2019-04-28 14:53:50 +02:00
Andreas Kling
75734aa003 Minesweeper: Add considering feature, where middle clicking marks with '?'
This is useful in the harder modes, for trying out different possibilities.
2019-04-28 13:55:41 +02:00
Andreas Kling
ed957ca2e1 WindowServer: Add 1280x720 resolution to the system menu. 2019-04-28 05:24:52 +02:00
Andreas Kling
d32d85e133 Kernel: Fix rename() sometimes failing to move within the same directory.
It was wrong to do a reverse name lookup on the old inode after adding
a new name for it, since we might very well get the new inode instead of
the old one, depending on hash table layouts.
2019-04-27 22:38:51 +02:00
Andreas Kling
95ddca8a52 LibC: Make the malloc()/free() scrubbing runtime optional (default on.)
Memory returned by malloc() is normally memset with 0x85.
Memory passed to free() is normally memset with 0x82.

These behaviors can now be disabled by setting one or both of
LIBC_NOSCRUB_MALLOC and LIBC_NOSCRUB_FREE in your environment. :^)
2019-04-27 21:19:56 +02:00
Andreas Kling
f80244399d LibC: Add dummy pthread.h for GCC build. 2019-04-27 21:19:18 +02:00
Andreas Kling
d3fb0a56ed LibC: Make fwrite() buffered.
This is a really naive implementation that makes fwrite() call fputc()
internally, but it still performs a lot better due to avoiding the write()
syscall every time.
2019-04-27 17:32:47 +02:00
Andreas Kling
52139a2392 DiskBackedFS: Flush write cache if it reaches 32 entries before sync.
This is just to avoid chewing through all of the kernel memory. There is a
lot of room for improvement here, and 32 is just a number from the place
where numbers come from.
2019-04-27 17:30:32 +02:00
Andreas Kling
dde8d90747 Ext2FS: Fix accidental zero-fill when appending to a file.
We were using the old file size, rather than the new file size, to determine
how much to zero-fill in the last block of a file.
2019-04-27 17:14:27 +02:00
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