Exemple #1
0
 static void centerCursor(long hwnd) {
   if (getForegroundWindow() != hwnd && !hasParent) return;
   getGlobalClientRect(hwnd, rect);
   int local_offset_x = rect.left;
   int local_offset_y = rect.top;
   /* -- This is wrong on multi-monitor setups
   getGlobalClientRect(getDesktopWindow(), rect2);
   Rect.intersect(rect, rect2, rect);
   */
   int center_x = (rect.left + rect.right) / 2;
   int center_y = (rect.top + rect.bottom) / 2;
   nSetCursorPosition(center_x, center_y);
   int local_x = center_x - local_offset_x;
   int local_y = center_y - local_offset_y;
   if (current_display != null)
     current_display.setMousePosition(local_x, transformY(hwnd, local_y));
 }
Exemple #2
0
 private static long handleMessage(long hwnd, int msg, long wParam, long lParam, long millis) {
   if (current_display != null)
     return current_display.doHandleMessage(hwnd, msg, wParam, lParam, millis);
   else return defWindowProc(hwnd, msg, wParam, lParam);
 }