< prev index next >

src/java.desktop/macosx/classes/sun/awt/CGraphicsEnvironment.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 77,86 **** --- 77,90 ---- */ private native void deregisterDisplayReconfiguration(long context); /** Available CoreGraphics displays. */ private final Map<Integer, CGraphicsDevice> devices = new HashMap<>(5); + /** + * The key in the {@link #devices} for the main display. + */ + private int mainDisplayID; /** Reference to the display reconfiguration callback context. */ private final long displayReconfigContext; /**
*** 134,152 **** private void initDevices() { synchronized (this) { final Map<Integer, CGraphicsDevice> old = new HashMap<>(devices); devices.clear(); ! int mainID = getMainDisplayID(); // initialization of the graphics device may change // list of displays on hybrid systems via an activation // of discrete video. // So, we initialize the main display first, and then // retrieve actual list of displays. ! if (!old.containsKey(mainID)) { ! old.put(mainID, new CGraphicsDevice(mainID)); } for (final int id : getDisplayIDs()) { devices.put(id, old.containsKey(id) ? old.get(id) : new CGraphicsDevice(id)); --- 138,156 ---- private void initDevices() { synchronized (this) { final Map<Integer, CGraphicsDevice> old = new HashMap<>(devices); devices.clear(); ! mainDisplayID = getMainDisplayID(); // initialization of the graphics device may change // list of displays on hybrid systems via an activation // of discrete video. // So, we initialize the main display first, and then // retrieve actual list of displays. ! if (!old.containsKey(mainDisplayID)) { ! old.put(mainDisplayID, new CGraphicsDevice(mainDisplayID)); } for (final int id : getDisplayIDs()) { devices.put(id, old.containsKey(id) ? old.get(id) : new CGraphicsDevice(id));
*** 155,165 **** displayChanged(); } @Override public synchronized GraphicsDevice getDefaultScreenDevice() throws HeadlessException { - final int mainDisplayID = getMainDisplayID(); CGraphicsDevice d = devices.get(mainDisplayID); if (d == null) { // we do not expect that this may happen, the only response // is to re-initialize the list of devices initDevices(); --- 159,168 ----
< prev index next >