more tweaks to avoid editor flicker under Mac OS X
svn: r7737
This commit is contained in:
parent
1adc9702e8
commit
169ee4cbd1
|
@ -534,15 +534,23 @@ void WakeUpMrEd()
|
||||||
|
|
||||||
static unsigned long lastTime;
|
static unsigned long lastTime;
|
||||||
|
|
||||||
|
static int wne_delay_on;
|
||||||
|
static unsigned long wne_delay_until;
|
||||||
|
|
||||||
static int TransferQueue(int all)
|
static int TransferQueue(int all)
|
||||||
{
|
{
|
||||||
EventRecord e;
|
EventRecord e;
|
||||||
|
unsigned long tc;
|
||||||
int sleep_time = 0;
|
int sleep_time = 0;
|
||||||
int delay_time = 0;
|
int delay_time = 0;
|
||||||
|
|
||||||
/* Don't call WaitNextEvent() too often. */
|
/* Don't call WaitNextEvent() too often. */
|
||||||
if (TickCount() <= lastTime + delay_time)
|
tc = TickCount();
|
||||||
|
if (tc <= lastTime + delay_time)
|
||||||
return 0;
|
return 0;
|
||||||
|
if (wne_delay_on && (tc < wne_delay_until))
|
||||||
|
return 0;
|
||||||
|
wne_delay_on = 0;
|
||||||
|
|
||||||
while (WNE(&e, dispatched ? ((double)sleep_time/60.0) : 0)) {
|
while (WNE(&e, dispatched ? ((double)sleep_time/60.0) : 0)) {
|
||||||
QueueTransferredEvent(&e);
|
QueueTransferredEvent(&e);
|
||||||
|
@ -553,6 +561,26 @@ static int TransferQueue(int all)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxStartRefreshSequence(void)
|
||||||
|
{
|
||||||
|
/* Editors are not buffered offscreen under Mac OS X, instead
|
||||||
|
relying on the OS's buffering of all windows, which are updated
|
||||||
|
on WNE boundaries. To avoid flicker, avoid calling WNE in the
|
||||||
|
middle of an editor refresh. The refresh might get stuck,
|
||||||
|
though, so we only wait a little while. */
|
||||||
|
|
||||||
|
if (!wne_delay_on) {
|
||||||
|
wne_delay_until = TickCount() + 10;
|
||||||
|
}
|
||||||
|
wne_delay_on++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxEndRefreshSequence(void)
|
||||||
|
{
|
||||||
|
if (wne_delay_on)
|
||||||
|
--wne_delay_on;
|
||||||
|
}
|
||||||
|
|
||||||
static void MrDequeue(MrQueueElem *q)
|
static void MrDequeue(MrQueueElem *q)
|
||||||
{
|
{
|
||||||
if (q->prev)
|
if (q->prev)
|
||||||
|
|
|
@ -27,6 +27,14 @@
|
||||||
|
|
||||||
static wxMemoryDC *wx_canvasless_offscreen;
|
static wxMemoryDC *wx_canvasless_offscreen;
|
||||||
|
|
||||||
|
#ifdef wx_mac
|
||||||
|
extern void wxStartRefreshSequence(void);
|
||||||
|
extern void wxEndRefreshSequence(void);
|
||||||
|
#else
|
||||||
|
# define wxStartRefreshSequence() /* empty */
|
||||||
|
# define wxEndRefreshSequence() /* empty */
|
||||||
|
#endif
|
||||||
|
|
||||||
extern void *MrEdGetWindowContext(wxWindow *w);
|
extern void *MrEdGetWindowContext(wxWindow *w);
|
||||||
|
|
||||||
class SimpleScroll
|
class SimpleScroll
|
||||||
|
@ -812,6 +820,8 @@ void wxMediaCanvas::Redraw(double localx, double localy, double fw, double fh)
|
||||||
if (!media || media->printing)
|
if (!media || media->printing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
wxStartRefreshSequence();
|
||||||
|
|
||||||
GetView(&x, &y, &w, &h);
|
GetView(&x, &y, &w, &h);
|
||||||
|
|
||||||
right = x + w;
|
right = x + w;
|
||||||
|
@ -851,6 +861,8 @@ void wxMediaCanvas::Redraw(double localx, double localy, double fw, double fh)
|
||||||
media->SetAdmin(oldadmin);
|
media->SetAdmin(oldadmin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxEndRefreshSequence();
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool wxMediaCanvas::ScrollTo(double localx, double localy, double fw, double fh,
|
Bool wxMediaCanvas::ScrollTo(double localx, double localy, double fw, double fh,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user