Skip to content

Commit 4d8afa0

Browse files
committed
Add support for Copy/Cut/Paste keys
These keys are present in some old unix keyboards, but more importantly, their keycodes can be mapped to physical keys in modern programmable keyboards. Using them in Linux is a way to be able to have the same keys for copy/pasting in GUI apps and in terminal apps instead of switching between ctrl-c/ctrl-v and ctrl-shift-c/ctrl-shift-v.
1 parent 508ad4a commit 4d8afa0

File tree

3 files changed

+30
-0
lines changed
  • bundles/org.eclipse.swt

3 files changed

+30
-0
lines changed

bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public class GDK extends OS {
5151
public static final int GDK_Caps_Lock = 0xffE5;
5252
public static final int GDK_Control_L = 0xffe3;
5353
public static final int GDK_Control_R = 0xffe4;
54+
public static final int GDK_Copy = 0x1008ff57;
55+
public static final int GDK_Cut = 0x1008ff58;
5456
public static final int GDK_CURRENT_TIME = 0x0;
5557
public static final int GDK_DECOR_BORDER = 0x2;
5658
public static final int GDK_DECOR_MAXIMIZE = 0x40;
@@ -175,6 +177,7 @@ public class GDK extends OS {
175177
public static final int GDK_PROPERTY_NOTIFY = 16;
176178
public static final int GDK_Page_Down = 0xff56;
177179
public static final int GDK_Page_Up = 0xff55;
180+
public static final int GDK_Paste = 0x1008ff6d;
178181
public static final int GDK_Pause = 0xff13;
179182
public static final int GDK_Print = 0xff61;
180183
public static final int GDK_Return = 0xff0d;

bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/SWT.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3325,6 +3325,30 @@ public class SWT {
33253325
*/
33263326
public static final int PRINT_SCREEN = KEYCODE_BIT + 87;
33273327

3328+
/**
3329+
* Keyboard event constant representing the copy
3330+
* key (value is (1<<24)+88).
3331+
*
3332+
* @since 4.38
3333+
*/
3334+
public static final int COPY = KEYCODE_BIT + 88;
3335+
3336+
/**
3337+
* Keyboard event constant representing the cut
3338+
* key (value is (1<<24)+89).
3339+
*
3340+
* @since 4.38
3341+
*/
3342+
public static final int CUT = KEYCODE_BIT + 89;
3343+
3344+
/**
3345+
* Keyboard event constant representing the paste
3346+
* key (value is (1<<24)+90).
3347+
*
3348+
* @since 4.38
3349+
*/
3350+
public static final int PASTE = KEYCODE_BIT + 90;
3351+
33283352
/**
33293353
* The <code>MessageBox</code> style constant for error icon
33303354
* behavior (value is 1).

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,9 @@ public void stop() {
480480
{GDK.GDK_Print, SWT.PRINT_SCREEN},
481481
{GDK.GDK_Help, SWT.HELP},
482482

483+
{GDK.GDK_Copy, SWT.COPY},
484+
{GDK.GDK_Cut, SWT.CUT},
485+
{GDK.GDK_Paste, SWT.PASTE},
483486
};
484487

485488
/* Cache pressed modifier state. See Bug 537025. */

0 commit comments

Comments
 (0)