case LeaveNotify:
if( event->xcrossing.mode != NotifyNormal ) break;
- if( cursor_entered && event->xcrossing.window == win ) {
- cursor_entered = 0;
- }
+ cursor_entered = 0;
event_win = event->xany.window;
dispatch_cursor_leave();
break;
case EnterNotify:
if( event->xcrossing.mode != NotifyNormal ) break;
- if( !cursor_entered && event->xcrossing.window == win ) {
- if( !event->xcrossing.focus && get_resources()->grab_input_focus ) {
- XSetInputFocus(display, win, RevertToParent, CurrentTime);
+
+ if( !cursor_entered ) {
+ for( int i=0; i<popups.size(); ++i ) { // popups always take focus
+ if( popups[i]->win == event->xcrossing.window )
+ cursor_entered = 1;
+ }
+ if( !cursor_entered && get_resources()->grab_input_focus &&
+ !event->xcrossing.focus && event->xcrossing.window == win ) {
+ cursor_entered = 1;
}
- cursor_entered = 1;
+ if( cursor_entered )
+ focus();
}
event_win = event->xany.window;
cursor_x = event->xcrossing.x;
return 0;
}
+void BC_WindowBase::get_fullscreen_geometry(int &wx, int &wy, int &ww, int &wh)
+{
+ XineramaScreenInfo *info = top_level->get_xinerama_info(-1);
+ if( info ) {
+ wx = info->x_org; wy = info->y_org;
+ ww = info->width; wh = info->height;
+ }
+ else {
+ wx = get_screen_x(0, -1);
+ wy = get_screen_y(0, -1);
+ int scr_w0 = get_screen_w(0, 0);
+ int root_w = get_root_w(0);
+ int root_h = get_root_h(0);
+ if( root_w > scr_w0 ) { // multi-headed
+ if( wx >= scr_w0 ) {
+ // assumes right side is the big one
+ ww = root_w - scr_w0;
+ wh = root_h;
+ }
+ else {
+ // use same aspect ratio to compute left height
+ ww = scr_w0;
+ wh = (w*root_h) / (root_w-scr_w0);
+ }
+ }
+ else {
+ ww = root_w;
+ wh = root_h;
+ }
+ }
+}
+
int BC_WindowBase::get_screen_x(int lock_display, int screen)
{
int result = -1;
set_opaque();
}
+void BC_WindowBase::focus()
+{
+ XWindowAttributes xwa;
+ XGetWindowAttributes(top_level->display, top_level->win, &xwa);
+ if( xwa.map_state == IsViewable )
+ XSetInputFocus(top_level->display, top_level->win, RevertToParent, CurrentTime);
+}
+