| 98 | protected GlfwCallback makeCallback() { |
| 99 | return new GlfwCallback() { |
| 100 | |
| 101 | @Override |
| 102 | public void error(int error, String description) { |
| 103 | System.err.println(" ERROR in GLFW windowing system :" + error + " / " + description); |
| 104 | Runnable r = () -> { |
| 105 | checkClassLoader(); |
| 106 | System.err.println(" ERROR in GLFW windowing system :" + error + " / " + description); |
| 107 | new Exception().printStackTrace(); |
| 108 | }; |
| 109 | |
| 110 | if (checkThread()) r.run(); |
| 111 | else { |
| 112 | events.addLast(r); |
| 113 | RunLoop.main.shouldSleep.add(Windows.this); |
| 114 | RunLoop.main.interrupt(); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | @Override |
| 119 | public void windowFocus(long window, boolean focused) { |
| 120 | Runnable r = () -> { |
| 121 | checkClassLoader(); |
| 122 | GlfwCallback a = adaptors.get(window); |
| 123 | if (a != null) |
| 124 | a.windowFocus(window, focused); |
| 125 | }; |
| 126 | |
| 127 | if (checkThread()) r.run(); |
| 128 | else { |
| 129 | events.addLast(r); |
| 130 | RunLoop.main.shouldSleep.add(Windows.this); |
| 131 | RunLoop.main.interrupt(); |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | @Override |
| 136 | public void windowRefresh(long window) { |
| 137 | Runnable r = () -> { |
| 138 | checkClassLoader(); |
| 139 | GlfwCallback a = adaptors.get(window); |
| 140 | if (a != null) a.windowRefresh(window); |
| 141 | }; |
| 142 | |
| 143 | if (checkThread()) r.run(); |
| 144 | else { |
| 145 | events.addLast(r); |
| 146 | RunLoop.main.shouldSleep.add(Windows.this); |
| 147 | RunLoop.main.interrupt(); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | |
| 152 | boolean fakeButton1 = false; |
| 153 | |
| 154 | @Override |
| 155 | public void mouseButton(long window, int button, int pressed, int mods) { |
| 156 | if (button == 0 && mods == 2 && pressed != 0) { |
| 157 | button = 1; |