-
Notifications
You must be signed in to change notification settings - Fork 0
adding a surface observer interface #8
base: mir-1.9-miroil
Are you sure you want to change the base?
Conversation
erlend-g
commented
Jun 30, 2021
- Adding interface surface observer interface
- Adding a wrapper for Surface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this code will be used on a single thread, and if that's right it isn't threadsafe.
void window_resized_to(mir::scene::Surface const* surf, mir::geometry::Size const& window_size) override; | ||
|
||
private: | ||
std::shared_ptr<miroil::SurfaceObserver> listener; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be const?
int query(MirWindowAttrib attrib) const; | ||
|
||
private: | ||
std::shared_ptr<mir::scene::Surface> wrapped; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be const?
|
||
private: | ||
std::shared_ptr<mir::scene::Surface> wrapped; | ||
std::unordered_map<std::shared_ptr<miroil::SurfaceObserver>, std::shared_ptr<miroil::SurfaceObserverImpl>> observers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't access to this be protected by (at least) a mutex?
It is probably best to copy the SurfaceObservers
implementation (by using BasicObservers<>
to achieve threadsafety.)
For a discussion about this design context see https://accu.org/journals/overload/22/124/griffiths_2040/ Some of the names have changed, and some of the code moved, but the design is the same. |