Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

WMWindowCopyRect.cxx 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. *
  3. * This is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This software is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this software; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  16. * USA.
  17. */
  18. // -=- WMCopyRect.cxx
  19. #ifdef HAVE_CONFIG_H
  20. #include <config.h>
  21. #endif
  22. #include <rfb_win32/WMWindowCopyRect.h>
  23. #include <rfb/LogWriter.h>
  24. #include <windows.h>
  25. using namespace rfb;
  26. using namespace rfb::win32;
  27. static LogWriter vlog("WMCopyRect");
  28. // -=- WMHooks class
  29. rfb::win32::WMCopyRect::WMCopyRect() : ut(0), fg_window(0) {
  30. }
  31. bool
  32. rfb::win32::WMCopyRect::processEvent() {
  33. // See if the foreground window has moved
  34. HWND window = GetForegroundWindow();
  35. if (window) {
  36. RECT wrect;
  37. if (IsWindow(window) && IsWindowVisible(window) && GetWindowRect(window, &wrect)) {
  38. Rect winrect(wrect.left, wrect.top, wrect.right, wrect.bottom);
  39. if (fg_window == window) {
  40. if (!fg_window_rect.tl.equals(winrect.tl) && ut) {
  41. // Window has moved - mark both the previous and new position as changed
  42. // (we can't use add_copied() here because we aren't that properly synced
  43. // with the actual state of the framebuffer)
  44. ut->add_changed(Region(winrect));
  45. ut->add_changed(Region(fg_window_rect));
  46. }
  47. }
  48. fg_window = window;
  49. fg_window_rect = winrect;
  50. } else {
  51. fg_window = 0;
  52. }
  53. } else {
  54. fg_window = 0;
  55. }
  56. return false;
  57. }
  58. bool
  59. rfb::win32::WMCopyRect::setUpdateTracker(UpdateTracker* ut_) {
  60. ut = ut_;
  61. return true;
  62. }