List of usage examples for java.awt.event InputEvent BUTTON2_MASK
int BUTTON2_MASK
To view the source code for java.awt.event InputEvent BUTTON2_MASK.
Click Source Link
From source file:com.jcraft.weirdx.DDXWindowImpSwing.java
public void mouseEntered(MouseEvent e) { if (window != null && window.getFrame() != null) { java.awt.Window frame = window.getFrame(); if ((frame instanceof java.awt.Frame) && frame == e.getSource()) { try { if (window.isRealized()) { XWindow.setInputFocus(window.client, window.id, 1, (int) System.currentTimeMillis(), false); }/*from w w w . j a v a2 s . com*/ } catch (Exception ee) { LOG.error(ee); } return; } } String str = CopyPaste.getString(); if (!CopyPaste.isOwner() && str != null) { synchronized (window.screen.root) { Property p = window.screen.root.getProperty(); while (p != null) { if (p.propertyName == 9) break; p = p.next; } if (p != null) { p.data = str.getBytes(); p.size = p.data.length; } } Selection sel = Selection.getSelection(1); // PRIMARY if (sel != null && sel.client != null) { int time = (int) System.currentTimeMillis(); Event event = new Event(); event.mkSelectionClear(time, sel.wid, sel.selection); try { sel.client.sendEvent(event, 1, Event.NoEventMask, Event.NoEventMask, null); } catch (Exception ee) { //System.out.println(ee); } ; sel.window = window.screen.root; sel.wid = window.screen.root.id; sel.lastTimeChanged = time; sel.client = null; } CopyPaste.setString(str); } if (window.id == window.screen.rootId) { return; } if (window.isMapped()) { requestFocus(); XWindow.focus.win = window.id; } int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x; XWindow.sprite.hot.y = y; int mod = e.getModifiers(); int state = 0; if ((mod & InputEvent.BUTTON1_MASK) != 0) state |= (1 << 8); if ((mod & InputEvent.BUTTON2_MASK) != 0) state |= (1 << 9); if ((mod & InputEvent.BUTTON3_MASK) != 0) state |= (1 << 10); if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; Client client = window.client; if (client == null || client == serverClient) return; event.mkEnterNotify(0, // Ancestor window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 0, // Normal 0x1 | 0x02 // focus|same-screen ); try { XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } }
From source file:com.jcraft.weirdx.DDXWindowImp.java
public void mouseEntered(MouseEvent e) { if (window == null) return;/*w w w . j av a 2 s.c o m*/ if (window.getFrame() != null) { java.awt.Window frame = window.getFrame(); if ((frame instanceof java.awt.Frame) && frame == e.getSource()) { try { if (window.isRealized()) { XWindow.setInputFocus(window.client, window.id, 1, (int) System.currentTimeMillis(), false); } } catch (Exception ee) { LOG.error(ee); } return; } } String str = CopyPaste.getString(); if (!CopyPaste.isOwner() && str != null) { synchronized (window.screen.root) { Property p = window.screen.root.getProperty(); while (p != null) { if (p.propertyName == 9) break; p = p.next; } if (p != null) { p.data = str.getBytes(); p.size = p.data.length; } } Selection sel = Selection.getSelection(1); // PRIMARY if (sel != null && sel.client != null) { int time = (int) System.currentTimeMillis(); Event event = new Event(); event.mkSelectionClear(time, sel.wid, sel.selection); try { sel.client.sendEvent(event, 1, Event.NoEventMask, Event.NoEventMask, null); } catch (Exception ee) { //System.out.println(ee); } ; sel.window = window.screen.root; sel.wid = window.screen.root.id; sel.lastTimeChanged = time; sel.client = null; } CopyPaste.setString(str); } if (window.id == window.screen.rootId) { return; } if (window.isMapped()) { requestFocus(); XWindow.focus.win = window.id; } int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x; XWindow.sprite.hot.y = y; int mod = e.getModifiers(); int state = 0; if ((mod & InputEvent.BUTTON1_MASK) != 0) state |= (1 << 8); if ((mod & InputEvent.BUTTON2_MASK) != 0) state |= (1 << 9); if ((mod & InputEvent.BUTTON3_MASK) != 0) state |= (1 << 10); if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; Client client = window.client; if (client == null || client == serverClient) return; event.mkEnterNotify(0, // Ancestor window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 0, // Normal 0x1 | 0x02 // focus|same-screen ); try { XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } }
From source file:com.jcraft.weirdx.DDXWindowImp.java
public void mouseExited(MouseEvent e) { if (window == null) return;/*from w ww . ja v a 2 s. c om*/ if (window.id == window.screen.rootId) { return; } int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x; XWindow.sprite.hot.y = y; int mod = e.getModifiers(); int state = 0; if ((mod & InputEvent.BUTTON1_MASK) != 0) state |= (1 << 8); if ((mod & InputEvent.BUTTON2_MASK) != 0) state |= (1 << 9); if ((mod & InputEvent.BUTTON3_MASK) != 0) state |= (1 << 10); if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; Client client = window.client; if (client == null || client == serverClient) return; event.mkLeaveNotify(0, // Ancestor window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 0, // Normal 0x1 | 0x02 // focus|same-screen ); try { XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } }
From source file:com.jcraft.weirdx.DDXWindowImp.java
public void mousePressed(MouseEvent e) { if (threeButton) { if (threeBstate == s) { threeBPressed = e;/* w w w . j ava2 s . c om*/ threeBstate = sp; return; } if (threeBstate == sp // || threeBstate==sppr ) { threeBPressed = null; threeBstate = spp; e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } } procPressed(e); }
From source file:com.jcraft.weirdx.DDXWindowImpSwing.java
private void procPressed(MouseEvent e) { int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x;/* w ww .j av a 2 s. c o m*/ XWindow.sprite.hot.y = y; int mod = e.getModifiers(); if (mod == 0) { mod |= InputEvent.BUTTON1_MASK; } // ????? int state = 0; int detail = 1; if ((mod & InputEvent.BUTTON1_MASK) != 0) detail = 1; if ((mod & InputEvent.BUTTON2_MASK) != 0) detail = 2; if ((mod & InputEvent.BUTTON3_MASK) != 0) detail = 3; if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; Event.filters[Event.MotionNotify] = Event.PointerMotionMask | Event.ButtonMotionMask | ((Event.Button1Mask >> 1) << detail); event.mkButtonPress(detail, window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 1); try { if (XWindow.grab == null) { if (XWindow.checkDeviceGrabs(event, 0, 1)) { return; } } if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, false, 1); else XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); } // if((mod & InputEvent.SHIFT_MASK)!=0) state|=1; // if((mod & InputEvent.CTRL_MASK)!=0) state|=4; // alt -> state|=8; XWindow.sprite.hot.state = state; }
From source file:com.jcraft.weirdx.DDXWindowImp.java
private void procPressed(MouseEvent e) { int x = e.getX() + window.x; int y = e.getY() + window.y; oldWindowx = window.x;/* w w w . j av a2 s . c o m*/ oldWindowy = window.y; XWindow.sprite.hot.x = x; XWindow.sprite.hot.y = y; int mod = e.getModifiers(); if (mod == 0) { mod |= InputEvent.BUTTON1_MASK; } // ????? int state = 0; int detail = 1; if ((mod & InputEvent.BUTTON1_MASK) != 0) detail = 1; if ((mod & InputEvent.BUTTON2_MASK) != 0) detail = 2; if ((mod & InputEvent.BUTTON3_MASK) != 0) detail = 3; if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; Event.filters[Event.MotionNotify] = Event.PointerMotionMask | Event.ButtonMotionMask | ((Event.Button1Mask >> 1) << detail); event.mkButtonPress(detail, window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 1); try { if (XWindow.grab == null) { if (XWindow.checkDeviceGrabs(event, 0, 1)) { return; } } if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, false, 1); else XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); } // if((mod & InputEvent.SHIFT_MASK)!=0) state|=1; // if((mod & InputEvent.CTRL_MASK)!=0) state|=4; // alt -> state|=8; XWindow.sprite.hot.state = state; }
From source file:com.jcraft.weirdx.DDXWindowImpSwing.java
public void mouseReleased(MouseEvent e) { if (threeButton) { if (threeBstate == sppr) { threeBPressed = null;/*from w w w. j a v a2s . c o m*/ threeBstate = s; return; } if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null; threeBstate = s; } else if (threeBstate == spp) { threeBPressed = null; threeBstate = sppr; e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } } procReleased(e); }
From source file:com.jcraft.weirdx.DDXWindowImp.java
public void mouseReleased(MouseEvent e) { if (threeButton) { if (threeBstate == sppr) { threeBPressed = null;/* w w w. j a v a2 s . com*/ threeBstate = s; return; } if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null; threeBstate = s; } else if (threeBstate == spp) { threeBPressed = null; threeBstate = sppr; e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } } try { procReleased(e); } catch (Exception ee) { } }
From source file:com.jcraft.weirdx.DDXWindowImp.java
private void procReleased(MouseEvent e) { int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x;/* ww w . j a v a 2 s . co m*/ XWindow.sprite.hot.y = y; int mod = e.getModifiers(); int state = 0; int detail = 0; if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); detail = 1; } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); detail = 2; } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); detail = 3; } if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; XWindow.sprite.hot.state = 0; // ????? Event.filters[Event.MotionNotify] = Event.PointerMotionMask/*| ((Event.Button1Mask>>1)<<detail)*/; event.mkButtonRelease(detail, window.screen.rootId, window.id, 0, x, y, e.getX(), e.getY(), state, 1); try { if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, true, 1); else XWindow.sendDeviceEvent(window, event, XWindow.grab, null, 1); } catch (Exception ee) { } XWindow.grab = null; }
From source file:com.jcraft.weirdx.DDXWindowImpSwing.java
@SuppressWarnings("unused") public void mouseDragged(MouseEvent e) { if (threeButton) { if (threeBstate != s) { if (threeBstate == sp) { procPressed(threeBPressed); threeBPressed = null;/* w w w . j a v a 2 s.c o m*/ threeBstate = s; } else if (threeBstate == spp) { e = new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), (e.getModifiers() & (~(InputEvent.BUTTON1_MASK | InputEvent.BUTTON3_MASK))) | InputEvent.BUTTON2_MASK, e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); } else if (threeBstate == sppr) { return; } } } int x = e.getX() + window.x; int y = e.getY() + window.y; XWindow.sprite.hot.x = x; XWindow.sprite.hot.y = y; int mod = e.getModifiers(); // button 1 -> 16 // button 2 -> 8 // button 3 -> 4 // shift -> 1 // control -> 2 // alt -> 12 ?? int state = 0; int detail = 0; if ((mod & InputEvent.BUTTON1_MASK) != 0) { state |= (1 << 8); detail = 1; } if ((mod & InputEvent.BUTTON2_MASK) != 0) { state |= (1 << 9); detail = 2; } if ((mod & InputEvent.BUTTON3_MASK) != 0) { state |= (1 << 10); detail = 3; } if ((mod & InputEvent.SHIFT_MASK) != 0) state |= 1; if ((mod & InputEvent.CTRL_MASK) != 0) state |= 4; // alt -> state|=8; XWindow.sprite.hot.state = state; px = x; py = y; event.mkMotionNotify(1, window.screen.rootId, /*window.id,*/ XWindow.sprite.win.id, 0, px, py, e.getX(), e.getY(), state, 1); try { if (!XWindow.checkMotion(event, window)) { return; } event.mkMotionNotify(1, window.screen.rootId, /*window.id,*/ XWindow.sprite.win.id, 0, px, py, px - XWindow.sprite.win.x, py - XWindow.sprite.win.y, //e.getX(), //e.getY(), state, 1); if (XWindow.grab != null) XWindow.sendGrabbedEvent(event, false, 1); else XWindow.sendDeviceEvent(XWindow.sprite.win, event, XWindow.grab, null, 1); } catch (Exception ee) { } }