aboutsummaryrefslogtreecommitdiffstats
path: root/include/pugl/detail
diff options
context:
space:
mode:
Diffstat (limited to 'include/pugl/detail')
-rw-r--r--include/pugl/detail/implementation.c3
-rw-r--r--include/pugl/detail/mac.m15
-rw-r--r--include/pugl/detail/win.c16
-rw-r--r--include/pugl/detail/win.h1
4 files changed, 7 insertions, 28 deletions
diff --git a/include/pugl/detail/implementation.c b/include/pugl/detail/implementation.c
index e9a3450..f15b856 100644
--- a/include/pugl/detail/implementation.c
+++ b/include/pugl/detail/implementation.c
@@ -398,7 +398,8 @@ void
puglDispatchSimpleEvent(PuglView* view, const PuglEventType type)
{
assert(type == PUGL_CREATE || type == PUGL_DESTROY || type == PUGL_MAP ||
- type == PUGL_UNMAP || type == PUGL_UPDATE || type == PUGL_CLOSE);
+ type == PUGL_UNMAP || type == PUGL_UPDATE || type == PUGL_CLOSE ||
+ type == PUGL_LOOP_ENTER || type == PUGL_LOOP_LEAVE);
const PuglEvent event = {{type, 0}};
puglDispatchEvent(view, &event);
diff --git a/include/pugl/detail/mac.m b/include/pugl/detail/mac.m
index efcaca0..a807761 100644
--- a/include/pugl/detail/mac.m
+++ b/include/pugl/detail/mac.m
@@ -190,7 +190,6 @@ updateViewRect(PuglView* view)
PuglView* puglview;
NSTrackingArea* trackingArea;
NSMutableAttributedString* markedText;
- NSTimer* timer;
NSMutableDictionary* userTimers;
bool reshaped;
}
@@ -717,15 +716,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
- (void)viewWillStartLiveResize
{
- timer = [NSTimer timerWithTimeInterval:(1 / 60.0)
- target:self
- selector:@selector(resizeTick)
- userInfo:nil
- repeats:YES];
- [[NSRunLoop currentRunLoop] addTimer:timer
- forMode:NSRunLoopCommonModes];
-
- [super viewWillStartLiveResize];
+ puglDispatchSimpleEvent(puglview, PUGL_LOOP_ENTER);
}
- (void)viewWillDraw
@@ -749,9 +740,7 @@ handleCrossing(PuglWrapperView* view, NSEvent* event, const PuglEventType type)
- (void)viewDidEndLiveResize
{
- [super viewDidEndLiveResize];
- [timer invalidate];
- timer = NULL;
+ puglDispatchSimpleEvent(puglview, PUGL_LOOP_LEAVE);
}
@end
diff --git a/include/pugl/detail/win.c b/include/pugl/detail/win.c
index 84cca27..237ebde 100644
--- a/include/pugl/detail/win.c
+++ b/include/pugl/detail/win.c
@@ -51,7 +51,6 @@
#define PUGL_LOCAL_CLOSE_MSG (WM_USER + 50)
#define PUGL_LOCAL_MARK_MSG (WM_USER + 51)
#define PUGL_LOCAL_CLIENT_MSG (WM_USER + 52)
-#define PUGL_RESIZE_TIMER_ID 9461
#define PUGL_USER_TIMER_MIN 9470
typedef BOOL (WINAPI *PFN_SetProcessDPIAware)(void);
@@ -590,17 +589,10 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_ENTERSIZEMOVE:
case WM_ENTERMENULOOP:
- view->impl->resizing = true;
- SetTimer(view->impl->hwnd,
- PUGL_RESIZE_TIMER_ID,
- 1000 / (UINT)view->hints[PUGL_REFRESH_RATE],
- NULL);
+ puglDispatchSimpleEvent(view, PUGL_LOOP_ENTER);
break;
case WM_TIMER:
- if (wParam == PUGL_RESIZE_TIMER_ID) {
- RedrawWindow(view->impl->hwnd, NULL, NULL,
- RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_INTERNALPAINT);
- } else if (wParam >= PUGL_USER_TIMER_MIN) {
+ if (wParam >= PUGL_USER_TIMER_MIN) {
PuglEvent ev = {{PUGL_TIMER, 0}};
ev.timer.id = wParam - PUGL_USER_TIMER_MIN;
puglDispatchEvent(view, &ev);
@@ -608,9 +600,7 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_EXITSIZEMOVE:
case WM_EXITMENULOOP:
- KillTimer(view->impl->hwnd, PUGL_RESIZE_TIMER_ID);
- view->impl->resizing = false;
- puglPostRedisplay(view);
+ puglDispatchSimpleEvent(view, PUGL_LOOP_LEAVE);
break;
case WM_GETMINMAXINFO:
mmi = (MINMAXINFO*)lParam;
diff --git a/include/pugl/detail/win.h b/include/pugl/detail/win.h
index 0ead1fa..4c0a3c0 100644
--- a/include/pugl/detail/win.h
+++ b/include/pugl/detail/win.h
@@ -42,7 +42,6 @@ struct PuglInternalsImpl {
HDC hdc;
PuglSurface* surface;
bool flashing;
- bool resizing;
bool mouseTracked;
};