Re: proposal for a smarter behavior for raising windows on mouse click



Am Di, den 27.01.2004 schrieb Lubos Lunak um 20:24:
>  Could you please explain step by step how this would work in the case of 
> drag&drop? Note that there exists something called start drag distance, 
> causing DND to be really initiated only after dragging for few pixels, thus 
> preventing unwanted DND, e.g. in case people are not too skilled with the 
> mouse. I sense few obstacles ahead.

If the user drags the mouse with the button pressed, the wm should
not raise the window.

I played a bit with the metacity window manager and tried:

- Store the mouse coords when receiving a ButtonPress event on a window
  and focus the window.
- Compare the current mouse coords with the stored ones when receiving
  a ButtonRelease event and determine thus if the pointer has been
  dragged. Raise the window only if the pointer motion is within a
  threshold, e.g. 3 pixels.

The problem that I had with this was that metacity did not receive
ButtonRelease events when clicking on a widget which caught the event.
In fact, only clicking on the status bar worked.


some pseudo-code:
-----------------

bool check_for_raise_permission() {
  if (mouse dragged or _NET_WM_DONT_RAISE is set) return FALSE;
  else return TRUE;
}

...

switch (event) {
  case (ButtonPress):
    store mouse coords;
    focus window;
    break;
  case (ButtonRelease):
    /* the wm does not get here in all cases... :( */
    if (check_for_raise_permission()) raise window;

...



Bye, Martin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]