Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit54db23c

Browse files
author
zhourenjian
committed
No text selection for Label, Link, Group and other widgets, so DND on Shell won't get text selection, and DND behavior will be a lot smoother.
1 parenta07d75d commit54db23c

File tree

8 files changed

+25
-1
lines changed

8 files changed

+25
-1
lines changed

‎sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/custom/CLabel.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ public void redraw() {
403403
textHandle =document.createElement("DIV");
404404
textHandle.className ="clabel-text";
405405
this.containerHandle().appendChild(textHandle);
406+
OS.setTextSelection(textHandle,false);
406407
}
407408
OS.clearChildren(textHandle);
408409
}else {

‎sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/internal/browser/OS.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ private static void init() {
156156
s.height ="100px";
157157
s.overflow ="scroll";
158158
invisibleContainer =el;
159+
setTextSelection(el,false);
160+
159161
containers =newObject();
160162

161163
el =document.createElement ("DIV");
@@ -995,4 +997,14 @@ public static boolean isInputCharacter(int keyCode, boolean shiftKey, boolean al
995997
returnfalse;
996998
}
997999

1000+
/**
1001+
* @j2sNative
1002+
* if (O$.isMozilla || O$.isFirefox) {
1003+
* handle.style.MozUserSelect = enabled ? "all" : "none";
1004+
* } else if (typeof handle.onselectstart != "undefined") {
1005+
* handle.onselectstart = enabled ? null : function () { return false; };
1006+
* }
1007+
*/
1008+
publicstaticvoidsetTextSelection(Elementhandle,booleanenabled) {
1009+
}
9981010
}

‎sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Button.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,8 @@ public void run() {
529529
};
530530
//bindHandle();
531531
hookSelection();
532+
533+
OS.setTextSelection(this.handle,false);
532534
}
533535

534536
/*

‎sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Group.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ protected void createHandle () {
286286
contentBox = (Element)createCSSElement(handle,"group-content-box");
287287
content = (Element)createCSSElement(contentBox,"group-content");
288288

289+
OS.setTextSelection(this.titleText,false);
289290
}
290291

291292
publicRectanglegetClientArea () {

‎sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Label.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ void createHandle() {
714714
parentHandle.appendChild(handle);
715715
}
716716
}
717+
718+
OS.setTextSelection(this.handle,false);
717719
}
718720

719721
publicvoidsetBounds(intx,inty,intwidth,intheight) {

‎sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Link.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ void createHandle () {
239239
parentHandle.appendChild(handle);
240240
}
241241
}
242+
243+
OS.setTextSelection(this.handle,false);
242244
}
243245

244246
voidcreateWidget () {

‎sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/TabFolder.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ void createItem (TabItem item, final int index) {
375375
sendEvent (SWT.Selection,event);
376376
// the widget could be destroyed at this point
377377
}
378+
379+
OS.setTextSelection(tab,false);
378380
}
379381

380382
protectedvoidcreateHandle () {

‎sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/ToolItem.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,9 @@ public void setText (String string) {
12831283
}
12841284
OS.clearChildren(textEl);
12851285
}
1286-
textEl.appendChild(document.createTextNode(string));
1286+
textEl.appendChild(document.createTextNode(string));
1287+
1288+
OS.setTextSelection(textEl,false);
12871289
}
12881290

12891291
parent.layoutItems ();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp