src/solaris/classes/sun/awt/X11/XWindow.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2002, 2010, 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) 2002, 2014, 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
*** 198,208 ****
}
params.putIfNull(BORDER_PIXEL, Long.valueOf(0));
getColorModel(); // fix 4948833: this call forces the color map to be initialized
params.putIfNull(COLORMAP, gData.get_awt_cmap());
params.putIfNull(DEPTH, gData.get_awt_depth());
! params.putIfNull(VISUAL_CLASS, Integer.valueOf((int)XConstants.InputOutput));
params.putIfNull(VISUAL, visInfo.get_visual());
params.putIfNull(VALUE_MASK, XConstants.CWBorderPixel | XConstants.CWEventMask | XConstants.CWColormap);
Long parentWindow = (Long)params.get(PARENT_WINDOW);
if (parentWindow == null || parentWindow.longValue() == 0) {
XToolkit.awtLock();
--- 198,208 ----
}
params.putIfNull(BORDER_PIXEL, Long.valueOf(0));
getColorModel(); // fix 4948833: this call forces the color map to be initialized
params.putIfNull(COLORMAP, gData.get_awt_cmap());
params.putIfNull(DEPTH, gData.get_awt_depth());
! params.putIfNull(VISUAL_CLASS, Integer.valueOf(XConstants.InputOutput));
params.putIfNull(VISUAL, visInfo.get_visual());
params.putIfNull(VALUE_MASK, XConstants.CWBorderPixel | XConstants.CWEventMask | XConstants.CWColormap);
Long parentWindow = (Long)params.get(PARENT_WINDOW);
if (parentWindow == null || parentWindow.longValue() == 0) {
XToolkit.awtLock();
*** 348,358 ****
}
Graphics getGraphics(SurfaceData surfData, Color afore, Color aback, Font afont) {
if (surfData == null) return null;
! Component target = (Component) this.target;
/* Fix for bug 4746122. Color and Font shouldn't be null */
Color bgColor = aback;
if (bgColor == null) {
bgColor = SystemColor.window;
--- 348,358 ----
}
Graphics getGraphics(SurfaceData surfData, Color afore, Color aback, Font afont) {
if (surfData == null) return null;
! Component target = this.target;
/* Fix for bug 4746122. Color and Font shouldn't be null */
Color bgColor = aback;
if (bgColor == null) {
bgColor = SystemColor.window;
*** 546,556 ****
int x = xe.get_x();
int y = xe.get_y();
int w = xe.get_width();
int h = xe.get_height();
! Component target = (Component)getEventSource();
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
if (!compAccessor.getIgnoreRepaint(target)
&& compAccessor.getWidth(target) != 0
&& compAccessor.getHeight(target) != 0)
--- 546,556 ----
int x = xe.get_x();
int y = xe.get_y();
int w = xe.get_width();
int h = xe.get_height();
! Component target = getEventSource();
AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
if (!compAccessor.getIgnoreRepaint(target)
&& compAccessor.getWidth(target) != 0
&& compAccessor.getHeight(target) != 0)
*** 738,748 ****
button -= 2;
}
modifiers = getModifiers(xbe.get_state(),button,0, type, wheel_mouse);
if (!wheel_mouse) {
! MouseEvent me = new MouseEvent((Component)getEventSource(),
type == XConstants.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED,
jWhen,modifiers, x, y,
xbe.get_x_root(),
xbe.get_y_root(),
clickCount,popupTrigger,button);
--- 738,748 ----
button -= 2;
}
modifiers = getModifiers(xbe.get_state(),button,0, type, wheel_mouse);
if (!wheel_mouse) {
! MouseEvent me = new MouseEvent(getEventSource(),
type == XConstants.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED,
jWhen,modifiers, x, y,
xbe.get_x_root(),
xbe.get_y_root(),
clickCount,popupTrigger,button);
*** 750,760 ****
postEventToEventQueue(me);
if ((type == XConstants.ButtonRelease) &&
((mouseButtonClickAllowed & XlibUtil.getButtonMask(lbutton)) != 0) ) // No up-button in the drag-state
{
! postEventToEventQueue(me = new MouseEvent((Component)getEventSource(),
MouseEvent.MOUSE_CLICKED,
jWhen,
modifiers,
x, y,
xbe.get_x_root(),
--- 750,760 ----
postEventToEventQueue(me);
if ((type == XConstants.ButtonRelease) &&
((mouseButtonClickAllowed & XlibUtil.getButtonMask(lbutton)) != 0) ) // No up-button in the drag-state
{
! postEventToEventQueue(me = new MouseEvent(getEventSource(),
MouseEvent.MOUSE_CLICKED,
jWhen,
modifiers,
x, y,
xbe.get_x_root(),
*** 764,774 ****
}
}
else {
if (xev.get_type() == XConstants.ButtonPress) {
! MouseWheelEvent mwe = new MouseWheelEvent((Component)getEventSource(),MouseEvent.MOUSE_WHEEL, jWhen,
modifiers,
x, y,
xbe.get_x_root(),
xbe.get_y_root(),
1,false,MouseWheelEvent.WHEEL_UNIT_SCROLL,
--- 764,774 ----
}
}
else {
if (xev.get_type() == XConstants.ButtonPress) {
! MouseWheelEvent mwe = new MouseWheelEvent(getEventSource(),MouseEvent.MOUSE_WHEEL, jWhen,
modifiers,
x, y,
xbe.get_x_root(),
xbe.get_y_root(),
1,false,MouseWheelEvent.WHEEL_UNIT_SCROLL,
*** 835,845 ****
long jWhen = XToolkit.nowMillisUTC_offset(xme.get_time());
int modifiers = getModifiers(xme.get_state(), 0, 0);
boolean popupTrigger = false;
! Component source = (Component)getEventSource();
if (xme.get_window() != window) {
Point localXY = toLocal(xme.get_x_root(), xme.get_y_root());
x = localXY.x;
y = localXY.y;
--- 835,845 ----
long jWhen = XToolkit.nowMillisUTC_offset(xme.get_time());
int modifiers = getModifiers(xme.get_state(), 0, 0);
boolean popupTrigger = false;
! Component source = getEventSource();
if (xme.get_window() != window) {
Point localXY = toLocal(xme.get_x_root(), xme.get_y_root());
x = localXY.x;
y = localXY.y;
*** 1109,1129 ****
return;
}else {
unicodeKey = keysymToUnicode( keysym[0], ev.get_state() );
if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
keyEventLog.fine("--XWindow.java XIM did NOT process event, hex keysym:"+Long.toHexString(keysym[0])+"\n"+
! " unicode key:"+Integer.toHexString((int)unicodeKey));
}
}
}else {
// No input method instance found. For example, there's a Java Input Method.
// Produce do-it-yourself keysym and perhaps unicode character.
keysym[0] = xkeycodeToKeysym(ev);
unicodeKey = keysymToUnicode( keysym[0], ev.get_state() );
if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
keyEventLog.fine("--XWindow.java XIM is absent; hex keysym:"+Long.toHexString(keysym[0])+"\n"+
! " unicode key:"+Integer.toHexString((int)unicodeKey));
}
}
// Keysym should be converted to Unicode, if possible and necessary,
// and Java KeyEvent keycode should be calculated.
// For press we should post pressed & typed Java events.
--- 1109,1129 ----
return;
}else {
unicodeKey = keysymToUnicode( keysym[0], ev.get_state() );
if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
keyEventLog.fine("--XWindow.java XIM did NOT process event, hex keysym:"+Long.toHexString(keysym[0])+"\n"+
! " unicode key:"+Integer.toHexString(unicodeKey));
}
}
}else {
// No input method instance found. For example, there's a Java Input Method.
// Produce do-it-yourself keysym and perhaps unicode character.
keysym[0] = xkeycodeToKeysym(ev);
unicodeKey = keysymToUnicode( keysym[0], ev.get_state() );
if (keyEventLog.isLoggable(PlatformLogger.Level.FINE)) {
keyEventLog.fine("--XWindow.java XIM is absent; hex keysym:"+Long.toHexString(keysym[0])+"\n"+
! " unicode key:"+Integer.toHexString(unicodeKey));
}
}
// Keysym should be converted to Unicode, if possible and necessary,
// and Java KeyEvent keycode should be calculated.
// For press we should post pressed & typed Java events.
*** 1464,1474 ****
{
long jWhen = XToolkit.nowMillisUTC_offset(when);
int modifiers = getModifiers(state, 0, keyCode);
! KeyEvent ke = new KeyEvent((Component)getEventSource(), id, jWhen,
modifiers, keyCode, (char)keyChar, keyLocation);
if (event != 0) {
byte[] data = Native.toBytes(event, eventSize);
setBData(ke, data);
}
--- 1464,1474 ----
{
long jWhen = XToolkit.nowMillisUTC_offset(when);
int modifiers = getModifiers(state, 0, keyCode);
! KeyEvent ke = new KeyEvent(getEventSource(), id, jWhen,
modifiers, keyCode, (char)keyChar, keyLocation);
if (event != 0) {
byte[] data = Native.toBytes(event, eventSize);
setBData(ke, data);
}