File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1399,6 +1399,21 @@ static void dump_mapped(Ghandles * g)
13991399}
14001400#endif
14011401
1402+ static void process_xievent_focus (Ghandles * g , const XILeaveEvent * ev );
1403+
1404+ static void focus_if_not_focused (Ghandles * g , const XButtonEvent * ev ) {
1405+ Window focused ;
1406+ int revertTo ;
1407+ XGetInputFocus (g -> display , & focused , & revertTo );
1408+ if (focused != ev -> window ) {
1409+ XILeaveEvent mock ;
1410+ mock .type = XI_FocusIn ;
1411+ mock .mode = NotifyNormal ;
1412+ mock .detail = NotifyNonlinear ;
1413+ process_xievent_focus (g , & mock );
1414+ }
1415+ }
1416+
14021417/* handle local Xserver event: XButtonEvent
14031418 * same as XKeyEvent - send to relevant window in VM */
14041419static void process_xevent_button (Ghandles * g , const XButtonEvent * ev )
@@ -1408,8 +1423,11 @@ static void process_xevent_button(Ghandles * g, const XButtonEvent * ev)
14081423 CHECK_NONMANAGED_WINDOW (g , ev -> window );
14091424 update_wm_user_time (g , ev -> window , ev -> time );
14101425
1411- k .type = ev -> type ;
1426+ if (ev -> type == ButtonPress ) {
1427+ focus_if_not_focused (g , ev );
1428+ }
14121429
1430+ k .type = ev -> type ;
14131431 k .x = ev -> x ;
14141432 k .y = ev -> y ;
14151433 k .state = ev -> state ;
You can’t perform that action at this time.
0 commit comments