Bugfix: on Linux (X11) the inactive window was not getting mouse-move events.

This feature has been working in OSX for long - to see mouse-overs on buttons
from inactive windows (and tooltips) and allow a button to be active for
input right away.

Will need check by linuxers if this works satisfying. Also Windows now might
support this feature.
This commit is contained in:
Ton Roosendaal
2012-11-06 13:22:33 +00:00
parent 804f642ebd
commit 48f968edc2

View File

@@ -2731,47 +2731,45 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event = *evt; event = *evt;
switch (type) { switch (type) {
/* mouse move */ /* mouse move, also to inactive window (X11 does this) */
case GHOST_kEventCursorMove: case GHOST_kEventCursorMove:
{ {
if (win->active) { GHOST_TEventCursorData *cd = customdata;
GHOST_TEventCursorData *cd = customdata; wmEvent *lastevent = win->queue.last;
wmEvent *lastevent = win->queue.last; int cx, cy;
int cx, cy;
GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy); GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy);
evt->x = cx; evt->x = cx;
evt->y = (win->sizey - 1) - cy; evt->y = (win->sizey - 1) - cy;
event.x = evt->x; event.x = evt->x;
event.y = evt->y; event.y = evt->y;
event.type = MOUSEMOVE; event.type = MOUSEMOVE;
/* some painting operators want accurate mouse events, they can /* some painting operators want accurate mouse events, they can
* handle in between mouse move moves, others can happily ignore * handle in between mouse move moves, others can happily ignore
* them for better performance */ * them for better performance */
if (lastevent && lastevent->type == MOUSEMOVE) if (lastevent && lastevent->type == MOUSEMOVE)
lastevent->type = INBETWEEN_MOUSEMOVE; lastevent->type = INBETWEEN_MOUSEMOVE;
update_tablet_data(win, &event); update_tablet_data(win, &event);
wm_event_add(win, &event); wm_event_add(win, &event);
/* also add to other window if event is there, this makes overdraws disappear nicely */ /* also add to other window if event is there, this makes overdraws disappear nicely */
/* it remaps mousecoord to other window in event */ /* it remaps mousecoord to other window in event */
owin = wm_event_cursor_other_windows(wm, win, &event); owin = wm_event_cursor_other_windows(wm, win, &event);
if (owin) { if (owin) {
wmEvent oevent = *(owin->eventstate); wmEvent oevent = *(owin->eventstate);
oevent.x = owin->eventstate->x = event.x; oevent.x = owin->eventstate->x = event.x;
oevent.y = owin->eventstate->y = event.y; oevent.y = owin->eventstate->y = event.y;
oevent.type = MOUSEMOVE; oevent.type = MOUSEMOVE;
update_tablet_data(owin, &oevent);
wm_event_add(owin, &oevent);
}
update_tablet_data(owin, &oevent);
wm_event_add(owin, &oevent);
} }
break; break;
} }
case GHOST_kEventTrackpad: case GHOST_kEventTrackpad: