[haiku-commits] BRANCH looncraz-github.ScreenStream [ae3ce3190da1] in src: kits/interface servers/app

  • From: looncraz-github.ScreenStream <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 28 Mar 2015 00:31:36 +0100 (CET)

added 1 changeset to branch 'refs/remotes/looncraz-github/ScreenStream'
old head: 777a9e16562e5509edbf78b9ffaed42ed5fbcec0
new head: ae3ce3190da12590acfaee7ef0d8b7dfcdb0e320
overview: https://github.com/looncraz/haiku/compare/777a9e16562e...ae3ce3190da1

----------------------------------------------------------------------------

ae3ce3190da1: Correct ScreenStream, Clear Region on Update

                                        [ looncraz <looncraz@xxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Commit:      ae3ce3190da12590acfaee7ef0d8b7dfcdb0e320
Author:      looncraz <looncraz@xxxxxxxxxxxx>
Date:        Fri Mar 27 23:15:31 2015 UTC

----------------------------------------------------------------------------

2 files changed, 13 insertions(+), 11 deletions(-)
src/kits/interface/ScreenStream.cpp | 23 ++++++++++++-----------
src/servers/app/Desktop.cpp         |  1 +

----------------------------------------------------------------------------

diff --git a/src/kits/interface/ScreenStream.cpp 
b/src/kits/interface/ScreenStream.cpp
index 7786927..00075de 100644
--- a/src/kits/interface/ScreenStream.cpp
+++ b/src/kits/interface/ScreenStream.cpp
@@ -91,21 +91,19 @@ BScreenStream::Update()
                return InitCheck();
 
        // Limit to a maximum interval
-       bigtime_t updateStart = system_time();
-       while (updateStart - fLastUpdate < fMaxUpdateInterval) {
-               if (fScreen.WaitForRetrace() != B_OK) {
-
-                       // TODO: REMOVE!
-                       STRACE(("WaitForRetrace() failure\n"));
-                       snooze(17000);
-               }
+       while (system_time() - fLastUpdate < fMaxUpdateInterval) {
+               if (fScreen.WaitForRetrace() != B_OK)
+                       snooze(fMaxUpdateInterval/10);
        }
 
+       fLastUpdate = system_time();
+
        bool success = false;
        int32 reply = B_ERROR;
        status_t error = B_ERROR;
        if (fPortLink->StartMessage(AS_UPDATE_SCREEN_STREAM) == B_OK) {
                if (fPortLink->Attach(fPortLink->ReceiverPort()) == B_OK
+                       && fPortLink->Attach(fScreen.ID()) == B_OK
                        && fPortLink->Attach(fStreamID) == B_OK
                        && fPortLink->FlushWithReply(reply) == B_OK) {
                        if (reply == B_OK) {
@@ -135,9 +133,6 @@ BScreenStream::Update()
                STRACE(("MESSAGE CANCELED!\n"));
        }
 
-       // update time regardless of failure, we don't want the client
-       // thrashing the server with bad requests
-       fLastUpdate = system_time();
        return error;
 }
 
@@ -245,6 +240,12 @@ BScreenStream::_UpdateBitmap()
 {
        status_t error = B_OK;
 
+       // First update is always a full-update
+       if (fBitmap == NULL) {
+               error = fScreen.GetBitmap(&fBitmap, fShowCursor);
+               return error;
+       }
+
        for (int i = 0; i < fRegion.CountRects(); ++i) {
                BRect frame = fRegion.RectAt(i);
                if (frame.IsValid()) {
diff --git a/src/servers/app/Desktop.cpp b/src/servers/app/Desktop.cpp
index 44f9280..224973e 100644
--- a/src/servers/app/Desktop.cpp
+++ b/src/servers/app/Desktop.cpp
@@ -2696,6 +2696,7 @@ Desktop::_DispatchMessage(int32 code, 
BPrivate::LinkReceiver& link)
                        replyLink.StartMessage(B_OK);
                        replyLink.AttachRegion(stream->GetRegion());
                        replyLink.Flush();
+                       stream->MakeEmpty();
                        break;
                }
 


Other related posts:

  • » [haiku-commits] BRANCH looncraz-github.ScreenStream [ae3ce3190da1] in src: kits/interface servers/app - looncraz-github . ScreenStream