[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp Display.cs, 1.6, 1.7 Timer.cs,
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp Display.cs, 1.6, 1.7 Timer.cs, 1.3, 1.4 |
Date: |
Mon, 21 Jul 2003 21:22:54 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv20600/Xsharp
Modified Files:
Display.cs Timer.cs
Log Message:
Release the display lock when events are dispatched.
Index: Display.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Display.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Display.cs 21 Jun 2003 11:16:18 -0000 1.6
--- Display.cs 22 Jul 2003 01:22:51 -0000 1.7
***************
*** 46,50 ****
private bool pendingExposes;
private InputOutputWidget exposeList;
- private bool inMainLoop;
private Xlib.Cursor[] cursors;
internal Xlib.Time knownEventTime;
--- 46,49 ----
***************
*** 485,491 ****
int timeout;
- // We are now in the main loop
processing events.
- inMainLoop = true;
-
// Flush any requests that are in the
outgoing queue.
Xlib.XFlush(dpy);
--- 484,487 ----
***************
*** 513,517 ****
// Read the next event
and dispatch it.
Xlib.XNextEvent(dpy,
out xevent);
! DispatchEvent(ref
xevent);
}
else
--- 509,521 ----
// Read the next event
and dispatch it.
Xlib.XNextEvent(dpy,
out xevent);
! Unlock();
! try
! {
!
DispatchEvent(ref xevent);
! }
! finally
! {
! dpy = Lock();
! }
}
else
***************
*** 523,527 ****
widget =
exposeList;
exposeList =
exposeList.nextExpose;
! widget.Expose();
}
pendingExposes = false;
--- 527,539 ----
widget =
exposeList;
exposeList =
exposeList.nextExpose;
! Unlock();
! try
! {
!
widget.Expose();
! }
! finally
! {
! dpy =
Lock();
! }
}
pendingExposes = false;
***************
*** 543,547 ****
{
Xlib.XNextEvent(dpy,
out xevent);
! DispatchEvent(ref
xevent);
return AppEvent.Regular;
}
--- 555,567 ----
{
Xlib.XNextEvent(dpy,
out xevent);
! Unlock();
! try
! {
!
DispatchEvent(ref xevent);
! }
! finally
! {
! dpy = Lock();
! }
return AppEvent.Regular;
}
***************
*** 551,555 ****
(dpy, out
xevent, timeout) > 0)
{
!
DispatchEvent(ref xevent);
return
AppEvent.Regular;
}
--- 571,583 ----
(dpy, out
xevent, timeout) > 0)
{
! Unlock();
! try
! {
!
DispatchEvent(ref xevent);
! }
! finally
! {
! dpy =
Lock();
! }
return
AppEvent.Regular;
}
***************
*** 559,563 ****
finally
{
- inMainLoop = false;
Unlock();
}
--- 587,590 ----
Index: Timer.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Timer.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Timer.cs 23 Jun 2003 05:14:42 -0000 1.3
--- Timer.cs 22 Jul 2003 01:22:51 -0000 1.4
***************
*** 207,211 ****
this.state = state;
this.nextDue =
! DateTime.Now + new TimeSpan
(dueTime *
TimeSpan.TicksPerMillisecond);
this.period = period;
--- 207,211 ----
this.state = state;
this.nextDue =
! DateTime.UtcNow + new TimeSpan
(dueTime *
TimeSpan.TicksPerMillisecond);
this.period = period;
***************
*** 273,277 ****
this.state = state;
this.nextDue =
! DateTime.Now + new TimeSpan
(dueTime *
TimeSpan.TicksPerMillisecond);
this.period = period;
--- 273,277 ----
this.state = state;
this.nextDue =
! DateTime.UtcNow + new TimeSpan
(dueTime *
TimeSpan.TicksPerMillisecond);
this.period = period;
***************
*** 325,329 ****
RemoveTimer();
this.nextDue =
! DateTime.Now + new TimeSpan
(dueTime *
TimeSpan.TicksPerMillisecond);
this.period = period;
--- 325,329 ----
RemoveTimer();
this.nextDue =
! DateTime.UtcNow + new TimeSpan
(dueTime *
TimeSpan.TicksPerMillisecond);
this.period = period;
***************
*** 411,426 ****
// Activate timers that have fired on a particular display.
internal static bool ActivateTimers(Display dpy)
{
// Bail out early if there are no timers, to
avoid
! // calling "DateTime.Now" if we don't need to.
! lock(dpy)
{
! if(dpy.timerQueue == null)
! {
! return false;
! }
}
! DateTime now = DateTime.Now;
Timer timer;
DateTime next;
--- 411,425 ----
// Activate timers that have fired on a particular display.
+ // We assume that this is called with the display lock.
internal static bool ActivateTimers(Display dpy)
{
// Bail out early if there are no timers, to
avoid
! // calling "DateTime.UtcNow" if we don't need
to.
! if(dpy.timerQueue == null)
{
! return false;
}
!
! DateTime now = DateTime.UtcNow;
Timer timer;
DateTime next;
***************
*** 430,448 ****
// Remove the first timer from the
queue if
// it has expired. Bail out if it
hasn't.
! lock(dpy)
{
! timer = dpy.timerQueue;
! if(timer == null)
! {
! break;
! }
! else if(timer.nextDue <= now)
! {
! timer.RemoveTimer();
! }
! else
! {
! break;
! }
}
--- 429,444 ----
// Remove the first timer from the
queue if
// it has expired. Bail out if it
hasn't.
! timer = dpy.timerQueue;
! if(timer == null)
{
! break;
! }
! else if(timer.nextDue <= now)
! {
! timer.RemoveTimer();
! }
! else
! {
! break;
}
***************
*** 452,461 ****
{
TimerCallback cb1 =
timer.callback as TimerCallback;
! cb1(timer.state);
}
else
{
EventHandler cb2 =
timer.callback as EventHandler;
! cb2(timer.state,
EventArgs.Empty);
}
--- 448,473 ----
{
TimerCallback cb1 =
timer.callback as TimerCallback;
! dpy.Unlock();
! try
! {
! cb1(timer.state);
! }
! finally
! {
! dpy.Lock();
! }
}
else
{
EventHandler cb2 =
timer.callback as EventHandler;
! dpy.Unlock();
! try
! {
! cb2(timer.state,
EventArgs.Empty);
! }
! finally
! {
! dpy.Lock();
! }
}
***************
*** 495,499 ****
{
DateTime fireAt =
dpy.timerQueue.nextDue;
! long diff = fireAt.Ticks -
DateTime.Now.Ticks;
if(diff <= 0)
{
--- 507,511 ----
{
DateTime fireAt =
dpy.timerQueue.nextDue;
! long diff = fireAt.Ticks -
DateTime.UtcNow.Ticks;
if(diff <= 0)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/Xsharp Display.cs, 1.6, 1.7 Timer.cs, 1.3, 1.4,
Rhys Weatherley <address@hidden> <=