/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Per-screen XSETTINGS.
*/
public class XSettings {
/**
*/
/**
* Update these settings with <code>data</code> obtained from
* XSETTINGS manager.
*
* @param data settings data obtained from
* <code>_XSETTINGS_SETTINGS</code> window property of the
* settings manager.
* @return a <code>Map</code> of changed settings.
*/
}
/**
* TBS ...
*/
class Update {
/* byte order mark */
/* setting type */
private byte[] data;
private int dlen;
private int idx;
private boolean isLittle;
private boolean isValid;
/**
* Construct an Update object for the data read from
* <code>_XSETTINGS_SETTINGS</code> property of the XSETTINGS
* selection owner.
*
* @param data <code>_XSETTINGS_SETTINGS</code> contents.
*/
if (dlen < 12) {
// XXX: debug trace?
return;
}
// first byte gives endianness of the data
// next 3 bytes are unused (pad to 32 bit)
idx = 0;
idx = 4;
// N_SETTINGS is actually CARD32 (i.e. unsigned), but
// since java doesn't have an unsigned int type, and
// N_SETTINGS cannot realistically exceed 2^31 (so we
// gonna use int anyway), just read it as INT32.
idx = 8;
updatedSettings = new HashMap();
isValid = true;
}
private void needBytes(int n)
throws IndexOutOfBoundsException
{
return;
}
+ " need " + n
+ " length " + dlen);
}
private int getCARD8()
throws IndexOutOfBoundsException
{
needBytes(1);
++idx;
return val;
}
private int getCARD16()
throws IndexOutOfBoundsException
{
needBytes(2);
int val;
if (isLittle) {
} else {
}
idx += 2;
return val;
}
private int getINT32()
throws IndexOutOfBoundsException
{
needBytes(4);
int val;
if (isLittle) {
} else {
}
idx += 4;
return val;
}
private long getCARD32()
throws IndexOutOfBoundsException
{
return getINT32() & 0x00000000ffffffffL;
}
throws IndexOutOfBoundsException
{
try {
} catch (UnsupportedEncodingException e) {
// XXX: cannot happen, "UTF-8" is always supported
}
return str;
}
/**
* Update settings.
*/
if (!isValid) {
return null;
}
synchronized (XSettings.this) {
if (this.serial <= currentSerial) {
return null;
}
}
}
return updatedSettings;
}
/**
* Parses a particular x setting.
*
* @exception IndexOutOfBoundsException if there isn't enough
* data for a setting.
*/
throws IndexOutOfBoundsException,
{
++idx; // pad to next CARD16
// save position of the property name, skip to serial
// check if we should bother
long lastChanged = getCARD32();
// Avoid constructing garbage for properties that has not
// changed, skip the data for this property.
if (type == TYPE_INTEGER) {
idx += 4;
} else if (type == TYPE_STRING) {
} else if (type == TYPE_COLOR) {
} else {
throw new IllegalArgumentException("Unknown type: "
+ type);
}
return;
}
if (type == TYPE_INTEGER) {
}
else if (type == TYPE_STRING) {
}
else if (type == TYPE_COLOR) {
int r = getCARD16();
int g = getCARD16();
int b = getCARD16();
int a = getCARD16();
g / 65535.0f,
b / 65535.0f,
a / 65535.0f);
}
else {
}
// dtrace???
return;
}
}
} // class XSettings.Update
}