Commit Graph

166 Commits

Author SHA1 Message Date
Linus Groh
0cab3bca2f LibGUI: Add and use Window::center_on_screen()
Various applications were using the same slightly verbose code to center
themselves on the screen/desktop:

Gfx::IntRect window_rect { 0, 0, width, height };
window_rect.center_within(GUI::Desktop::the().rect());
window->set_rect(window_rect);

Which now becomes:

window->resize(width, height);
window->center_on_screen();
2020-08-15 17:38:19 +02:00
Andreas Kling
46e53417c9 SystemServer: Adjust assertion+comment for new dup2() behavior
dup2(fd, fd) will no longer clear CLOEXEC on the descriptor.
2020-08-15 11:14:09 +02:00
Tom
5f3d384454 WindowServer: Minimize the modal stack when minimizing from frame
Rather than only minimizing the modal window, minimize the entire
modal window stack just like when minimizing it from the task bar.
2020-08-15 01:28:18 +02:00
Linus Groh
895ab8e745 WindowServer: Take MenuApplet windows into account for hovered_window
This finally makes tooltips on menu applets the same as everywhere else!

Here's what went wrong:
WindowManager::process_mouse_event() receives a Window*&, determines the
hovered window and sets it accordingly. However there's a branch that
tests for menubar_rect().contains(event.position()) and returns early -
which resulted in hovered_window never being set to any MenuApplet
window, even hovered ones.

The hovered_window result is being used in WindowManager::event() and
passed to WindowManager::set_hovered_window(), which is responsible for
creating WindowLeft and WindowEntered events when the hovered window
changes, as a result of the mentioned chain of events this also never
happens for MenuApplet windows.
The WindowLeft event would the cause Window::handle_left_event() in
LibGUI to be called, which unsets the window's hovered widget, which
is necessary for the widget to receive a subsequent Enter event -
again, all of this never happened.

Now it's working as expected though, so we can start using tooltips on
menu applets :^)
2020-08-14 10:28:03 +02:00
Linus Groh
d979379a99 WindowServer: Handle global cursor tracking before ongoing drag/move/resize
In the case of an ongoing window drag/move/resize action
WindowManager::process_mouse_event() would return early, even before
delivering mouse events to windows with global cursor tracking enabled.
They would only continue to receive new mouse events once those actions
were completed.

Fixes #3116.
2020-08-13 15:54:17 +02:00
Ben Wiederhake
3ec7b8b33c Services: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Tom
8ffa4131ce WindowServer: Limit maximizing windows to top window in modal stack
When maximizing a window that is blocked by a modal window, only
maximize the top window in the stack. However, if the stack is
minimized, restore all of them in addition.

Fixes #3074
2020-08-10 21:02:11 +02:00
Andreas Kling
ecc8a42cd2 WindowServer: Use to_theme_window_type() a bit more 2020-08-10 13:05:02 +02:00
Andreas Kling
de1a54c378 WindowServer+LibGfx: Move window frame rect calculation to WindowTheme 2020-08-10 13:03:44 +02:00
Andreas Kling
c81c8b68bb WindowServer+LibGfx: Move notification window frame painting to LibGfx
ClassicWindowTheme can now also paint notification window frames.
2020-08-09 19:34:56 +02:00
Andreas Kling
e7460b6fb4 WindowServer+LibGfx: Move normal window frame painting to a WindowTheme
This patch introduces the ClassicWindowTheme, which is our default
theme implemented as a Gfx::WindowTheme subclass.

In this initial cut, we move normal window frame painting and title
bar metrics helpers out of WindowServer and into LibGfx.

This will eventually allow us much greater flexibility with theming
windows, and also makes it easier to build applications that want to
render a window with a specific style for some reason. :^)
2020-08-09 19:29:15 +02:00
Brian Gianforcaro
bcb4cb4543 AudioServer: Lock the process veil after startup
We can't do any file syscalls anyway because of the reduction of pledges,
so we might as well lock the veil anyway.
2020-08-07 09:10:14 +02:00
Nico Weber
ce95628b7f Unicode: Try s/codepoint/code_point/g again
This time, without trailing 's'. Ran:

    git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05 22:33:42 +02:00
Nico Weber
19ac1f6368 Revert "Unicode: s/codepoint/code_point/g"
This reverts commit ea9ac3155d.
It replaced "codepoint" with "code_points", not "code_point".
2020-08-05 22:33:42 +02:00
Andreas Kling
cb1fcd3eaf LaunchServer: Disown child processes after spawning 2020-08-04 18:17:16 +02:00
Andreas Kling
6e1cb2bae8 SystemMenu: Disown child processes after spawning 2020-08-04 18:17:16 +02:00
Andreas Kling
edefcc7f3a Taskbar: Disown quick-launched programs 2020-08-04 18:17:16 +02:00
Andreas Kling
7219f069a5 SystemMenu: Disown spawned programs 2020-08-04 18:17:16 +02:00
Andreas Kling
6e221adade LibWeb: Send key events to the WebContent process
This makes contenteditable work in multi-process mode. :^)
2020-08-03 19:58:59 +02:00
Andreas Kling
ea9ac3155d Unicode: s/codepoint/code_point/g
Unicode calls them "code points" so let's follow their style.
2020-08-03 19:06:41 +02:00
Tom
ad48bd1aca WindowServer: Bring window stack to front when clicking on frame
When clicking on a window's frame that is blocked by a modal
window, we want to bring the entire window stack to the front
regardless of where the user clicked in the frame (not just the
icon).
2020-08-03 18:34:39 +02:00
AnotherTest
97256ad977 ProtocolServer+LibTLS: Pipe certificate requests from LibTLS to clients
This makes gemini.circumlunar.space (and some more gemini pages) work
again :^)
2020-08-02 18:57:51 +02:00
Ben Wiederhake
597b0c9efd WindowServer: Redraw MenuApplets on add/delete 2020-08-02 11:00:50 +02:00
Nico Weber
6dd10ad8dc Themes: Fix default theme window stripes and shadow after #2811
Change #2811 made window title stripes and window title shadow themable,
but it used the same stripe and shadow color for all window modes.
This is fine for the new 'basalt' theme which uses the same color
in all four window modes, but it changed the default theme so that
background windows had brown stripes and a brown shadow.

Instead, make the title stripe and title shadow themable per window mode,
and change the default theme to restore the colors it had before
change #2811: The title stripe color is the same as Border1 for all
window modes, and the title shadow is the same as the title stripe
darkened by 0.6.
2020-08-01 19:26:54 +02:00
Peter Elliott
5ae9eee4a3 LibGUI+WindowServer: Provide default placement to windows
This prevents windows from being opened directly on top of eachother,
and provides default behavior for when window position is not specified.

The new behavior is as follows:
- Windows that have been created without a set position are assigned one
  by WindowServer.
- The assigned position is either offset from the last window that is
  still in an assigned position, or a default position if no such window
  is available.
2020-08-01 08:06:48 +02:00
thankyouverycool
c815fa7f47 Services: Convert WindowFrame button bitmaps to themable PNGs
Custom buttons can now be set using TitleButtonIcons under the
Paths group in themes. WindowFrame recognizes window-close.png,
window-minimize.png, window-maximize.png and window-restore.png
filenames.
2020-08-01 07:56:48 +02:00
Andreas Kling
ef711f501e LibWeb: Move the Page/Frame/EventHandler classes into Page/ 2020-07-28 19:28:29 +02:00
Ben Wiederhake
58dd9f2d2a SystemMenu: Add 'Themes' icon 2020-07-28 16:29:44 +02:00
Ben Wiederhake
a9d30a59d9 SystemMenu: Add icons for categories 2020-07-28 16:29:44 +02:00
Ben Wiederhake
404981a892 SystemMenu: Untangle app/category discovery and GUI building
I was a bit confused by the fact that a method named `build_system_menu()`
first enumerates a directory. Moving the app/category discovery to a dedicated
function that returns the GUI-relevant information makes this process a bit
less surprising.

As an added bonus, `g_app_category_menus` was actually only a temporary mapping,
and didn't need to be global. In theory, SystemMenu should use a handful fewer
of bytes now.
2020-07-28 16:29:44 +02:00
Ben Wiederhake
e8ed7f829e SystemMenu: Add icon to 'Exit' menu item 2020-07-28 16:29:44 +02:00
Andreas Kling
33d2ecdd79 WebServer: Show icons in directory listings :^)
Just adding some basic folder/file icon makes a big difference here.
2020-07-27 22:39:01 +02:00
Andreas Kling
7f70a6f0cb WebServer: Try to send an appopriate Content-Type header
Use Core::guess_mime_type_based_on_filename() for this. It's obviously
not perfect, but it works better than just sending "text/html" for
everything no matter what. :^)
2020-07-27 19:57:20 +02:00
Andreas Kling
5c7d54d50d WebServer: Use table tags in directory listings
Use tables to align stuff instead of putting everything in a <pre>.
2020-07-27 19:57:20 +02:00
Andreas Kling
efa117f801 WebServer: Use urlencode() in directory listings 2020-07-27 19:57:20 +02:00
thankyouverycool
c50f258b7a LibGUI+WindowServer: Allow applets to retrieve their location
MenuApplet windows can now call rect_in_menubar to return their
location in the MenuBar.
2020-07-26 11:32:12 +02:00
thankyouverycool
030f4150b8 WindowServer: Adjust MenuApplet position on resize
Applet rects are now recalculated when changed.
2020-07-26 11:32:12 +02:00
Andreas Kling
0d3d22f464 WindowServer: Use WindowManager::window_title_font() in one place
If we use this everywhere, it may one day become possible to change the
window title font.
2020-07-25 13:45:52 +02:00
Andreas Kling
0aef87b82c WindowServer: Center the window titlebar icons vertically
This feels a bit tricksy, but at least makes window icons look much
better with the "Basalt" theme. :^)
2020-07-25 13:43:56 +02:00
Andreas Kling
e2f45a4b0e WindowServer: Relayout window buttons immediately on theme change 2020-07-25 13:35:16 +02:00
Andreas Kling
299824de73 LibGUI: Rename GUI::Image => GUI::ImageWidget
"Image" was a bit too vague, "ImageWidget" is obviously a widget of
some sort.
2020-07-23 17:31:08 +02:00
Benoît Lormeau
60a7187db2 AudioServer: Give the AudioClient a way to keep track of the main mix volume 2020-07-21 19:02:25 +02:00
Nico Weber
a98d960ad4 Taskbar: Use Name from .af file as tooltip
With this, System Monitor has "System Monitor" instead of
"SystemMonitor" as tooltip, matching the app's title bar
and menu bar title.

Same for File Manager and Text Editor.
2020-07-18 15:51:46 +02:00
Andreas Kling
82c38f6fdf WindowServer: Decide on a window title before measuring its width
If we add "(Not responding)" to the title of an unresponsive window,
the title rect needs to be wider or we'll have text-on-stripes.

Thanks to @SharpOB for reporting this bug!
2020-07-18 01:50:24 +02:00
Nullspeak
51b2b0d5e5 WindowServer: New title bar vars for themes
The theming system can now control title bar height, title button
size, title stripe color and the title text shadow color.
The implemented theme metrics system could be later extended to LibGUI
to allow themes to change widget padding, border width, etc.
2020-07-17 23:19:08 +02:00
Tom
f591157eb8 WindowServer: Fix picking new active window after destroy
We need to mark windows as destroyed and not consider them
when picking a new active window. Fixes lost focus after
closing some windows.
2020-07-16 19:47:11 +02:00
Tom
603c17262c WindowServer: Fix traversing modal stack
When walking the modal window stack upwards, we need to check if
the top modal window is still a descendant of the window that
the parent is blocked by. Fixes not all windows being brought to
the front when trying to active a parent in the middle of the
modal window stack.
2020-07-16 19:47:11 +02:00
Tom
d87f876946 WindowServer: Fix crash when no active input window is set 2020-07-16 16:10:21 +02:00
Tom
a269e3e573 Taskbar: Don't create buttons for modal windows
Since the user can't really do much with windows that are blocked
by a modal window, there is no point in showing multiple buttons.
2020-07-16 16:10:21 +02:00
Tom
bbdf0665fc WindowServer: Expose window parent information and more modal improvements
* The parent information is necessary by the Taskbar to be able to
  determine a modal window's parent
* Minimize and maximize modal window stacks together
2020-07-16 16:10:21 +02:00