Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/Eclipse-R4_21/Control.java b/Eclipse-R4_22/Control.java
- index bfedd8d..d447596 100644
- --- a/Eclipse-R4_21/Control.java
- +++ b/Eclipse-R4_22/Control.java
- @@ -882,11 +882,7 @@ void forceResize () {
- gtk_widget_get_preferred_size (topHandle, requisition);
- GtkAllocation allocation = new GtkAllocation ();
- GTK.gtk_widget_get_allocation(topHandle, allocation);
- - if (GTK.GTK4) {
- - GTK4.gtk_widget_size_allocate (topHandle, allocation, -1);
- - } else {
- - GTK3.gtk_widget_size_allocate (topHandle, allocation);
- - }
- + gtk_widget_size_allocate(topHandle, allocation, -1);
- }
- /**
- @@ -1070,7 +1066,7 @@ Point resizeCalculationsGTK3 (long widget, int width, int height) {
- }
- int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
- - // bug in GTK2 crashes JVM, in GTK3 the new shell only. See bug 472743
- + // bug in GTK3 the crashes new shell only. See bug 472743
- width = Math.min(width, (2 << 14) - 1);
- height = Math.min(height, (2 << 14) - 1);
- @@ -1153,11 +1149,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
- Control focusControl = display.getFocusControl();
- GTK.gtk_widget_show(topHandle);
- gtk_widget_get_preferred_size (topHandle, requisition);
- - if (GTK.GTK4) {
- - GTK4.gtk_widget_size_allocate (topHandle, allocation, -1);
- - } else {
- - GTK3.gtk_widget_size_allocate (topHandle, allocation);
- - }
- + gtk_widget_size_allocate(topHandle, allocation, -1);
- GTK.gtk_widget_hide(topHandle);
- /* Bug 540002: Showing and hiding widget causes original focused control to loose focus,
- * Reset focus to original focused control after dealing with allocation.
- @@ -5007,7 +4999,13 @@ boolean sendMouseEvent (int type, int button, int count, int detail, boolean sen
- sendOrPost(SWT.MouseDown, mouseDownEvent);
- }
- }
- - return true;
- + /* This checks for Wayland, a previous MouseDown || MouseMove in the
- + * dragDetectionQueue and it checks if the current event is MouseMove
- + * This will prevent them from not being queued, which caused
- + * Bug 576215 - [Wayland] Mouse events not received as on other platforms.
- + * In x11 this will always return true as before.
- + */
- + if( (OS.isX11() || (dragDetectionQueue == null) || (type != SWT.MouseMove)) ) return true;
- }
- Event event = new Event ();
- event.time = time;
- @@ -5039,7 +5037,6 @@ boolean sendMouseEvent (int type, int button, int count, int detail, boolean sen
- /**
- * Bug 510446:
- - * In the original gtk2 DnD architecture, Drag detection was done in mouseDown.
- * For Wayland support, Drag detection is now done in mouseMove (as does gtk internally).
- *
- * However, traditionally external widgets (e.g StyledText or non-SWT widgets) expect to
- @@ -5052,7 +5049,7 @@ boolean sendMouseEvent (int type, int button, int count, int detail, boolean sen
- * - To ensure we follow 'send/post' contract as per parameter, we
- * temporarily utilize event.data to hold send/post flag.
- * There's also logic in place such that mouseDown/mouseMotion is always sent before mouseUp.
- - * - On Gtk2, mouseMove is sent during DnD. On Gtk3x11 it's not due to hacky implementation of DnD.
- + * - On Gtk3x11 it's not due to hacky implementation of DnD.
- * On Wayland mouseMove is once again sent during DnD as per improved architecture.
- */
- event.data = Boolean.valueOf(send);
- @@ -5875,11 +5872,7 @@ public boolean setParent (Composite parent) {
- allocation.y = y;
- allocation.width = width;
- allocation.height = height;
- - if (GTK.GTK4) {
- - GTK4.gtk_widget_size_allocate (topHandle, allocation, -1);
- - } else {
- - GTK3.gtk_widget_size_allocate (topHandle, allocation);
- - }
- + gtk_widget_size_allocate(topHandle, allocation, -1);
- this.parent = parent;
- setZOrder (null, false, true);
- reskin (SWT.ALL);
- diff --git a/Eclipse-R4_21/Display.java b/Eclipse-R4_22/Display.java
- index 74ea637..eea5afc 100644
- --- a/Eclipse-R4_21/Display.java
- +++ b/Eclipse-R4_22/Display.java
- @@ -1,5 +1,5 @@
- /*******************************************************************************
- - * Copyright (c) 2000, 2020 IBM Corporation and others.
- + * Copyright (c) 2000, 2021 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- @@ -127,6 +127,7 @@ public class Display extends Device {
- long fds;
- int allocated_nfds;
- boolean wake;
- + boolean windowSizeSet;
- int [] max_priority = new int [1], timeout = new int [1];
- Callback eventCallback;
- long eventProc, windowProc2, windowProc3, windowProc4, windowProc5, windowProc6;
- @@ -134,9 +135,10 @@ public class Display extends Device {
- long snapshotDrawProc, keyPressReleaseProc, focusProc, enterMotionProc, leaveProc,
- scrollProc, resizeProc, activateProc, gesturePressReleaseProc;
- long notifyProc;
- + long computeSizeProc;
- Callback windowCallback2, windowCallback3, windowCallback4, windowCallback5, windowCallback6;
- Callback changeValue;
- - Callback snapshotDraw, keyPressReleaseCallback, focusCallback, enterMotionCallback,
- + Callback snapshotDraw, keyPressReleaseCallback, focusCallback, enterMotionCallback, computeSizeCallback,
- scrollCallback, leaveCallback, resizeCallback, activateCallback, gesturePressReleaseCallback;
- Callback notifyCallback;
- EventTable eventTable, filterTable;
- @@ -225,13 +227,13 @@ public class Display extends Device {
- * other areas of SWT (i.e. WebKit). See bug 540060.
- */
- /** @noreference */
- - public ArrayList<Long> dBusServers = new ArrayList<>();
- + public java.util.List<Long> dBusServers = new ArrayList<>();
- /** @noreference */
- - public ArrayList<Long> dBusAuthObservers = new ArrayList<>();
- + public java.util.List<Long> dBusAuthObservers = new ArrayList<>();
- /** @noreference */
- - public ArrayList<Long> dBusGUIDS = new ArrayList<>();
- + public java.util.List<Long> dBusGUIDS = new ArrayList<>();
- /** @noreference */
- - public ArrayList<Long> dBusConnections = new ArrayList<>();
- + public java.util.List<Long> dBusConnections = new ArrayList<>();
- /* Deferred Layout list */
- Composite[] layoutDeferred;
- @@ -859,7 +861,7 @@ void addPopup (Menu menu) {
- void addSkinnableWidget (Widget widget) {
- if (skinCount >= skinList.length) {
- - Widget[] newSkinWidgets = new Widget [skinList.length + GROW_SIZE];
- + Widget[] newSkinWidgets = new Widget [(skinList.length + 1) * 3 / 2];
- System.arraycopy (skinList, 0, newSkinWidgets, 0, skinList.length);
- skinList = newSkinWidgets;
- }
- @@ -1156,6 +1158,7 @@ void createDisplay (DeviceData data) {
- GDK.gdk_threads_enter ();
- }
- boolean init;
- + windowSizeSet = false;
- if (GTK.GTK4) {
- init = GTK4.gtk_init_check();
- } else {
- @@ -3532,6 +3535,7 @@ void initializeCallbacks () {
- signalIds [Widget.MAP_EVENT] = OS.g_signal_lookup (OS.map_event, GTK.GTK_TYPE_WIDGET ());
- signalIds [Widget.MNEMONIC_ACTIVATE] = OS.g_signal_lookup (OS.mnemonic_activate, GTK.GTK_TYPE_WIDGET ());
- signalIds [Widget.MOTION_NOTIFY_EVENT] = OS.g_signal_lookup (OS.motion_notify_event, GTK.GTK_TYPE_WIDGET ());
- + signalIds [Widget.COMPUTE_SIZE] = OS.g_signal_lookup(OS.compute_size, GTK.GTK_TYPE_WIDGET() );
- /*
- * Connect to the "popped-up" signal on GTK3.22+ if the user has specified the
- * SWT_MENU_LOCATION_DEBUGGING environment variable.
- @@ -3589,6 +3593,9 @@ void initializeCallbacks () {
- activateCallback = new Callback(this, "activateProc", void.class, new Type[] {long.class, long.class, long.class}); //$NON-NLS-1$
- activateProc = activateCallback.getAddress();
- +
- + computeSizeCallback = new Callback(this, "computeSizeProc", void.class, new Type[] {long.class, long.class, long.class}); //$NON-NLS-1$
- + computeSizeProc = computeSizeCallback.getAddress();
- }
- notifyCallback = new Callback(this, "notifyProc", long.class, new Type[] {
- @@ -3664,7 +3671,6 @@ void initializeCallbacks () {
- closuresProc [Widget.TOGGLED] = windowProc3;
- closuresProc [Widget.UNMAP_EVENT] = windowProc3;
- closuresProc [Widget.WINDOW_STATE_EVENT] = windowProc3;
- - closuresProc [Widget.ROW_DELETED] = windowProc3;
- closuresProc [Widget.DIRECTION_CHANGED] = windowProc3;
- windowCallback4 = new Callback (this, "windowProc", 4); //$NON-NLS-1$
- @@ -3679,7 +3685,6 @@ void initializeCallbacks () {
- closuresProc [Widget.SWITCH_PAGE] = windowProc4;
- closuresProc [Widget.TEST_COLLAPSE_ROW] = windowProc4;
- closuresProc [Widget.TEST_EXPAND_ROW] = windowProc4;
- - closuresProc [Widget.ROW_INSERTED] = windowProc4;
- closuresProc [Widget.ROW_HAS_CHILD_TOGGLED] = windowProc4;
- closuresProc [Widget.DELETE_FROM_CURSOR] = windowProc4;
- closuresProc [Widget.DELETE_FROM_CURSOR_INVERSE] = windowProc4;
- @@ -5079,12 +5084,7 @@ String dumpWidgetTableInfo() {
- for (int i = 0; i < widgetTable.length; i++) {
- Widget w = widgetTable[i];
- if (w != null && w.isDisposed()) {
- - Collection<Integer> list = disposed.get(w);
- - if (list == null) {
- - list = new ArrayList<>();
- - disposed.put(w, list);
- - }
- - list.add(Integer.valueOf(i));
- + disposed.computeIfAbsent(w, k -> new ArrayList<>()).add(Integer.valueOf(i));
- }
- }
- if (!disposed.isEmpty()) {
- @@ -5287,6 +5287,17 @@ public static void setAppVersion (String version) {
- * @since 2.1
- */
- public void setCursorLocation (int x, int y) {
- + /*
- + * Wayland does not support mouse warping, thus setCursorLocation
- + * is not supported due to gdk_device_warp not being implemented
- + * in Wayland. There currently is no good solution that could be
- + * implemented, so a log entry was determined to be sufficient.
- + *
- + * See Bug 577099
- + */
- + if(!OS.isX11()) {
- + System.err.println("SWT Display.java Error: setCursorLocation only supported on X11. \n");
- + }
- setCursorLocation(new Point (x, y));
- }
- @@ -6001,6 +6012,41 @@ public void syncExec (Runnable runnable) {
- synchronizer.syncExec (runnable);
- }
- +/**
- + * Calls the callable in the user-interface thread and returns the supplied value.
- + * The callable may throw checked Exception. Any Exception is rethrown in the calling thread.
- + *
- + * @param callable the code to run on the user-interface thread
- + *
- + * @exception SWTException <ul>
- + * <li>ERROR_FAILED_EXEC - if an exception occurred when executing the runnable</li>
- + * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
- + * </ul>
- + *
- + * @see #syncExec(Runnable)
- + * @see SwtCallable#call()
- + * @since 3.118
- + */
- +public <T, E extends Exception> T syncCall(SwtCallable<T, E> callable) throws E {
- + Objects.nonNull(callable);
- + @SuppressWarnings("unchecked")
- + T[] t = (T[]) new Object[1];
- + Object[] ex = new Object[1];
- + syncExec(() -> {
- + try {
- + t[0] = callable.call();
- + } catch (Exception e) {
- + ex[0] = e;
- + }
- + });
- + if (ex[0] != null) {
- + @SuppressWarnings("unchecked")
- + E e = (E) ex[0];
- + throw e;
- + }
- + return t[0];
- +}
- +
- static int translateKey (int key) {
- for (int i=0; i<KeyTable.length; i++) {
- if (KeyTable [i] [0] == key) return KeyTable [i] [1];
- @@ -6100,6 +6146,10 @@ void leaveProc(long controller, long user_data) {
- if (widget != null) widget.leaveProc(controller, handle, user_data);
- }
- +void computeSizeProc(long toplevel, long size, long user_data) {
- + //TODO: GTK4 - Could be needed for minimum Size, signal remains connected
- +}
- +
- void activateProc(long action, long parameter, long user_data) {
- Widget widget = getWidget(user_data);
- if(widget == null) return;
- diff --git a/Eclipse-R4_21/SWT.java b/Eclipse-R4_22/SWT.java
- index 35d5860..5dadc75 100644
- --- a/Eclipse-R4_21/SWT.java
- +++ b/Eclipse-R4_22/SWT.java
- @@ -1020,6 +1020,20 @@ public class SWT {
- */
- public static final int ZoomChanged = 55;
- + /**
- + * The SWT emptiness change event type (value is 56).
- + *
- + * <p>
- + * This event is sent on <code>Tree</code> when the first <code>TreeItem</code> was
- + * added to it (with the <code>detail</code> field set to 0) or the last
- + * <code>TreeItem</code> was removed from it (with the <code>detail</code> field
- + * set to 1).
- + * </p>
- + *
- + * @since 3.118
- + */
- + public static final int EmptinessChanged = 56;
- +
- /* Event Details */
- /**
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement