Mercurial > projects > dwt2
comparison org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/graphics/Device.d @ 113:fb3aa8075988
D2 support for the linux port.
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Wed, 06 Apr 2011 21:57:23 +0200 |
parents | b397a43d66d1 |
children |
comparison
equal
deleted
inserted
replaced
112:9f4c18c268b2 | 113:fb3aa8075988 |
---|---|
118 // Devices = new Device[4]; | 118 // Devices = new Device[4]; |
119 //} | 119 //} |
120 /* | 120 /* |
121 * TEMPORARY CODE. | 121 * TEMPORARY CODE. |
122 */ | 122 */ |
123 static synchronized Device getDevice () { | 123 static Device getDevice () { |
124 if (DeviceFinder !is null) DeviceFinder.run(); | 124 synchronized { |
125 Device device = CurrentDevice; | 125 if (DeviceFinder !is null) DeviceFinder.run(); |
126 CurrentDevice = null; | 126 Device device = CurrentDevice; |
127 return device; | 127 CurrentDevice = null; |
128 return device; | |
129 } | |
128 } | 130 } |
129 | 131 |
130 /** | 132 /** |
131 * Constructs a new instance of this class. | 133 * Constructs a new instance of this class. |
132 * <p> | 134 * <p> |
258 } | 260 } |
259 } | 261 } |
260 } | 262 } |
261 } | 263 } |
262 | 264 |
263 static synchronized Device findDevice (void* xDisplay) { | 265 static Device findDevice (void* xDisplay) { |
264 for (int i=0; i<Devices.length; i++) { | 266 synchronized { |
265 Device device = Devices [i]; | 267 for (int i=0; i<Devices.length; i++) { |
266 if (device !is null && device.xDisplay is xDisplay) { | 268 Device device = Devices [i]; |
267 return device; | 269 if (device !is null && device.xDisplay is xDisplay) { |
268 } | 270 return device; |
269 } | 271 } |
270 return null; | 272 } |
271 } | 273 return null; |
272 | 274 } |
273 synchronized static void deregister (Device device) { | 275 } |
274 for (int i=0; i<Devices.length; i++) { | 276 |
275 if (device is Devices [i]) Devices [i] = null; | 277 static void deregister (Device device) { |
278 synchronized { | |
279 for (int i=0; i<Devices.length; i++) { | |
280 if (device is Devices [i]) Devices [i] = null; | |
281 } | |
276 } | 282 } |
277 } | 283 } |
278 | 284 |
279 /** | 285 /** |
280 * Destroys the device in the operating system and releases | 286 * Destroys the device in the operating system and releases |
720 newErrors [errors.length] = new Exception (""); | 726 newErrors [errors.length] = new Exception (""); |
721 errors = newErrors; | 727 errors = newErrors; |
722 } | 728 } |
723 } | 729 } |
724 | 730 |
725 static synchronized void register (Device device) { | 731 static void register (Device device) { |
726 for (int i=0; i<Devices.length; i++) { | 732 synchronized { |
727 if (Devices [i] is null) { | 733 for (int i=0; i<Devices.length; i++) { |
728 Devices [i] = device; | 734 if (Devices [i] is null) { |
729 return; | 735 Devices [i] = device; |
730 } | 736 return; |
731 } | 737 } |
732 Device [] newDevices = new Device [Devices.length + 4]; | 738 } |
733 System.arraycopy (Devices, 0, newDevices, 0, Devices.length); | 739 Device [] newDevices = new Device [Devices.length + 4]; |
734 newDevices [Devices.length] = device; | 740 System.arraycopy (Devices, 0, newDevices, 0, Devices.length); |
735 Devices = newDevices; | 741 newDevices [Devices.length] = device; |
742 Devices = newDevices; | |
743 } | |
736 } | 744 } |
737 | 745 |
738 /** | 746 /** |
739 * Releases any internal resources back to the operating | 747 * Releases any internal resources back to the operating |
740 * system and clears all fields except the device handle. | 748 * system and clears all fields except the device handle. |