Skip to content

Commit

Permalink
JBR-5497: revert JRSUIController changes (performOnMainThreadWaiting:…
Browse files Browse the repository at this point in the history
…YES) to avoid UI freeze but appkit violations must be fixed in follow-up fix
  • Loading branch information
bourgesl authored and vprovodin committed Nov 23, 2024
1 parent 4940381 commit 84a4edc
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/java.desktop/macosx/native/libosxui/JRSUIController.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#import "JNIUtilities.h"
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
#import <ThreadUtilities.h>

#import "apple_laf_JRSUIControl.h"
#import "apple_laf_JRSUIConstants_DoubleValue.h"
Expand Down Expand Up @@ -160,12 +159,13 @@ static inline jint doPaintCGContext(CGContextRef cgRef, jlong controlPtr, jlong
{
JRSUIControlRef control = (JRSUIControlRef)jlong_to_ptr(controlPtr);
_SyncEncodedProperties(control, oldProperties, newProperties);

/*
JBR-5497: revert to avoid UI freeze => must be fixed in follow-up fix
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
*/
CGRect bounds = CGRectMake(x, y, w, h);
JRSUIControlDraw(gRenderer, control, cgRef, bounds);
}];

/* }]; */
return 0;
}

Expand Down Expand Up @@ -254,11 +254,12 @@ static inline jint doPaintCGContext(CGContextRef cgRef, jlong controlPtr, jlong
CGPoint point = CGPointMake(pointX, pointY);

__block jint result;

/*
JBR-5497: revert to avoid UI freeze => must be fixed in follow-up fix
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
*/
result = JRSUIControlGetHitPart(gRenderer, control, bounds, point);
}];

/* }]; */
return result;
}

Expand All @@ -272,9 +273,12 @@ static inline jint doPaintCGContext(CGContextRef cgRef, jlong controlPtr, jlong
{
__block Boolean result;

/*
JBR-5497: revert to avoid UI freeze => must be fixed in follow-up fix
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
*/
result = JRSUIControlShouldScrollToClick();
}];
/* }]; */
return result;
}

Expand All @@ -290,11 +294,13 @@ static inline jint doPaintCGContext(CGContextRef cgRef, jlong controlPtr, jlong
_SyncEncodedProperties(control, oldProperties, newProperties);

__block CGRect partBounds;

/*
JBR-5497: revert to avoid UI freeze => must be fixed in follow-up fix
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
*/
CGRect frame = CGRectMake(x, y, w, h);
partBounds = JRSUIControlGetScrollBarPartBounds(control, frame, part);
}];
/* }]; */

jdouble *rect = (*env)->GetPrimitiveArrayCritical(env, rectArray, NULL);
if (rect != NULL) {
Expand All @@ -319,9 +325,12 @@ static inline jint doPaintCGContext(CGContextRef cgRef, jlong controlPtr, jlong

__block jdouble result;

/*
JBR-5497: revert to avoid UI freeze => must be fixed in follow-up fix
[ThreadUtilities performOnMainThreadWaiting:YES block:^(){
*/
CGRect frame = CGRectMake(x, y, w, h);
result = (jdouble)JRSUIControlGetScrollBarOffsetFor(control, frame, offset, visibleAmount, extent);
}];
/* }]; */
return result;
}

0 comments on commit 84a4edc

Please sign in to comment.