summaryrefslogtreecommitdiff
path: root/modules/window/c++/xcb.cpp
diff options
context:
space:
mode:
authorClaudius 'keldu' Holeksa <mail@keldu.de>2024-08-06 16:13:50 +0200
committerClaudius 'keldu' Holeksa <mail@keldu.de>2024-08-06 16:13:50 +0200
commit6a5d5b204569fc6abe6cb5a8ac338350eb5e923d (patch)
tree04339a65d987c0bed58c9e1eeb0a3742e7c95705 /modules/window/c++/xcb.cpp
parente42c3750013e634bbe1834e3e684367e42814b97 (diff)
Fixed xcb windows
Diffstat (limited to 'modules/window/c++/xcb.cpp')
-rw-r--r--modules/window/c++/xcb.cpp56
1 files changed, 50 insertions, 6 deletions
diff --git a/modules/window/c++/xcb.cpp b/modules/window/c++/xcb.cpp
index e90fa5a..9d4ae58 100644
--- a/modules/window/c++/xcb.cpp
+++ b/modules/window/c++/xcb.cpp
@@ -261,25 +261,69 @@ void window<backend::linux_xcb>::resize(uint64_t w, uint64_t h){
conveyor<data<schema::WindowEvents>> window<backend::linux_xcb>::on_event() {
auto caf = new_conveyor_and_feeder<data<schema::WindowEvents>>();
- event_feeder = std::move(caf.feeder);
+ event_feeder_ = std::move(caf.feeder);
return std::move(caf.conveyor);
}
void window<backend::linux_xcb>::resize_event(uint64_t x, uint64_t y, uint64_t width, uint64_t height){
- /// @todo implement
- assert(false);
+ video_mode_.width = width;
+ video_mode_.height = height;
+
+ if(event_feeder_) {
+ /// @TODO implement
+ assert(false);
+ }
}
void window<backend::linux_xcb>::mouse_event(int16_t x, int16_t y, uint16_t state, bool pressed){
- /// @todo implement
+ if(x < 0 || y < 0){
+ return;
+ }
+
+ uint32_t ux = static_cast<uint32_t>(x);
+ uint32_t uy = static_cast<uint32_t>(y);
+
+ if( ux >= video_mode_.width || uy >= video_mode_.height){
+ return;
+ }
+
+ if(event_feeder_){
+ /// @TODO implement
assert(false);
+ }
}
+
void window<backend::linux_xcb>::mouse_move_event(int16_t x, int16_t y){
- /// @todo implement
+ if(x < 0 || y < 0){
+ return;
+ }
+ uint32_t ux = static_cast<uint32_t>(x);
+ uint32_t uy = static_cast<uint32_t>(y);
+
+ if( ux >= video_mode_.width || uy >= video_mode_.height){
+ return;
+ }
+
+ if(event_feeder_){
+ /// @TODO implement
assert(false);
+ }
}
+
void window<backend::linux_xcb>::keyboard_event(int16_t x, int16_t y, uint32_t keycode, bool pressed, bool repeat){
- /// @todo implement
+ if(x < 0 || y < 0){
+ return;
+ }
+ uint32_t ux = static_cast<uint32_t>(x);
+ uint32_t uy = static_cast<uint32_t>(y);
+
+ if( ux >= video_mode_.width || uy >= video_mode_.height){
+ return;
+ }
+
+ if(event_feeder_){
+ /// @TODO implement
assert(false);
+ }
}
xcb_window_t window<backend::linux_xcb>::get_xcb_window_handle() const{