From 29ffa24c0f42a6c142e8c1fbb0ae27eefde34592 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Thu, 17 Dec 2009 02:45:11 +0000 Subject: [PATCH] 2009-12-17 03:45 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/gtxwc/gtxwc.c ! fixed timeout checking in function taking text from clipboard. Due to typo it was waiting for XServer answer for 3 milliseconds instead of 3 seconds so sometimes it was too small even in local usage (i.e. when clipboard was accessed 1-st time by application and some internal XLib structures had to be initialized) and probably using remote XServers it was able to retrieve only the 1-st type of selection (if any). --- harbour/ChangeLog | 10 ++++++++++ harbour/src/rtl/gtxwc/gtxwc.c | 9 +++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9f0e702300..91a892a9b0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,16 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-17 03:45 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/gtxwc/gtxwc.c + ! fixed timeout checking in function taking text from clipboard. + Due to typo it was waiting for XServer answer for 3 milliseconds + instead of 3 seconds so sometimes it was too small even in local + usage (i.e. when clipboard was accessed 1-st time by application + and some internal XLib structures had to be initialized) and + probably using remote XServers it was able to retrieve only the + 1-st type of selection (if any). + 2009-12-16 21:38 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/hbwin.ch * contrib/hbwin/tests/testmapi.prg diff --git a/harbour/src/rtl/gtxwc/gtxwc.c b/harbour/src/rtl/gtxwc/gtxwc.c index deeb4128a2..b6f1bf4ae5 100644 --- a/harbour/src/rtl/gtxwc/gtxwc.c +++ b/harbour/src/rtl/gtxwc/gtxwc.c @@ -3406,14 +3406,15 @@ static void hb_gt_xwc_RequestSelection( PXWND_DEF wnd ) hb_gt_xwc_ProcessMessages( wnd ); if( !wnd->ClipboardRcvd && wnd->ClipboardRequest == aRequest ) { + ULONG ulTime = hb_gt_xwc_CurrentTime() - ulCurrentTime; struct timeval timeout; fd_set readfds; - if( hb_gt_xwc_CurrentTime() - ulCurrentTime > 3 ) + if( ulTime > 3000 ) break; - - timeout.tv_sec = 3; - timeout.tv_usec = 0; + ulTime = 3000 - ulTime; + timeout.tv_sec = ulTime / 1000; + timeout.tv_usec = ( ulTime % 1000 ) / 1000; FD_ZERO( &readfds ); FD_SET( iConnFD, &readfds );