Skip to content

Commit

Permalink
Fixed screen not being sent on first connect
Browse files Browse the repository at this point in the history
Broke mouse visability on web browser. Will fix
  • Loading branch information
smasherprog committed May 5, 2016
1 parent f09f544 commit 3fd84b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
17 changes: 4 additions & 13 deletions Core/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace SL {
{
std::lock_guard<std::mutex> lock(_NewClientLock);
_NewClients.push_back(socket);

}
if (_IUserNetworkDriver != nullptr) _IUserNetworkDriver->OnConnect(socket);
}
Expand Down Expand Up @@ -77,21 +78,11 @@ namespace SL {
}
void OnMouseImg(std::shared_ptr<Utilities::Image> img)
{
if (!LastMouse) {//first screen send all!
if (!LastMouse) {
_ServerNetworkDriver.SendMouse(nullptr, *img);
std::lock_guard<std::mutex> lock(_NewClientLock);
_NewClients.clear();
}
else {//compare and send all difs along
{
//make sure to send the full screens to any new connects
std::lock_guard<std::mutex> lock(_NewClientLock);
for (auto& a : _NewClients) {
_ServerNetworkDriver.SendMouse(a.get(), *img);
}
_NewClients.clear();
}
if (memcmp(img->data(), LastScreen->data(), std::min(LastScreen->size(), img->size())) != 0) {
else {
if (memcmp(img->data(), LastMouse->data(), std::min(LastMouse->size(), img->size())) != 0) {
_ServerNetworkDriver.SendMouse(nullptr, *img);
}
}
Expand Down
2 changes: 1 addition & 1 deletion wwwroot/Core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ module SL {
this._HTMLCanvasMouseImage.height = point.Y;
try {
this._Cursor = this._HTMLCanvasMouseImage.getContext("2d").createImageData(point.X, point.Y);

for (var i = 0; i < this._Cursor.data.length; i += 4) {
this._Cursor.data[i + 0] = img[i + 0];
this._Cursor.data[i + 1] = img[i + 1];
Expand Down

0 comments on commit 3fd84b5

Please sign in to comment.