Well that will be too obvious but still...
You need to listen move event and whenever you detect top-left <= 0 or top-right >= SCREEN_WIDTH you will manually re-size your window. Surely you need to get screen size before all those and calculate half of it and so on.
No need to mention that, in half-maximized state you need to listen and check if the window is moved to restore its previous dimensions.
I really believe there is no trivial way to implement this unless you are to use winapi. Well in winapi case one can object trivialness and I can't deny.
Please let us know if you eventually come up with an easier solution.