Help with Window Movement

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
maxtyson123
Posts: 24
Joined: Wed Apr 19, 2023 1:40 am
Libera.chat IRC: maxtyson123

Help with Window Movement

Post by maxtyson123 »

I have been working on the window manager for my OS and I have came across an issue I was wondering if someone with more anvanced C++ skills could help me with.
Source code for the project is here https://github.com/maxtyson123/max-os

My problem is that the window is not receiving the on click event that my mouse driver raises. I have setup and debugged with GDB to find the following results:
In mouse.cpp, MouseDriver::HandleInterrupt is called correctly
In, mouse.cpp, MouseDriver::HandleInterrupt passes the event to the setup mouse event handlers
I,ve put a break point at MouseEventHandler::onMouseDownEvent and the execution stops there showing that it is reached, however the desktop (Which extends the class MouseEvent handler, and overrides the onMouseDownEvent function) does not stop execution when a break point is placed there, either meaning I am using GDB wrong or the desktop does not receive the event.
I put a break point at MouseDriver::connectMouseEventHandler and it correctly shows that the desktop is registered as an event handler.

Is there anything else I should test for? Otherwise from those testings I conclude that there might be a problem with the way I override the onMouseDownEvent function, although it could be entirely separate and something to do with window movement code, however I have tried to make the window change its colours on click and that test failed so I'm thinking the problem is that its not receiving the event.

Would someone be able to guide me why this is not working? In the meantime I will continue to try problem solve it myself.
Thanks.
lochyj
Posts: 10
Joined: Fri Nov 11, 2022 10:28 pm

Re: Help with Window Movement

Post by lochyj »

If you still have the problem, you should try `step` in gdb to see if the handler actually gets called. That is if step works with c++, which I am not sure of. I don't have any c++ experience so I cant help that much.
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Re: Help with Window Movement

Post by kzinti »

Start by:

1) Making the MouseEventHandler methods pure virtual (i.e. add "= 0" at the end of each method declaration).
2) Add the "override" keyword after each method you override in desktop.h

I suspect you might get some compile errors pointing you towards the problem.
Post Reply