int XButtonRelease(int w, int client_data, int call_data, int continue_to_dispatch) { display.hideToolTip(); XButtonEvent xEvent = new XButtonEvent(); OS.memmove(xEvent, call_data, XButtonEvent.sizeof); /* * Forward the mouse event to the parent. * This is necessary so that mouse listeners * in the parent will be called, despite the * fact that the event did not really occur * in X in the parent. This is done to be * compatible with Windows. */ int[] argList = {OS.XmNx, 0, OS.XmNy, 0}; OS.XtGetValues(handle, argList, argList.length / 2); xEvent.window = OS.XtWindow(parent.handle); xEvent.x += argList[1]; xEvent.y += argList[3]; OS.memmove(call_data, xEvent, XButtonEvent.sizeof); int result = parent.XButtonRelease(w, client_data, call_data, continue_to_dispatch); xEvent.x -= argList[1]; xEvent.y -= argList[3]; if (result == 0 && xEvent.button == 1) { int[] argList2 = {OS.XmNwidth, 0, OS.XmNheight, 0}; OS.XtGetValues(handle, argList2, argList2.length / 2); int width = argList2[1], height = argList2[3]; if (0 <= xEvent.x && xEvent.x < width && 0 <= xEvent.y && xEvent.y < height) { click(xEvent.x > width - 12, xEvent.state); } setDrawPressed(set); } return result; }