[haiku-development] Re: Detect overlapping window

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 29 Apr 2008 10:46:18 +0200

Hi Mohmed,

Mohmed Hammassani wrote:
> I am trying to implement some window management features. The feature i 
> am currently interested in is tabbing. Say we have two windows on the 
> desktop, window A and window B. When window B is dragged using its tab 
> and dropped over window A's tab, window B takes on window A's size and 
> window B's tab gets shifted so that its to the right of window A's tab.

the code could use a little refactoring. There is some stuff handled by the 
Window class which should be handled by the Decorator class instead (there 
are respective TODOs in the Mouse*() hooks). The mouse hooks are called 
from a mouse event filter that the Desktop class installs into the event 
processing. One of the reasons for the hooks being present in the Window 
class is for the case that the mouse event concerns the inside of the 
window, in this case, it is passed on to the client application/window.

In any case the actual window movement is handled through the 
Desktop::MoveWindowBy() method, so in there, you have the knowledge of 
other windows on the screen. The Desktop object has a window list 
"_CurrentWindows()" for the windows visible on the current workspace. You 
can see how it is used for example in 
Desktop::_RebuildClippingForAllWindows().

You will have to find some way to associate the meaning of "combine windows 
into one tabbed window" to a certain mouse action with or without keyboard 
modifiers held down. A lot of mouse actions and modifiers are already 
assigned. For example, right clicking means to send a window to the back, 
shift-left clicking means to slide the tab along the top of the window. 
There are a couple more and you will have to find one of your own, because 
I guess we BeOS veterans would prefer the mouse actions and modifiers to 
stay what we are used to. :-)

BTW, there was someone a little while back also with the plans to work on 
window management. Have not heard of any progress with this project so far, 
but maybe you guys can work together or at least share some experience.

Best regards,
-Stephan

Other related posts: