1
1
/*
2
- * Copyright (c) 1997, 2024 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 1997, 2025 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
27
27
28
28
import java .awt .image .ColorModel ;
29
29
30
- import sun .awt .AppContext ;
31
30
import sun .awt .SunToolkit ;
32
31
33
32
/**
75
74
*/
76
75
public abstract class GraphicsDevice {
77
76
78
- private Window fullScreenWindow ;
79
- private AppContext fullScreenAppContext ; // tracks which AppContext
80
- // created the FS window
81
- // this lock is used for making synchronous changes to the AppContext's
82
- // current full screen window
83
- private final Object fsAppContextLock = new Object ();
84
-
77
+ private volatile Window fullScreenWindow ;
85
78
private Rectangle windowedModeBounds ;
86
79
87
80
/**
@@ -303,23 +296,15 @@ public void setFullScreenWindow(Window w) {
303
296
fullScreenWindow .setBounds (windowedModeBounds );
304
297
}
305
298
// Set the full screen window
306
- synchronized (fsAppContextLock ) {
307
- // Associate fullscreen window with current AppContext
308
- if (w == null ) {
309
- fullScreenAppContext = null ;
310
- } else {
311
- fullScreenAppContext = AppContext .getAppContext ();
312
- }
313
- fullScreenWindow = w ;
314
- }
299
+ fullScreenWindow = w ;
315
300
if (fullScreenWindow != null ) {
316
301
windowedModeBounds = fullScreenWindow .getBounds ();
317
302
// Note that we use the graphics configuration of the device,
318
303
// not the window's, because we're setting the fs window for
319
304
// this device.
320
305
final GraphicsConfiguration gc = getDefaultConfiguration ();
321
306
final Rectangle screenBounds = gc .getBounds ();
322
- if (SunToolkit . isDispatchThreadForAppContext ( fullScreenWindow )) {
307
+ if (EventQueue . isDispatchThread ( )) {
323
308
// Update graphics configuration here directly and do not wait
324
309
// asynchronous notification from the peer. Note that
325
310
// setBounds() will reset a GC, if it was set incorrectly.
@@ -342,15 +327,7 @@ public void setFullScreenWindow(Window w) {
342
327
* @since 1.4
343
328
*/
344
329
public Window getFullScreenWindow () {
345
- Window returnWindow = null ;
346
- synchronized (fsAppContextLock ) {
347
- // Only return a handle to the current fs window if we are in the
348
- // same AppContext that set the fs window
349
- if (fullScreenAppContext == AppContext .getAppContext ()) {
350
- returnWindow = fullScreenWindow ;
351
- }
352
- }
353
- return returnWindow ;
330
+ return fullScreenWindow ;
354
331
}
355
332
356
333
/**
0 commit comments