From 3e693e08a90063a55fe1279dab974a77a3bb76d5 Mon Sep 17 00:00:00 2001 From: parg Date: Thu, 19 Dec 2024 15:59:08 +0000 Subject: [PATCH] Double click middle mouse button to popout sidebar entry --- uis/src/com/biglybt/ui/swt/Utils.java | 28 +++++++++++++------ .../ui/swt/views/skin/sidebar/SideBar.java | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/uis/src/com/biglybt/ui/swt/Utils.java b/uis/src/com/biglybt/ui/swt/Utils.java index a5a3c8b9b52..6de5f397a64 100644 --- a/uis/src/com/biglybt/ui/swt/Utils.java +++ b/uis/src/com/biglybt/ui/swt/Utils.java @@ -1084,15 +1084,25 @@ public static void disposeSWTObjects(Object... disposeList) { if (disposeList == null) { return; } - for (int i = 0; i < disposeList.length; i++) { - try { - Object o = disposeList[i]; - if (o instanceof Widget && !((Widget) o).isDisposed()) - ((Widget) o).dispose(); - else if ((o instanceof Resource) && !((Resource) o).isDisposed()) { - ((Resource) o).dispose(); - } - } catch (Exception e) { + for ( Object o: disposeList ){ + if ( o == null ){ + continue; + } + try{ + if (o instanceof Widget){ + Widget w = (Widget)o; + if ( !w.isDisposed()){ + w.dispose(); + } + }else if ( o instanceof Resource){ + Resource r = (Resource)o; + if ( !r.isDisposed()){ + r.dispose(); + } + }else{ + Debug.out( "No dispose action for " + o.getClass()); + } + }catch (Exception e) { Debug.out("Warning: Disposal failed " + Debug.getCompressedStackTrace(e, 0, -1, true)); } diff --git a/uis/src/com/biglybt/ui/swt/views/skin/sidebar/SideBar.java b/uis/src/com/biglybt/ui/swt/views/skin/sidebar/SideBar.java index d2d322f1e19..f263a4fba54 100644 --- a/uis/src/com/biglybt/ui/swt/views/skin/sidebar/SideBar.java +++ b/uis/src/com/biglybt/ui/swt/views/skin/sidebar/SideBar.java @@ -1112,7 +1112,7 @@ public void handleEvent(final Event event) { SideBarEntrySWT entry = (SideBarEntrySWT) ((treeItem == null || treeItem.isDisposed()) ? null : treeItem.getData("MdiEntry")); - if ( entry != null && event.button == 1 ){ + if ( entry != null && ( event.button == 1 || event.button == 2 )){ // don't trigger popout if double click is in close area or // item has child and user is clicking in the expandy area