24 Mar 2014

38550

0

Walking in circles

When work progresses, there’s a natural tendency towards running out of simple bugs to fix, and being left with those persistent ones that seem to have an intelligence of their own.

I thought I was over those. That the bug I was working on would be a simple one.

I wanted to have some test builds ready to share with the world, to be able to tell you all “hey look, if you don’t try to navigate with the keyboard, everything mostly acts the way it should, come and try!”

The week began by improving the way the shell menus work without activating their windows. This would mean that the title bar of the parent window does not go grey when a shell menu is displayed. But when the logic that calculates when and how to cancel the menu relies on activation events, suddenly that system stops working, since the windows are never activating.

I had to redesign the way I controlled that, improving the input captures system I started writing last week, so that it tracks mouse events and manages who receives those events. This has given a twist to the Focus Manager class, which now truly manages the focus of the menu, arbitrating who receives the input at any given time. But alas, it can never be that simple.

At this point, it was possible to switch between menus in the horizontal menubar, simply by moving the mouse to a new item. A dual hook system was implemented, where shell menus use a GetMessage hook, and system popups use a MessageFilter hook. Moving the mouse to a new item causes the old item to be cancelled, and the new item to be activated. Or that was the theory. Because of the complex flow of messages and method calls going between the different windows and classes, once a shell menu is open, moving to a system popup behaves wrongly.

In trying to fix this issue, I broke the activation logic. In trying to fix the activation logic again, I broke the menubar. I kept walking in circles.

I started metaphorically bashing my head against a metaphorical wall, trying to think of how exactly should I fix one, without breaking the other, but it’s already Monday morning, and I find myself without a solution.

It hasn’t all been useless, though, since by revisiting the code, I noticed some code that didn’t quite look right. But the issue I was trying to fix, the one that would make the menus feel like menus, is still there.

Since there’s nothing to show this week, here are some sleeping kittens:

 

Discussion: https://www.reactos.org/forum/viewtopic.php?f=2&t=13159

This blog post represents the personal opinion of the author and is not representative of the position of the ReactOS Project.