1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:18:12 +00:00

LibGUI+Inspector: Highlight the currently remotely inspected widget

This patch adds a magenta rectangle around the currently inspected
widget. This allows you to browse an app's widget tree somewhat
visually using the Inspector. :^)
This commit is contained in:
Andreas Kling 2020-03-05 14:42:05 +01:00
parent d16f8214d8
commit e23c5b7e83
5 changed files with 29 additions and 0 deletions

View file

@ -96,6 +96,14 @@ void RemoteProcess::send_request(const JsonObject& request)
m_socket->write(serialized);
}
void RemoteProcess::set_inspected_object(uintptr_t address)
{
JsonObject request;
request.set("type", "SetInspectedObject");
request.set("address", address);
send_request(request);
}
void RemoteProcess::update()
{
m_socket->on_connected = [this] {

View file

@ -43,6 +43,8 @@ public:
RemoteObjectGraphModel& object_graph_model() { return *m_object_graph_model; }
const NonnullOwnPtrVector<RemoteObject>& roots() const { return m_roots; }
void set_inspected_object(uintptr_t);
Function<void()> on_update;
private:

View file

@ -81,6 +81,7 @@ int main(int argc, char** argv)
tree_view.on_activation = [&](auto& index) {
auto* remote_object = static_cast<RemoteObject*>(index.internal_data());
properties_table_view.set_model(remote_object->property_model());
remote_process.set_inspected_object(remote_object->json.get("address").to_number<uintptr_t>());
};
window->show();