mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:27:45 +00:00
implemented settings for window manager.
This commit is contained in:
parent
d4a16d6031
commit
63486b8438
5 changed files with 54 additions and 51 deletions
|
@ -5,7 +5,7 @@ Height=1080
|
||||||
[Cursor]
|
[Cursor]
|
||||||
Arrow=/res/cursors/arrow.png
|
Arrow=/res/cursors/arrow.png
|
||||||
ResizeH=/res/cursors/resize-horizontal.png
|
ResizeH=/res/cursors/resize-horizontal.png
|
||||||
ResizeV=/res/cursor/resize-vertical.png
|
ResizeV=/res/cursors/resize-vertical.png
|
||||||
ResizeDTLBR=/res/cursors/resize-diagonal-tlbr.png
|
ResizeDTLBR=/res/cursors/resize-diagonal-tlbr.png
|
||||||
ResizeDBLTR=/res/cursors/resize-diagonal-bltr.png
|
ResizeDBLTR=/res/cursors/resize-diagonal-bltr.png
|
||||||
IBeam=/res/cursors/i-beam.png
|
IBeam=/res/cursors/i-beam.png
|
||||||
|
@ -29,3 +29,5 @@ DraggingWindowTitle=255,255,255
|
||||||
HighlightWindowBorder=161,13,13
|
HighlightWindowBorder=161,13,13
|
||||||
HighlightWindowBorder2=250,187,187
|
HighlightWindowBorder2=250,187,187
|
||||||
HighlightWindowTitle=255,255,255
|
HighlightWindowTitle=255,255,255
|
||||||
|
|
||||||
|
MenuSelectionColor=132,53,26
|
||||||
|
|
|
@ -76,10 +76,8 @@ void WSCompositor::compose()
|
||||||
for (auto& dirty_rect : dirty_rects.rects()) {
|
for (auto& dirty_rect : dirty_rects.rects()) {
|
||||||
if (wm.any_opaque_window_contains_rect(dirty_rect))
|
if (wm.any_opaque_window_contains_rect(dirty_rect))
|
||||||
continue;
|
continue;
|
||||||
if (!m_wallpaper)
|
m_back_painter->fill_rect(dirty_rect, wm.m_background_color);
|
||||||
m_back_painter->fill_rect(dirty_rect, wm.m_background_color);
|
m_back_painter->blit(dirty_rect.location(), *m_wallpaper, dirty_rect);
|
||||||
else
|
|
||||||
m_back_painter->blit(dirty_rect.location(), *m_wallpaper, dirty_rect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto compose_window = [&] (WSWindow& window) -> IterationDecision {
|
auto compose_window = [&] (WSWindow& window) -> IterationDecision {
|
||||||
|
|
|
@ -38,11 +38,10 @@ WSWindowManager::WSWindowManager()
|
||||||
{
|
{
|
||||||
s_the = this;
|
s_the = this;
|
||||||
|
|
||||||
m_wm_config = CConfigFile::get_for_app("WindowManager");
|
|
||||||
|
|
||||||
m_username = getlogin();
|
m_username = getlogin();
|
||||||
|
|
||||||
m_menu_selection_color = Color::from_rgb(0x84351a);
|
reload_config();
|
||||||
|
|
||||||
struct AppMenuItem {
|
struct AppMenuItem {
|
||||||
const char *binary_name;
|
const char *binary_name;
|
||||||
|
@ -117,44 +116,6 @@ WSWindowManager::WSWindowManager()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
dbgprintf("WindowManager: Loaded config from %s\n",
|
|
||||||
m_wm_config->file_name().view().characters());
|
|
||||||
dbgprintf("WindowManager: Screen size is %dx%d\n",
|
|
||||||
m_wm_config->read_num_entry("Screen", "Width", 800),
|
|
||||||
m_wm_config->read_num_entry("Screen", "Height", 600));
|
|
||||||
set_resolution(m_wm_config->read_num_entry("Screen", "Width", 800),
|
|
||||||
m_wm_config->read_num_entry("Screen", "Height", 600));
|
|
||||||
|
|
||||||
dbgprintf("WindowManager: Loading cursors (arrow: %s)\n", m_wm_config->read_entry("Cursor", "Arrow", "").characters());
|
|
||||||
m_arrow_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "Arrow", "")), { 2, 2 });
|
|
||||||
m_resize_horizontally_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "ResizeH", "")));
|
|
||||||
m_resize_vertically_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "ResizeV", "")));
|
|
||||||
m_resize_diagonally_tlbr_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "ResizeDTLBR", "")));
|
|
||||||
m_resize_diagonally_bltr_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "ResizeDBLTR", "")));
|
|
||||||
m_i_beam_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "IBeam", "")));
|
|
||||||
m_disallowed_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "Disallowed", "")));
|
|
||||||
m_move_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "Move", "")));
|
|
||||||
|
|
||||||
dbgprintf("WindowManager: Loading colors\n");
|
|
||||||
m_background_color = m_wm_config->read_color_entry("Colors", "Background", Color::Red);
|
|
||||||
dbgprintf("-- BGColor: %s\n", m_background_color.to_string());
|
|
||||||
|
|
||||||
m_active_window_border_color = m_wm_config->read_color_entry("Colors", "ActiveWindowBorder", Color::Red);
|
|
||||||
m_active_window_border_color2 = m_wm_config->read_color_entry("Colors", "ActiveWindowBorder2", Color::Red);
|
|
||||||
m_active_window_title_color = m_wm_config->read_color_entry("Colors", "ActiveWindowTitle", Color::Red);
|
|
||||||
|
|
||||||
m_inactive_window_border_color = m_wm_config->read_color_entry("Colors", "InactiveWindowBorder", Color::Red);
|
|
||||||
m_inactive_window_border_color2 = m_wm_config->read_color_entry("Colors", "InactiveWindowBorder2", Color::Red);
|
|
||||||
m_inactive_window_title_color = m_wm_config->read_color_entry("Colors", "InactiveWindowTitle", Color::Red);
|
|
||||||
|
|
||||||
m_dragging_window_border_color = m_wm_config->read_color_entry("Colors", "DraggingWindowBorder", Color::Red);
|
|
||||||
m_dragging_window_border_color2 = m_wm_config->read_color_entry("Colors", "DraggingWindowBorder2", Color::Red);
|
|
||||||
m_dragging_window_title_color = m_wm_config->read_color_entry("Colors", "DraggingWindowTitle", Color::Red);
|
|
||||||
|
|
||||||
m_highlight_window_border_color = m_wm_config->read_color_entry("Colors", "HighlightWindowBorder", Color::Red);
|
|
||||||
m_highlight_window_border_color2 = m_wm_config->read_color_entry("Colors", "HighlightWindowBorder2", Color::Red);
|
|
||||||
m_highlight_window_title_color = m_wm_config->read_color_entry("Colors", "HighlightWindowTitle", Color::Red);
|
|
||||||
|
|
||||||
// NOTE: This ensures that the system menu has the correct dimensions.
|
// NOTE: This ensures that the system menu has the correct dimensions.
|
||||||
set_current_menubar(nullptr);
|
set_current_menubar(nullptr);
|
||||||
|
|
||||||
|
@ -176,6 +137,40 @@ WSWindowManager::~WSWindowManager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WSWindowManager::reload_config()
|
||||||
|
{
|
||||||
|
m_wm_config = CConfigFile::get_for_app("WindowManager");
|
||||||
|
|
||||||
|
m_arrow_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "Arrow", "")), { 2, 2 });
|
||||||
|
m_resize_horizontally_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "ResizeH", "")));
|
||||||
|
m_resize_vertically_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "ResizeV", "")));
|
||||||
|
m_resize_diagonally_tlbr_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "ResizeDTLBR", "")));
|
||||||
|
m_resize_diagonally_bltr_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "ResizeDBLTR", "")));
|
||||||
|
m_i_beam_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "IBeam", "")));
|
||||||
|
m_disallowed_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "Disallowed", "")));
|
||||||
|
m_move_cursor = WSCursor::create(*GraphicsBitmap::load_from_file(m_wm_config->read_entry("Cursor", "Move", "")));
|
||||||
|
|
||||||
|
m_background_color = m_wm_config->read_color_entry("Colors", "Background", Color::Red);
|
||||||
|
|
||||||
|
m_active_window_border_color = m_wm_config->read_color_entry("Colors", "ActiveWindowBorder", Color::Red);
|
||||||
|
m_active_window_border_color2 = m_wm_config->read_color_entry("Colors", "ActiveWindowBorder2", Color::Red);
|
||||||
|
m_active_window_title_color = m_wm_config->read_color_entry("Colors", "ActiveWindowTitle", Color::Red);
|
||||||
|
|
||||||
|
m_inactive_window_border_color = m_wm_config->read_color_entry("Colors", "InactiveWindowBorder", Color::Red);
|
||||||
|
m_inactive_window_border_color2 = m_wm_config->read_color_entry("Colors", "InactiveWindowBorder2", Color::Red);
|
||||||
|
m_inactive_window_title_color = m_wm_config->read_color_entry("Colors", "InactiveWindowTitle", Color::Red);
|
||||||
|
|
||||||
|
m_dragging_window_border_color = m_wm_config->read_color_entry("Colors", "DraggingWindowBorder", Color::Red);
|
||||||
|
m_dragging_window_border_color2 = m_wm_config->read_color_entry("Colors", "DraggingWindowBorder2", Color::Red);
|
||||||
|
m_dragging_window_title_color = m_wm_config->read_color_entry("Colors", "DraggingWindowTitle", Color::Red);
|
||||||
|
|
||||||
|
m_highlight_window_border_color = m_wm_config->read_color_entry("Colors", "HighlightWindowBorder", Color::Red);
|
||||||
|
m_highlight_window_border_color2 = m_wm_config->read_color_entry("Colors", "HighlightWindowBorder2", Color::Red);
|
||||||
|
m_highlight_window_title_color = m_wm_config->read_color_entry("Colors", "HighlightWindowTitle", Color::Red);
|
||||||
|
|
||||||
|
m_menu_selection_color = m_wm_config->read_color_entry("Colors", "MenuSelectionColor", Color::Red);
|
||||||
|
}
|
||||||
|
|
||||||
const Font& WSWindowManager::font() const
|
const Font& WSWindowManager::font() const
|
||||||
{
|
{
|
||||||
return Font::default_font();
|
return Font::default_font();
|
||||||
|
@ -207,11 +202,13 @@ void WSWindowManager::set_resolution(int width, int height)
|
||||||
WSClientConnection::for_each_client([&] (WSClientConnection& client) {
|
WSClientConnection::for_each_client([&] (WSClientConnection& client) {
|
||||||
client.notify_about_new_screen_rect(WSScreen::the().rect());
|
client.notify_about_new_screen_rect(WSScreen::the().rect());
|
||||||
});
|
});
|
||||||
/*dbgprintf("Saving resolution: %dx%d to config file at %s.\n", width, height,
|
if (m_wm_config) {
|
||||||
m_wm_config->file_name().characters());
|
dbgprintf("Saving resolution: %dx%d to config file at %s.\n", width, height,
|
||||||
m_wm_config->write_num_entry("Screen", "Width", width);
|
m_wm_config->file_name().characters());
|
||||||
m_wm_config->write_num_entry("Screen", "Height", height);
|
m_wm_config->write_num_entry("Screen", "Width", width);
|
||||||
m_wm_config->sync();*/
|
m_wm_config->write_num_entry("Screen", "Height", height);
|
||||||
|
m_wm_config->sync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,8 @@ private:
|
||||||
void tell_wm_listener_about_window_rect(WSWindow& listener, WSWindow&);
|
void tell_wm_listener_about_window_rect(WSWindow& listener, WSWindow&);
|
||||||
void pick_new_active_window();
|
void pick_new_active_window();
|
||||||
|
|
||||||
|
void reload_config();
|
||||||
|
|
||||||
RetainPtr<WSCursor> m_arrow_cursor;
|
RetainPtr<WSCursor> m_arrow_cursor;
|
||||||
RetainPtr<WSCursor> m_resize_horizontally_cursor;
|
RetainPtr<WSCursor> m_resize_horizontally_cursor;
|
||||||
RetainPtr<WSCursor> m_resize_vertically_cursor;
|
RetainPtr<WSCursor> m_resize_vertically_cursor;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <WindowServer/WSWindowManager.h>
|
#include <WindowServer/WSWindowManager.h>
|
||||||
#include <WindowServer/WSEventLoop.h>
|
#include <WindowServer/WSEventLoop.h>
|
||||||
#include <WindowServer/WSCompositor.h>
|
#include <WindowServer/WSCompositor.h>
|
||||||
|
#include <LibCore/CConfigFile.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -18,7 +19,10 @@ int main(int, char**)
|
||||||
}
|
}
|
||||||
|
|
||||||
WSEventLoop loop;
|
WSEventLoop loop;
|
||||||
WSScreen screen(1024, 768);
|
|
||||||
|
auto wm_config = CConfigFile::get_for_app("WindowManager");
|
||||||
|
WSScreen screen(wm_config->read_num_entry("Screen", "Width", 1024),
|
||||||
|
wm_config->read_num_entry("Screen", "Height", 768));
|
||||||
WSCompositor::the();
|
WSCompositor::the();
|
||||||
WSWindowManager window_manager;
|
WSWindowManager window_manager;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue