mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:57:35 +00:00
LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much better visual clue about what type of metric is being used.
This commit is contained in:
parent
656b01eb0f
commit
116cf92156
212 changed files with 1144 additions and 1144 deletions
|
@ -91,8 +91,8 @@ void AppletManager::calculate_applet_rects(Window& window)
|
|||
int right_edge_x = menubar_rect.width() - 4;
|
||||
for (auto& existing_applet : m_applets) {
|
||||
|
||||
Gfx::Rect new_applet_rect(right_edge_x - existing_applet->size().width(), 0, existing_applet->size().width(), existing_applet->size().height());
|
||||
Gfx::Rect dummy_menubar_rect(0, 0, 0, 18);
|
||||
Gfx::IntRect new_applet_rect(right_edge_x - existing_applet->size().width(), 0, existing_applet->size().width(), existing_applet->size().height());
|
||||
Gfx::IntRect dummy_menubar_rect(0, 0, 0, 18);
|
||||
new_applet_rect.center_vertically_within(dummy_menubar_rect);
|
||||
|
||||
existing_applet->set_rect_in_menubar(new_applet_rect);
|
||||
|
@ -126,7 +126,7 @@ void AppletManager::draw_applet(const Window& applet)
|
|||
painter.blit(applet.rect_in_menubar().location(), *applet.backing_store(), applet.backing_store()->rect());
|
||||
}
|
||||
|
||||
void AppletManager::invalidate_applet(const Window& applet, const Gfx::Rect& rect)
|
||||
void AppletManager::invalidate_applet(const Window& applet, const Gfx::IntRect& rect)
|
||||
{
|
||||
draw_applet(applet);
|
||||
MenuManager::the().window().invalidate(rect.translated(applet.rect_in_menubar().location()));
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
void add_applet(Window& applet);
|
||||
void remove_applet(Window& applet);
|
||||
void draw();
|
||||
void invalidate_applet(const Window& applet, const Gfx::Rect& rect);
|
||||
void invalidate_applet(const Window& applet, const Gfx::IntRect& rect);
|
||||
void calculate_applet_rects(Window& window);
|
||||
|
||||
private:
|
||||
|
|
|
@ -107,7 +107,7 @@ void Button::on_mouse_event(const MouseEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
Gfx::Rect Button::screen_rect() const
|
||||
Gfx::IntRect Button::screen_rect() const
|
||||
{
|
||||
return m_relative_rect.translated(m_frame.rect().location());
|
||||
}
|
||||
|
|
|
@ -42,11 +42,11 @@ public:
|
|||
Button(WindowFrame&, NonnullRefPtr<Gfx::CharacterBitmap>&&, Function<void(Button&)>&& on_click_handler);
|
||||
~Button();
|
||||
|
||||
Gfx::Rect relative_rect() const { return m_relative_rect; }
|
||||
void set_relative_rect(const Gfx::Rect& rect) { m_relative_rect = rect; }
|
||||
Gfx::IntRect relative_rect() const { return m_relative_rect; }
|
||||
void set_relative_rect(const Gfx::IntRect& rect) { m_relative_rect = rect; }
|
||||
|
||||
Gfx::Rect rect() const { return { {}, m_relative_rect.size() }; }
|
||||
Gfx::Rect screen_rect() const;
|
||||
Gfx::IntRect rect() const { return { {}, m_relative_rect.size() }; }
|
||||
Gfx::IntRect screen_rect() const;
|
||||
|
||||
void paint(Gfx::Painter&);
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
private:
|
||||
WindowFrame& m_frame;
|
||||
Gfx::Rect m_relative_rect;
|
||||
Gfx::IntRect m_relative_rect;
|
||||
NonnullRefPtr<Gfx::CharacterBitmap> m_bitmap;
|
||||
bool m_pressed { false };
|
||||
bool m_visible { true };
|
||||
|
|
|
@ -49,12 +49,12 @@ namespace WindowServer {
|
|||
|
||||
HashMap<int, NonnullRefPtr<ClientConnection>>* s_connections;
|
||||
|
||||
static Gfx::Rect normalize_window_rect(Gfx::Rect rect, WindowType window_type)
|
||||
static Gfx::IntRect normalize_window_rect(Gfx::IntRect rect, WindowType window_type)
|
||||
{
|
||||
auto min_size = 1;
|
||||
if (window_type == WindowType::Normal)
|
||||
min_size = 50;
|
||||
Gfx::Rect normalized_rect = { rect.x(), rect.y(), max(rect.width(), min_size), max(rect.height(), min_size) };
|
||||
Gfx::IntRect normalized_rect = { rect.x(), rect.y(), max(rect.width(), min_size), max(rect.height(), min_size) };
|
||||
return normalized_rect;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ void ClientConnection::die()
|
|||
});
|
||||
}
|
||||
|
||||
void ClientConnection::notify_about_new_screen_rect(const Gfx::Rect& rect)
|
||||
void ClientConnection::notify_about_new_screen_rect(const Gfx::IntRect& rect)
|
||||
{
|
||||
post_message(Messages::WindowClient::ScreenRectChanged(rect));
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
bool is_showing_modal_window() const;
|
||||
|
||||
void notify_about_new_screen_rect(const Gfx::Rect&);
|
||||
void notify_about_new_screen_rect(const Gfx::IntRect&);
|
||||
void post_paint_message(Window&, bool ignore_occlusion = false);
|
||||
|
||||
Menu* find_menu_by_id(int menu_id)
|
||||
|
|
|
@ -118,10 +118,10 @@ void Compositor::compose()
|
|||
return;
|
||||
}
|
||||
|
||||
dirty_rects.add(Gfx::Rect::intersection(m_last_geometry_label_rect, Screen::the().rect()));
|
||||
dirty_rects.add(Gfx::Rect::intersection(m_last_cursor_rect, Screen::the().rect()));
|
||||
dirty_rects.add(Gfx::Rect::intersection(m_last_dnd_rect, Screen::the().rect()));
|
||||
dirty_rects.add(Gfx::Rect::intersection(current_cursor_rect(), Screen::the().rect()));
|
||||
dirty_rects.add(Gfx::IntRect::intersection(m_last_geometry_label_rect, Screen::the().rect()));
|
||||
dirty_rects.add(Gfx::IntRect::intersection(m_last_cursor_rect, Screen::the().rect()));
|
||||
dirty_rects.add(Gfx::IntRect::intersection(m_last_dnd_rect, Screen::the().rect()));
|
||||
dirty_rects.add(Gfx::IntRect::intersection(current_cursor_rect(), Screen::the().rect()));
|
||||
|
||||
auto any_dirty_rect_intersects_window = [&dirty_rects](const Window& window) {
|
||||
auto window_frame_rect = window.frame().rect();
|
||||
|
@ -148,7 +148,7 @@ void Compositor::compose()
|
|||
if (m_wallpaper_mode == WallpaperMode::Simple) {
|
||||
m_back_painter->blit(dirty_rect.location(), *m_wallpaper, dirty_rect);
|
||||
} else if (m_wallpaper_mode == WallpaperMode::Center) {
|
||||
Gfx::Point offset { ws.size().width() / 2 - m_wallpaper->size().width() / 2,
|
||||
Gfx::IntPoint offset { ws.size().width() / 2 - m_wallpaper->size().width() / 2,
|
||||
ws.size().height() / 2 - m_wallpaper->size().height() / 2 };
|
||||
m_back_painter->blit_offset(dirty_rect.location(), *m_wallpaper,
|
||||
dirty_rect, offset);
|
||||
|
@ -191,7 +191,7 @@ void Compositor::compose()
|
|||
// we want to try to blit the backing store at the same place
|
||||
// it was previously, and fill the rest of the window with its
|
||||
// background color.
|
||||
Gfx::Rect backing_rect;
|
||||
Gfx::IntRect backing_rect;
|
||||
backing_rect.set_size(backing_store->size());
|
||||
switch (WindowManager::the().resize_direction_of_window(window)) {
|
||||
case ResizeDirection::None:
|
||||
|
@ -216,7 +216,7 @@ void Compositor::compose()
|
|||
break;
|
||||
}
|
||||
|
||||
Gfx::Rect dirty_rect_in_backing_coordinates = dirty_rect
|
||||
Gfx::IntRect dirty_rect_in_backing_coordinates = dirty_rect
|
||||
.intersected(window.rect())
|
||||
.intersected(backing_rect)
|
||||
.translated(-backing_rect.location());
|
||||
|
@ -259,9 +259,9 @@ void Compositor::compose()
|
|||
flush(r);
|
||||
}
|
||||
|
||||
void Compositor::flush(const Gfx::Rect& a_rect)
|
||||
void Compositor::flush(const Gfx::IntRect& a_rect)
|
||||
{
|
||||
auto rect = Gfx::Rect::intersection(a_rect, Screen::the().rect());
|
||||
auto rect = Gfx::IntRect::intersection(a_rect, Screen::the().rect());
|
||||
|
||||
Gfx::RGBA32* front_ptr = m_front_bitmap->scanline(rect.y()) + rect.x();
|
||||
Gfx::RGBA32* back_ptr = m_back_bitmap->scanline(rect.y()) + rect.x();
|
||||
|
@ -300,9 +300,9 @@ void Compositor::invalidate()
|
|||
invalidate(Screen::the().rect());
|
||||
}
|
||||
|
||||
void Compositor::invalidate(const Gfx::Rect& a_rect)
|
||||
void Compositor::invalidate(const Gfx::IntRect& a_rect)
|
||||
{
|
||||
auto rect = Gfx::Rect::intersection(a_rect, Screen::the().rect());
|
||||
auto rect = Gfx::IntRect::intersection(a_rect, Screen::the().rect());
|
||||
if (rect.is_empty())
|
||||
return;
|
||||
|
||||
|
@ -384,7 +384,7 @@ void Compositor::run_animations()
|
|||
float width_delta_per_step = (float)(from_rect.width() - to_rect.width()) / minimize_animation_steps;
|
||||
float height_delta_per_step = (float)(from_rect.height() - to_rect.height()) / minimize_animation_steps;
|
||||
|
||||
Gfx::Rect rect {
|
||||
Gfx::IntRect rect {
|
||||
from_rect.x() - (int)(x_delta_per_step * animation_index),
|
||||
from_rect.y() - (int)(y_delta_per_step * animation_index),
|
||||
from_rect.width() - (int)(width_delta_per_step * animation_index),
|
||||
|
@ -421,7 +421,7 @@ bool Compositor::set_resolution(int desired_width, int desired_height)
|
|||
return success;
|
||||
}
|
||||
|
||||
Gfx::Rect Compositor::current_cursor_rect() const
|
||||
Gfx::IntRect Compositor::current_cursor_rect() const
|
||||
{
|
||||
auto& wm = WindowManager::the();
|
||||
return { Screen::the().cursor_location().translated(-wm.active_cursor().hotspot()), wm.active_cursor().size() };
|
||||
|
@ -449,7 +449,7 @@ void Compositor::draw_geometry_label()
|
|||
int height_steps = (window_being_moved_or_resized->height() - window_being_moved_or_resized->base_size().height()) / window_being_moved_or_resized->size_increment().height();
|
||||
geometry_string = String::format("%s (%dx%d)", geometry_string.characters(), width_steps, height_steps);
|
||||
}
|
||||
auto geometry_label_rect = Gfx::Rect { 0, 0, wm.font().width(geometry_string) + 16, wm.font().glyph_height() + 10 };
|
||||
auto geometry_label_rect = Gfx::IntRect { 0, 0, wm.font().width(geometry_string) + 16, wm.font().glyph_height() + 10 };
|
||||
geometry_label_rect.center_within(window_being_moved_or_resized->rect());
|
||||
m_back_painter->fill_rect(geometry_label_rect, wm.palette().window());
|
||||
m_back_painter->draw_rect(geometry_label_rect, wm.palette().threed_shadow2());
|
||||
|
@ -460,7 +460,7 @@ void Compositor::draw_geometry_label()
|
|||
void Compositor::draw_cursor()
|
||||
{
|
||||
auto& wm = WindowManager::the();
|
||||
Gfx::Rect cursor_rect = current_cursor_rect();
|
||||
Gfx::IntRect cursor_rect = current_cursor_rect();
|
||||
m_back_painter->blit(cursor_rect.location(), wm.active_cursor().bitmap(), wm.active_cursor().rect());
|
||||
|
||||
if (wm.dnd_client()) {
|
||||
|
@ -504,7 +504,7 @@ void Compositor::decrement_display_link_count(Badge<ClientConnection>)
|
|||
m_display_link_notify_timer->stop();
|
||||
}
|
||||
|
||||
bool Compositor::any_opaque_window_contains_rect(const Gfx::Rect& rect)
|
||||
bool Compositor::any_opaque_window_contains_rect(const Gfx::IntRect& rect)
|
||||
{
|
||||
bool found_containing_window = false;
|
||||
WindowManager::the().for_each_visible_window_from_back_to_front([&](Window& window) {
|
||||
|
@ -527,7 +527,7 @@ bool Compositor::any_opaque_window_contains_rect(const Gfx::Rect& rect)
|
|||
};
|
||||
|
||||
|
||||
bool Compositor::any_opaque_window_above_this_one_contains_rect(const Window& a_window, const Gfx::Rect& rect)
|
||||
bool Compositor::any_opaque_window_above_this_one_contains_rect(const Window& a_window, const Gfx::IntRect& rect)
|
||||
{
|
||||
bool found_containing_window = false;
|
||||
bool checking = false;
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
void compose();
|
||||
void invalidate();
|
||||
void invalidate(const Gfx::Rect&);
|
||||
void invalidate(const Gfx::IntRect&);
|
||||
|
||||
bool set_resolution(int desired_width, int desired_height);
|
||||
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
String wallpaper_path() const { return m_wallpaper_path; }
|
||||
|
||||
void invalidate_cursor();
|
||||
Gfx::Rect current_cursor_rect() const;
|
||||
Gfx::IntRect current_cursor_rect() const;
|
||||
|
||||
void increment_display_link_count(Badge<ClientConnection>);
|
||||
void decrement_display_link_count(Badge<ClientConnection>);
|
||||
|
@ -76,14 +76,14 @@ private:
|
|||
Compositor();
|
||||
void init_bitmaps();
|
||||
void flip_buffers();
|
||||
void flush(const Gfx::Rect&);
|
||||
void flush(const Gfx::IntRect&);
|
||||
void draw_cursor();
|
||||
void draw_geometry_label();
|
||||
void draw_menubar();
|
||||
void run_animations();
|
||||
void notify_display_links();
|
||||
bool any_opaque_window_contains_rect(const Gfx::Rect&);
|
||||
bool any_opaque_window_above_this_one_contains_rect(const Window&, const Gfx::Rect&);
|
||||
bool any_opaque_window_contains_rect(const Gfx::IntRect&);
|
||||
bool any_opaque_window_above_this_one_contains_rect(const Window&, const Gfx::IntRect&);
|
||||
|
||||
RefPtr<Core::Timer> m_compose_timer;
|
||||
RefPtr<Core::Timer> m_immediate_compose_timer;
|
||||
|
@ -98,9 +98,9 @@ private:
|
|||
|
||||
Gfx::DisjointRectSet m_dirty_rects;
|
||||
|
||||
Gfx::Rect m_last_cursor_rect;
|
||||
Gfx::Rect m_last_dnd_rect;
|
||||
Gfx::Rect m_last_geometry_label_rect;
|
||||
Gfx::IntRect m_last_cursor_rect;
|
||||
Gfx::IntRect m_last_dnd_rect;
|
||||
Gfx::IntRect m_last_geometry_label_rect;
|
||||
|
||||
String m_wallpaper_path;
|
||||
WallpaperMode m_wallpaper_mode { WallpaperMode::Unchecked };
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
namespace WindowServer {
|
||||
|
||||
Cursor::Cursor(NonnullRefPtr<Gfx::Bitmap>&& bitmap, const Gfx::Point& hotspot)
|
||||
Cursor::Cursor(NonnullRefPtr<Gfx::Bitmap>&& bitmap, const Gfx::IntPoint& hotspot)
|
||||
: m_bitmap(move(bitmap))
|
||||
, m_hotspot(hotspot)
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ NonnullRefPtr<Cursor> Cursor::create(NonnullRefPtr<Gfx::Bitmap>&& bitmap)
|
|||
return adopt(*new Cursor(move(bitmap), bitmap->rect().center()));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Cursor> Cursor::create(NonnullRefPtr<Gfx::Bitmap>&& bitmap, const Gfx::Point& hotspot)
|
||||
NonnullRefPtr<Cursor> Cursor::create(NonnullRefPtr<Gfx::Bitmap>&& bitmap, const Gfx::IntPoint& hotspot)
|
||||
{
|
||||
return adopt(*new Cursor(move(bitmap), hotspot));
|
||||
}
|
||||
|
|
|
@ -45,22 +45,22 @@ enum class StandardCursor {
|
|||
|
||||
class Cursor : public RefCounted<Cursor> {
|
||||
public:
|
||||
static NonnullRefPtr<Cursor> create(NonnullRefPtr<Gfx::Bitmap>&&, const Gfx::Point& hotspot);
|
||||
static NonnullRefPtr<Cursor> create(NonnullRefPtr<Gfx::Bitmap>&&, const Gfx::IntPoint& hotspot);
|
||||
static NonnullRefPtr<Cursor> create(NonnullRefPtr<Gfx::Bitmap>&&);
|
||||
static RefPtr<Cursor> create(StandardCursor);
|
||||
~Cursor();
|
||||
|
||||
Gfx::Point hotspot() const { return m_hotspot; }
|
||||
Gfx::IntPoint hotspot() const { return m_hotspot; }
|
||||
const Gfx::Bitmap& bitmap() const { return *m_bitmap; }
|
||||
|
||||
Gfx::Rect rect() const { return m_bitmap->rect(); }
|
||||
Gfx::Size size() const { return m_bitmap->size(); }
|
||||
Gfx::IntRect rect() const { return m_bitmap->rect(); }
|
||||
Gfx::IntSize size() const { return m_bitmap->size(); }
|
||||
|
||||
private:
|
||||
Cursor(NonnullRefPtr<Gfx::Bitmap>&&, const Gfx::Point&);
|
||||
Cursor(NonnullRefPtr<Gfx::Bitmap>&&, const Gfx::IntPoint&);
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_bitmap;
|
||||
Gfx::Point m_hotspot;
|
||||
Gfx::IntPoint m_hotspot;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ private:
|
|||
|
||||
class MouseEvent final : public Event {
|
||||
public:
|
||||
MouseEvent(Type type, const Gfx::Point& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta = 0)
|
||||
MouseEvent(Type type, const Gfx::IntPoint& position, unsigned buttons, MouseButton button, unsigned modifiers, int wheel_delta = 0)
|
||||
: Event(type)
|
||||
, m_position(position)
|
||||
, m_buttons(buttons)
|
||||
|
@ -115,7 +115,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Gfx::Point position() const { return m_position; }
|
||||
Gfx::IntPoint position() const { return m_position; }
|
||||
int x() const { return m_position.x(); }
|
||||
int y() const { return m_position.y(); }
|
||||
MouseButton button() const { return m_button; }
|
||||
|
@ -128,10 +128,10 @@ public:
|
|||
void set_drag(bool b) { m_drag = b; }
|
||||
void set_drag_data_type(const String& drag_data_type) { m_drag_data_type = drag_data_type; }
|
||||
|
||||
MouseEvent translated(const Gfx::Point& delta) const { return MouseEvent((Type)type(), m_position.translated(delta), m_buttons, m_button, m_modifiers, m_wheel_delta); }
|
||||
MouseEvent translated(const Gfx::IntPoint& delta) const { return MouseEvent((Type)type(), m_position.translated(delta), m_buttons, m_button, m_modifiers, m_wheel_delta); }
|
||||
|
||||
private:
|
||||
Gfx::Point m_position;
|
||||
Gfx::IntPoint m_position;
|
||||
unsigned m_buttons { 0 };
|
||||
MouseButton m_button { MouseButton::None };
|
||||
unsigned m_modifiers { 0 };
|
||||
|
@ -142,19 +142,19 @@ private:
|
|||
|
||||
class ResizeEvent final : public Event {
|
||||
public:
|
||||
ResizeEvent(const Gfx::Rect& old_rect, const Gfx::Rect& rect)
|
||||
ResizeEvent(const Gfx::IntRect& old_rect, const Gfx::IntRect& rect)
|
||||
: Event(Event::WindowResized)
|
||||
, m_old_rect(old_rect)
|
||||
, m_rect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
Gfx::Rect old_rect() const { return m_old_rect; }
|
||||
Gfx::Rect rect() const { return m_rect; }
|
||||
Gfx::IntRect old_rect() const { return m_old_rect; }
|
||||
Gfx::IntRect rect() const { return m_rect; }
|
||||
|
||||
private:
|
||||
Gfx::Rect m_old_rect;
|
||||
Gfx::Rect m_rect;
|
||||
Gfx::IntRect m_old_rect;
|
||||
Gfx::IntRect m_rect;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ Window& Menu::ensure_menu_window()
|
|||
|
||||
int width = this->content_width();
|
||||
|
||||
Gfx::Point next_item_location(frame_thickness(), frame_thickness());
|
||||
Gfx::IntPoint next_item_location(frame_thickness(), frame_thickness());
|
||||
for (auto& item : m_items) {
|
||||
int height = 0;
|
||||
if (item.type() == MenuItem::Text)
|
||||
|
@ -186,7 +186,7 @@ void Menu::draw()
|
|||
ASSERT(menu_window()->backing_store());
|
||||
Gfx::Painter painter(*menu_window()->backing_store());
|
||||
|
||||
Gfx::Rect rect { {}, menu_window()->size() };
|
||||
Gfx::IntRect rect { {}, menu_window()->size() };
|
||||
Gfx::StylePainter::paint_window_frame(painter, rect, palette);
|
||||
painter.fill_rect(rect.shrunken(6, 6), palette.menu_base());
|
||||
int width = this->content_width();
|
||||
|
@ -201,7 +201,7 @@ void Menu::draw()
|
|||
has_items_with_icon = has_items_with_icon | !!item.icon();
|
||||
}
|
||||
|
||||
Gfx::Rect stripe_rect { frame_thickness(), frame_thickness(), s_stripe_width, menu_window()->height() - frame_thickness() * 2 };
|
||||
Gfx::IntRect stripe_rect { frame_thickness(), frame_thickness(), s_stripe_width, menu_window()->height() - frame_thickness() * 2 };
|
||||
painter.fill_rect(stripe_rect, palette.menu_stripe());
|
||||
painter.draw_line(stripe_rect.top_right(), stripe_rect.bottom_right(), palette.menu_stripe().darkened());
|
||||
|
||||
|
@ -210,9 +210,9 @@ void Menu::draw()
|
|||
if (is_scrollable()) {
|
||||
bool can_go_up = m_scroll_offset > 0;
|
||||
bool can_go_down = m_scroll_offset < m_max_scroll_offset;
|
||||
Gfx::Rect up_indicator_rect { frame_thickness(), frame_thickness(), content_width(), item_height() };
|
||||
Gfx::IntRect up_indicator_rect { frame_thickness(), frame_thickness(), content_width(), item_height() };
|
||||
painter.draw_text(up_indicator_rect, "\xE2\xAC\x86", Gfx::TextAlignment::Center, can_go_up ? palette.menu_base_text() : palette.color(ColorRole::DisabledText));
|
||||
Gfx::Rect down_indicator_rect { frame_thickness(), menu_window()->height() - item_height() - frame_thickness(), content_width(), item_height() };
|
||||
Gfx::IntRect down_indicator_rect { frame_thickness(), menu_window()->height() - item_height() - frame_thickness(), content_width(), item_height() };
|
||||
painter.draw_text(down_indicator_rect, "\xE2\xAC\x87", Gfx::TextAlignment::Center, can_go_down ? palette.menu_base_text() : palette.color(ColorRole::DisabledText));
|
||||
}
|
||||
|
||||
|
@ -227,16 +227,16 @@ void Menu::draw()
|
|||
} else if (!item.is_enabled()) {
|
||||
text_color = Color::MidGray;
|
||||
}
|
||||
Gfx::Rect text_rect = item.rect().translated(stripe_rect.width() + 6, 0);
|
||||
Gfx::IntRect text_rect = item.rect().translated(stripe_rect.width() + 6, 0);
|
||||
if (item.is_checkable()) {
|
||||
if (item.is_exclusive()) {
|
||||
Gfx::Rect radio_rect { item.rect().x() + 5, 0, 12, 12 };
|
||||
Gfx::IntRect radio_rect { item.rect().x() + 5, 0, 12, 12 };
|
||||
radio_rect.center_vertically_within(text_rect);
|
||||
Gfx::StylePainter::paint_radio_button(painter, radio_rect, palette, item.is_checked(), false);
|
||||
} else {
|
||||
Gfx::Rect checkmark_rect { item.rect().x() + 7, 0, s_checked_bitmap_width, s_checked_bitmap_height };
|
||||
Gfx::IntRect checkmark_rect { item.rect().x() + 7, 0, s_checked_bitmap_width, s_checked_bitmap_height };
|
||||
checkmark_rect.center_vertically_within(text_rect);
|
||||
Gfx::Rect checkbox_rect = checkmark_rect.inflated(4, 4);
|
||||
Gfx::IntRect checkbox_rect = checkmark_rect.inflated(4, 4);
|
||||
painter.fill_rect(checkbox_rect, palette.base());
|
||||
Gfx::StylePainter::paint_frame(painter, checkbox_rect, palette, Gfx::FrameShape::Container, Gfx::FrameShadow::Sunken, 2);
|
||||
if (item.is_checked()) {
|
||||
|
@ -244,7 +244,7 @@ void Menu::draw()
|
|||
}
|
||||
}
|
||||
} else if (item.icon()) {
|
||||
Gfx::Rect icon_rect { item.rect().x() + 3, 0, s_item_icon_width, s_item_icon_width };
|
||||
Gfx::IntRect icon_rect { item.rect().x() + 3, 0, s_item_icon_width, s_item_icon_width };
|
||||
icon_rect.center_vertically_within(text_rect);
|
||||
painter.blit(icon_rect.location(), *item.icon(), item.icon()->rect());
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ void Menu::draw()
|
|||
}
|
||||
if (item.is_submenu()) {
|
||||
static auto& submenu_arrow_bitmap = Gfx::CharacterBitmap::create_from_ascii(s_submenu_arrow_bitmap_data, s_submenu_arrow_bitmap_width, s_submenu_arrow_bitmap_height).leak_ref();
|
||||
Gfx::Rect submenu_arrow_rect {
|
||||
Gfx::IntRect submenu_arrow_rect {
|
||||
item.rect().right() - s_submenu_arrow_bitmap_width - 2,
|
||||
0,
|
||||
s_submenu_arrow_bitmap_width,
|
||||
|
@ -264,8 +264,8 @@ void Menu::draw()
|
|||
painter.draw_bitmap(submenu_arrow_rect.location(), submenu_arrow_bitmap, text_color);
|
||||
}
|
||||
} else if (item.type() == MenuItem::Separator) {
|
||||
Gfx::Point p1(item.rect().translated(stripe_rect.width() + 4, 0).x(), item.rect().center().y() - 1);
|
||||
Gfx::Point p2(width - 7, item.rect().center().y() - 1);
|
||||
Gfx::IntPoint p1(item.rect().translated(stripe_rect.width() + 4, 0).x(), item.rect().center().y() - 1);
|
||||
Gfx::IntPoint p2(width - 7, item.rect().center().y() - 1);
|
||||
painter.draw_line(p1, p2, palette.threed_shadow1());
|
||||
painter.draw_line(p1.translated(0, 1), p2.translated(0, 1), palette.threed_highlight());
|
||||
}
|
||||
|
@ -320,8 +320,8 @@ void Menu::handle_mouse_move_event(const MouseEvent& mouse_event)
|
|||
if (hovered_item() && hovered_item()->is_submenu()) {
|
||||
|
||||
auto item = *hovered_item();
|
||||
auto submenu_top_left = item.rect().location() + Gfx::Point { item.rect().width(), 0 };
|
||||
auto submenu_bottom_left = submenu_top_left + Gfx::Point { 0, item.submenu()->menu_window()->height() };
|
||||
auto submenu_top_left = item.rect().location() + Gfx::IntPoint { item.rect().width(), 0 };
|
||||
auto submenu_bottom_left = submenu_top_left + Gfx::IntPoint { 0, item.submenu()->menu_window()->height() };
|
||||
|
||||
auto safe_hover_triangle = Gfx::Triangle { m_last_position_in_hover, submenu_top_left, submenu_bottom_left };
|
||||
m_last_position_in_hover = mouse_event.position();
|
||||
|
@ -467,7 +467,7 @@ MenuItem* Menu::item_with_identifier(unsigned identifer)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
int Menu::item_index_at(const Gfx::Point& position)
|
||||
int Menu::item_index_at(const Gfx::IntPoint& position)
|
||||
{
|
||||
int i = 0;
|
||||
for (auto& item : m_items) {
|
||||
|
@ -489,7 +489,7 @@ void Menu::redraw_if_theme_changed()
|
|||
redraw();
|
||||
}
|
||||
|
||||
void Menu::popup(const Gfx::Point& position)
|
||||
void Menu::popup(const Gfx::IntPoint& position)
|
||||
{
|
||||
if (is_empty()) {
|
||||
dbg() << "Menu: Empty menu popup";
|
||||
|
@ -500,7 +500,7 @@ void Menu::popup(const Gfx::Point& position)
|
|||
redraw_if_theme_changed();
|
||||
|
||||
const int margin = 30;
|
||||
Gfx::Point adjusted_pos = position;
|
||||
Gfx::IntPoint adjusted_pos = position;
|
||||
|
||||
if (adjusted_pos.x() + window.width() >= Screen::the().width() - margin) {
|
||||
adjusted_pos = adjusted_pos.translated(-window.width(), 0);
|
||||
|
|
|
@ -73,11 +73,11 @@ public:
|
|||
callback(item);
|
||||
}
|
||||
|
||||
Gfx::Rect text_rect_in_menubar() const { return m_text_rect_in_menubar; }
|
||||
void set_text_rect_in_menubar(const Gfx::Rect& rect) { m_text_rect_in_menubar = rect; }
|
||||
Gfx::IntRect text_rect_in_menubar() const { return m_text_rect_in_menubar; }
|
||||
void set_text_rect_in_menubar(const Gfx::IntRect& rect) { m_text_rect_in_menubar = rect; }
|
||||
|
||||
Gfx::Rect rect_in_menubar() const { return m_rect_in_menubar; }
|
||||
void set_rect_in_menubar(const Gfx::Rect& rect) { m_rect_in_menubar = rect; }
|
||||
Gfx::IntRect rect_in_menubar() const { return m_rect_in_menubar; }
|
||||
void set_rect_in_menubar(const Gfx::IntRect& rect) { m_rect_in_menubar = rect; }
|
||||
|
||||
Window* menu_window() { return m_menu_window.ptr(); }
|
||||
Window& ensure_menu_window();
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
|
||||
void close();
|
||||
|
||||
void popup(const Gfx::Point&);
|
||||
void popup(const Gfx::IntPoint&);
|
||||
|
||||
bool is_menu_ancestor_of(const Menu&) const;
|
||||
|
||||
|
@ -137,7 +137,7 @@ private:
|
|||
void handle_mouse_move_event(const MouseEvent&);
|
||||
int visible_item_count() const;
|
||||
|
||||
int item_index_at(const Gfx::Point&);
|
||||
int item_index_at(const Gfx::IntPoint&);
|
||||
int padding_between_text_and_shortcut() const { return 50; }
|
||||
void did_activate(MenuItem&);
|
||||
void update_for_new_hovered_item();
|
||||
|
@ -145,15 +145,15 @@ private:
|
|||
ClientConnection* m_client { nullptr };
|
||||
int m_menu_id { 0 };
|
||||
String m_name;
|
||||
Gfx::Rect m_rect_in_menubar;
|
||||
Gfx::Rect m_text_rect_in_menubar;
|
||||
Gfx::IntRect m_rect_in_menubar;
|
||||
Gfx::IntRect m_text_rect_in_menubar;
|
||||
MenuBar* m_menubar { nullptr };
|
||||
NonnullOwnPtrVector<MenuItem> m_items;
|
||||
RefPtr<Window> m_menu_window;
|
||||
|
||||
WeakPtr<Window> m_window_menu_of;
|
||||
bool m_is_window_menu_open = { false };
|
||||
Gfx::Point m_last_position_in_hover;
|
||||
Gfx::IntPoint m_last_position_in_hover;
|
||||
int m_theme_index_at_last_paint { -1 };
|
||||
int m_hovered_item_index { -1 };
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ const Menu* MenuItem::submenu() const
|
|||
return m_menu.client()->find_menu_by_id(m_submenu_id);
|
||||
}
|
||||
|
||||
Gfx::Rect MenuItem::rect() const
|
||||
Gfx::IntRect MenuItem::rect() const
|
||||
{
|
||||
if (!m_menu.is_scrollable())
|
||||
return m_rect;
|
||||
|
|
|
@ -64,8 +64,8 @@ public:
|
|||
String shortcut_text() const { return m_shortcut_text; }
|
||||
void set_shortcut_text(const String& text) { m_shortcut_text = text; }
|
||||
|
||||
void set_rect(const Gfx::Rect& rect) { m_rect = rect; }
|
||||
Gfx::Rect rect() const;
|
||||
void set_rect(const Gfx::IntRect& rect) { m_rect = rect; }
|
||||
Gfx::IntRect rect() const;
|
||||
|
||||
unsigned identifier() const { return m_identifier; }
|
||||
|
||||
|
@ -91,7 +91,7 @@ private:
|
|||
unsigned m_identifier { 0 };
|
||||
String m_text;
|
||||
String m_shortcut_text;
|
||||
Gfx::Rect m_rect;
|
||||
Gfx::IntRect m_rect;
|
||||
RefPtr<Gfx::Bitmap> m_icon;
|
||||
int m_submenu_id { -1 };
|
||||
bool m_exclusive { false };
|
||||
|
|
|
@ -418,7 +418,7 @@ void MenuManager::close_bar()
|
|||
m_bar_open = false;
|
||||
}
|
||||
|
||||
Gfx::Rect MenuManager::menubar_rect() const
|
||||
Gfx::IntRect MenuManager::menubar_rect() const
|
||||
{
|
||||
return { 0, 0, Screen::the().rect().width(), 19 };
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ void MenuManager::set_current_menubar(MenuBar* menubar)
|
|||
#ifdef DEBUG_MENUS
|
||||
dbg() << "[WM] Current menubar is now " << menubar;
|
||||
#endif
|
||||
Gfx::Point next_menu_location { MenuManager::menubar_menu_margin() / 2, 0 };
|
||||
Gfx::IntPoint next_menu_location { MenuManager::menubar_menu_margin() / 2, 0 };
|
||||
for_each_active_menubar_menu([&](Menu& menu) {
|
||||
int text_width = menu.title_font().width(menu.name());
|
||||
menu.set_rect_in_menubar({ next_menu_location.x() - MenuManager::menubar_menu_margin() / 2, 0, text_width + MenuManager::menubar_menu_margin(), menubar_rect().height() - 1 });
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
bool is_open(const Menu&) const;
|
||||
bool has_open_menu() const { return !m_open_menu_stack.is_empty(); }
|
||||
|
||||
Gfx::Rect menubar_rect() const;
|
||||
Gfx::IntRect menubar_rect() const;
|
||||
static int menubar_menu_margin() { return 16; }
|
||||
|
||||
void set_needs_window_resize();
|
||||
|
|
|
@ -51,10 +51,10 @@ public:
|
|||
|
||||
static Screen& the();
|
||||
|
||||
Gfx::Size size() const { return { width(), height() }; }
|
||||
Gfx::Rect rect() const { return { 0, 0, width(), height() }; }
|
||||
Gfx::IntSize size() const { return { width(), height() }; }
|
||||
Gfx::IntRect rect() const { return { 0, 0, width(), height() }; }
|
||||
|
||||
Gfx::Point cursor_location() const { return m_cursor_location; }
|
||||
Gfx::IntPoint cursor_location() const { return m_cursor_location; }
|
||||
unsigned mouse_button_state() const { return m_mouse_button_state; }
|
||||
|
||||
void on_receive_mouse_data(const MousePacket&);
|
||||
|
@ -73,7 +73,7 @@ private:
|
|||
int m_height { 0 };
|
||||
int m_framebuffer_fd { -1 };
|
||||
|
||||
Gfx::Point m_cursor_location;
|
||||
Gfx::IntPoint m_cursor_location;
|
||||
unsigned m_mouse_button_state { 0 };
|
||||
unsigned m_modifiers { 0 };
|
||||
};
|
||||
|
|
|
@ -131,10 +131,10 @@ void Window::set_title(const String& title)
|
|||
WindowManager::the().notify_title_changed(*this);
|
||||
}
|
||||
|
||||
void Window::set_rect(const Gfx::Rect& rect)
|
||||
void Window::set_rect(const Gfx::IntRect& rect)
|
||||
{
|
||||
ASSERT(!rect.is_empty());
|
||||
Gfx::Rect old_rect;
|
||||
Gfx::IntRect old_rect;
|
||||
if (m_rect == rect)
|
||||
return;
|
||||
old_rect = m_rect;
|
||||
|
@ -145,7 +145,7 @@ void Window::set_rect(const Gfx::Rect& rect)
|
|||
m_frame.notify_window_rect_changed(old_rect, rect);
|
||||
}
|
||||
|
||||
void Window::set_rect_without_repaint(const Gfx::Rect& rect)
|
||||
void Window::set_rect_without_repaint(const Gfx::IntRect& rect)
|
||||
{
|
||||
ASSERT(!rect.is_empty());
|
||||
if (m_rect == rect)
|
||||
|
@ -354,7 +354,7 @@ void Window::invalidate()
|
|||
Compositor::the().invalidate(frame().rect());
|
||||
}
|
||||
|
||||
void Window::invalidate(const Gfx::Rect& rect)
|
||||
void Window::invalidate(const Gfx::IntRect& rect)
|
||||
{
|
||||
if (type() == WindowType::MenuApplet) {
|
||||
AppletManager::the().invalidate_applet(*this, rect);
|
||||
|
@ -395,7 +395,7 @@ void Window::set_default_icon()
|
|||
m_icon = default_window_icon();
|
||||
}
|
||||
|
||||
void Window::request_update(const Gfx::Rect& rect, bool ignore_occlusion)
|
||||
void Window::request_update(const Gfx::IntRect& rect, bool ignore_occlusion)
|
||||
{
|
||||
if (m_pending_paint_rects.is_empty()) {
|
||||
deferred_invoke([this, ignore_occlusion](auto&) {
|
||||
|
@ -405,7 +405,7 @@ void Window::request_update(const Gfx::Rect& rect, bool ignore_occlusion)
|
|||
m_pending_paint_rects.add(rect);
|
||||
}
|
||||
|
||||
void Window::popup_window_menu(const Gfx::Point& position)
|
||||
void Window::popup_window_menu(const Gfx::IntPoint& position)
|
||||
{
|
||||
if (!m_window_menu) {
|
||||
m_window_menu = Menu::construct(nullptr, -1, "(Window Menu)");
|
||||
|
@ -464,7 +464,7 @@ void Window::set_fullscreen(bool fullscreen)
|
|||
if (m_fullscreen == fullscreen)
|
||||
return;
|
||||
m_fullscreen = fullscreen;
|
||||
Gfx::Rect new_window_rect = m_rect;
|
||||
Gfx::IntRect new_window_rect = m_rect;
|
||||
if (m_fullscreen) {
|
||||
m_saved_nonfullscreen_rect = m_rect;
|
||||
new_window_rect = Screen::the().rect();
|
||||
|
@ -475,19 +475,19 @@ void Window::set_fullscreen(bool fullscreen)
|
|||
set_rect(new_window_rect);
|
||||
}
|
||||
|
||||
Gfx::Rect Window::tiled_rect(WindowTileType tiled) const
|
||||
Gfx::IntRect Window::tiled_rect(WindowTileType tiled) const
|
||||
{
|
||||
int frame_width = (m_frame.rect().width() - m_rect.width()) / 2;
|
||||
switch (tiled) {
|
||||
case WindowTileType::None:
|
||||
return m_untiled_rect;
|
||||
case WindowTileType::Left:
|
||||
return Gfx::Rect(0,
|
||||
return Gfx::IntRect(0,
|
||||
WindowManager::the().maximized_window_rect(*this).y(),
|
||||
Screen::the().width() / 2 - frame_width,
|
||||
WindowManager::the().maximized_window_rect(*this).height());
|
||||
case WindowTileType::Right:
|
||||
return Gfx::Rect(Screen::the().width() / 2 + frame_width,
|
||||
return Gfx::IntRect(Screen::the().width() / 2 + frame_width,
|
||||
WindowManager::the().maximized_window_rect(*this).y(),
|
||||
Screen::the().width() / 2 - frame_width,
|
||||
WindowManager::the().maximized_window_rect(*this).height());
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
Window(Core::Object&, WindowType);
|
||||
virtual ~Window() override;
|
||||
|
||||
void popup_window_menu(const Gfx::Point&);
|
||||
void popup_window_menu(const Gfx::IntPoint&);
|
||||
void request_close();
|
||||
|
||||
unsigned wm_event_mask() const { return m_wm_event_mask; }
|
||||
|
@ -136,33 +136,33 @@ public:
|
|||
|
||||
bool is_modal() const { return m_modal; }
|
||||
|
||||
Gfx::Rect rect() const { return m_rect; }
|
||||
void set_rect(const Gfx::Rect&);
|
||||
Gfx::IntRect rect() const { return m_rect; }
|
||||
void set_rect(const Gfx::IntRect&);
|
||||
void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); }
|
||||
void set_rect_without_repaint(const Gfx::Rect&);
|
||||
void set_rect_without_repaint(const Gfx::IntRect&);
|
||||
|
||||
void set_taskbar_rect(const Gfx::Rect& rect) { m_taskbar_rect = rect; }
|
||||
const Gfx::Rect& taskbar_rect() const { return m_taskbar_rect; }
|
||||
void set_taskbar_rect(const Gfx::IntRect& rect) { m_taskbar_rect = rect; }
|
||||
const Gfx::IntRect& taskbar_rect() const { return m_taskbar_rect; }
|
||||
|
||||
void move_to(const Gfx::Point& position) { set_rect({ position, size() }); }
|
||||
void move_to(const Gfx::IntPoint& position) { set_rect({ position, size() }); }
|
||||
void move_to(int x, int y) { move_to({ x, y }); }
|
||||
|
||||
void move_by(const Gfx::Point& delta) { set_position_without_repaint(position().translated(delta)); }
|
||||
void move_by(const Gfx::IntPoint& delta) { set_position_without_repaint(position().translated(delta)); }
|
||||
|
||||
Gfx::Point position() const { return m_rect.location(); }
|
||||
void set_position(const Gfx::Point& position) { set_rect({ position.x(), position.y(), width(), height() }); }
|
||||
void set_position_without_repaint(const Gfx::Point& position) { set_rect_without_repaint({ position.x(), position.y(), width(), height() }); }
|
||||
Gfx::IntPoint position() const { return m_rect.location(); }
|
||||
void set_position(const Gfx::IntPoint& position) { set_rect({ position.x(), position.y(), width(), height() }); }
|
||||
void set_position_without_repaint(const Gfx::IntPoint& position) { set_rect_without_repaint({ position.x(), position.y(), width(), height() }); }
|
||||
|
||||
Gfx::Size size() const { return m_rect.size(); }
|
||||
Gfx::IntSize size() const { return m_rect.size(); }
|
||||
|
||||
void invalidate();
|
||||
void invalidate(const Gfx::Rect&);
|
||||
void invalidate(const Gfx::IntRect&);
|
||||
|
||||
virtual void event(Core::Event&) override;
|
||||
|
||||
// Only used by WindowType::MenuApplet. Perhaps it could be a Window subclass? I don't know.
|
||||
void set_rect_in_menubar(const Gfx::Rect& rect) { m_rect_in_menubar = rect; }
|
||||
const Gfx::Rect& rect_in_menubar() const { return m_rect_in_menubar; }
|
||||
void set_rect_in_menubar(const Gfx::IntRect& rect) { m_rect_in_menubar = rect; }
|
||||
const Gfx::IntRect& rect_in_menubar() const { return m_rect_in_menubar; }
|
||||
|
||||
const Gfx::Bitmap* backing_store() const { return m_backing_store.ptr(); }
|
||||
Gfx::Bitmap* backing_store() { return m_backing_store.ptr(); }
|
||||
|
@ -187,11 +187,11 @@ public:
|
|||
bool has_alpha_channel() const { return m_has_alpha_channel; }
|
||||
void set_has_alpha_channel(bool value) { m_has_alpha_channel = value; }
|
||||
|
||||
Gfx::Size size_increment() const { return m_size_increment; }
|
||||
void set_size_increment(const Gfx::Size& increment) { m_size_increment = increment; }
|
||||
Gfx::IntSize size_increment() const { return m_size_increment; }
|
||||
void set_size_increment(const Gfx::IntSize& increment) { m_size_increment = increment; }
|
||||
|
||||
Gfx::Size base_size() const { return m_base_size; }
|
||||
void set_base_size(const Gfx::Size& size) { m_base_size = size; }
|
||||
Gfx::IntSize base_size() const { return m_base_size; }
|
||||
void set_base_size(const Gfx::IntSize& size) { m_base_size = size; }
|
||||
|
||||
const Gfx::Bitmap& icon() const { return *m_icon; }
|
||||
void set_icon(NonnullRefPtr<Gfx::Bitmap>&& icon) { m_icon = move(icon); }
|
||||
|
@ -201,7 +201,7 @@ public:
|
|||
const Cursor* override_cursor() const { return m_override_cursor.ptr(); }
|
||||
void set_override_cursor(RefPtr<Cursor>&& cursor) { m_override_cursor = move(cursor); }
|
||||
|
||||
void request_update(const Gfx::Rect&, bool ignore_occlusion = false);
|
||||
void request_update(const Gfx::IntRect&, bool ignore_occlusion = false);
|
||||
Gfx::DisjointRectSet take_pending_paint_rects() { return move(m_pending_paint_rects); }
|
||||
|
||||
bool in_minimize_animation() const { return m_minimize_animation_step != -1; }
|
||||
|
@ -211,7 +211,7 @@ public:
|
|||
void start_minimize_animation() { m_minimize_animation_step = 0; }
|
||||
void end_minimize_animation() { m_minimize_animation_step = -1; }
|
||||
|
||||
Gfx::Rect tiled_rect(WindowTileType) const;
|
||||
Gfx::IntRect tiled_rect(WindowTileType) const;
|
||||
void recalculate_rect();
|
||||
|
||||
// For InlineLinkedList.
|
||||
|
@ -247,9 +247,9 @@ private:
|
|||
Vector<WeakPtr<Window>> m_child_windows;
|
||||
|
||||
String m_title;
|
||||
Gfx::Rect m_rect;
|
||||
Gfx::Rect m_saved_nonfullscreen_rect;
|
||||
Gfx::Rect m_taskbar_rect;
|
||||
Gfx::IntRect m_rect;
|
||||
Gfx::IntRect m_saved_nonfullscreen_rect;
|
||||
Gfx::IntRect m_taskbar_rect;
|
||||
WindowType m_type { WindowType::Normal };
|
||||
bool m_global_cursor_tracking_enabled { false };
|
||||
bool m_automatic_cursor_tracking_enabled { false };
|
||||
|
@ -264,22 +264,22 @@ private:
|
|||
bool m_maximized { false };
|
||||
bool m_fullscreen { false };
|
||||
WindowTileType m_tiled { WindowTileType::None };
|
||||
Gfx::Rect m_untiled_rect;
|
||||
Gfx::IntRect m_untiled_rect;
|
||||
bool m_occluded { false };
|
||||
RefPtr<Gfx::Bitmap> m_backing_store;
|
||||
RefPtr<Gfx::Bitmap> m_last_backing_store;
|
||||
int m_window_id { -1 };
|
||||
i32 m_client_id { -1 };
|
||||
float m_opacity { 1 };
|
||||
Gfx::Size m_size_increment;
|
||||
Gfx::Size m_base_size;
|
||||
Gfx::IntSize m_size_increment;
|
||||
Gfx::IntSize m_base_size;
|
||||
NonnullRefPtr<Gfx::Bitmap> m_icon;
|
||||
RefPtr<Cursor> m_override_cursor;
|
||||
WindowFrame m_frame;
|
||||
unsigned m_wm_event_mask { 0 };
|
||||
Gfx::DisjointRectSet m_pending_paint_rects;
|
||||
Gfx::Rect m_unmaximized_rect;
|
||||
Gfx::Rect m_rect_in_menubar;
|
||||
Gfx::IntRect m_unmaximized_rect;
|
||||
Gfx::IntRect m_rect_in_menubar;
|
||||
RefPtr<Menu> m_window_menu;
|
||||
MenuItem* m_window_menu_minimize_item { nullptr };
|
||||
MenuItem* m_window_menu_maximize_item { nullptr };
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
endpoint WindowClient = 4
|
||||
{
|
||||
Paint(i32 window_id, Gfx::Size window_size, Vector<Gfx::Rect> rects) =|
|
||||
MouseMove(i32 window_id, Gfx::Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta, bool is_drag, String drag_data_type) =|
|
||||
MouseDown(i32 window_id, Gfx::Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
||||
MouseDoubleClick(i32 window_id, Gfx::Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
||||
MouseUp(i32 window_id, Gfx::Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
||||
MouseWheel(i32 window_id, Gfx::Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
||||
Paint(i32 window_id, Gfx::IntSize window_size, Vector<Gfx::IntRect> rects) =|
|
||||
MouseMove(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta, bool is_drag, String drag_data_type) =|
|
||||
MouseDown(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
||||
MouseDoubleClick(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
||||
MouseUp(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
||||
MouseWheel(i32 window_id, Gfx::IntPoint mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
||||
WindowEntered(i32 window_id) =|
|
||||
WindowLeft(i32 window_id) =|
|
||||
KeyDown(i32 window_id, u8 character, u32 key, u32 modifiers, u32 scancode) =|
|
||||
|
@ -14,23 +14,23 @@ endpoint WindowClient = 4
|
|||
WindowDeactivated(i32 window_id) =|
|
||||
WindowStateChanged(i32 window_id, bool minimized, bool occluded) =|
|
||||
WindowCloseRequest(i32 window_id) =|
|
||||
WindowResized(i32 window_id, Gfx::Rect old_rect, Gfx::Rect new_rect) =|
|
||||
WindowResized(i32 window_id, Gfx::IntRect old_rect, Gfx::IntRect new_rect) =|
|
||||
|
||||
MenuItemActivated(i32 menu_id, i32 identifier) =|
|
||||
|
||||
ScreenRectChanged(Gfx::Rect rect) =|
|
||||
ScreenRectChanged(Gfx::IntRect rect) =|
|
||||
|
||||
WM_WindowRemoved(i32 wm_id, i32 client_id, i32 window_id) =|
|
||||
WM_WindowStateChanged(i32 wm_id, i32 client_id, i32 window_id, bool is_active, bool is_minimized, bool is_frameless, i32 window_type, [UTF8] String title, Gfx::Rect rect, i32 progress) =|
|
||||
WM_WindowIconBitmapChanged(i32 wm_id, i32 client_id, i32 window_id, i32 icon_buffer_id, Gfx::Size icon_size) =|
|
||||
WM_WindowRectChanged(i32 wm_id, i32 client_id, i32 window_id, Gfx::Rect rect) =|
|
||||
WM_WindowStateChanged(i32 wm_id, i32 client_id, i32 window_id, bool is_active, bool is_minimized, bool is_frameless, i32 window_type, [UTF8] String title, Gfx::IntRect rect, i32 progress) =|
|
||||
WM_WindowIconBitmapChanged(i32 wm_id, i32 client_id, i32 window_id, i32 icon_buffer_id, Gfx::IntSize icon_size) =|
|
||||
WM_WindowRectChanged(i32 wm_id, i32 client_id, i32 window_id, Gfx::IntRect rect) =|
|
||||
|
||||
AsyncSetWallpaperFinished(bool success) =|
|
||||
|
||||
DragAccepted() =|
|
||||
DragCancelled() =|
|
||||
|
||||
DragDropped(i32 window_id, Gfx::Point mouse_position, [UTF8] String text, String data_type, String data) =|
|
||||
DragDropped(i32 window_id, Gfx::IntPoint mouse_position, [UTF8] String text, String data_type, String data) =|
|
||||
|
||||
UpdateSystemTheme(i32 system_theme_buffer_id) =|
|
||||
|
||||
|
|
|
@ -150,14 +150,14 @@ void WindowFrame::did_set_maximized(Badge<Window>, bool maximized)
|
|||
m_maximize_button->set_bitmap(maximized ? *s_unmaximize_button_bitmap : *s_maximize_button_bitmap);
|
||||
}
|
||||
|
||||
Gfx::Rect WindowFrame::title_bar_rect() const
|
||||
Gfx::IntRect WindowFrame::title_bar_rect() const
|
||||
{
|
||||
if (m_window.type() == WindowType::Notification)
|
||||
return { m_window.width() + 3, 3, window_titlebar_height, m_window.height() };
|
||||
return { 4, 4, m_window.width(), window_titlebar_height };
|
||||
}
|
||||
|
||||
Gfx::Rect WindowFrame::title_bar_icon_rect() const
|
||||
Gfx::IntRect WindowFrame::title_bar_icon_rect() const
|
||||
{
|
||||
auto titlebar_rect = title_bar_rect();
|
||||
return {
|
||||
|
@ -168,7 +168,7 @@ Gfx::Rect WindowFrame::title_bar_icon_rect() const
|
|||
};
|
||||
}
|
||||
|
||||
Gfx::Rect WindowFrame::title_bar_text_rect() const
|
||||
Gfx::IntRect WindowFrame::title_bar_text_rect() const
|
||||
{
|
||||
auto titlebar_rect = title_bar_rect();
|
||||
auto titlebar_icon_rect = title_bar_icon_rect();
|
||||
|
@ -196,7 +196,7 @@ WindowFrame::FrameColors WindowFrame::compute_frame_colors() const
|
|||
void WindowFrame::paint_notification_frame(Gfx::Painter& painter)
|
||||
{
|
||||
auto palette = WindowManager::the().palette();
|
||||
Gfx::Rect outer_rect = { {}, rect().size() };
|
||||
Gfx::IntRect outer_rect = { {}, rect().size() };
|
||||
|
||||
Gfx::StylePainter::paint_window_frame(painter, outer_rect, palette);
|
||||
|
||||
|
@ -216,7 +216,7 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
|
|||
{
|
||||
auto palette = WindowManager::the().palette();
|
||||
auto& window = m_window;
|
||||
Gfx::Rect outer_rect = { {}, rect().size() };
|
||||
Gfx::IntRect outer_rect = { {}, rect().size() };
|
||||
|
||||
Gfx::StylePainter::paint_window_frame(painter, outer_rect, palette);
|
||||
|
||||
|
@ -232,7 +232,7 @@ void WindowFrame::paint_normal_frame(Gfx::Painter& painter)
|
|||
painter.draw_line(titlebar_rect.bottom_left().translated(0, 1), titlebar_rect.bottom_right().translated(0, 1), palette.button());
|
||||
painter.draw_line(titlebar_rect.bottom_left().translated(0, 2), titlebar_rect.bottom_right().translated(0, 2), palette.button());
|
||||
|
||||
auto leftmost_button_rect = m_buttons.is_empty() ? Gfx::Rect() : m_buttons.last().relative_rect();
|
||||
auto leftmost_button_rect = m_buttons.is_empty() ? Gfx::IntRect() : m_buttons.last().relative_rect();
|
||||
|
||||
painter.fill_rect_with_gradient(titlebar_rect, border_color, border_color2);
|
||||
|
||||
|
@ -275,7 +275,7 @@ void WindowFrame::paint(Gfx::Painter& painter)
|
|||
}
|
||||
}
|
||||
|
||||
static Gfx::Rect frame_rect_for_window(Window& window, const Gfx::Rect& rect)
|
||||
static Gfx::IntRect frame_rect_for_window(Window& window, const Gfx::IntRect& rect)
|
||||
{
|
||||
if (window.is_frameless())
|
||||
return rect;
|
||||
|
@ -302,12 +302,12 @@ static Gfx::Rect frame_rect_for_window(Window& window, const Gfx::Rect& rect)
|
|||
}
|
||||
}
|
||||
|
||||
static Gfx::Rect frame_rect_for_window(Window& window)
|
||||
static Gfx::IntRect frame_rect_for_window(Window& window)
|
||||
{
|
||||
return frame_rect_for_window(window, window.rect());
|
||||
}
|
||||
|
||||
Gfx::Rect WindowFrame::rect() const
|
||||
Gfx::IntRect WindowFrame::rect() const
|
||||
{
|
||||
return frame_rect_for_window(m_window);
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ void WindowFrame::invalidate_title_bar()
|
|||
Compositor::the().invalidate(title_bar_rect().translated(rect().location()));
|
||||
}
|
||||
|
||||
void WindowFrame::notify_window_rect_changed(const Gfx::Rect& old_rect, const Gfx::Rect& new_rect)
|
||||
void WindowFrame::notify_window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect)
|
||||
{
|
||||
int window_button_width = 15;
|
||||
int window_button_height = 15;
|
||||
|
@ -329,13 +329,13 @@ void WindowFrame::notify_window_rect_changed(const Gfx::Rect& old_rect, const Gf
|
|||
|
||||
for (auto& button : m_buttons) {
|
||||
if (m_window.type() == WindowType::Notification) {
|
||||
Gfx::Rect rect { 0, pos, window_button_width, window_button_height };
|
||||
Gfx::IntRect rect { 0, pos, window_button_width, window_button_height };
|
||||
rect.center_horizontally_within(title_bar_rect());
|
||||
button.set_relative_rect(rect);
|
||||
pos += window_button_width;
|
||||
} else {
|
||||
pos -= window_button_width;
|
||||
Gfx::Rect rect { pos, 0, window_button_width, window_button_height };
|
||||
Gfx::IntRect rect { pos, 0, window_button_width, window_button_height };
|
||||
rect.center_vertically_within(title_bar_text_rect());
|
||||
button.set_relative_rect(rect);
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ void WindowFrame::on_mouse_event(const MouseEvent& event)
|
|||
{ ResizeDirection::Left, ResizeDirection::None, ResizeDirection::Right },
|
||||
{ ResizeDirection::DownLeft, ResizeDirection::Down, ResizeDirection::DownRight },
|
||||
};
|
||||
Gfx::Rect outer_rect = { {}, rect().size() };
|
||||
Gfx::IntRect outer_rect = { {}, rect().size() };
|
||||
ASSERT(outer_rect.contains(event.position()));
|
||||
int window_relative_x = event.x() - outer_rect.x();
|
||||
int window_relative_y = event.y() - outer_rect.y();
|
||||
|
|
|
@ -41,15 +41,15 @@ public:
|
|||
WindowFrame(Window&);
|
||||
~WindowFrame();
|
||||
|
||||
Gfx::Rect rect() const;
|
||||
Gfx::IntRect rect() const;
|
||||
void paint(Gfx::Painter&);
|
||||
void on_mouse_event(const MouseEvent&);
|
||||
void notify_window_rect_changed(const Gfx::Rect& old_rect, const Gfx::Rect& new_rect);
|
||||
void notify_window_rect_changed(const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect);
|
||||
void invalidate_title_bar();
|
||||
|
||||
Gfx::Rect title_bar_rect() const;
|
||||
Gfx::Rect title_bar_icon_rect() const;
|
||||
Gfx::Rect title_bar_text_rect() const;
|
||||
Gfx::IntRect title_bar_rect() const;
|
||||
Gfx::IntRect title_bar_icon_rect() const;
|
||||
Gfx::IntRect title_bar_text_rect() const;
|
||||
|
||||
void did_set_maximized(Badge<Window>, bool);
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ WindowManager::~WindowManager()
|
|||
{
|
||||
}
|
||||
|
||||
NonnullRefPtr<Cursor> WindowManager::get_cursor(const String& name, const Gfx::Point& hotspot)
|
||||
NonnullRefPtr<Cursor> WindowManager::get_cursor(const String& name, const Gfx::IntPoint& hotspot)
|
||||
{
|
||||
auto path = m_config->read_entry("Cursor", name, "/res/cursors/arrow.png");
|
||||
auto gb = Gfx::Bitmap::load_from_file(path);
|
||||
|
@ -150,7 +150,7 @@ bool WindowManager::set_resolution(int width, int height)
|
|||
}
|
||||
if (m_config) {
|
||||
if (success) {
|
||||
dbg() << "Saving resolution: " << Gfx::Size(width, height) << " to config file at " << m_config->file_name();
|
||||
dbg() << "Saving resolution: " << Gfx::IntSize(width, height) << " to config file at " << m_config->file_name();
|
||||
m_config->write_num_entry("Screen", "Width", width);
|
||||
m_config->write_num_entry("Screen", "Height", height);
|
||||
m_config->sync();
|
||||
|
@ -164,7 +164,7 @@ bool WindowManager::set_resolution(int width, int height)
|
|||
return success;
|
||||
}
|
||||
|
||||
Gfx::Size WindowManager::resolution() const
|
||||
Gfx::IntSize WindowManager::resolution() const
|
||||
{
|
||||
return Screen::the().size();
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ void WindowManager::notify_title_changed(Window& window)
|
|||
tell_wm_listeners_window_state_changed(window);
|
||||
}
|
||||
|
||||
void WindowManager::notify_rect_changed(Window& window, const Gfx::Rect& old_rect, const Gfx::Rect& new_rect)
|
||||
void WindowManager::notify_rect_changed(Window& window, const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect)
|
||||
{
|
||||
UNUSED_PARAM(old_rect);
|
||||
UNUSED_PARAM(new_rect);
|
||||
|
@ -388,7 +388,7 @@ void WindowManager::start_window_move(Window& window, const MouseEvent& event)
|
|||
window.invalidate();
|
||||
}
|
||||
|
||||
void WindowManager::start_window_resize(Window& window, const Gfx::Point& position, MouseButton button)
|
||||
void WindowManager::start_window_resize(Window& window, const Gfx::IntPoint& position, MouseButton button)
|
||||
{
|
||||
move_to_front_and_make_active(window);
|
||||
constexpr ResizeDirection direction_for_hot_area[3][3] = {
|
||||
|
@ -396,7 +396,7 @@ void WindowManager::start_window_resize(Window& window, const Gfx::Point& positi
|
|||
{ ResizeDirection::Left, ResizeDirection::None, ResizeDirection::Right },
|
||||
{ ResizeDirection::DownLeft, ResizeDirection::Down, ResizeDirection::DownRight },
|
||||
};
|
||||
Gfx::Rect outer_rect = window.frame().rect();
|
||||
Gfx::IntRect outer_rect = window.frame().rect();
|
||||
ASSERT(outer_rect.contains(position));
|
||||
int window_relative_x = position.x() - outer_rect.x();
|
||||
int window_relative_y = position.y() - outer_rect.y();
|
||||
|
@ -489,7 +489,7 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event, Window*& hove
|
|||
m_move_window->set_tiled(WindowTileType::Right);
|
||||
} else if (pixels_moved_from_start > 5 || m_move_window->tiled() == WindowTileType::None) {
|
||||
m_move_window->set_tiled(WindowTileType::None);
|
||||
Gfx::Point pos = m_move_window_origin.translated(event.position() - m_move_origin);
|
||||
Gfx::IntPoint pos = m_move_window_origin.translated(event.position() - m_move_origin);
|
||||
m_move_window->set_position_without_repaint(pos);
|
||||
if (m_move_window->rect().contains(event.position()))
|
||||
hovered_window = m_move_window;
|
||||
|
@ -565,7 +565,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo
|
|||
auto new_rect = m_resize_window_original_rect;
|
||||
|
||||
// First, size the new rect.
|
||||
Gfx::Size minimum_size { 50, 50 };
|
||||
Gfx::IntSize minimum_size { 50, 50 };
|
||||
|
||||
new_rect.set_width(max(minimum_size.width(), new_rect.width() + change_w));
|
||||
new_rect.set_height(max(minimum_size.height(), new_rect.height() + change_h));
|
||||
|
@ -890,14 +890,14 @@ void WindowManager::clear_resize_candidate()
|
|||
m_resize_candidate = nullptr;
|
||||
}
|
||||
|
||||
Gfx::Rect WindowManager::menubar_rect() const
|
||||
Gfx::IntRect WindowManager::menubar_rect() const
|
||||
{
|
||||
if (active_fullscreen_window())
|
||||
return {};
|
||||
return MenuManager::the().menubar_rect();
|
||||
}
|
||||
|
||||
Gfx::Rect WindowManager::desktop_rect() const
|
||||
Gfx::IntRect WindowManager::desktop_rect() const
|
||||
{
|
||||
if (active_fullscreen_window())
|
||||
return {};
|
||||
|
@ -1068,7 +1068,7 @@ void WindowManager::invalidate()
|
|||
Compositor::the().invalidate();
|
||||
}
|
||||
|
||||
void WindowManager::invalidate(const Gfx::Rect& rect)
|
||||
void WindowManager::invalidate(const Gfx::IntRect& rect)
|
||||
{
|
||||
Compositor::the().invalidate(rect);
|
||||
}
|
||||
|
@ -1137,9 +1137,9 @@ ResizeDirection WindowManager::resize_direction_of_window(const Window& window)
|
|||
return m_resize_direction;
|
||||
}
|
||||
|
||||
Gfx::Rect WindowManager::maximized_window_rect(const Window& window) const
|
||||
Gfx::IntRect WindowManager::maximized_window_rect(const Window& window) const
|
||||
{
|
||||
Gfx::Rect rect = Screen::the().rect();
|
||||
Gfx::IntRect rect = Screen::the().rect();
|
||||
|
||||
// Subtract window title bar (leaving the border)
|
||||
rect.set_y(rect.y() + window.frame().title_bar_rect().height());
|
||||
|
@ -1183,14 +1183,14 @@ void WindowManager::end_dnd_drag()
|
|||
m_dnd_bitmap = nullptr;
|
||||
}
|
||||
|
||||
Gfx::Rect WindowManager::dnd_rect() const
|
||||
Gfx::IntRect WindowManager::dnd_rect() const
|
||||
{
|
||||
int bitmap_width = m_dnd_bitmap ? m_dnd_bitmap->width() : 0;
|
||||
int bitmap_height = m_dnd_bitmap ? m_dnd_bitmap->height() : 0;
|
||||
int width = font().width(m_dnd_text) + bitmap_width;
|
||||
int height = max((int)font().glyph_height(), bitmap_height);
|
||||
auto location = Compositor::the().current_cursor_rect().center().translated(8, 8);
|
||||
return Gfx::Rect(location, { width, height }).inflated(4, 4);
|
||||
return Gfx::IntRect(location, { width, height }).inflated(4, 4);
|
||||
}
|
||||
|
||||
bool WindowManager::update_theme(String theme_path, String theme_name)
|
||||
|
|
|
@ -88,21 +88,21 @@ public:
|
|||
void remove_window(Window&);
|
||||
|
||||
void notify_title_changed(Window&);
|
||||
void notify_rect_changed(Window&, const Gfx::Rect& oldRect, const Gfx::Rect& newRect);
|
||||
void notify_rect_changed(Window&, const Gfx::IntRect& oldRect, const Gfx::IntRect& newRect);
|
||||
void notify_minimization_state_changed(Window&);
|
||||
void notify_opacity_changed(Window&);
|
||||
void notify_occlusion_state_changed(Window&);
|
||||
void notify_progress_changed(Window&);
|
||||
void notify_client_changed_app_menubar(ClientConnection&);
|
||||
|
||||
Gfx::Rect maximized_window_rect(const Window&) const;
|
||||
Gfx::IntRect maximized_window_rect(const Window&) const;
|
||||
|
||||
const ClientConnection* dnd_client() const { return m_dnd_client.ptr(); }
|
||||
const String& dnd_text() const { return m_dnd_text; }
|
||||
const String& dnd_data_type() const { return m_dnd_data_type; }
|
||||
const String& dnd_data() const { return m_dnd_data; }
|
||||
const Gfx::Bitmap* dnd_bitmap() const { return m_dnd_bitmap; }
|
||||
Gfx::Rect dnd_rect() const;
|
||||
Gfx::IntRect dnd_rect() const;
|
||||
|
||||
void start_dnd_drag(ClientConnection&, const String& text, Gfx::Bitmap*, const String& data_type, const String& data);
|
||||
void end_dnd_drag();
|
||||
|
@ -116,8 +116,8 @@ public:
|
|||
|
||||
void move_to_front_and_make_active(Window&);
|
||||
|
||||
Gfx::Rect menubar_rect() const;
|
||||
Gfx::Rect desktop_rect() const;
|
||||
Gfx::IntRect menubar_rect() const;
|
||||
Gfx::IntRect desktop_rect() const;
|
||||
|
||||
const Cursor& active_cursor() const;
|
||||
const Cursor& arrow_cursor() const { return *m_arrow_cursor; }
|
||||
|
@ -131,15 +131,15 @@ public:
|
|||
const Cursor& move_cursor() const { return *m_move_cursor; }
|
||||
const Cursor& drag_cursor() const { return *m_drag_cursor; }
|
||||
|
||||
void invalidate(const Gfx::Rect&);
|
||||
void invalidate(const Gfx::IntRect&);
|
||||
void invalidate();
|
||||
void flush(const Gfx::Rect&);
|
||||
void flush(const Gfx::IntRect&);
|
||||
|
||||
const Gfx::Font& font() const;
|
||||
const Gfx::Font& window_title_font() const;
|
||||
|
||||
bool set_resolution(int width, int height);
|
||||
Gfx::Size resolution() const;
|
||||
Gfx::IntSize resolution() const;
|
||||
|
||||
void set_active_window(Window*);
|
||||
void set_hovered_button(Button*);
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
void tell_wm_listeners_window_icon_changed(Window&);
|
||||
void tell_wm_listeners_window_rect_changed(Window&);
|
||||
|
||||
void start_window_resize(Window&, const Gfx::Point&, MouseButton);
|
||||
void start_window_resize(Window&, const Gfx::IntPoint&, MouseButton);
|
||||
void start_window_resize(Window&, const MouseEvent&);
|
||||
|
||||
const Window* active_fullscreen_window() const { return (m_active_window && m_active_window->is_fullscreen()) ? m_active_window : nullptr; }
|
||||
|
@ -170,7 +170,7 @@ public:
|
|||
|
||||
private:
|
||||
NonnullRefPtr<Cursor> get_cursor(const String& name);
|
||||
NonnullRefPtr<Cursor> get_cursor(const String& name, const Gfx::Point& hotspot);
|
||||
NonnullRefPtr<Cursor> get_cursor(const String& name, const Gfx::IntPoint& hotspot);
|
||||
|
||||
void process_mouse_event(MouseEvent&, Window*& hovered_window);
|
||||
void process_event_for_doubleclick(Window& window, MouseEvent& event);
|
||||
|
@ -216,7 +216,7 @@ private:
|
|||
struct DoubleClickInfo {
|
||||
struct ClickMetadata {
|
||||
Core::ElapsedTimer clock;
|
||||
Gfx::Point last_position;
|
||||
Gfx::IntPoint last_position;
|
||||
};
|
||||
|
||||
ClickMetadata& metadata_for_button(MouseButton);
|
||||
|
@ -249,14 +249,14 @@ private:
|
|||
WeakPtr<Window> m_active_input_window;
|
||||
|
||||
WeakPtr<Window> m_move_window;
|
||||
Gfx::Point m_move_origin;
|
||||
Gfx::Point m_move_window_origin;
|
||||
Gfx::IntPoint m_move_origin;
|
||||
Gfx::IntPoint m_move_window_origin;
|
||||
|
||||
WeakPtr<Window> m_resize_window;
|
||||
WeakPtr<Window> m_resize_candidate;
|
||||
MouseButton m_resizing_mouse_button { MouseButton::None };
|
||||
Gfx::Rect m_resize_window_original_rect;
|
||||
Gfx::Point m_resize_origin;
|
||||
Gfx::IntRect m_resize_window_original_rect;
|
||||
Gfx::IntPoint m_resize_origin;
|
||||
ResizeDirection m_resize_direction { ResizeDirection::None };
|
||||
|
||||
u8 m_keyboard_modifiers { 0 };
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
endpoint WindowServer = 2
|
||||
{
|
||||
Greet() => (i32 client_id, Gfx::Rect screen_rect, i32 system_theme_buffer_id)
|
||||
Greet() => (i32 client_id, Gfx::IntRect screen_rect, i32 system_theme_buffer_id)
|
||||
|
||||
CreateMenubar() => (i32 menubar_id)
|
||||
DestroyMenubar(i32 menubar_id) => ()
|
||||
|
@ -30,7 +30,7 @@ endpoint WindowServer = 2
|
|||
UpdateMenuItem(i32 menu_id, i32 identifier, i32 submenu_id, [UTF8] String text, bool enabled, bool checkable, bool checked, [UTF8] String shortcut) => ()
|
||||
|
||||
CreateWindow(
|
||||
Gfx::Rect rect,
|
||||
Gfx::IntRect rect,
|
||||
bool has_alpha_channel,
|
||||
bool modal,
|
||||
bool minimizable,
|
||||
|
@ -38,8 +38,8 @@ endpoint WindowServer = 2
|
|||
bool fullscreen,
|
||||
bool frameless,
|
||||
float opacity,
|
||||
Gfx::Size base_size,
|
||||
Gfx::Size size_increment,
|
||||
Gfx::IntSize base_size,
|
||||
Gfx::IntSize size_increment,
|
||||
i32 type,
|
||||
[UTF8] String title,
|
||||
i32 parent_window_id) => (i32 window_id)
|
||||
|
@ -51,27 +51,27 @@ endpoint WindowServer = 2
|
|||
|
||||
SetWindowProgress(i32 window_id, i32 progress) =|
|
||||
|
||||
SetWindowRect(i32 window_id, Gfx::Rect rect) => (Gfx::Rect rect)
|
||||
GetWindowRect(i32 window_id) => (Gfx::Rect rect)
|
||||
SetWindowRect(i32 window_id, Gfx::IntRect rect) => (Gfx::IntRect rect)
|
||||
GetWindowRect(i32 window_id) => (Gfx::IntRect rect)
|
||||
|
||||
InvalidateRect(i32 window_id, Vector<Gfx::Rect> rects, bool ignore_occlusion) =|
|
||||
DidFinishPainting(i32 window_id, Vector<Gfx::Rect> rects) =|
|
||||
InvalidateRect(i32 window_id, Vector<Gfx::IntRect> rects, bool ignore_occlusion) =|
|
||||
DidFinishPainting(i32 window_id, Vector<Gfx::IntRect> rects) =|
|
||||
|
||||
SetGlobalCursorTracking(i32 window_id, bool enabled) => ()
|
||||
SetWindowOpacity(i32 window_id, float opacity) => ()
|
||||
|
||||
SetWindowBackingStore(i32 window_id, i32 bpp, i32 pitch, i32 shbuf_id, bool has_alpha_channel, Gfx::Size size, bool flush_immediately) => ()
|
||||
SetWindowBackingStore(i32 window_id, i32 bpp, i32 pitch, i32 shbuf_id, bool has_alpha_channel, Gfx::IntSize size, bool flush_immediately) => ()
|
||||
|
||||
WM_SetActiveWindow(i32 client_id, i32 window_id) =|
|
||||
WM_SetWindowMinimized(i32 client_id, i32 window_id, bool minimized) =|
|
||||
WM_StartWindowResize(i32 client_id, i32 window_id) =|
|
||||
WM_PopupWindowMenu(i32 client_id, i32 window_id, Gfx::Point screen_position) =|
|
||||
WM_SetWindowTaskbarRect(i32 client_id, i32 window_id, Gfx::Rect rect) =|
|
||||
WM_PopupWindowMenu(i32 client_id, i32 window_id, Gfx::IntPoint screen_position) =|
|
||||
WM_SetWindowTaskbarRect(i32 client_id, i32 window_id, Gfx::IntRect rect) =|
|
||||
|
||||
SetWindowHasAlphaChannel(i32 window_id, bool has_alpha_channel) => ()
|
||||
MoveWindowToFront(i32 window_id) => ()
|
||||
SetFullscreen(i32 window_id, bool fullscreen) => ()
|
||||
PopupMenu(i32 menu_id, Gfx::Point screen_position) => ()
|
||||
PopupMenu(i32 menu_id, Gfx::IntPoint screen_position) => ()
|
||||
DismissMenu(i32 menu_id) => ()
|
||||
|
||||
AsyncSetWallpaper(String path) =|
|
||||
|
@ -79,19 +79,19 @@ endpoint WindowServer = 2
|
|||
SetBackgroundColor(String background_color) => ()
|
||||
SetWallpaperMode(String mode) => ()
|
||||
|
||||
SetResolution(Gfx::Size resolution) => (bool success, Gfx::Size resolution)
|
||||
SetResolution(Gfx::IntSize resolution) => (bool success, Gfx::IntSize resolution)
|
||||
SetWindowIconBitmap(i32 window_id, Gfx::ShareableBitmap icon) => ()
|
||||
|
||||
GetWallpaper() => (String path)
|
||||
SetWindowOverrideCursor(i32 window_id, i32 cursor_type) => ()
|
||||
SetWindowCustomOverrideCursor(i32 window_id, Gfx::ShareableBitmap cursor) => ()
|
||||
|
||||
StartDrag([UTF8] String text, String data_type, String data, i32 bitmap_id, Gfx::Size bitmap_size) => (bool started)
|
||||
StartDrag([UTF8] String text, String data_type, String data, i32 bitmap_id, Gfx::IntSize bitmap_size) => (bool started)
|
||||
|
||||
SetSystemTheme(String theme_path, [UTF8] String theme_name) => (bool success)
|
||||
GetSystemTheme() => ([UTF8] String theme_name)
|
||||
|
||||
SetWindowBaseSizeAndSizeIncrement(i32 window_id, Gfx::Size base_size, Gfx::Size size_increment) => ()
|
||||
SetWindowBaseSizeAndSizeIncrement(i32 window_id, Gfx::IntSize base_size, Gfx::IntSize size_increment) => ()
|
||||
|
||||
EnableDisplayLink() =|
|
||||
DisableDisplayLink() =|
|
||||
|
|
|
@ -165,7 +165,7 @@ void WindowSwitcher::redraw()
|
|||
Compositor::the().invalidate(m_rect);
|
||||
}
|
||||
|
||||
Gfx::Rect WindowSwitcher::item_rect(int index) const
|
||||
Gfx::IntRect WindowSwitcher::item_rect(int index) const
|
||||
{
|
||||
return {
|
||||
padding(),
|
||||
|
@ -197,12 +197,12 @@ void WindowSwitcher::draw()
|
|||
rect_text_color = palette.threed_shadow2();
|
||||
}
|
||||
item_rect.shrink(item_padding(), 0);
|
||||
Gfx::Rect thumbnail_rect = { item_rect.location().translated(0, 5), { thumbnail_width(), thumbnail_height() } };
|
||||
Gfx::IntRect thumbnail_rect = { item_rect.location().translated(0, 5), { thumbnail_width(), thumbnail_height() } };
|
||||
if (window.backing_store()) {
|
||||
painter.draw_scaled_bitmap(thumbnail_rect, *window.backing_store(), window.backing_store()->rect());
|
||||
Gfx::StylePainter::paint_frame(painter, thumbnail_rect.inflated(4, 4), palette, Gfx::FrameShape::Container, Gfx::FrameShadow::Sunken, 2);
|
||||
}
|
||||
Gfx::Rect icon_rect = { thumbnail_rect.bottom_right().translated(-window.icon().width(), -window.icon().height()), { window.icon().width(), window.icon().height() } };
|
||||
Gfx::IntRect icon_rect = { thumbnail_rect.bottom_right().translated(-window.icon().width(), -window.icon().height()), { window.icon().width(), window.icon().height() } };
|
||||
painter.fill_rect(icon_rect, palette.window());
|
||||
painter.blit(icon_rect.location(), window.icon(), window.icon().rect());
|
||||
painter.draw_text(item_rect.translated(thumbnail_width() + 12, 0), window.title(), WindowManager::the().window_title_font(), Gfx::TextAlignment::CenterLeft, text_color);
|
||||
|
|
|
@ -68,13 +68,13 @@ private:
|
|||
void draw();
|
||||
void redraw();
|
||||
void select_window_at_index(int index);
|
||||
Gfx::Rect item_rect(int index) const;
|
||||
Gfx::IntRect item_rect(int index) const;
|
||||
Window* selected_window();
|
||||
|
||||
virtual void event(Core::Event&) override;
|
||||
|
||||
RefPtr<Window> m_switcher_window;
|
||||
Gfx::Rect m_rect;
|
||||
Gfx::IntRect m_rect;
|
||||
bool m_visible { false };
|
||||
Vector<WeakPtr<Window>> m_windows;
|
||||
int m_selected_index { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue