75 XIconSize[] res = new XIconSize[count];
76 for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) {
77 res[i] = new XIconSize(sizes_ptr);
78 log.finest("sizes_ptr[{1}] = {0}", res[i], Integer.valueOf(i));
79 }
80 return res;
81 } finally {
82 XToolkit.awtUnlock();
83 }
84 }
85
86 private Dimension calcIconSize(int widthHint, int heightHint) {
87 if (XWM.getWMID() == XWM.ICE_WM) {
88 // ICE_WM has a bug - it only displays icons of the size
89 // 16x16, while reporting 32x32 in its size list
90 log.finest("Returning ICE_WM icon size: 16x16");
91 return new Dimension(16, 16);
92 }
93
94 XIconSize[] sizeList = getIconSizes();
95 log.finest("Icon sizes: {0}", sizeList);
96 if (sizeList == null) {
97 // No icon sizes so we simply fall back to 16x16
98 return new Dimension(16, 16);
99 }
100 boolean found = false;
101 int dist = 0xffffffff, newDist, diff = 0, closestHeight, closestWidth;
102 int saveWidth = 0, saveHeight = 0;
103 for (int i = 0; i < sizeList.length; i++) {
104 if (widthHint >= sizeList[i].get_min_width() &&
105 widthHint <= sizeList[i].get_max_width() &&
106 heightHint >= sizeList[i].get_min_height() &&
107 heightHint <= sizeList[i].get_max_height()) {
108 found = true;
109 if ((((widthHint-sizeList[i].get_min_width())
110 % sizeList[i].get_width_inc()) == 0) &&
111 (((heightHint-sizeList[i].get_min_height())
112 % sizeList[i].get_height_inc()) ==0)) {
113 /* Found an exact match */
114 saveWidth = widthHint;
115 saveHeight = heightHint;
|
75 XIconSize[] res = new XIconSize[count];
76 for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) {
77 res[i] = new XIconSize(sizes_ptr);
78 log.finest("sizes_ptr[{1}] = {0}", res[i], Integer.valueOf(i));
79 }
80 return res;
81 } finally {
82 XToolkit.awtUnlock();
83 }
84 }
85
86 private Dimension calcIconSize(int widthHint, int heightHint) {
87 if (XWM.getWMID() == XWM.ICE_WM) {
88 // ICE_WM has a bug - it only displays icons of the size
89 // 16x16, while reporting 32x32 in its size list
90 log.finest("Returning ICE_WM icon size: 16x16");
91 return new Dimension(16, 16);
92 }
93
94 XIconSize[] sizeList = getIconSizes();
95 log.finest("Icon sizes: {0}", (Object[]) sizeList);
96 if (sizeList == null) {
97 // No icon sizes so we simply fall back to 16x16
98 return new Dimension(16, 16);
99 }
100 boolean found = false;
101 int dist = 0xffffffff, newDist, diff = 0, closestHeight, closestWidth;
102 int saveWidth = 0, saveHeight = 0;
103 for (int i = 0; i < sizeList.length; i++) {
104 if (widthHint >= sizeList[i].get_min_width() &&
105 widthHint <= sizeList[i].get_max_width() &&
106 heightHint >= sizeList[i].get_min_height() &&
107 heightHint <= sizeList[i].get_max_height()) {
108 found = true;
109 if ((((widthHint-sizeList[i].get_min_width())
110 % sizeList[i].get_width_inc()) == 0) &&
111 (((heightHint-sizeList[i].get_min_height())
112 % sizeList[i].get_height_inc()) ==0)) {
113 /* Found an exact match */
114 saveWidth = widthHint;
115 saveHeight = heightHint;
|