@@ -504,7 +504,7 @@ -(void) viewDidChangeBackingProperties
504
504
event.display .width = NSWidth (content);
505
505
event.display .height = NSHeight (content);
506
506
_al_event_source_emit_event (es, &event);
507
- ALLEGRO_INFO (" Window finished resizing" );
507
+ ALLEGRO_INFO (" Window finished resizing %d x %d \n " , event. display . width , event. display . height );
508
508
}
509
509
_al_event_source_unlock (es);
510
510
}
@@ -532,7 +532,7 @@ -(void) viewDidEndLiveResize
532
532
event.display .width = NSWidth (content);
533
533
event.display .height = NSHeight (content);
534
534
_al_event_source_emit_event (es, &event);
535
- ALLEGRO_INFO (" Window finished resizing" );
535
+ ALLEGRO_INFO (" Window finished resizing %d x %d \n " , event. display . width , event. display . height );
536
536
}
537
537
_al_event_source_unlock (es);
538
538
}
@@ -585,7 +585,6 @@ -(void) windowDidResize:(NSNotification*) notification
585
585
scale_factor = [window backingScaleFactor ];
586
586
}
587
587
#endif
588
-
589
588
NSSize max_size;
590
589
max_size.width = (dpy_ptr->max_w > 0 ) ? dpy_ptr->max_w / scale_factor : FLT_MAX;
591
590
max_size.height = (dpy_ptr->max_h > 0 ) ? dpy_ptr->max_h / scale_factor : FLT_MAX;
@@ -600,7 +599,7 @@ -(void) windowDidResize:(NSNotification*) notification
600
599
event.display .width = NSWidth (content);
601
600
event.display .height = NSHeight (content);
602
601
_al_event_source_emit_event (es, &event);
603
- ALLEGRO_INFO (" Window was resized\n " );
602
+ ALLEGRO_INFO (" Window was resized %d x %d \n " , event. display . width , event. display . height );
604
603
}
605
604
_al_event_source_unlock (es);
606
605
}
@@ -720,10 +719,9 @@ static bool set_current_display(ALLEGRO_DISPLAY* d) {
720
719
/* Helper to set up GL state as we want it. */
721
720
static void setup_gl (ALLEGRO_DISPLAY *d)
722
721
{
723
- _al_ogl_setup_gl (d);
724
-
725
722
ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) d;
726
723
[dpy->ctx performSelectorOnMainThread: @selector (update ) withObject: nil waitUntilDone: YES ];
724
+ _al_ogl_setup_gl (d);
727
725
}
728
726
729
727
@@ -2031,19 +2029,17 @@ static bool acknowledge_resize_display_win_main_thread(ALLEGRO_DISPLAY *d)
2031
2029
d->w = NSWidth (content);
2032
2030
d->h = NSHeight (content);
2033
2031
2034
- if (d->ogl_extras ->backbuffer ) {
2035
- _al_ogl_resize_backbuffer (d->ogl_extras ->backbuffer , d->w , d->h );
2036
- }
2037
- setup_gl (d);
2038
-
2039
2032
return true ;
2040
2033
}
2034
+
2041
2035
/* Call from user thread */
2042
2036
static bool acknowledge_resize_display_win (ALLEGRO_DISPLAY *d) {
2043
2037
ASSERT_USER_THREAD ();
2044
2038
dispatch_sync (dispatch_get_main_queue (), ^{
2045
2039
acknowledge_resize_display_win_main_thread (d);
2046
2040
});
2041
+ // must be done on the thread the user calls it from, not the main thread
2042
+ setup_gl (d);
2047
2043
return true ;
2048
2044
}
2049
2045
@@ -2062,6 +2058,8 @@ static bool resize_display_win(ALLEGRO_DISPLAY *d, int w, int h)
2062
2058
dispatch_sync (dispatch_get_main_queue (), ^{
2063
2059
rc = resize_display_win_main_thread (d, w, h);
2064
2060
});
2061
+ // must be done on the thread the user calls it from, not the main thread
2062
+ setup_gl (d);
2065
2063
return rc;
2066
2064
}
2067
2065
0 commit comments