aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteDirCache.java
Commit message (Expand)AuthorAgeFilesLines
* Fix all Javadoc warnings and fail on themAntoine Musso2023-06-161-1/+0
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-041-38/+5
* Fix javadoc in org.eclipse.jgit.pgmMatthias Sohn2017-12-181-0/+1
* Add missing usage texts for JGit commandline commandsMatthias Sohn2013-09-091-0/+2
* Move org.eclipse.jgit.pgm's resource bundle to internal packageMatthias Sohn2013-05-061-1/+1
* Move DirCache factory methods to RepositoryShawn O. Pearce2010-06-301-1/+1
* Externalize strings from JGitSasa Zivkov2010-05-191-2/+3
* Initial JGit contribution to eclipse.orgGit Development Community2009-09-291-0/+61
/* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
 * 
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this software; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
 * USA.
 */

// -=- SDisplayCorePolling.cxx

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <core/LogWriter.h>

#include <rfb_win32/SDisplayCorePolling.h>

using namespace core;
using namespace rfb;
using namespace rfb::win32;

static LogWriter vlog("SDisplayCorePolling");

const int POLLING_SEGMENTS = 16;

const unsigned int SDisplayCorePolling::pollTimerId = 1;

SDisplayCorePolling::SDisplayCorePolling(SDisplay* d, UpdateTracker* ut, int pollInterval_)
  : MsgWindow("rfb::win32::SDisplayCorePolling"),
  pollTimer(getHandle(), pollTimerId), pollNextStrip(false), display(d), updateTracker(ut) {
  pollInterval = pollInterval_ / POLLING_SEGMENTS;
  if (pollInterval < 10)
    pollInterval = 10;
  copyrect.setUpdateTracker(ut);
}

SDisplayCorePolling::~SDisplayCorePolling() {
}

LRESULT SDisplayCorePolling::processMessage(UINT msg, WPARAM wParam, LPARAM lParam) {
  if (msg == WM_TIMER && wParam == pollTimerId) {
    pollNextStrip = true;
    SetEvent(display->getUpdateEvent());
    return 0;
  }
  return MsgWindow::processMessage(msg, wParam, lParam);
}

void SDisplayCorePolling::setScreenRect(const Rect& screenRect_) {
  vlog.info("setScreenRect");
  screenRect = screenRect_;
  pollIncrementY = (screenRect.height()+POLLING_SEGMENTS-1)/POLLING_SEGMENTS;
  pollNextY = screenRect.tl.y;
  pollTimer.start(pollInterval);
}

void SDisplayCorePolling::flushUpdates() {
  vlog.write(120, "flushUpdates");

  // Check for window movement
  while (copyrect.processEvent()) {}

  if (pollNextStrip) {
    // Poll the next strip of the screen (in Screen coordinates)
    pollNextStrip = false;
    Rect pollrect = screenRect;
    if (pollNextY >= pollrect.br.y) {
      // Yes.  Reset the counter and return
      pollNextY = pollrect.tl.y;
    } else {
      // No.  Poll the next section
      pollrect.tl.y = pollNextY;
      pollNextY += pollIncrementY;
      if (pollrect.br.y > pollNextY)
        pollrect.br.y = pollNextY;
      updateTracker->add_changed(pollrect);
    }
  }
}