Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-11 18:18:21 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-11 18:18:21 +0300
commit4a4b0732e5d1bc71dde53934a4e74dc782beee1c (patch)
tree89731bd1e7c0a2305d947c8db1d68055c82f1f4e /intern
parent3bb5fc9c7d10f7dec32f8d2a772fce69be468b15 (diff)
Various changes made in the process of working on the UI code:
* Added functions to generate Timer events. There was some unfinished code to create one timer per window, this replaces that with a way to let operators or other handlers add/remove their own timers as needed. This is currently delivered as an event with the timer handle, perhaps this should be a notifier instead? Also includes some fixes in ghost for timer events that were not delivered in time, due to passing negative timeout. * Added a Message event, which is a generic event that can be added by any operator. This is used in the UI code to communicate the results of opened blocks. Again, this may be better as a notifier. * These two events should not be blocked as they are intended for a specific operator or handler, so there were exceptions added for this, which is one of the reasons they might work better as notifiers, but currently these things can't listen to notifier yet. * Added an option to events to indicate if the customdata should be freed or not. * Added a free() callback for area regions, and added a free function for area regions in blenkernel since it was already there for screens and areas. * Added ED_screen/area/region_exit functions to clean up things like operators and handlers when they are closed. * Added screen level regions, these will draw over areas boundaries, with the last created region on top. These are useful for tooltips, menus, etc, and are not saved to file. It's using the same ARegion struct as areas to avoid code duplication, but perhaps that should be renamed then. Note that redraws currently go correct, because only full window redraws are used, for partial redraws without any frontbuffer drawing, the window manager needs to get support for compositing subwindows. * Minor changes in the subwindow code to retrieve the matrix, and moved setlinestyle to glutil.c. * Reversed argument order in WM_event_add/remove_keymap_handler to be consistent with modal_handler. * Operators can now block events but not necessarily cancel/finish. * Modal operators are now stored in a list in the window/area/region they were created in. This means for example that when a transform operator is invoked from a region but registers a handler at the window level (since mouse motion across areas should work), it will still get removed when the region is closed while the operator is running.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/GHOST_Types.h2
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp6
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp5
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp5
4 files changed, 11 insertions, 7 deletions
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 349fb5a02fc..a413b765ccb 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -143,6 +143,8 @@ typedef enum {
GHOST_kEventWindowSize,
GHOST_kEventWindowMove,
+ GHOST_kEventTimer,
+
GHOST_kNumEventTypes
} GHOST_TEventType;
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index 5523fab50f1..e1980521eb0 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -423,17 +423,15 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
GHOST_TimerManager* timerMgr = getTimerManager();
if (waitForEvent) {
- GHOST_TUns64 curtime = getMilliSeconds();
GHOST_TUns64 next = timerMgr->nextFireTime();
double timeOut;
if (next == GHOST_kFireTimeNever) {
timeOut = kEventDurationForever;
} else {
- if (next<=curtime)
+ timeOut = (double)(next - getMilliSeconds())/1000.0;
+ if (timeOut < 0.0)
timeOut = 0.0;
- else
- timeOut = (double) (next - getMilliSeconds())/1000.0;
}
::ReceiveNextEvent(0, NULL, timeOut, false, &event);
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 6f9bad0f876..61b504400d2 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -190,11 +190,12 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
::Sleep(1);
#else
GHOST_TUns64 next = timerMgr->nextFireTime();
+ GHOST_TInt64 maxSleep = next - getMilliSeconds();
if (next == GHOST_kFireTimeNever) {
::WaitMessage();
- } else {
- ::SetTimer(NULL, 0, next - getMilliSeconds(), NULL);
+ } else if(maxSleep >= 0.0) {
+ ::SetTimer(NULL, 0, maxSleep, NULL);
::WaitMessage();
::KillTimer(NULL, 0);
}
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index bbce940f1b3..170a7c23843 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -309,7 +309,10 @@ processEvents(
if (next==GHOST_kFireTimeNever) {
SleepTillEvent(m_display, -1);
} else {
- SleepTillEvent(m_display, next - getMilliSeconds());
+ GHOST_TInt64 maxSleep = next - getMilliSeconds();
+
+ if(maxSleep >= 0)
+ SleepTillEvent(m_display, next - getMilliSeconds());
}
}