فهرست منبع

attempts at auto-focus

David Rose 19 سال پیش
والد
کامیت
c1f598e117
1فایلهای تغییر یافته به همراه12 افزوده شده و 0 حذف شده
  1. 12 0
      panda/src/glxdisplay/glxGraphicsWindow.cxx

+ 12 - 0
panda/src/glxdisplay/glxGraphicsWindow.cxx

@@ -361,6 +361,9 @@ process_events() {
     case MapNotify:
       properties.set_minimized(false);
       system_changed_properties(properties);
+
+      // Auto-focus the window when it is mapped.
+      XSetInputFocus(_display, _xwindow, RevertToPointerRoot, CurrentTime);
       break;
 
     case ClientMessage:
@@ -514,6 +517,15 @@ set_properties_now(WindowProperties &properties) {
     properties.clear_cursor_hidden();
   }
 
+  if (properties.has_foreground()) {
+    if (properties.get_foreground()) {
+      XSetInputFocus(_display, _xwindow, RevertToPointerRoot, CurrentTime);
+    } else {
+      XSetInputFocus(_display, PointerRoot, RevertToPointerRoot, CurrentTime);
+    }
+    properties.clear_foreground();
+  }
+
   set_wm_properties(wm_properties, true);
 }