mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-18 19:23:56 +00:00
Add window object
This commit is contained in:
@@ -19,6 +19,7 @@ struct handle_types
|
||||
registry,
|
||||
mutant,
|
||||
token,
|
||||
window,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -238,7 +239,7 @@ class handle_store : public generic_handle_store
|
||||
return h;
|
||||
}
|
||||
|
||||
bool erase(const typename value_map::iterator& entry)
|
||||
std::pair<typename value_map::iterator, bool> erase(const typename value_map::iterator& entry)
|
||||
{
|
||||
if (this->block_mutation_)
|
||||
{
|
||||
@@ -247,25 +248,25 @@ class handle_store : public generic_handle_store
|
||||
|
||||
if (entry == this->store_.end())
|
||||
{
|
||||
return false;
|
||||
return {entry, false};
|
||||
}
|
||||
|
||||
if constexpr (handle_detail::has_deleter_function<T>())
|
||||
{
|
||||
if (!T::deleter(entry->second))
|
||||
{
|
||||
return true;
|
||||
return {entry, true};
|
||||
}
|
||||
}
|
||||
|
||||
this->store_.erase(entry);
|
||||
return true;
|
||||
auto new_iter = this->store_.erase(entry);
|
||||
return {new_iter, true};
|
||||
}
|
||||
|
||||
bool erase(const handle_value h)
|
||||
{
|
||||
const auto entry = this->get_iterator(h);
|
||||
return this->erase(entry);
|
||||
return this->erase(entry).second;
|
||||
}
|
||||
|
||||
bool erase(const handle h) override
|
||||
|
||||
@@ -109,6 +109,7 @@ struct process_context
|
||||
handle_store<handle_types::semaphore, semaphore> semaphores{};
|
||||
handle_store<handle_types::port, port> ports{};
|
||||
handle_store<handle_types::mutant, mutant> mutants{};
|
||||
handle_store<handle_types::window, window> windows{};
|
||||
handle_store<handle_types::registry, registry_key, 2> registry_keys{};
|
||||
std::map<uint16_t, atom_entry> atoms{};
|
||||
|
||||
|
||||
@@ -279,6 +279,19 @@ namespace syscalls
|
||||
|
||||
thread->exit_status = exit_status;
|
||||
c.win_emu.callbacks.on_thread_terminated(thread_handle, *thread);
|
||||
|
||||
for (auto i = c.proc.windows.begin(); i != c.proc.windows.end();)
|
||||
{
|
||||
if (i->second.thread_id != thread->id)
|
||||
{
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
|
||||
i->second.ref_count = 1;
|
||||
i = c.proc.windows.erase(i).first;
|
||||
}
|
||||
|
||||
if (thread == c.proc.active_thread)
|
||||
{
|
||||
c.win_emu.yield_thread();
|
||||
|
||||
@@ -39,6 +39,39 @@ struct event : ref_counted_object
|
||||
}
|
||||
};
|
||||
|
||||
struct window : ref_counted_object
|
||||
{
|
||||
uint32_t thread_id{};
|
||||
std::u16string name{};
|
||||
std::u16string class_name{};
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
|
||||
void serialize_object(utils::buffer_serializer& buffer) const override
|
||||
{
|
||||
buffer.write(this->thread_id);
|
||||
buffer.write(this->name);
|
||||
buffer.write(this->class_name);
|
||||
buffer.write(this->width);
|
||||
buffer.write(this->height);
|
||||
buffer.write(this->x);
|
||||
buffer.write(this->y);
|
||||
}
|
||||
|
||||
void deserialize_object(utils::buffer_deserializer& buffer) override
|
||||
{
|
||||
buffer.read(this->thread_id);
|
||||
buffer.read(this->name);
|
||||
buffer.read(this->class_name);
|
||||
buffer.read(this->width);
|
||||
buffer.read(this->height);
|
||||
buffer.read(this->x);
|
||||
buffer.read(this->y);
|
||||
}
|
||||
};
|
||||
|
||||
struct mutant : ref_counted_object
|
||||
{
|
||||
uint32_t locked_count{0};
|
||||
|
||||
Reference in New Issue
Block a user